Skip to content

Conversation

@kubaraczkowski
Copy link
Contributor

@kubaraczkowski kubaraczkowski commented May 8, 2025

selfupdate supports semver with an optional 'v', but not when that 'v' is present in the zipped artifact.
This adds that support.

Summary by CodeRabbit

  • Bug Fixes
    • Improved executable name matching to support version numbers with an optional "v" prefix (e.g., both cmd-1.2.3-os-arch and cmd-v1.2.3-os-arch are now recognized).
  • Tests
    • Expanded test coverage to include executable names with and without the "v" prefix before version numbers, ensuring accurate validation across different naming conventions.

@coderabbitai
Copy link

coderabbitai bot commented May 8, 2025

Walkthrough

The regular expression used for matching executable filenames was updated to optionally allow a "v" prefix before the semantic version. Corresponding test cases were added to verify the new matching logic, including both valid and invalid patterns with the "v" prefix and various separators.

Changes

File(s) Change Summary
decompress.go Updated the regex in matchExecutableName to allow an optional "v" before the version segment.
decompress_test.go Added and adjusted test cases in TestMatchExecutableName for patterns with and without "v".

Poem

In files where patterns once were shy,
Now "v" may join—oh my, oh my!
Tests hop forth with names anew,
Hyphens, underscores, and "v"s in view.
Regex waltzes, rabbits cheer,
More matching joy this time of year!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 83ffad5 and b201940.

📒 Files selected for processing (2)
  • decompress.go (1 hunks)
  • decompress_test.go (1 hunks)
🔇 Additional comments (8)
decompress.go (1)

147-147: LGTM: Good implementation of the optional 'v' prefix support.

The regular expression was updated to support an optional 'v' prefix before the semver pattern by adding v? to the pattern. This aligns perfectly with the PR objective to support archives where the 'v' is included in the binary artifact's version naming.

decompress_test.go (7)

127-128: LGTM: Good test coverage for basic Linux binary names with 'v' prefix.

These test cases correctly verify that Linux binaries with the 'v' prefix in the version segment are properly matched, using both underscore and hyphen separators.


133-134: LGTM: Thorough testing of Linux binary names with OS and arch suffixes.

These test cases verify the complete pattern with OS and architecture suffixes for Linux binaries that include the 'v' prefix in their version segment.


138-138: LGTM: Good negative test for Linux binary without separator.

This test case correctly verifies that binaries without a proper separator before the 'v' prefix are rejected, which is consistent with the existing pattern behavior.


140-142: LGTM: Complete negative test coverage for Linux binaries with incomplete suffixes.

These test cases verify that Linux binaries with the 'v' prefix but incomplete OS/arch suffixes are properly rejected.


147-148: LGTM: Good test coverage for Windows binaries with 'v' prefix.

These test cases verify that Windows executables with the 'v' prefix in the version segment are properly matched, including the .exe extension.


153-154: LGTM: Thorough testing of Windows binaries with OS and arch suffixes.

These test cases verify the complete pattern with OS and architecture suffixes for Windows executables that include the 'v' prefix in their version segment.


160-162: LGTM: Complete negative test coverage for Windows binaries.

These test cases thoroughly verify all the invalid patterns for Windows executables with the 'v' prefix, including missing separators and incomplete OS/arch suffixes.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@codecov
Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.07%. Comparing base (83ffad5) to head (b201940).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #47   +/-   ##
=======================================
  Coverage   77.07%   77.07%           
=======================================
  Files          28       28           
  Lines        1435     1435           
=======================================
  Hits         1106     1106           
  Misses        279      279           
  Partials       50       50           
Flag Coverage Δ
unittests 77.07% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@creativeprojects
Copy link
Owner

Thanks for the PR, that was definitely a miss.
It looks good to me, good test coverage as well 👍🏻

@creativeprojects creativeprojects merged commit e969587 into creativeprojects:main May 16, 2025
7 checks passed
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.

3 participants