You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ci): scope the shard-attestation verdict to the current run attempt (#12066)
Artifacts live on the RUN, not the attempt, so every attempt after the first
downloads whatever the earlier ones published. `judge()` compared only the run
id -- one level coarser than the artifact namespace it judges -- so after a
pre-judgement `filter` death (fail-open per THE FILTER CONTRACT #4928, which is
untouched here) `rerun_failed_jobs` could never converge: the legs correctly
stayed skipped on attempt 2, the roster adjusted to expected-0, and attempt 1's
own credentials were then refused one by one as "unexpected attestation ... that
no declared leg accounts for". Measured on run 32806633489.
The credential already carried `run_attempt` and the verdict already PRINTED it
-- it just never COMPARED it. So this is a verdict change only: no payload
change, and nothing in ci.yml moves.
The rule is "latest per shard WITHIN ONE RUN", not "only this attempt's":
- a credential from an earlier attempt of this run that no declared leg
accounts for is discarded with a log line, granting no pass (the green comes
from #4928's expected-0, which it never enters);
- a credential from an earlier attempt that a declared leg DOES account for
still counts. `overwrite: true` on every upload means a re-running leg
replaces its own artifact, so what survives is the credential of a leg that
did NOT re-run -- and that leg keeps its earlier conclusion in
`needs.<job>.result`. Refusing it would turn the ordinary rerun_failed_jobs
case (one flaky shard) permanently red: the same defect, one button over;
- everything else keeps its old verdict. The tolerance demands a positive "this
run, an earlier attempt": a foreign credential from the CURRENT attempt is
still refused in the same words, so is one from another run, and an absent or
unreadable attempt buys no exemption.
--self-test grows the measured sequence (both gates), the current-attempt
counter-limb, the partial-re-run pin that blocks the "current attempt only"
mis-fix, and the fail-closed cases on both sides of the comparison.
Claude-Session: https://claude.ai/code/session_01UjM2ia8Av1v5NqfqQEQmC6
Co-authored-by: Claude <noreply@anthropic.com>
assert(!sameAttemptForeign.ok,'#11998: a credential from the CURRENT attempt that no declared leg accounts for is still refused — the tolerance is attempt-scoped, not blanket');
1051
+
assert(
1052
+
sameAttemptForeign.errors.some((e)=>e==="Test Core: unexpected attestation 'test-1-of-6' that no declared leg accounts for."),
1053
+
'#11998: …and it is refused in the exact words run 32806633489 printed, so the fail-closed limb is unchanged',
1054
+
);
1055
+
// Nor may the exemption launder another RUN's credential just because it
1056
+
// claims an earlier attempt: both halves of `carriedOver` are required.
assert(!foreignRunEarlierAttempt.ok,'#11998: an earlier-attempt credential from ANOTHER run is still refused — the run_id half of the test is load-bearing');
foreignRunInRoster.errors.some((e)=>e.includes('belongs to run 1234')),
1062
+
'#11998: …and one that IS on the roster still trips the run_id veto (#6082), attempt notwithstanding',
1063
+
);
1064
+
// The tolerance must not fire on attempt 1, where there is no earlier attempt
1065
+
// for a credential to have come from: the #4928 contradiction pin stands.
1066
+
assert(!rerun(testLeg('skipped'),attempt1Roster(),'1').ok,'#11998: on attempt 1 a credential from a leg reported skipped is still a contradiction ⇒ red');
1067
+
1068
+
// ⭐ THE MIS-FIX THIS PIN EXISTS TO BLOCK: "accept only the CURRENT attempt's"
1069
+
// — whether spelled as an attempt-namespaced artifact or as a verify-side
1070
+
// filter — reads the ordinary `rerun_failed_jobs` case as five missing
1071
+
// credentials. `overwrite: true` on every upload means a re-running leg
1072
+
// REPLACES its own artifact, so what persists is exactly the credential of a
1073
+
// leg that did NOT re-run, and that leg keeps its earlier conclusion in
1074
+
// `needs.test.result`. Refusing it moves this same never-converges defect
'#11998 fail-closed: a credential with no run_attempt field at all gets no exemption',
1102
+
);
1103
+
for(constbadof[null,'','two']){
1104
+
assert(!rerun(testLeg('skipped'),attempt1Roster(),bad).ok,`#11998 fail-closed: an unreadable GITHUB_RUN_ATTEMPT (${JSON.stringify(bad)}) restores the strict verdict rather than disabling the gate`);
1105
+
}
1106
+
// …and a caller that passes no `runAttempt` at all — every pre-#11998 call
1107
+
// site, this file's own fixtures above included — keeps the old verdict.
0 commit comments