| 1 | import assert from "node:assert/strict"; |
| 2 | import test from "node:test"; |
| 3 | import { readFileSync } from "node:fs"; |
| 4 | import { verifyProducer } from "./verify-manual-desktop-producer.mjs"; |
| 5 | |
| 6 | function fixture() { |
| 7 | return [{ repository: { full_name: "esengine/DeepSeek-Reasonix" }, head_sha: "09cdab3866d77c6ff0d007ee61b6aca3128ebe54", head_branch: "main-v2", event: "workflow_dispatch", path: ".github/workflows/release-stable.yml", run_attempt: 1, status: "completed" }, |
| 8 | ["darwin-arm64", "darwin-amd64", "darwin-universal", "windows-amd64", "windows-arm64", "linux-amd64"].map(platform => ({ name: `verify stable SignPath control plane / build (${platform}, preflight)`, conclusion: "success" }))]; |
| 9 | } |
| 10 | test("accepts only the protected producer with a complete successful matrix", () => { |
| 11 | verifyProducer(...fixture()); |
| 12 | for (const field of ["head_sha", "head_branch", "event", "path", "run_attempt", "status"]) { |
| 13 | const [run, jobs] = fixture(); run[field] = "different"; |
| 14 | assert.throws(() => verifyProducer(run, jobs)); |
| 15 | } |
| 16 | const [run, jobs] = fixture(); |
| 17 | assert.throws(() => verifyProducer(run, jobs.slice(1))); |
| 18 | assert.throws(() => verifyProducer(run, [...jobs, jobs[0]])); |
| 19 | jobs[0].conclusion = "failure"; |
| 20 | assert.throws(() => verifyProducer(run, jobs)); |
| 21 | }); |
| 22 | test("artifact recovery installs smoke dependencies and retains collection identity checks", () => { |
| 23 | const workflow = readFileSync(new URL("../.github/workflows/release-desktop.yml", import.meta.url), "utf8"); |
| 24 | const intel = workflow.split(" mac-universal-intel:")[1].split(" publish:")[0]; |
| 25 | assert.ok(intel.indexOf("pnpm --dir desktop install --frozen-lockfile") < intel.indexOf("node desktop/packaging/smoke.mjs")); |
| 26 | assert.ok(intel.includes("needs.signing-contract.result == 'success'")); |
| 27 | assert.ok(workflow.includes("GITHUB_RUN_ID=34816299501 GITHUB_RUN_ATTEMPT=1 node release-control/scripts/desktop-release-artifacts.mjs collect")); |
| 28 | assert.ok(workflow.includes("inputs.reuse_manual_artifacts && '09cdab3866d77c6ff0d007ee61b6aca3128ebe54' || inputs.candidate_control_sha || github.workflow_sha")); |
| 29 | }); |
| 30 |