Skip to content

Commit f6efe20

Browse files
committed
test(merge-queue-triage): pin a victim stacked through green groups as one hit
Scenario A18 re-scores the #26247 chain (victim <- green <- green <- victim). Red on the shipped script: it reports 2 independent hits. Claude-Session: https://claude.ai/code/session_01TB4mXrHF2oa5RXawpKD7Rj Co-authored-by: Claude <noreply@anthropic.com>
1 parent be531f6 commit f6efe20

1 file changed

Lines changed: 66 additions & 2 deletions

File tree

‎scripts/check-merge-queue-triage-outcome.mjs‎

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,10 @@ const sightingComment = (key, pr, runId) =>
570570
* test is `one victim's base === another victim's head`, so a fixture that let
571571
* these two default to the same shape could not tell the test from a tautology.
572572
*/
573-
const queueRun = (id, pr, base, head) => ({
573+
const queueRun = (id, pr, base, head, conclusion = 'failure') => ({
574574
id,
575575
workflow_id: WORKFLOW_ID,
576-
conclusion: 'failure',
576+
conclusion,
577577
head_branch: `gh-readonly-queue/main/pr-${pr}-${base}`,
578578
head_sha: head,
579579
});
@@ -596,6 +596,24 @@ const INCIDENT = {
596596
head12855: pad('1a24e9778'),
597597
};
598598

599+
/**
600+
* The #26247 anchor's chain, as the card that filed this work recorded it: one
601+
* deterministic break (#26064's queued commit) and a second victim (#26198)
602+
* stacked on it THROUGH two green, non-victim groups (#26158, #26210), whose
603+
* affected-only Test Core never selected the failing package.
604+
*
605+
* Same padding caveat as INCIDENT: the record abbreviates, so the four recorded
606+
* shas are right-padded, and the two the record does not carry (main before
607+
* the queue, #26198's own head) are declared synthetic.
608+
*/
609+
const CHAIN = {
610+
mainTip: pad('5c0ffee'), // synthetic: main before the queue
611+
head26064: pad('17f21e8d'), // #26064's victim head — and #26158's base
612+
head26158: pad('745c276b'), // #26158's GREEN group head — and #26210's base
613+
head26210: pad('7122b0db'), // #26210's GREEN group head — and #26198's base
614+
head26198: pad('d0d0cafe'), // synthetic: #26198's own queue head
615+
};
616+
599617
/**
600618
* The anchor issue an earlier pair already produced.
601619
*
@@ -1078,6 +1096,52 @@ function scenarios(root) {
10781096
];
10791097
},
10801098
},
1099+
{
1100+
id: 'A18',
1101+
name: 'TRANSITIVE STACK: a victim stacked on another THROUGH green, non-victim groups is ONE independent hit',
1102+
// The #26247 reading, re-scored. A ← B ← C ← D with only A and D red:
1103+
// D's base is C's head, C's base is B's head, B's base is A's head. B and
1104+
// C are not victims (their affected-only selection never ran the failing
1105+
// package), so a stack test that unions only through VICTIM runs never
1106+
// sees the chain and reports two independent hits for one break.
1107+
world: () => base({
1108+
runId: 37500000004,
1109+
prNumber: 26198,
1110+
headSha: CHAIN.head26198,
1111+
headBranch: `gh-readonly-queue/main/pr-26198-${CHAIN.head26210}`,
1112+
repoComments: [sightingComment(KEY_A, 26064, 37500000001)],
1113+
queueRuns: [
1114+
queueRun(37500000001, 26064, CHAIN.mainTip, CHAIN.head26064),
1115+
queueRun(37500000002, 26158, CHAIN.head26064, CHAIN.head26158, 'success'),
1116+
queueRun(37500000003, 26210, CHAIN.head26158, CHAIN.head26210, 'success'),
1117+
// The index is data, not git: a loop in it (here behind main's tip,
1118+
// where no victim lives) must END the walk, not hang the job, and
1119+
// must fuse nothing it reaches.
1120+
queueRun(37500000005, 26001, pad('c1c1e'), CHAIN.mainTip, 'success'),
1121+
queueRun(37500000006, 26002, CHAIN.mainTip, pad('c1c1e'), 'success'),
1122+
],
1123+
}),
1124+
check(r, t) {
1125+
const body = r.calls.issueCreate[0]?.body ?? '';
1126+
return [
1127+
t(r.calls.issueCreate.length === 1, `one anchor is filed, got ${r.calls.issueCreate.length}`),
1128+
t(/\*\*2 pull requests\*\*/.test(body),
1129+
`the raw victim count is 2 — the green groups are NOT victims and are not listed, got: ${JSON.stringify(body.slice(0, 240))}`),
1130+
t(/\*\*1 independent hit\*\*/.test(body),
1131+
`and the chain through the green groups scores ONE independent hit, got: ${JSON.stringify(body.slice(0, 240))}`),
1132+
t(/\|\s*#26064\s*\|\s*S1 · root\s*\|/.test(body),
1133+
`#26064 — the queued commit that broke — is the stack ROOT, got: ${JSON.stringify(body)}`),
1134+
t(/\|\s*#26198\s*\|\s*S1 · inherited\s*\|/.test(body),
1135+
'#26198 is marked INHERITED — it was built on #26064 two green groups later'),
1136+
t(!/#2615[8]|#2621[0]|#2600[12]/.test(body),
1137+
'no green group is promoted to a victim row'),
1138+
t(!/could not be placed in a stack/.test(body),
1139+
'both victims WERE placed, so the "unresolved" hedge does not appear'),
1140+
t(postedBody(r).includes('同属 **1 条投机栈**'),
1141+
"the victim's own triage comment carries the same reading as the anchor"),
1142+
];
1143+
},
1144+
},
10811145
{
10821146
id: 'A3',
10831147
name: 'NEGATIVE: two ejections with DIFFERENT keys produce no anchor at all',

0 commit comments

Comments
 (0)