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

feat: add cli for canceling a software upgrade #5

Merged
merged 7 commits into from
Feb 10, 2025

Conversation

johnletey
Copy link
Member

@johnletey johnletey commented Feb 10, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new command in the CLI that allows users to cancel a scheduled software upgrade, offering a streamlined and consistent way to manage software upgrade schedules.
    • Added a helper command for broadcasting a cancel software upgrade message, enhancing software upgrade management capabilities.
    • Expanded functionality in the upgrade testing to include both scheduling and canceling upgrades with appropriate authorization checks.
  • Documentation
    • Updated changelog to reflect the new version 1.0.2 and improvements made, including formatting adjustments for clarity.

@johnletey johnletey requested a review from boojamya February 10, 2025 11:29
@johnletey johnletey self-assigned this Feb 10, 2025
Copy link

coderabbitai bot commented Feb 10, 2025

Walkthrough

The pull request introduces a new CLI command, NewCmdCancelSoftwareUpgrade, enabling users to cancel a scheduled software upgrade. This command includes a usage string, a brief description, and an execution function that produces a MsgCancelUpgrade message. Additionally, the command is incorporated into the existing transaction command set through the GetTxCmd function, ensuring consistency with other CLI commands. The corresponding test function has been renamed to reflect the expanded functionality of scheduling and canceling upgrades. Minor documentation adjustments and a new changelog entry for version 1.0.2 are also included.

Changes

File(s) Change Summary
client/cli/tx.go Added NewCmdCancelSoftwareUpgrade command; integrates cancellation functionality for software upgrades by generating and sending MsgCancelUpgrade.
e2e/upgrade_test.go Renamed TestScheduleUpgrade to TestScheduleAndCancelUpgrade; modified command structure to remove --chain-id parameter; added cancellation logic with authorization checks.
.changelog/v1.0.2/improvements/5-add-helper-command.md Added a new helper command for broadcasting a cancel software upgrade message.
.changelog/v1.0.2/summary.md Added new changelog entry for version 1.0.2, indicating a non-consensus breaking patch release; included details about the new helper command.
CHANGELOG.md Added new version entry for v1.0.2; included details about the new helper command and minor formatting adjustments to the previous version entry.

Possibly related PRs

  • feat: add software-upgrade and recover-client helper #4: The changes in the main PR, which introduce a command for canceling software upgrades, are directly related to the modifications in the retrieved PR that add helper commands for broadcasting software upgrade messages, as both involve enhancements to the command-line interface for managing software upgrades.

Poem

Hop along with joy today,
A change so neat in CLI display.
With a cancel command so bold,
Software upgrades, now controlled! 🐇
My whiskers twitch, my heart is gay!

-- A Rabbit's Merry Note!


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link

@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 (3)
CHANGELOG.md (1)

3-11: Convert emphasis to proper heading.

The release date should use a proper heading format instead of emphasis to maintain consistency with markdown best practices.

-*Feb 10, 2024*
+### Feb 10, 2024
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

.changelog/v1.0.2/summary.md (1)

1-3: Convert emphasis to proper heading.

The release date should use a proper heading format instead of emphasis to maintain consistency with markdown best practices.

-*Feb 10, 2024*
+### Feb 10, 2024
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

1-1: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

.changelog/v1.0.1/improvements/4-add-helper-commands.md (1)

1-2: Suggestion: Correct verb tense and improve article usage for consistency.

The current changelog line uses "recover" which does not parallel the gerund "broadcasting." Consider revising the sentence for clarity and consistency, for example:

