Skip to content

refactor(feature): simplify latest version selection - #1441

Merged
skevetter merged 1 commit into
mainfrom
refactor/feature-latest-version
Oct 9, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/feature-latest-version

Conversation

@skevetter

@skevetter skevetter commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

findLatestVersion repeated current-version validation and combined a separate hasBest flag with two version comparisons. Validate current once and use it as the initial best version, leaving one strict comparison for each candidate and returning the original selected tag.

Add focused regression cases for empty and zero versions, unsorted candidates, first-input ties after normalization, build metadata, and prerelease ordering. Invalid/latest skipping and parsing remain unchanged.

Validation: affected package race tests and vet; CI-parity lint; applicable hooks; independent review; authenticated local CodeRabbit review. A temporary bounded comparison of the exact old and new helpers passed 346,200 inputs. CodeScene confirms the complex conditional is removed, with file code health increasing from 9.38 to 9.68; the unrelated loadConfig finding remains outside scope.

Closes #1437.

Summary by CodeRabbit

  • Bug Fixes
    • Improved outdated-version checks so only valid versions newer than the current version are reported as upgrades.
    • Correctly handles equivalent versions, build metadata, and prerelease ordering, avoiding upgrade notices when no newer version is available.
    • Invalid current versions no longer produce an outdated-version result.

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit c983899
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6ac8736cdbb0390008595ce6

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3a18662c-cbc2-4a42-950f-ea16b3b1294c
📥 Commits

Reviewing files that changed from the base of the PR and between 3ba1a43 and c983899.

📒 Files selected for processing (2)
  • cmd/feature/outdated.go
  • cmd/feature/outdated_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

findLatestVersion now validates the current tag before scanning candidates and uses its parsed version as the initial best value. Tests cover empty inputs, version ordering, normalized ties, build metadata, and prerelease comparisons.

Changes

Latest version selection

Layer / File(s) Summary
Version selection and regression tests
cmd/feature/outdated.go, cmd/feature/outdated_test.go
The helper returns an empty result for an invalid current tag and replaces the current best only with a greater candidate version. Tests cover empty inputs, ordering, ties, build metadata, and prerelease behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to c9838

No merge-blocking risk is identified in the version-selection change; it is ready for normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Issue #1437 is directly linked and has coding requirements. findLatestVersion parses current once, returns an empty string on invalid input, initializes best from the parsed current version, ski…
Out of Scope Changes check Passed The reported pull request changes are limited to cmd/feature/outdated.go and cmd/feature/outdated_test.go. The source change is limited to findLatestVersion. The test additions support the helpe…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: simplifying latest version selection in the feature command.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev ready!

Name Link
🔨 Latest commit c983899
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6ac8736ce1bb40000847cfcf
😎 Deploy Preview https://deploy-preview-1441--devsydev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the size/m label Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

Copy link
Copy Markdown
Contributor Author

@greptileai review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the simpler comparison preserves the existing behavior.

Summary

Simplifies findLatestVersion without changing which tag it returns.

  • Checks the current version once and uses it as the starting best version.
  • Keeps the original selected tag and the first tag among equal versions.
  • Adds tests for empty lists, zero versions, unsorted tags, ties, build metadata, and prereleases.
    No actionable issues were found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "refactor(feature): simplify latest versi..." · Reviewed by Greptile

@skevetter
skevetter marked this pull request as ready for review October 9, 2026 05:34
@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter
skevetter merged commit 92047bc into main Oct 9, 2026
94 checks passed
@skevetter
skevetter deleted the refactor/feature-latest-version branch October 9, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(feature): simplify latest version selection

1 participant