Skip to content

fix: stable channel detects update for dev builds#753

Merged
Aureliolo merged 2 commits intomainfrom
fix/stable-channel-dev-update
Mar 22, 2026
Merged

fix: stable channel detects update for dev builds#753
Aureliolo merged 2 commits intomainfrom
fix/stable-channel-dev-update

Conversation

@Aureliolo
Copy link
Copy Markdown
Owner

Summary

  • isUpdateAvailable (stable channel) used compareSemver which strips pre-release suffixes, treating 0.4.8-dev.4 and 0.4.8 as equal -- so a dev build on the stable channel never saw the stable release as an update
  • Switched to compareWithDev which correctly treats 0.4.8 > 0.4.8-dev.4 (stable beats dev at same base version); behavior is identical for two stable versions, so no regression
  • Added 4 test cases covering dev-build-on-stable-channel scenarios

Test plan

  • All selfupdate tests pass (50 tests including fuzz seed corpus)
  • go vet, go build pass
  • Verify synthorg update on a dev build correctly offers the stable release

Review coverage

Quick mode -- automated checks only (Go vet + test + build), no agent review.

🤖 Generated with Claude Code

isUpdateAvailable used compareSemver which strips pre-release suffixes,
treating 0.4.8-dev.4 and 0.4.8 as equal. Switch to compareWithDev so a
stable release is correctly detected as newer than a dev pre-release at
the same base version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 22, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where development builds running on the stable channel failed to recognize available stable updates. The core problem stemmed from an inadequate version comparison mechanism that incorrectly treated dev builds and stable releases with the same base version as equal. By implementing a more robust comparison function, the system now accurately determines when a stable release is newer, ensuring users receive timely update notifications. The change is validated with new test cases.

Highlights

  • Version Comparison Logic: The isUpdateAvailable function in the stable channel incorrectly used compareSemver, which stripped pre-release suffixes, preventing dev builds from detecting available stable updates.
  • Updated Comparison Function: Switched to compareWithDev for version comparison, which correctly identifies stable releases as newer than dev pre-releases with the same base version (e.g., 0.4.8 > 0.4.8-dev.4).
  • New Test Cases: Added four new test cases to cover scenarios where dev builds on the stable channel should correctly detect updates from stable releases.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 82b4d1d4-a858-4682-b08c-3e092d8daf5c

📥 Commits

Reviewing files that changed from the base of the PR and between a2bccac and 349c7df.

📒 Files selected for processing (2)
  • cli/internal/selfupdate/updater.go
  • cli/internal/selfupdate/updater_version_test.go
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CLI Test (windows-latest)
  • GitHub Check: Analyze (python)
🧰 Additional context used
📓 Path-based instructions (1)
cli/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Go CLI: use Cobra commands. Never use cd cli in Bash commands -- use go -C cli instead.

Files:

  • cli/internal/selfupdate/updater.go
  • cli/internal/selfupdate/updater_version_test.go
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: Aureliolo/synthorg PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-15T21:32:02.880Z
Learning: Applies to .github/workflows/*.yml : Dependabot: daily updates for uv + github-actions + npm + pre-commit + docker + gomod, grouped minor/patch, no auto-merge. Use `/review-dep-pr` to review Dependabot PRs before merging.
🧬 Code graph analysis (1)
cli/internal/selfupdate/updater.go (1)
cli/internal/version/version.go (1)
  • Version (9-9)
🔇 Additional comments (3)
cli/internal/selfupdate/updater.go (2)

123-123: Good consolidation of update decision logic.

Line 123 correctly routes dev-channel checks through isUpdateAvailable, reducing duplicate logic and keeping comparison semantics consistent.


299-303: Comparator switch fixes same-base stable-vs-dev ordering.

Lines 299-303 correctly use compareWithDev, so stable releases are detected as newer than same-base dev prereleases.

cli/internal/selfupdate/updater_version_test.go (1)

21-29: Strong regression coverage for the reported version-ordering bug.

These cases validate the critical stable-vs-dev and dev-vs-dev transitions that previously misreported update availability.


Walkthrough

The self-update logic was changed to remove the separate isDevUpdateAvailable path and use isUpdateAvailable with compareWithDev for comparisons. The new logic stops stripping a leading v from the latest tag except when trimming produces "dev" for the current version, and it now treats stable releases at the same base version as newer than corresponding -dev.<n> prereleases. Tests were updated to add expectations for stable-vs-dev and dev-vs-dev cases and the previous TestIsDevUpdateAvailable was removed.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: stable channel now detects updates for dev builds, which is the primary change in this PR.
Description check ✅ Passed The description is directly related to the changeset, explaining the root cause (compareSemver stripping pre-release suffixes), the solution (switching to compareWithDev), and test coverage details.
Docstring Coverage ✅ Passed Docstring coverage is 42.86% which is sufficient. The required threshold is 40.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes an issue where updates for development builds on the stable channel were not being detected. The change to use compareWithDev in isUpdateAvailable is appropriate and resolves the problem by correctly handling pre-release version suffixes. The new test cases are well-written and cover the necessary scenarios to prevent regressions. I have one suggestion regarding code duplication that has arisen from this change, which could improve the overall maintainability of the code.

Comment on lines +312 to +316
// Use compareWithDev so a stable release is correctly detected as
// newer than a dev pre-release at the same base version (e.g.
// 0.4.8 > 0.4.8-dev.4). compareSemver ignores pre-release
// suffixes and would treat them as equal.
cmp, err := compareWithDev(latest, current)
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.

medium

With this change, isUpdateAvailable is now functionally identical to isDevUpdateAvailable. To improve maintainability and reduce code duplication, consider removing isDevUpdateAvailable and updating its call site in CheckDevFromURL to use this function instead.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 22, 2026
Both functions became identical after switching to compareWithDev.
Remove the duplicate and merge test cases into a single table.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Aureliolo Aureliolo merged commit f53da9f into main Mar 22, 2026
38 checks passed
@Aureliolo Aureliolo deleted the fix/stable-channel-dev-update branch March 22, 2026 22:44
Aureliolo added a commit that referenced this pull request Mar 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.4.9](v0.4.8...v0.4.9)
(2026-03-23)


### Features

* add consultancy and data team template archetypes
([#764](#764))
([81dc75f](81dc75f))
* add personality presets for new template archetypes
([#758](#758))
([de4e661](de4e661))
* improve wipe command UX with interactive prompts
([#759](#759))
([bbd4d2d](bbd4d2d))


### Bug Fixes

* stable channel detects update for dev builds
([#753](#753))
([f53da9f](f53da9f))


### Documentation

* add version banner to docs header
([#761](#761))
([8f8c1f8](8f8c1f8))


### Maintenance

* adopt new features from web dependency upgrades
([#763](#763))
([1bb6336](1bb6336))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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