Skip to content

fix(desktop): a failed update-track save keeps offering the current track's updates - #34917

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-34876
Nov 12, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-34876

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

DesktopUpdates.setChannel set releaseFloorRef to the requested track's minimumVersion before desktopSettings.setUpdateChannel ran, and nothing restored it when the save failed. The offerable filter then kept applying the other track's floor on the unchanged track, so valid updates there were dropped and the state read up-to-date. The fix uses Ref.getAndSet to remember the previous floor and adds Effect.onError on the settings save to restore it before the error is mapped to DesktopUpdateChannelPersistenceError. The success path and the same-track early return are unchanged. No new regex or parser.

Fixes #34876

Reproduction on main

On origin/main 4e0b528, I added a test to apps/desktop/src/updates/DesktopUpdates.test.ts using the existing updates harness. The packaged Stable 1.2.3 build has a settings write that fails with DesktopSettingsWriteError. The test calls updates.setChannel('nightly', { minimumVersion: '1.2.5-nightly.20261028.1' }), which rejects with DesktopUpdateChannelPersistenceError, and the state channel stays 'latest'. The updater then emits update-available 1.2.4. Ran vp test run apps/desktop/src/updates/DesktopUpdates.test.ts: the new test fails with expected null to equal '1.2.4' (availableVersion stays null) and the other 44 tests pass. This is a service-level reproduction with Electron and settings faked; no packaged UI session was run.

Evidence

In the packaged Linux Electron app, start on Stable 1.2.3. Force the real settings write to fail, then request Nightly with minimum version 1.2.5-nightly.20261028.1 through desktop IPC. The request rejects and the track remains Stable. Offer Stable 1.2.4 from a local HTTP feed and click Check for Updates.

Both sides use fresh synthetic homes, the same driver, light theme, and a 1100×780 window. Captures show the About update controls.

Before After
Before: Stable incorrectly reports Up to Date After: Stable offers Download
4e0b52806b 19943c548c
Before recording After recording
State: availableVersion null State: availableVersion 1.2.4

Reproduction driver · Packaging script · Reproduction instructions

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • The guarded track-switch dialog was not exercised; the failed-save request used the real desktop bridge and IPC with the reproduction's exact channel and minimum version.
  • Public release infrastructure, download, installation, restart behavior, and other operating systems were not exercised; this proof covers the failed save and subsequent Stable offer.

Tests

Without the fix, vp test run apps/desktop/src/updates/DesktopUpdates.test.ts fails the repro test 'keeps the current track's offers when a track switch fails to save' with expected null to equal '1.2.4'. With the fix, all 45 tests pass, before and after formatting. vp run check:changed: lint, knip 1/2 and 2/2, typecheck (2 packages) and test (1 file) passed; format failed on the first run. After vp format, vp format --check on both changed files passed. The full check:changed was not re-run after formatting; the commit hooks (fmt, lint, knip) passed.

AI-assisted; verified with the tests and tools listed above.

…ffers

Reproduces #34876: setChannel sets the release floor before the settings
write, so a rejected save leaves the requested track's floor in place and
the unchanged track's newer releases are filtered out.

AI-assisted; verified with the tests and tools listed above.
…rack's updates

Restore the previous release floor when persisting the new update channel fails,
so later checks on the unchanged track are not filtered by the requested track's
minimum version.

Fixes #34876

AI-assisted; verified with the tests and tools listed above.
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 12, 2026

@macroscopeapp macroscopeapp 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.

All clear

Posted via Macroscope — Effect Service Conventions

@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 19943c5

Macroscope's review found this PR approvable — A failed update-channel save now restores the previous release floor, preserving offers from the current track. Successful channel changes and product defaults remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

When setChannel applies a minimum version, it now saves the previous release floor and restores it if channel persistence fails. A test verifies that the failed switch leaves latest selected and a Stable offer remains available.

Changes: Channel persistence failure handling

