Files
paseo/scripts/merge-mac-manifest.test.mjs
Mohamed Boudra 25eb26db0f feat(desktop): add time-based staged rollout for stable updates
Linear ramp from 0% at publish to 100% at releaseDate + rolloutHours
(default 24h, configurable per release). Beta channel and rolloutHours=0
short-circuit to admit everyone. Per-machine bucket derives from a
persistent UUID at <userData>/.updaterId and feeds electron-updater's
isUserWithinRollout hook.

Adds desktop-rollout.yml workflow for in-place rolloutHours edits on
already-published releases (hotfix to 0 or extend the ramp), serialized
against finalize-rollout in desktop-release.yml via a shared concurrency
group keyed on the tag. Replaces the hand-rolled mac manifest merge
with a js-yaml round-trip that preserves unknown fields.
2026-04-28 16:48:18 +07:00

31 lines
1.3 KiB
JavaScript

import assert from "node:assert/strict";
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
import { test } from "vitest";
import { mergeMacManifest } from "./merge-mac-manifest.mjs";
test("preserves unknown fields while merging files by url", () => {
const dir = mkdtempSync(path.join(tmpdir(), "paseo-merge-mac-manifest-"));
try {
const arm64Path = path.join(dir, "arm64.yml");
const x64Path = path.join(dir, "x64.yml");
const outputPath = path.join(dir, "latest-mac.yml");
writeFileSync(
arm64Path,
"version: 1.2.3\nfiles:\n - url: app-arm64.zip\n sha512: arm\nstagingPercentage: 25\npath: app-arm64.zip\nsha512: arm\nreleaseDate: '2026-04-28T00:00:00.000Z'\n",
);
writeFileSync(
x64Path,
"version: 1.2.3\nfiles:\n - url: app-x64.zip\n sha512: x64\nstagingPercentage: 50\npath: app-x64.zip\nsha512: x64\nreleaseDate: '2026-04-29T00:00:00.000Z'\n",
);
mergeMacManifest(arm64Path, x64Path, outputPath);
const output = readFileSync(outputPath, "utf8");
assert.match(output, /stagingPercentage: 25/);
assert.match(output, /url: app-arm64\.zip/);
assert.match(output, /url: app-x64\.zip/);
} finally {
rmSync(dir, { force: true, recursive: true });
}
});