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

refactor: limit breaking changes for next version #22972

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 18, 2024

Description

With the removal of testutil/integration happening on main soon: #22904
This makes sure some helpers that are still useful do not get deleted, nor change place between main (0.54) and 0.52

Additionally, check-compat script has been supersede by https://github.com/cosmos/nightly-stack/blob/main/.github/workflows/build-applications.yaml


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
    • Introduced a new CreateMultiStore function to enhance testing capabilities for store management.
  • Bug Fixes
    • Updated test files to utilize the new CreateMultiStore function, ensuring compatibility and improved functionality.
  • Documentation
    • Marked the old CreateMultiStore function as deprecated, redirecting usage to the updated utility for better organization.
  • Chores
    • Removed compatibility check script and associated GitHub Actions workflow.

@julienrbrt julienrbrt requested review from JulianToledano and a team as code owners December 18, 2024 08:12
Copy link
Contributor

coderabbitai bot commented Dec 18, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request involves a refactoring of testing utilities across multiple files in the Cosmos SDK project. The primary change is the migration of the CreateMultiStore function from the integration package to moduletestutil. This involves updating import statements, removing the original implementation, and redirecting the function call to the new location. The changes are consistent across test files and utility helpers, indicating a systematic approach to consolidating testing utilities.

Changes

File Change Summary
client/grpc_query_test.go Replaced integration import with moduletestutil and updated CreateMultiStore call.
tests/integration/distribution/migration_v4_test.go Updated CreateMultiStore function call from integration to moduletestutil.
testutil/integration/helpers.go Deprecated original CreateMultiStore function, redirected to moduletestutil.
types/module/testutil/helpers.go Added new CreateMultiStore function with in-memory database creation and store mounting.
.github/scripts/check-compat.sh Deleted compatibility check script.
.github/workflows/software-compat-v052.yml Deleted GitHub Actions workflow for compatibility testing.

Possibly related PRs

  • ci: remove duplicate gosec & lint fixes #21685: This PR modifies the import statements and function calls related to CreateMultiStore, similar to the changes made in the main PR regarding the import of moduletestutil instead of integration.
  • chore: bring v0.52.0-beta.2 changelog to main #22188: This PR also involves changes to the CHANGELOG.md that reflect updates in the testing utilities, which aligns with the changes made in the main PR regarding the testing framework.
  • test(integration): port x/slashing tests to server v2 #22754: This PR ports slashing tests to server v2, which may involve similar testing utilities as those modified in the main PR, indicating a connection in the context of testing framework updates.
  • test(systemtests): fix export v2 #22799: This PR addresses changes in the export functionality, which may relate to the modifications in the testing utilities in the main PR, as both involve aspects of application state management and testing.
  • docs: runtime docs #22816: This PR updates the documentation for the runtime, which may include references to the testing utilities that were modified in the main PR, indicating a broader context of changes in the testing framework.
  • refactor(client/v2): remove gov dependency #22867: This PR removes the governance dependency, which may relate to the overall restructuring of the testing utilities and framework as seen in the main PR, suggesting a connection in the context of codebase refactoring.

Suggested reviewers

  • akhilkumarpilli
  • kocubinski
  • sontrinh16
  • facundomedica

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ef14a84 and 73a4af2.

📒 Files selected for processing (2)
  • .github/scripts/check-compat.sh (0 hunks)
  • .github/workflows/software-compat-v052.yml (0 hunks)
💤 Files with no reviewable changes (2)
  • .github/scripts/check-compat.sh
  • .github/workflows/software-compat-v052.yml

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Dec 18, 2024
@github-actions github-actions bot added the C:CLI label Dec 18, 2024
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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 751679f and ef14a84.

📒 Files selected for processing (4)
  • client/grpc_query_test.go (1 hunks)
  • tests/integration/distribution/migration_v4_test.go (1 hunks)
  • testutil/integration/helpers.go (1 hunks)
  • types/module/testutil/helpers.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
types/module/testutil/helpers.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

client/grpc_query_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/integration/distribution/migration_v4_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

testutil/integration/helpers.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

🔇 Additional comments (4)
testutil/integration/helpers.go (1)

8-9: LGTM! Clear deprecation notice with migration path.

The deprecation notice clearly indicates where to find the new implementation, which helps with the migration process.

client/grpc_query_test.go (1)

40-40: LGTM! Successful migration to new CreateMultiStore.

The change correctly uses the new moduletestutil.CreateMultiStore while maintaining the same functionality.

types/module/testutil/helpers.go (1)

89-99: LGTM! Clean implementation with proper store initialization.

The implementation correctly:

  • Uses in-memory database for testing
  • Properly initializes the commit multi-store with logging and metrics
  • Correctly mounts all provided stores
  • Loads the latest version as required