Layer / File(s) Summary
Release floor rollback and regression test
apps/desktop/src/updates/DesktopUpdates.ts, apps/desktop/src/updates/DesktopUpdates.test.ts
setChannel restores the previous release floor when saving the channel fails. A test checks that latest remains selected and that a Stable offer at version 1.2.4 is accepted.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Suggested labels: bugfix, size:S

Suggested reviewers: t3dotgg, macroscopeapp

Merge Risk: Minimal · up to 19943

A failed update-track save no longer leaves a stale release floor that could hide valid updates on the still-selected track. Successful switches and the same-track early return are unchanged. No merge-blocking risk is apparent.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected area: a failed update-track save keeps offering the current track's updates. The change restores the previous release floor when the channel save fails, so the…
Linked Issues check Passed Issue #34876 requires that a rejected track save not leave the requested track's release floor in place. The reviewed diff of apps/desktop/src/updates/DesktopUpdates.ts changes setChannel to capture t…
Out of Scope Changes check Passed The code change is limited to setChannel in DesktopUpdates.ts: floor save and restore around the settings write. This directly implements issue #34876. The PR summary also reports a regression test in…
Description check Passed The description covers the problem (a failed track save leaves the requested track's release floor in place, which filters valid updates on the still-selected track), the change (Ref.getAndSet to keep…
Full details: Title check

Explanation

The title names the fix and the affected area: a failed update-track save keeps offering the current track's updates. The change restores the previous release floor when the channel save fails, so the title matches the main change. It is a conventional commit with a scope and states the bug in plain language.

Full details: Linked Issues check

Explanation

Issue #34876 requires that a rejected track save not leave the requested track's release floor in place. The reviewed diff of apps/desktop/src/updates/DesktopUpdates.ts changes setChannel to capture the previous floor with Ref.getAndSet before the save. It attaches Effect.onError to desktopSettings.setUpdateChannel(nextChannel) that calls Ref.set(releaseFloorRef, previousFloor). The error then maps to DesktopUpdateChannelPersistenceError as before. This restores the floor after a failed Stable-to-Nightly save, so the Stable offerable filter applies again. The success path and the same-track early return keep their prior sequence of operations. The regression test described in the PR was not readable (test diff unavailable), so the test result rests on the PR's reported run, not on my inspection.

Full details: Out of Scope Changes check

Explanation

The code change is limited to setChannel in DesktopUpdates.ts: floor save and restore around the settings write. This directly implements issue #34876. The PR summary also reports a regression test in DesktopUpdates.test.ts, which supports the same objective. The PR's Evidence section is a placeholder and contains no code. No unrelated changes were identified in the reviewed evidence. The test file diff could not be read, so its contents are not independently verified.

Full details: Description check

Explanation

The description covers the problem (a failed track save leaves the requested track's release floor in place, which filters valid updates on the still-selected track), the change (Ref.getAndSet to keep the previous floor, Effect.onError restores it before the error mapping), and a scope reference to the linked issue #34876. Verification is detailed: a failing service-level regression test before the fix, 45 passing tests after, lint/knip/typecheck results, and before/after evidence including screenshots and state files. Its limits are stated explicitly. It does not use the template's exact headings (Problem, Change, Scope, Verification), and the title is absent from the provided text, so the conventional commit title cannot be checked. Those gaps are minor and the content is substantially complete.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8024e50 and 19943c5.

Files selected for processing: 2

  • apps/desktop/src/updates/DesktopUpdates.test.ts
  • apps/desktop/src/updates/DesktopUpdates.ts

Limit details: You’ve used all 10 included reviews currently available.

@juliusmarminge
juliusmarminge merged commit f423a4d into main Nov 12, 2026
36 checks passed
@juliusmarminge
juliusmarminge deleted the factory/issue-34876 branch November 12, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Failed update-track save hides available updates on the unchanged track

1 participant