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

test(e2e): filter out retracted version #4129

Merged

Conversation

rootulp
Copy link
Collaborator

@rootulp rootulp commented Dec 13, 2024

Closes #4116

Testing

test-e2e2024/12/13 10:44:02 === RUN MinorVersionCompatibility
test-e2e2024/12/13 10:44:02 Running MinorVersionCompatibility test with versions v1.0.0	v1.1.0	v1.10.0	v1.10.1	v1.11.0	v1.12.0	v1.13.0	v1.14.0	v1.2.0	v1.3.0	v1.3.0	v1.4.0	v1.5.0	v1.6.0	v1.7.0	v1.9.0	v2.0.0	v2.1.0	v2.1.1	v2.1.2	v2.2.0	v2.2.0	v2.2.0	v2.3.0	v2.3.0	v2.3.1	v2.3.1	v3.0.0	v3.0.0	v3.0.0	v3.0.1	v3.0.1	v3.0.1	v3.0.2	v3.0.2	v3.0.2

@rootulp rootulp self-assigned this Dec 13, 2024
@rootulp rootulp marked this pull request as ready for review December 13, 2024 15:45
@rootulp rootulp requested a review from a team as a code owner December 13, 2024 15:45
@rootulp rootulp requested review from cmwaters, ninabarbakadze and evan-forbes and removed request for a team December 13, 2024 15:45
Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

📝 Walkthrough

Walkthrough

The pull request introduces modifications to the MinorVersionCompatibility function and the VersionSet type to enhance version filtering logic. A new constant for a retracted version of the celestia-app is added, and the parsing logic is updated to exclude this version from compatibility tests. Additionally, a new FilterOut method is implemented in the VersionSet type to facilitate the exclusion of specified versions. These changes aim to ensure that the compatibility tests do not use redacted versions.

Changes

File Path Change Summary
test/e2e/minor_version_compatibility.go Added constant retractedCelestiaApp and updated version filtering logic to exclude it. Enhanced error handling for parsing.
test/e2e/testnet/versions.go Introduced FilterOut method in VersionSet to exclude specified versions from the set.

Assessment against linked issues

Objective Addressed Explanation
Filter out redacted versions of celestia-app (#[4116])

Possibly related PRs

  • ci(goreleaser): use latest tag from GitHub action #4094: The changes in the main PR involve filtering versions, including a new constant for a retracted version, which relates to the version management aspect of the FilterOut method introduced in the retrieved PR. Both PRs focus on handling specific versions in the context of compatibility and filtering logic.

Suggested reviewers

  • cmwaters
  • ninabarbakadze
  • evan-forbes
  • rach-id

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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. (Experiment)
  • @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.

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

🧹 Outside diff range and nitpick comments (1)
test/e2e/testnet/versions.go (1)

127-135: LGTM with a minor optimization suggestion

The implementation is clean and follows the existing patterns. Consider using strings.Compare or implementing a custom comparator method for Version structs if more complex version comparison logic is needed in the future.

 func (v VersionSet) FilterOut(retracted Version) VersionSet {
 	output := make(VersionSet, 0, len(v))
 	for _, version := range v {
-		if version != retracted {
+		if !version.equals(retracted) {  // Future-proof with a dedicated comparison method
 			output = append(output, version)
 		}
 	}
 	return output
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b0cf504 and 5ba00b1.

📒 Files selected for processing (2)
  • test/e2e/minor_version_compatibility.go (2 hunks)
  • test/e2e/testnet/versions.go (1 hunks)
🔇 Additional comments (2)
test/e2e/minor_version_compatibility.go (2)

26-27: LGTM: Well-documented constant declaration

The constant declaration clearly explains its purpose through the comment.


38-41: Verify version filtering logic

The implementation correctly filters out the retracted version and includes v3 versions as per PR objectives. Let's verify the filtering behavior.

✅ Verification successful

Based on the gathered information, I can now provide a final response about the version filtering logic verification:

Version filtering implementation is correct and properly structured

The code correctly implements the version filtering requirements:

  • FilterMajor selects versions matching a specific major version
  • FilterOutReleaseCandidates removes RC versions
  • FilterOut excludes the specified retracted version (v1.8.0)
  • The filtering chain properly concatenates v1, v2, and v3 versions while excluding RCs and the retracted version
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the version filtering excludes v1.8.0 and includes v3 versions

# Test: Check if v1.8.0 is properly excluded and v3 versions are included
echo "Running MinorVersionCompatibility test..."
rg "Running MinorVersionCompatibility test with versions" -A 1

Length of output: 157


Script:

#!/bin/bash
# Let's analyze the version filtering logic more comprehensively

# Check the implementation of version filtering functions
ast-grep --pattern 'func FilterMajor($$$) {
  $$$
}'

# Look for the retracted versions definition
rg "retracted.*:=" -A 2

# Check the test implementation
rg "func TestMinorVersionCompatibility" -A 10

# Look for version parsing implementation
ast-grep --pattern 'func ParseVersions($$$) {
  $$$
}'

Length of output: 428


Script:

#!/bin/bash
# Let's check the version filtering implementation and test setup

# Look for FilterMajor implementation with a more specific pattern
ast-grep --pattern '($_ *Version) FilterMajor($$$) *Version {
  $$$
}'

