-
Notifications
You must be signed in to change notification settings - Fork 39
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(dashmate): invalid platform version in the status command #2249
Conversation
WalkthroughThis pull request introduces several modifications across multiple files in the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 and nitpick comments (1)
packages/dashmate/src/status/scopes/platform.js (1)
195-210
: LGTM: Drive version retrieval implementationThe implementation for retrieving the Drive version is well-structured and aligns with the existing codebase. Good practices observed:
- Using
dockerCompose.execCommand
for consistency.- Proper error handling to distinguish between Drive-specific and other issues.
- Trimming the retrieved version string.
Suggestions for minor improvements:
- Consider adding a timeout to the Docker command execution to prevent potential hanging:
const driveVersionResult = await Promise.race([ dockerCompose.execCommand(config, 'drive_abci', 'drive-abci version'), new Promise((_, reject) => setTimeout(() => reject(new Error('Command timed out')), 5000)) ]);
- Enhance the error message when catching non-Drive issues for better debugging:
throw new Error(`Unexpected error while retrieving Drive version: ${e.message}`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- packages/dashmate/src/commands/group/status.js (1 hunks)
- packages/dashmate/src/commands/status/index.js (1 hunks)
- packages/dashmate/src/commands/status/platform.js (0 hunks)
- packages/dashmate/src/status/scopes/platform.js (2 hunks)
- packages/rs-drive-abci/src/main.rs (4 hunks)
💤 Files with no reviewable changes (1)
- packages/dashmate/src/commands/status/platform.js
🧰 Additional context used
🔇 Additional comments (8)
packages/dashmate/src/commands/group/status.js (1)
89-89
: LGTM! Verify consistency and update documentation.The change correctly updates the Platform Version to display the Drive version instead of the Tenderdash version, addressing the issue mentioned in the PR objectives. This modification aligns with the goal of reducing confusion about the actual platform version being used.
To ensure consistency across the codebase, please run the following script:
Consider updating any relevant documentation that explains the Platform Version to reflect this change from Tenderdash version to Drive version.
✅ Verification successful
Verification Successful! All references to the Tenderdash version as the Platform Version have been removed and replaced with the Drive version in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that all references to Platform Version now use Drive version instead of Tenderdash version # Test 1: Search for any remaining references to Tenderdash version as Platform Version echo "Searching for remaining references to Tenderdash version as Platform Version:" rg --type js "Platform.*Version.*tenderdash\.version" # Test 2: Confirm that Drive version is now used for Platform Version echo "Confirming Drive version is used for Platform Version:" rg --type js "Platform.*Version.*drive\.version"Length of output: 634
packages/dashmate/src/commands/status/index.js (1)
119-119
: LGTM! The change correctly implements the PR objective.The modification to use
platform.drive.version
instead ofplatform.tenderdash.version
for the Platform Version is consistent with the PR objective. This change resolves the issue of displaying the incorrect platform version in the status command output.To ensure consistency across the codebase, let's verify that
platform.drive.version
is correctly set elsewhere:This script will help us confirm that the Drive version is consistently retrieved and used throughout the codebase.
✅ Verification successful
Verified! The usage of
platform.drive.version
forPlatform Version
is consistent across the codebase. No issues found.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of platform.drive.version # Test 1: Search for assignments to platform.drive.version echo "Searching for assignments to platform.drive.version:" rg --type js 'platform\.drive\.version\s*=' -g '!**/node_modules/**' # Test 2: Search for the retrieval of Drive version echo "Searching for Drive version retrieval:" rg --type js 'getDriveVersion|drive.*version' -g '!**/node_modules/**'Length of output: 1661
packages/dashmate/src/status/scopes/platform.js (2)
162-162
: LGTM: Addition of version propertyThe addition of the
version
property to theinfo
object is in line with the PR objective to display the Drive version as the Platform Version. Initializing it asnull
is a good practice for optional properties.
Line range hint
1-324
: Summary: Changes successfully implement PR objectivesThe modifications to
packages/dashmate/src/status/scopes/platform.js
successfully address the PR objective of displaying the Drive version as the Platform Version. Key points:
- The implementation is consistent with the existing codebase and follows good practices.
- Proper error handling is in place, distinguishing between Drive-specific and other issues.
- The changes are non-breaking, as the new
version
property is optional and initialized asnull
.The code changes align well with the stated PR objectives and maintain the overall integrity of the file.
To ensure the changes are correctly implemented across the codebase, please run the following verification script:
packages/rs-drive-abci/src/main.rs (4)
62-65
: LGTM: Version command addedThe addition of the
Version
command to theCommands
enum is a valuable feature. It provides users with an easy way to check the current software version, which is essential for troubleshooting and ensuring compatibility.
155-155
: LGTM: Version command handling addedThe
run
method has been correctly updated to handle the newVersion
command. The implementation is simple and consistent with the other command handlers.
390-393
: LGTM: Version printing function addedThe
print_version
function is implemented correctly. It uses theCARGO_PKG_VERSION
environment variable to print the current package version, which is the standard way to access this information in Rust projects.
228-232
: LGTM: Improved error handling in main functionThe error handling in the
main
function has been improved. The new implementation usingmap_err
is more idiomatic Rust and provides better error logging. The use oftracing::error!
ensures consistency with the project's logging approach.
There was a problem hiding this 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 and nitpick comments (2)
.yarnrc.yml (2)
19-19
: Approve: Addition ofelliptic
tonpmAuditExcludePackages
The addition of
elliptic
to thenpmAuditExcludePackages
list is a good temporary measure to address a security vulnerability. The TODO comment clearly indicates that this should be removed when a version greater than 6.5.7 is released.To ensure this temporary fix is not forgotten, would you like me to create a GitHub issue to track the removal of this exclusion when the new version of
elliptic
is released?
Line range hint
1-46
: Consider separating unrelated changesThe changes made to this file, while beneficial for project maintenance, appear to be unrelated to the main objective of this PR (fixing the dashmate status command). Consider separating these changes into a different PR to maintain focus and ease the review process.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- .yarnrc.yml (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
.yarnrc.yml (1)
Line range hint
7-7
: Approve: Indentation correction for@humanwhocodes/object-schema
The indentation for the
@humanwhocodes/object-schema
entry has been corrected, improving readability and consistency with other entries in the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (2)
packages/dashmate/test/unit/status/scopes/platform.spec.js (2)
126-126
: Use a constant for thedrive
version to avoid hardcodingThe
version: '1.4.1'
is hardcoded in multiple places within theexpectedScope
objects. Consider defining a constant or using a variable to represent the version number. This will make future updates easier and reduce the likelihood of inconsistencies.Example:
+ const driveVersion = '1.4.1'; ... expectedScope = { // ... drive: { dockerStatus: DockerStatusEnum.running, serviceStatus: ServiceStatusEnum.up, - version: '1.4.1', + version: driveVersion, }, };Also applies to: 201-201, 306-306, 363-363, 501-501
389-392
: Include an error message when simulatingDockerComposeError
Adding an error message to the
DockerComposeError
will provide more context during test failures and make debugging easier.Apply this diff:
const error = new DockerComposeError({ exitCode: 1, + message: 'Simulated error for testing drive_abci version command failure', });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- packages/dashmate/src/status/scopes/platform.js (2 hunks)
- packages/dashmate/test/unit/status/scopes/platform.spec.js (13 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/dashmate/src/status/scopes/platform.js
🧰 Additional context used
🔇 Additional comments (2)
packages/dashmate/test/unit/status/scopes/platform.spec.js (2)
3-3
: ImportingDockerComposeError
is appropriateThe added import statement for
DockerComposeError
is necessary for handling Docker Compose errors in the tests.
274-274
: VerifyisServiceRunning
checks for both servicesEnsure that
mockDockerCompose.isServiceRunning
is being correctly stubbed for both'drive_tenderdash'
and'drive_abci'
. This will ensure that the test accurately reflects the service statuses.
Issue being fixed or feature implemented
The dashmate status command shows the tenderdash version as "Platform Version" which is confusing.
What was done?
How Has This Been Tested?
Calling the status command locally
Breaking Changes
None
Checklist:
For repository code-owners and collaborators only
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
getDriveInfo
function to include a version property in the returned object..yarnrc.yml
file for better package management and error handling.