desktop dev update channel: every push to main builds dev bundles (<next patch>-dev.<UTC>), the VDS signs and publishes dev/latest.json (newest 5); app channel setting stable|dev, background updater at start / 15 min / resume / channel switch, deferred while in use, no downgrade, autostart rewritten on every start, card shows version and channel
This commit is contained in:
parent
4dff7d9b2e
commit
39b2f73ad7
25 changed files with 732 additions and 47 deletions
39
tests/desktop-dev.test.ts
Normal file
39
tests/desktop-dev.test.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import { describe, expect, test } from 'bun:test';
|
||||
import { compare, devVersion, guardProblem, nextPatch, pruneDev, utcStamp } from '../tools/desktop-dev';
|
||||
|
||||
describe('desktop dev channel', () => {
|
||||
test('stamps the next patch with the UTC commit time', () => {
|
||||
expect(nextPatch('0.8.47')).toBe('0.8.48');
|
||||
expect(nextPatch('0.8.48-rc.1')).toBe('0.8.48');
|
||||
expect(utcStamp(new Date('2026-10-23T09:05:07+03:00'))).toBe('20261023060507');
|
||||
expect(devVersion('0.8.47', new Date('2026-10-23T06:05:07Z'))).toBe('0.8.48-dev.20261023060507');
|
||||
});
|
||||
|
||||
test('dev builds sort above the current stable, below the next stable, monotonic in time', () => {
|
||||
const a = devVersion('0.8.47', new Date('2026-10-23T06:05:07Z'));
|
||||
const b = devVersion('0.8.47', new Date('2026-10-23T06:05:08Z'));
|
||||
expect(compare(a, '0.8.47')).toBe(1);
|
||||
expect(compare('0.8.48', a)).toBe(1);
|
||||
expect(compare(b, a)).toBe(1);
|
||||
expect(compare(a, a)).toBe(0);
|
||||
// after 0.8.48 ships, its successor's dev builds pass it
|
||||
expect(compare(devVersion('0.8.48', new Date('2026-10-24T00:00:00Z')), '0.8.48')).toBe(1);
|
||||
expect(compare('0.8.48-dev.10', '0.8.48-dev.9')).toBe(1);
|
||||
expect(compare('0.10.0', '0.9.9')).toBe(1);
|
||||
});
|
||||
|
||||
test('the publish guard refuses a version not above the live dev build', () => {
|
||||
expect(guardProblem('0.8.48-dev.20261023060507', null)).toBeNull();
|
||||
expect(guardProblem('0.8.48-dev.20261023060508', '0.8.48-dev.20261023060507')).toBeNull();
|
||||
expect(guardProblem('0.8.48-dev.20261023060507', '0.8.48-dev.20261023060507')).toContain('refused');
|
||||
expect(guardProblem('0.8.48-dev.20261023060506', '0.8.48-dev.20261023060507')).toContain('refused');
|
||||
expect(guardProblem('0.8.48', null)).toContain('not a dev version');
|
||||
});
|
||||
|
||||
test('prunes dev drafts to the newest 5, never other releases', () => {
|
||||
const rel = (t: string) => ({ tag_name: t });
|
||||
const dev = [1, 2, 3, 4, 5, 6, 7].map(i => rel(`dev-0.8.48-dev.2026102300000${i}`));
|
||||
const out = pruneDev([rel('v0.8.47'), rel('rc-' + 'a'.repeat(40)), ...dev.reverse()]);
|
||||
expect(out.map(r => r.tag_name)).toEqual(['dev-0.8.48-dev.20261023000002', 'dev-0.8.48-dev.20261023000001']);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue