✅ test(pr-autocreate): every mutant in src/pr-autocreate.ts lines 1–605 dies

Merged
AT
2d ago
+529-47

Slice: #624

Part of #580's one-time sweep. Part 1 of src/pr-autocreate.ts: every Survived and NoCoverage mutant in its lines now dies. Part 2 (#625) is left alone.

Re-measured on main

src/pr-autocreate.ts has not changed on main since 0a9c8be. The issue's range ends at line 587, if (refspecs.length === 0) return { dir, resolvable: true }; in pushTarget. The source changes below add lines above it, so that line is now 605. Part 1 is lines 1–605, and part 2 (#625) starts at line 606, if (refspecs.length > 1) ….

How they die

  • The real-git describes run last. They keep main's place in the file but are declared through describeLater and run from the file's end, so every in-process case runs first. Stryker's tap runner bails at the first failure, so a mutant an in-process case kills never waits on git: a hand-applied part-1 mutant fails the suite within 1.3 s. A first version moved the describes instead, which made a diff too large for GitHub to show, so Guard could not count the tests.
  • A new in-process section covers:
    • the settings, each wrong kind with its own message, the retired link and the opt-out lines;
    • the state and opt-out paths, eligible, optedOutNow, heldBy and ownSlices;
    • placeholder: 50 and 52 commits, the footer, a held draft;
    • the Pulls client's every answer: timeouts, body keys, read, listing, create and body;
    • ensurePr's branches, with the exact git and GitHub calls;
    • withLock at the stale edge (181 sleeps);
    • pushTarget's option and positional edges.
  • A clock in every FakeSys. Each FakeSys there has a clock its sleeps move on, so a lock a mutant leaves behind ends at withLock's deadline instead of holding the suite.
  • A turn after each real-git test. Each real-git describe yields a setTimeout turn after every test. On macOS, stdout to a pipe is async, so a failure reaches Stryker's tap runner before the next execFileSync blocks the event loop. Before this, a mutant's failure surfaced only at the end of the file, and the #624 baseline took 125 minutes with 359 Timeouts.

Source changes, for equivalent mutants and one seam:

  • autocreateSettings reads prAutocreate with ?., and statePath hashes the branch with update's default encoding. loadState reads ?? {}. saveState drops a mkdir that withLock already made.
  • withLock waits by recursion, so a mutant cannot spin it forever.
  • ownSlices, Pulls.read, create and body drop fallbacks that a later check made invisible.
  • pushTarget takes its shell parser as a parameter (the seam), and its option and positional loops are bounded by the words.

No // Stryker disable, no new dependency, and no guard file changed.

Evidence

agnipariksha 0.8.8's --files takes no line range, so the gate judges the whole file. Two runs, both on the first commit, 9905cf0. It has the same source and the same test cases as the head, with the describes in the moved order:

agnipariksha --lane src --files src/pr-autocreate.ts --no-reuse
run 1: src: 1474 killed of 1548 in 1 file(s) (10 NoCoverage, 1472 Killed, 2 Timeout, 64 Survived; 8 timeout(s) retried) - REFUSED
run 2: src: 1379 killed of 1450 in 1 file(s) (10 NoCoverage, 1377 Killed, 2 Timeout, 61 Survived; 7 timeout(s) retried) - REFUSED
  REFUSED src: the timeout retry pass outgrew its 15-minute budget; the machine is busy, push again when it is quieter
agnipariksha total: … 1 refused - exit 1

Both runs exit 1: the lane is REFUSED, and agnipariksha's total still exits 1 rather than 2, on part 2's blocking mutants.
By line, from the blocking lists of both runs:

LinesBlocking, run 1Blocking, run 2
1–605 (#624)00
606–1177 (#625)74 (64 Survived, 10 NoCoverage)71 (61 Survived, 10 NoCoverage)

The refusal is part 2's Timeouts. Their mutants die only in the real-git describes, which run past the timeout limit (1.5 × dry run + 90 s) when other sessions load the machine. A direct Stryker run on the whole file at load ~80 gave these counts:

  • part 1: 790 Killed and 6 Timeouts. 4 of the 6 were Stryker's hit limit, which agnipariksha retries and counts as killed; the other 2 were killed in other runs.
  • part 2: 269 Timeouts.

Part 2's Timeouts go to #625. Its issue lists settling pr-autocreate.ts's timeout retries as its own deliverable. The parent session accepted this split under the rule #668 set for split files. Its condition is that lines 1–605 hold no unsettled Timeout either. A direct run on lines 1–605 will show that once the shared agnipariksha lock comes back to this session; until then auto-merge stays off.

  • pnpm check exits 0 on the rebased branch: pnpm test 2963 of 2963 and pnpm test:scripts 138 of 138. Typecheck, lint, pins and pariksha pass too.
  • The pre-push hook passed on the push.

🤖 Generated with Claude Code