test: the real waitValidate is exercised against a cancelled dispatch

Code review r2 (M1): the cancelled-run filter in merge-candidate's
waitValidate had no test or mutant — every test replaced ops.waitValidate
with a fake. realOps now takes an injectable `exec` (default: the same
spawnSync wrapper) so the real implementation runs against scripted
`gh run list` answers: a cancelled dispatch is skipped and its
replacement followed; a lone cancelled run ends in `missing`, never red.

Mutant: merge-trusts-cancelled-dispatch.

Issue: #510
User-Visible: no
This commit is contained in:
Codex
2026-09-09 18:45:44 +03:00
parent 8acbd333d8
commit 615181050b
3 changed files with 54 additions and 4 deletions
+11
View File
@@ -8158,6 +8158,17 @@ const MUTANT_DEFINITIONS = [
replace: " if (false) { // mutant: cancelled counts as red",
}],
},
{
id: 'merge-trusts-cancelled-dispatch',
guard: 'node --test test/merge-candidate.test.mjs',
because: 'the real waitValidate must skip a dispatch cancelled by its replacement; reading it as red '
+ 'fails the merge candidate for nothing (#510 review r2 M1, #511)',
patches: [{
file: 'scripts/merge-candidate.mjs',
find: " const runs = all.filter((x) => (!event || x.event === event) && x.conclusion !== 'cancelled');",
replace: " const runs = all.filter((x) => (!event || x.event === event)); // mutant: cancelled is red",
}],
},
{
id: 'review-trusts-push-run-without-mutants',
guard: 'node --test test/validate-gate.test.mjs',