āœ… test(work): every mutant in src/work.ts dies

Merged
AT
6d ago
+387-21

Slice: #630

Part of #580's one-time sweep. This is part 2 of 2 of src/work.ts, lines 740 to the end: every Survived and NoCoverage mutant in it now dies, and none times out. Since this is the file's last part, the gate on the whole file exits 0.

Re-measured on main

src/work.ts was last changed on main in 590386f (#683), and is the same on 859a7e9, this branch's base. A direct Stryker run of src/work.ts:740-1409 there gave 946 mutants: 806 Killed and 140 blocking (112 Survived, 28 NoCoverage), with 0 Timeouts. Part 1 (#629, merged as #680) covered lines 1–738.

How they die

The tests cover:

  • sessionToken, read both in and out of a Claude cloud session.

  • prePush:

    • its git log calls;
    • a log of blank lines;
    • a ref line with no remote ref;
    • a ref outside refs/heads/;
    • the work rules off;
    • a personal repository.
  • Where the clone finds the default branch:

    • GitHub's tip, SHA-256 included;
    • origin's ref;
    • answers that give no commit id, a GitHub sha of [TIP] among them;
    • a name with a slash;
    • one that is not text.

    They also cover what a merge brought from the default branch, as GitHub compares it.

  • prMerged and prStarted: every missing Actions variable, an event with no repository, and issues with no type.

  • section(), to the letter.

  • propose:

    • its refusals;
    • a personal repository;
    • the batch answer past numbers it cannot propose;
    • decisions with no proposal.
  • fileState: its answers from GitHub.

Source rewrites, each for a mutant no test can see

  • inCloud() names a Claude cloud session in one place, for sessionToken and for the Pulls that refuse-retired lists with. Their cloud flag changes nothing in a list.
  • refuse-retired's output keeps io's own err, which it never writes.
  • The default branch is read without an optional chain, because isPersonal has already read the same answer and found an owner in it.
  • Merge parents and ref lines are read without dropping blank lines, since a blank line names nothing.
  • A comment or pull request with no body is read as String(body), which names nothing. It replaces a fallback that a mutant could fill without any test seeing it.
  • prMerged finds a State's slice among the slices it built, not in a second list of their numbers.
  • propose builds a proposal's body only where a page is given, which the refusal before it ensures.
  • Behaviour is unchanged.

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

Evidence

agnipariksha --lane src --files src/work.ts --no-reuse
src: 1779 killed of 1779 in 1 file(s) (1779 Killed; 0 timeout(s) retried) - pass
agnipariksha total: 1779 killed of 1779 in 1 lane(s), 0 blocking, 0 refused - exit 0
(exit 0 after 1423 s, on this branch rebased onto 859a7e9)

The gate before the last test was added killed 1778 of 1779. Its one survivor was the ConditionalExpression at src/work.ts:788, which 'reads no tip from an answer that gives no commit id' now kills with a GitHub sha of [TIP].

  • The pre-push hook passed on the push.

šŸ¤– Generated with Claude Code


Summary by cubic

Kills every remaining mutant in src/work.ts — part 2 of 2 of the #580 mutation sweep, covering lines 740 to the end. The gate on the whole file now exits 0.

  • Tests cover sessionToken, prePush (git log calls, blank lines, ref lines naming no remote ref, refs outside refs/heads/, work rules off, personal repos, how the clone finds and merges the default branch), every missing Actions variable in prMerged and prStarted, section(), propose's refusals, and fileState's GitHub answers.
  • Small behavior-preserving source rewrites kill the mutants no test can see: inCloud() names a Claude cloud session once, blank or missing bodies read as String(...), and prMerged and propose build from what they already have.