Skip to content

fix(update): allow stable updates from older previews - #871

Open
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/update-latest-from-preview
Open

fix(update): allow stable updates from older previews#871
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/update-latest-from-preview

Conversation

@luvs01

@luvs01 luvs01 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Compare an installed preview by its major.minor.patch core when the selected update channel is latest.
  • Keep the latest-channel target strict: a preview registry target is still never accepted as a stable update.
  • Cover both the comparator and the GUI/API update-check result that controls one-click availability.

Problem

An older preview install such as 2.8.2-preview.20260731 cannot be parsed by the stable-only current-version branch. With npm latest at 2.9.1, isNewer() therefore returns false, and the dashboard incorrectly reports already_latest and disables one-click update.

Behavior

  • latest=2.9.1, current=2.8.2-preview.20260731: update available.
  • latest=2.9.1, current=2.9.1-preview.20260731: no update, preserving the existing core-version comparison policy.
  • A preview value in the latest target remains rejected.

Verification

  • bun test tests/update-notify.test.ts tests/update-job.test.ts: 60 passed, 0 failed, 152 assertions.
  • bun run typecheck: passed.
  • bun run privacy:scan: passed.
  • git diff --check upstream/dev...HEAD: passed.

No documentation change is included because this restores the documented existing update-channel behavior rather than adding a new user-facing option.

Summary by CodeRabbit

  • Bug Fixes

    • Improved update checks for preview versions, allowing older previews to detect newer stable releases.
    • Prevented update notifications when a preview already matches the stable release’s base version.
  • Tests

    • Added coverage for preview-to-stable update detection and matching-version behavior.

@github-actions github-actions Bot added the bug Something isn't working label Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c8b955e5-7a81-49f3-8428-1e873e5d4294

📥 Commits

Reviewing files that changed from the base of the PR and between 6edec46 and bc0a569.

📒 Files selected for processing (3)
  • src/update/notify.ts
  • tests/update-job.test.ts
  • tests/update-notify.test.ts

📝 Walkthrough

Walkthrough

Changes

Preview update comparison

Layer / File(s) Summary
Preview base-version comparison and test coverage
src/update/notify.ts, tests/update-job.test.ts, tests/update-notify.test.ts
isNewer compares stable releases with preview versions by major, minor, and patch components. Tests cover updates from older previews and suppression for previews with the same stable base.

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

Suggested reviewers: lidge-jun, ingwannu, wibias

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes allowing stable updates from older preview versions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc0a569c17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/update/notify.ts
if (channel === "latest") {
const l = parseStable(latest);
const c = parseStable(current);
const c = parseStable(current) ?? parsePreview(current)?.slice(0, 3);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Parse multi-component preview identifiers

When the installed build has a supported multi-component prerelease such as 2.8.2-preview.20260731.2, parsePreview() rejects it because its regex permits exactly one numeric component after preview. The release tooling accepts this form, and tests/release-notes.test.ts explicitly exercises same-day suffixes such as .2 and .10; consequently this branch still returns false and the GUI/API reports already_latest even when stable 2.9.1 is available. Parse the core independently of the complete prerelease identifier, or allow all supported numeric components, and cover this form in the update tests.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant