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: version check #127

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

feat: version check #127

wants to merge 1 commit into from

Conversation

infiniteregrets
Copy link
Member

@infiniteregrets infiniteregrets commented Feb 26, 2025

Important

Add version check command to CLI for checking the latest release from GitHub.

  • Behavior:
    • Adds VersionCheck command to Commands enum in main.rs to check for the latest version.
    • Uses check_for_updates() in updates.rs to fetch the latest release from GitHub.
    • If a new version is available, prints the latest version and update instructions; otherwise, confirms the software is up-to-date.
  • Dependencies:
    • Adds reqwest dependency in Cargo.toml for HTTP requests.
  • Misc:
    • Updates Cargo.lock with new dependencies and versions.

This description was created by Ellipsis for 1b8a3e4. It will automatically update as commits are pushed.

@infiniteregrets infiniteregrets requested a review from a team as a code owner February 26, 2025 03:05
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 1b8a3e4 in 1 minute and 59 seconds

More details
  • Looked at 1039 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. src/updates.rs:30
  • Draft comment:
    Consider using a dedicated semver parser instead of string comparison for version numbers. For example, comparing '0.10.0' with '0.8.4' lexically may yield incorrect results.
  • Reason this comment was not posted:
    Marked as duplicate.
2. src/updates.rs:28
  • Draft comment:
    Consider checking the HTTP response status explicitly before attempting to deserialize JSON. This could help in diagnostics if GitHub returns an error response.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    The code already has reasonable error handling through ok()? pattern. Adding explicit status checking would be redundant since reqwest handles this. The function returns Option and gracefully handles all errors by returning None. For a simple update checker, this level of error handling is appropriate - users don't need detailed error diagnostics.
    Maybe detailed error diagnostics would help users understand why update checks fail. The current code silently fails with None for any error.
    For an update checker that runs in the background, silent failure is actually preferable - users don't need to see diagnostic messages for temporary network issues or GitHub API problems.
    The comment should be deleted. The existing error handling is appropriate for this use case, and adding explicit status checking would be unnecessary complexity.
3. src/main.rs:106
  • Draft comment:
    In the documentation for the 'Ls' subcommand, please change 'upto a maximum of 1000' to 'up to a maximum of 1000' for clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. src/main.rs:122
  • Draft comment:
    Please update 'upto a maximum of 1000' to 'up to a maximum of 1000' in the 'ListBasins' subcommand documentation.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. src/main.rs:256
  • Draft comment:
    In the 'Fence' subcommand documentation, please change 'It may be upto 16 bytes' to 'It may be up to 16 bytes' for proper spacing.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_pwps4bngM3o6iCqB


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

let current = env!("CARGO_PKG_VERSION");
let current = current.trim_start_matches('v');

if latest > current {
Copy link

Choose a reason for hiding this comment

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

Consider using a proper semantic versioning comparison instead of string comparison (lines 30-37). Lexicographical comparison can misorder versions (e.g., "10.0" vs "9.9"). Using the semver crate would be more robust.

@infiniteregrets infiniteregrets marked this pull request as draft February 26, 2025 07:33
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.

1 participant