- Add helper commands for broadcasting software upgrade and recover client messages. ([#4](https://github.com/noble-assets/authority/pull/4))
+ Add helper commands for broadcasting a software upgrade and recovering client messages. ([#4](https://github.com/noble-assets/authority/pull/4))

This change improves clarity and maintains a consistent structure across the listed actions.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~1-~1: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac1bb56 and fe57f51.

📒 Files selected for processing (6)
  • .changelog/v1.0.1/improvements/4-add-helper-commands.md (1 hunks)
  • .changelog/v1.0.2/improvements/5-add-helper-command.md (1 hunks)
  • .changelog/v1.0.2/summary.md (1 hunks)
  • CHANGELOG.md (2 hunks)
  • client/cli/tx.go (2 hunks)
  • e2e/upgrade_test.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/cli/tx.go
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

5-5: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

.changelog/v1.0.2/summary.md

1-1: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~21-~21: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

.changelog/v1.0.1/improvements/4-add-helper-commands.md

[uncategorized] ~1-~1: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: test (TestScheduleAndCancelUpgrade)
  • GitHub Check: test (TestParameterUpdate)
  • GitHub Check: test (TestOwnershipTransfer)
  • GitHub Check: test (TestBeginBlocker)
  • GitHub Check: test (TestClientSubstitution)
🔇 Additional comments (6)
e2e/upgrade_test.go (4)

32-33: LGTM!

The function name and comment accurately reflect the expanded functionality of testing both scheduling and cancelling upgrades.


64-80: LGTM!

The test cases for cancelling software upgrade are well-structured and consistent with the existing patterns:

  • Test unauthorized access with proper error validation
  • Test authorized access with success validation

82-82: LGTM!

The final state verification correctly ensures that the upgrade was cancelled by checking for empty version and zero height.


44-44: Verify the impact of removing the --chain-id parameter.

The command has been simplified by removing the --chain-id parameter. Please ensure this change doesn't affect the command's functionality in different chain environments.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Check if the command works without chain-id in different environments.

# Search for other occurrences of the command to ensure consistency
rg -A 5 'authority software-upgrade'

Length of output: 38


Let's run a follow-up script to gather more context about the use (or non-use) of the --chain-id parameter in the repository. In particular, we want to inspect the relevant section of the test file and search for any occurrences of the --chain-id flag.


🏁 Script executed:

#!/bin/bash
echo "Searching for '--chain-id' flag in the entire repository:"
rg "--chain-id" || echo "No '--chain-id' occurrences found."

echo ""
echo "Verifying the command definition in e2e/upgrade_test.go (lines 40-50):"
awk 'NR>=40 && NR<=50 {print NR, $0}' e2e/upgrade_test.go

Length of output: 1264


The removal of the --chain-id parameter does not appear to break functionality.

  • A repository-wide search for the --chain-id flag (now using proper quoting) revealed no occurrences, confirming that the parameter was not used elsewhere.
  • The test in e2e/upgrade_test.go on line 44 only relies on the explicitly provided parameters, and there’s no evidence of chain-specific code expecting --chain-id.
.changelog/v1.0.2/improvements/5-add-helper-command.md (1)

1-1: LGTM!

The changelog entry is well-formatted and clearly describes the new functionality with the correct PR reference.

CHANGELOG.md (1)

21-21: LGTM!

The improvement entry is well-formatted and consistent with the changelog style.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~21-~21: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

@johnletey johnletey requested a review from 0xstepit February 10, 2025 13:58
Copy link

@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 (2)
.changelog/v1.0.2/summary.md (1)

1-3: Markdown Formatting Suggestion

The release date "Feb 10, 2025" is formatted using emphasis which may trigger markdownlint MD036. If you intend for this to be a heading or a prominently formatted date, consider using a proper heading (for example, # Feb 10, 2025) or an alternative styling.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

1-1: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

CHANGELOG.md (1)

21-21: Language Suggestion for Verb Form

The entry on line 21 reads:
- Add helper commands for broadcasting software upgrade and recover client messages.
Consider rephrasing it for clarity. For example, "Add helper commands to broadcast software upgrade and recover client messages" may read more naturally.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~21-~21: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe57f51 and 4cfdbbc.

📒 Files selected for processing (2)
  • .changelog/v1.0.2/summary.md (1 hunks)
  • CHANGELOG.md (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
CHANGELOG.md

5-5: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

.changelog/v1.0.2/summary.md

1-1: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~21-~21: This verb may not be in the correct form. Consider using a different form for this context.
Context: ...s for broadcasting software upgrade and recover client messages. ([#4](https://github.c...

(AI_EN_LECTOR_REPLACEMENT_VERB_FORM)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: prepare
  • GitHub Check: build
🔇 Additional comments (2)
CHANGELOG.md (2)

3-8: New Version Entry for v1.0.2

The new changelog entry for version v1.0.2 is clearly documented with the appropriate release date and description. Note that the release date on line 5 is formatted with emphasis; if a heading style is preferred, you might consider adjusting it accordingly.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

5-5: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


11-12: Helper Command Improvement Entry

The improvement entry for adding a helper command to broadcast a cancel software upgrade message is well stated and appropriately references pull request #5.

Copy link

@0xstepit 0xstepit left a comment

Choose a reason for hiding this comment

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

Great job 💪

@johnletey johnletey changed the title feat: add cli for cancelling a software upgrade feat: add cli for canceling a software upgrade Feb 10, 2025
@johnletey johnletey merged commit 740fce2 into main Feb 10, 2025
10 checks passed
@johnletey johnletey deleted the john/cancel-software-upgrade branch February 10, 2025 14:36
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.

2 participants