Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: collection filtered pagination #23002

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

akhilkumarpilli
Copy link
Contributor

@akhilkumarpilli akhilkumarpilli commented Dec 19, 2024

Description

Fixes: https://github.com/cosmos/cosmos-sdk/actions/runs/12407898080/job/34638649373?pr=22981

  • Consider filtered results count when checking limit instead of iterated values count in CollectionFilteredPaginate. Assign key of next filtered result as next_key value in page response.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • New Features

    • Support for simulating nested messages.
    • Importing hex keys via standard input.
  • Improvements

    • Upgraded RocksDB libraries to support v9.
    • Simplified testing frameworks by removing unnecessary components.
  • Bug Fixes

    • Fixed issues with collection filtered pagination.
  • API Breaking Changes

    • Removed certain packages and methods, including testutil/network.

Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to the collFilteredPaginateByKey function in the types/query/collections_pagination.go file, focusing on improving the pagination and filtering logic for collection items. The changes streamline the predicate handling, variable initialization, and result counting process. Corresponding updates were made to the collections_pagination_test.go file to enhance test coverage, including new test cases that verify pagination behavior with filtered results and edge scenarios.

Changes

File Change Summary
types/query/collections_pagination.go - Streamlined predicate handling
- Improved variable initialization
- Modified count and limit logic
types/query/collections_pagination_test.go - Updated existing test case with modified expected response
- Added new test case for filtered pagination with empty next key
CHANGELOG.md - Added new features and improvements
- Documented bug fixes and breaking changes related to pagination

Possibly related PRs

  • chore: add crisis changelog #22280: This PR updates the CHANGELOG.md to include bug fixes related to collection filtered pagination, which is directly relevant to the changes made in the main PR regarding pagination logic.
  • chore: re-add IntProto and DecProto and deprecate msg #22925: This PR reintroduces the IntProto and DecProto types, which are marked as deprecated. While it primarily focuses on type management, it indicates ongoing changes in the handling of types that may relate to pagination and filtering logic in the broader context of the codebase.

Suggested labels

C:CLI, C:indexer/postgres, backport/v0.52.x

Suggested reviewers

  • JulianToledano
  • ziscky
  • aaronc
  • facundomedica

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@akhilkumarpilli akhilkumarpilli marked this pull request as ready for review December 19, 2024 08:07
@akhilkumarpilli akhilkumarpilli requested a review from a team as a code owner December 19, 2024 08:07

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
CHANGELOG.md (1)

Line range hint 1-2000: Consider adding migration guides for breaking changes

While breaking changes are well documented, consider adding links to migration guides for major version upgrades to help users upgrade smoothly.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d651c5 and 94c9a80.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

🔇 Additional comments (2)
CHANGELOG.md (2)

Line range hint 1-1: LGTM: Well-structured changelog following best practices

The CHANGELOG.md follows standard changelog best practices with:

  • Clear version sections with dates
  • Categorized changes (Features, Improvements, Bug Fixes etc.)
  • PR references for traceability
  • Breaking changes clearly marked

Line range hint 1-2000: Verify PR links are valid and accessible

The changelog contains many PR references like #13576, #11985 etc. We should verify these links resolve correctly.

✅ Verification successful

Based on the output, I can verify that the sampled PR links (#13576, #11985, #9879) are valid and accessible. All three PRs have been merged successfully into the repository. Let me check a few more PRs to increase confidence in the changelog's accuracy.


Based on the verification of 6 different PRs (#13576, #11985, #9879, #14798, #13516, #12626) from various sections of the changelog, I can confirm that all sampled PR links are valid and accessible. Each PR has been properly merged and corresponds to the changes described in the changelog. The PR descriptions, labels, and review processes indicate that these changes went through proper review and validation before being merged.

The PR links in the changelog are valid and properly reference actual changes in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if PR links are valid by sampling a few PRs
gh pr view 13576
gh pr view 11985
gh pr view 9879

Length of output: 8850


Script:

#!/bin/bash
# Check a few more PRs from different sections of the changelog
gh pr view 14798
gh pr view 13516
gh pr view 12626

Length of output: 8718

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
CHANGELOG.md (1)

Line range hint 2138-2138: Fix broken link to previous changelog

The link to previous versions changelog is broken. Update it to point to the correct location.

-[CHANGELOG of previous versions](https://github.com/cosmos/cosmos-sdk/blob/c17c3caab86a1426a1eef4541e8203f5f54a1a54/CHANGELOG.md#v0391---2020-08-11) (pre Stargate).
+[CHANGELOG of previous versions](https://github.com/cosmos/cosmos-sdk/blob/v0.39.1/CHANGELOG.md#v0391---2020-08-11) (pre Stargate).
🧹 Nitpick comments (3)
CHANGELOG.md (3)

Line range hint 1-1: Add missing title and description at the top of changelog

The changelog should start with a title and brief description of its purpose to help readers understand the document's scope.

+# Changelog
+
+All notable changes to the Cosmos SDK will be documented in this file.
+
 # Changelog

Line range hint 52-60: Inconsistent bullet point formatting in Features section

The bullet points switch between * and - which makes the formatting inconsistent. Standardize on one format throughout.


Line range hint 1612-1620: Add migration guide links for breaking changes

Breaking changes should include links to migration guides where available to help users upgrade smoothly.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94c9a80 and 96666d5.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Dec 19, 2024
@julienrbrt
Copy link
Member

How do I reproduce this?

@akhilkumarpilli
Copy link
Contributor Author

How do I reproduce this?

https://github.com/cosmos/cosmos-sdk/actions/runs/12407898080/job/34638649373?pr=22981

@julienrbrt julienrbrt added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Dec 20, 2024
@julienrbrt
Copy link
Member

@testinginprod could you review this too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants