Skip to content

Commit c6264c9

Browse files
author
Looper
committed
Prefer active updater release-note metadata
Generated-By: looper 0.10.1 (runner=fixer, agent=codex)
1 parent 380a098 commit c6264c9

2 files changed

Lines changed: 66 additions & 21 deletions

File tree

apps/web/src/lib/updater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ function isRecord(value: unknown): value is Record<string, unknown> {
105105
}
106106

107107
function metadataFromStatus(status: OpenDesignHostUpdaterStatusSnapshot | null): Record<string, unknown> | null {
108-
if (isRecord(status?.metadata)) return status.metadata;
109108
if (isRecord(status?.active?.metadata)) return status.active.metadata;
109+
if (isRecord(status?.metadata)) return status.metadata;
110110
if (isRecord(status?.incoming?.metadata)) return status.incoming.metadata;
111111
return null;
112112
}

apps/web/tests/lib/updater.test.ts

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -219,34 +219,79 @@ describe('web updater model', () => {
219219
});
220220

221221
it('keeps the downloaded installer visible without surfacing newer incoming progress', () => {
222-
const model = deriveUpdaterModel(
223-
downloadedStatus({
224-
incoming: {
225-
arch: 'arm64',
226-
artifact: {
227-
name: 'Open Design Beta 1.2.3-beta.5.dmg',
228-
platformKey: 'macAppleSilicon',
229-
type: 'dmg',
230-
url: 'https://fixture.test/Open Design Beta 1.2.3-beta.5.dmg',
222+
const status = downloadedStatus({
223+
active: {
224+
arch: 'arm64',
225+
artifact: {
226+
name: 'Open Design Beta 1.2.3-beta.4.dmg',
227+
platformKey: 'macAppleSilicon',
228+
type: 'dmg',
229+
url: 'https://fixture.test/Open Design Beta 1.2.3-beta.4.dmg',
230+
},
231+
checksum: {
232+
algorithm: 'sha256',
233+
value: 'active-checksum',
234+
},
235+
channel: 'beta',
236+
downloadedAt: '2026-05-19T00:00:00.000Z',
237+
key: '1.2.3-beta.4-mac-arm64',
238+
metadata: {
239+
releaseNotes: {
240+
jumpTo: {
241+
kind: 'external',
242+
url: 'https://releases.example.test/beta/versions/1.2.3-beta.4/details',
243+
},
244+
},
245+
},
246+
path: '/tmp/open-design-updater/Open Design Beta.dmg',
247+
platformKey: 'macAppleSilicon',
248+
version: '1.2.3-beta.4',
249+
},
250+
incoming: {
251+
arch: 'arm64',
252+
artifact: {
253+
name: 'Open Design Beta 1.2.3-beta.5.dmg',
254+
platformKey: 'macAppleSilicon',
255+
type: 'dmg',
256+
url: 'https://fixture.test/Open Design Beta 1.2.3-beta.5.dmg',
257+
},
258+
channel: 'beta',
259+
key: '1.2.3-beta.5-mac-arm64',
260+
metadata: {
261+
releaseNotes: {
262+
jumpTo: {
263+
kind: 'external',
264+
url: 'https://releases.example.test/beta/versions/1.2.3-beta.5/details',
265+
},
231266
},
232-
channel: 'beta',
233-
key: '1.2.3-beta.5-mac-arm64',
234-
progress: {
235-
receivedBytes: 64,
236-
totalBytes: 256,
267+
},
268+
progress: {
269+
receivedBytes: 64,
270+
totalBytes: 256,
271+
},
272+
startedAt: '2026-05-19T00:00:00.000Z',
273+
version: '1.2.3-beta.5',
274+
},
275+
metadata: {
276+
releaseNotes: {
277+
jumpTo: {
278+
kind: 'external',
279+
url: 'https://releases.example.test/beta/versions/1.2.3-beta.5/details',
237280
},
238-
startedAt: '2026-05-19T00:00:00.000Z',
239-
version: '1.2.3-beta.5',
240281
},
241-
state: 'downloaded',
242-
}),
243-
{ hostAvailable: true },
244-
);
282+
},
283+
state: 'downloaded',
284+
});
285+
const model = deriveUpdaterModel(status, { hostAvailable: true });
245286

246287
expect(model.busy).toBe(false);
247288
expect(model.hasDownloadedInstaller).toBe(true);
248289
expect(model.shouldPrompt).toBe(true);
249290
expect(model.downloadProgress).toBeNull();
291+
expect(releaseNotesJumpToFromStatus(status)).toEqual({
292+
kind: 'external',
293+
url: 'https://releases.example.test/beta/versions/1.2.3-beta.4/details',
294+
});
250295
});
251296

252297
it('does not keep prompting after the installer has been opened', () => {

0 commit comments

Comments
 (0)