Let's verify that all usages of the old CreateMultiStore have been migrated:

✅ Verification successful

All usages of CreateMultiStore are using the new implementation

The verification shows that all references to CreateMultiStore in the codebase are using the new implementation from moduletestutil package. The function is being used correctly in test files:

  • tests/integration/distribution/migration_v4_test.go
  • client/grpc_query_test.go

No references to the old integration.CreateMultiStore were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old integration.CreateMultiStore
rg -l "integration.CreateMultiStore"

Length of output: 36


Script:

#!/bin/bash
# Let's search for any usage of CreateMultiStore function to ensure all references are using the new implementation
rg "CreateMultiStore\(" -A 2

Length of output: 1008

tests/integration/distribution/migration_v4_test.go (1)

Line range hint 33-170: LGTM: Comprehensive test coverage for v4 migration.

The tests thoroughly cover both the data migration (previous proposer) and funds migration aspects, with proper setup, mocks, and assertions.

@@ -75,7 +74,7 @@ func TestFundsMigration(t *testing.T) {
authtypes.StoreKey, banktypes.StoreKey, disttypes.StoreKey,
)
logger := log.NewTestLogger(t)
cms := integration.CreateMultiStore(keys, logger)
cms := moduletestutil.CreateMultiStore(keys, logger)
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

The CreateMultiStore change is correct but part of a larger migration

The verification shows that the change in tests/integration/distribution/migration_v4_test.go is correct, as CreateMultiStore is already aliased in testutil/integration/helpers.go to point to moduletestutil.CreateMultiStore. However, this change is part of a larger migration effort since:

  • The files still importing the old package are using other integration utilities like NewIntegrationApp, WithAutomaticFinalizeBlock, and WithAutomaticCommit
  • The old import path is still referenced in multiple test files
  • The testutil/integration/helpers.go file shows CreateMultiStore is marked as deprecated with instructions to use the new path directly
🔗 Analysis chain

LGTM: Successful migration of CreateMultiStore usage.

The change aligns with the PR objectives to preserve helper functions while removing the testutil/integration module.

Let's verify that all usages of CreateMultiStore have been migrated consistently:


Migration of CreateMultiStore requires additional changes

The verification revealed that there are still several files importing the old testutil/integration package, and the migration is incomplete. Key findings:

  • Files still using the old import:
    • tests/integration/server/grpc_test.go
    • tests/integration/example/example_test.go
    • tests/integration/bank/keeper/deterministic_test.go
    • tests/integration/auth/keeper/msg_server_test.go
    • tests/integration/auth/keeper/fixture_test.go

Let's verify if these files also use CreateMultiStore and need similar migration:


Let's check what other functions these files are using from the integration package to better understand the migration scope:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to integration.CreateMultiStore
# and verify consistent usage of moduletestutil.CreateMultiStore

# Check for any remaining references to the old import
rg -l "github.com/cosmos/cosmos-sdk/testutil/integration"

# Check for any remaining references to integration.CreateMultiStore
rg "integration\.CreateMultiStore"

# Verify consistent usage of the new import
rg -l "github.com/cosmos/cosmos-sdk/types/module/testutil"

# Verify consistent usage of moduletestutil.CreateMultiStore
rg "moduletestutil\.CreateMultiStore"

Length of output: 4520


Script:

#!/bin/bash
# Check the content of files still using the old import to see if they use CreateMultiStore
for file in tests/integration/server/grpc_test.go tests/integration/example/example_test.go tests/integration/bank/keeper/deterministic_test.go tests/integration/auth/keeper/msg_server_test.go tests/integration/auth/keeper/fixture_test.go; do
    echo "=== $file ==="
    rg "CreateMultiStore" "$file" -C 2
done

Length of output: 2145


Script:

#!/bin/bash
# Check what other integration package functions these files are using
for file in tests/integration/server/grpc_test.go tests/integration/example/example_test.go tests/integration/bank/keeper/deterministic_test.go tests/integration/auth/keeper/msg_server_test.go tests/integration/auth/keeper/fixture_test.go; do
    echo "=== $file ==="
    # Get a few lines around any line that uses the integration package
    rg -A 2 -B 2 "integration\." "$file"
done

# Also check the helpers file to understand the integration package usage
echo "=== testutil/integration/helpers.go ==="
cat testutil/integration/helpers.go

Length of output: 4404

@julienrbrt julienrbrt enabled auto-merge December 18, 2024 08:37
@julienrbrt julienrbrt added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit ca55998 Dec 18, 2024
81 of 82 checks passed
@julienrbrt julienrbrt deleted the julien/limit-bc branch December 18, 2024 09:00
mergify bot pushed a commit that referenced this pull request Dec 18, 2024
julienrbrt added a commit that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:CLI Type: CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants