Skip to content

Commit 115b580

Browse files
committed
fix(release): preserve waiver context when reusing validation
1 parent e585660 commit 115b580

2 files changed

Lines changed: 57 additions & 12 deletions

File tree

‎scripts/full-release-validation-state.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,10 @@ async function collectMode(mode) {
859859
evidenceRootRunId: executionPlan.evidenceReuse.rootRunId,
860860
evidenceRunUrl: executionPlan.evidenceReuse.runUrl,
861861
evidenceSha: executionPlan.evidenceReuse.evidenceSha,
862+
releaseProfile: executionPlan.releaseProfile,
863+
rerunGroup: executionPlan.rerunGroup,
864+
targetVersion: executionPlan.targetVersion,
865+
telegramWaiver: executionPlan.telegramWaiver,
862866
trustedWorkflow: executionPlan.trustedWorkflow,
863867
workflowSha: executionPlan.workflowSha,
864868
},

‎test/scripts/full-release-validation-state.test.ts‎

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,15 +2458,54 @@ console.log(JSON.stringify({
24582458
expect(JSON.parse(readFileSync(validatorArgs, "utf8"))).toContain("--expected-selected-run-id");
24592459
});
24602460

2461-
it("blocks Decision when canonical evidence manifest changes after planning", () => {
2462-
const root = mkdtempSync(join(tmpdir(), "frv-reuse-manifest-mismatch-"));
2461+
it.each([
2462+
{ name: "unchanged evidence", waived: false, mutation: "none", blocker: "" },
2463+
{ name: "owner-waived evidence", waived: true, mutation: "none", blocker: "" },
2464+
{
2465+
name: "changed source manifest",
2466+
waived: false,
2467+
mutation: "sha",
2468+
blocker: "provenance_mismatch",
2469+
},
2470+
{
2471+
name: "missing source waiver",
2472+
waived: true,
2473+
mutation: "waiver",
2474+
blocker: "reused_evidence_invalid",
2475+
},
2476+
{
2477+
name: "wrong source version",
2478+
waived: true,
2479+
mutation: "version",
2480+
blocker: "reused_evidence_invalid",
2481+
},
2482+
])("revalidates $name at the Decision boundary", ({ waived, mutation, blocker }) => {
2483+
const root = tempDirs.make("frv-reuse-decision-");
24632484
const output = join(root, "decision.json");
24642485
const executionPlanPath = join(root, "plan.json");
24652486
const gh = join(root, "gh");
24662487
const validator = join(root, "validator.mjs");
2488+
const waiver = waived
2489+
? { telegramWaiver: "2026.8.1-owner-approved", targetVersion: "2026.8.1" }
2490+
: {};
2491+
const sourceManifest = { ...evidenceManifest(), validationInputs: waiver };
2492+
const revalidatedManifest = structuredClone(sourceManifest);
2493+
if (mutation === "sha") {
2494+
revalidatedManifest.targetSha = "c".repeat(40);
2495+
} else if (mutation === "waiver") {
2496+
revalidatedManifest.validationInputs = {};
2497+
} else if (mutation === "version") {
2498+
revalidatedManifest.validationInputs.targetVersion = "2026.8.2";
2499+
}
24672500
const sealedPlan = executionPlan(
2468-
{ rerunGroup: "ci" },
24692501
{
2502+
rerunGroup: "ci",
2503+
releaseProfile: "stable",
2504+
children: { normalCi: { result: "success", runAttempt: 1, runId: "101" } },
2505+
...waiver,
2506+
},
2507+
{
2508+
...waiver,
24702509
evidenceReuse: {
24712510
changedPaths: [],
24722511
evidenceSha: TARGET_SHA,
@@ -2475,7 +2514,7 @@ console.log(JSON.stringify({
24752514
rootRunId: "99",
24762515
runUrl: "https://example.invalid/runs/99",
24772516
selectedRunId: "99",
2478-
sourceManifest: evidenceManifest(),
2517+
sourceManifest,
24792518
},
24802519
},
24812520
);
@@ -2497,7 +2536,7 @@ printf '%s\\n' '{"id":101,"event":"workflow_dispatch","path":".github/workflows/
24972536
validator,
24982537
`console.log(JSON.stringify({
24992538
children: ${JSON.stringify(reusedEvidenceChildren())},
2500-
manifest: {runAttempt: 1, runId: "99", targetSha: "${"c".repeat(40)}"},
2539+
manifest: ${JSON.stringify(revalidatedManifest)},
25012540
releaseProfile: "stable",
25022541
rerunGroup: "ci"
25032542
}));\n`,
@@ -2522,13 +2561,15 @@ printf '%s\\n' '{"id":101,"event":"workflow_dispatch","path":".github/workflows/
25222561
},
25232562
timeout: 10_000,
25242563
});
2525-
expect(result.status, result.stderr).toBe(1);
2526-
expect(JSON.parse(readFileSync(output, "utf8")).blockers).toContainEqual(
2527-
expect.objectContaining({
2528-
kind: "provenance_mismatch",
2529-
message: "revalidated evidence source manifest differs from the immutable plan",
2530-
}),
2531-
);
2564+
expect(result.status, result.stderr).not.toBe(2);
2565+
const decision = JSON.parse(readFileSync(output, "utf8"));
2566+
expect(result.status, JSON.stringify(decision.blockers)).toBe(blocker ? 1 : 0);
2567+
expect(decision.state).toBe(blocker ? "blocked_complete" : "passed");
2568+
if (blocker) {
2569+
expect(decision.blockers).toContainEqual(expect.objectContaining({ kind: blocker }));
2570+
} else {
2571+
expect(decision.blockers).toEqual([]);
2572+
}
25322573
});
25332574

25342575
it("validates a generated manifest against its immutable execution plan", () => {

0 commit comments

Comments
 (0)