Skip to content

Commit a1bfed3

Browse files
t3dotggclaude
andcommitted
fix(desktop): a crossing that leaves the host on its old track fails, whatever the version order
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 8b48852 commit a1bfed3

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

‎apps/desktop/src/updates/DesktopRemoteUpdates.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,34 @@ describe("DesktopRemoteUpdates", () => {
296296
);
297297
});
298298

299+
it.effect("fails a crossing to an older-numbered Stable that the feed does not offer", () => {
300+
const harness = makeHarness({
301+
appVersion: "1.2.4-nightly.20261027.1",
302+
beforeSetUpdateChannel: Effect.void,
303+
});
304+
305+
return runRemoteUpdatesTest(harness, ({ reports, requests }) =>
306+
Effect.gen(function* () {
307+
yield* Queue.offer(requests, {
308+
...request("req-to-stable"),
309+
channel: "latest",
310+
targetVersion: "1.2.3",
311+
});
312+
yield* settle;
313+
harness.emit("update-not-available");
314+
yield* settle;
315+
harness.emit("update-not-available");
316+
yield* settle;
317+
318+
// Still on Nightly, though the target is numbered below this build.
319+
assert.deepEqual(
320+
terminalReports(reports).map((report) => [report.outcome, report.reason]),
321+
[["failed", "The desktop app found no build of 1.2.3."]],
322+
);
323+
}),
324+
);
325+
});
326+
299327
it.effect("accepts a newer build than the checked release on the requested track", () => {
300328
const harness = makeHarness({ beforeSetUpdateChannel: Effect.void });
301329

‎apps/desktop/src/updates/DesktopRemoteUpdates.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,13 @@ export const listen: Effect.Effect<
312312
return true;
313313
}
314314
case "done": {
315-
// A switch that leaves the host below its checked release did not reach it, on either
316-
// track; a track-only host already at the release is done.
315+
// A switch that leaves the host on its old track, or below its checked release, did
316+
// not reach it; a track-only host already at the release is done.
317317
const done =
318318
request.targetVersion !== undefined &&
319319
next.outcome === "up-to-date" &&
320-
compareSemverVersions(state.currentVersion, request.targetVersion) < 0
320+
(crossing(state) ||
321+
compareSemverVersions(state.currentVersion, request.targetVersion) < 0)
321322
? {
322323
outcome: "failed" as const,
323324
reason: `The desktop app found no build of ${request.targetVersion}.`,

0 commit comments

Comments
 (0)