# Check the FilterOutReleaseCandidates implementation
ast-grep --pattern '($_ *Version) FilterOutReleaseCandidates($$$) *Version {
  $$$
}'

# Check the FilterOut implementation
ast-grep --pattern '($_ *Version) FilterOut($$$) *Version {
  $$$
}'

# Look for the retractedCelestiaApp definition
rg "retractedCelestiaApp.*=" -B 2 -A 2

# Check the test setup and version string
rg "versionStr.*:=" -B 2 -A 2

Length of output: 2067


Script:

#!/bin/bash
# Let's check the getAllVersions implementation and the actual version filtering logic

# Look for getAllVersions implementation
ast-grep --pattern 'func getAllVersions($$$) {
  $$$
}'

# Check the Version type definition and methods
rg "type Version" -A 5

# Check for any version-related constants or configurations
rg "const.*Version" -A 2

# Look for the actual test execution logs
rg "MinorVersionCompatibility.*versions:" --ignore-case

Length of output: 40234


Script:

#!/bin/bash
# Let's check the implementation of version filtering functions and the test setup

# Look for the implementation of FilterMajor and other version filtering methods
rg "func.*Filter" test/e2e/testnet/versions.go -A 5

# Check the test implementation and setup
rg "func TestMinorVersionCompatibility" test/e2e/minor_version_compatibility.go -A 20

# Look for getAllVersions implementation
rg "func getAllVersions" test/e2e/minor_version_compatibility.go -A 10

# Check for any version-related constants in the test
rg "const.*Version" test/e2e/minor_version_compatibility.go

Length of output: 1163

Comment on lines +33 to +36
retracted, ok := testnet.ParseVersion(retractedCelestiaApp)
if !ok {
logger.Fatal("failed to parse retracted version")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider enhancing error handling

The current implementation uses logger.Fatal which will terminate the program. Consider returning an error instead to allow graceful handling by the caller.

-	if !ok {
-		logger.Fatal("failed to parse retracted version")
-	}
+	if !ok {
+		return fmt.Errorf("failed to parse retracted version %s", retractedCelestiaApp)
+	}

Committable suggestion skipped: line range outside the PR's diff.

@cmwaters
Copy link
Contributor

This all runs the v1 state machine iiuc. IMO we should only have minor compatibility tests for the latest major version or better still we could come up with a larger test that does both coordinated major version upgrades and spontaneous localized minor version upgrades

@rootulp rootulp merged commit da77d6f into celestiaorg:main Dec 16, 2024
30 checks passed
@rootulp rootulp deleted the rp/minor-version-compat-retracted-version branch December 16, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MinorVersionCompatabilityTest should not use redacted versions of celestia-app
4 participants