Skip to content

Fix update detection for pseudo-version builds - #375

Merged
jeremy merged 1 commit into
mainfrom
fix/update-version-detection
Mar 25, 2026
Merged

Fix update detection for pseudo-version builds#375
jeremy merged 1 commit into
mainfrom
fix/update-version-detection

Conversation

@robzolkos

@robzolkos robzolkos commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • compare current and latest versions semantically instead of treating any difference as an update
  • suppress false update notices when a pseudo-version build is newer than the latest tagged release
  • apply the comparison consistently in doctor, upgrade, and background update notices
screenshot-2026-03-24_18-47-49

Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9714497196

Testing

  • go test ./internal/commands/...

Summary by cubic

Use semantic version comparison so updates are only shown when the latest release is actually newer. Fixes false “update available” notices for pseudo-version builds in doctor, upgrade, and background checks.

  • Bug Fixes

    • Compare versions using golang.org/x/mod/semver via a new helper, preventing pseudo-version builds from being flagged as outdated.
    • Apply the check in doctor, upgrade, and background UpdateCheck.Notice() paths.
    • Add tests covering pseudo-versions and equality cases.
  • Dependencies

    • Add golang.org/x/mod v0.34.0 for semver comparisons.

Written for commit 17abd55. Summary will update on new commits.

The CLI treated any different GitHub release tag as an available update,
even when the current build was actually newer than the latest tagged
release. This caused outputs like:

- current: 0.4.1-0.20260313174735-243815fa23b2
- update available: 0.4.0

Use semantic version comparison for doctor, upgrade, and background update
notices so updates are only shown when the latest release is actually newer
than the current build.

Tests:
- go test ./internal/commands/...
Copilot AI review requested due to automatic review settings March 24, 2026 22:29
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) deps bug Something isn't working labels Mar 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes false-positive update notifications when the CLI is built from a newer pseudo-version than the latest tagged release by switching update detection to semantic version comparison (including pseudo-versions/prereleases) across doctor, upgrade, and background update notices.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Changes:

  • Add a shared semantic version comparison helper (isUpdateAvailable) using golang.org/x/mod/semver.
  • Apply semantic “latest > current” checks consistently in upgrade, doctor, and update notices.
  • Add targeted tests to ensure older “latest” releases are suppressed when the current build is a newer pseudo-version.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/commands/version_compare.go Introduces semantic version normalization and comparison helper for update detection.
internal/commands/version_compare_test.go Adds unit tests for update-availability logic, including pseudo-version cases.
internal/commands/upgrade.go Uses semantic update detection to avoid reporting updates when “latest” is older.
internal/commands/upgrade_test.go Adds coverage ensuring upgrade output is suppressed when latest is older than a pseudo-version build.
internal/commands/update_notice.go Uses semantic comparison so background notices don’t show when latest is older.
internal/commands/update_notice_test.go Adds coverage for suppressing notices when latest is older than current pseudo-version build.
internal/commands/doctor.go Uses semantic update detection in the version check to avoid false “update available” warnings.
internal/commands/doctor_test.go Adds coverage ensuring doctor doesn’t warn when latest is older than current pseudo-version build.
go.mod Adds golang.org/x/mod dependency for semver comparison.
go.sum Records checksums for the new golang.org/x/mod dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 10 files

@jeremy
jeremy merged commit 45de523 into main Mar 25, 2026
31 checks passed
@jeremy
jeremy deleted the fix/update-version-detection branch March 25, 2026 04:34
jeremy added a commit that referenced this pull request Jul 25, 2026
Add TestTodosShowJSONSurfacesSDKFields, a regression guard for #449: the
fields that report (due_on, starts_on, comments_count, boosts_count,
completion_subscribers, description_attachments) must all surface in the
--json output of `todos show`.

The implementation already landed on main via the SDK model — SDK #375
added completion_subscribers/comments_count, SDK #400 added
description_attachments, absorbed by CLI #552/#554's SDK bumps; due_on,
starts_on and boosts_count already existed with omitempty. `todos show`
emits the SDK Todo object directly, so the fields surface today. This is
coverage, not a fix (hence Refs, not Fixes).

The test serves a fully-populated todo and asserts both the presence and
the values of all six fields, keeping the omitempty date/count fields
exercised with nonzero values so a future SDK bump can't silently drop
them.
jeremy added a commit that referenced this pull request Jul 25, 2026
Add TestTodosShowJSONSurfacesSDKFields, a regression guard for #449: the
fields that report (due_on, starts_on, comments_count, boosts_count,
completion_subscribers, description_attachments) must all surface in the
--json output of `todos show`.

The implementation already landed on main via the SDK model — SDK #375
added completion_subscribers/comments_count, SDK #400 added
description_attachments, absorbed by CLI #552/#554's SDK bumps; due_on,
starts_on and boosts_count already existed with omitempty. `todos show`
emits the SDK Todo object directly, so the fields surface today. This is
coverage, not a fix (hence Refs, not Fixes).

The test serves a fully-populated todo and asserts both the presence and
the values of all six fields, keeping the omitempty date/count fields
exercised with nonzero values so a future SDK bump can't silently drop
them.
jeremy added a commit that referenced this pull request Jul 25, 2026
…564)

Add TestTodosShowJSONSurfacesSDKFields, a regression guard for #449: the
fields that report (due_on, starts_on, comments_count, boosts_count,
completion_subscribers, description_attachments) must all surface in the
--json output of `todos show`.

The implementation already landed on main via the SDK model — SDK #375
added completion_subscribers/comments_count, SDK #400 added
description_attachments, absorbed by CLI #552/#554's SDK bumps; due_on,
starts_on and boosts_count already existed with omitempty. `todos show`
emits the SDK Todo object directly, so the fields surface today. This is
coverage, not a fix (hence Refs, not Fixes).

The test serves a fully-populated todo and asserts both the presence and
the values of all six fields, keeping the omitempty date/count fields
exercised with nonzero values so a future SDK bump can't silently drop
them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations deps tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants