✅ test(work): every mutant in src/work.ts lines 1–738 dies
Slice: #629
Part of #580's one-time sweep. Part 1 of src/work.ts: every Survived and NoCoverage mutant in its lines now dies, and none times out. Part 2 (#630) is left alone.
Re-measured on main (ce8f6c9)
Since 0a9c8be, #662 changed src/work.ts and added 34 lines above the boundary. The slice's range, lines 1–671 then, was lines 1–705 on main. That range held 114 blocking mutants (85 Survived, 29 NoCoverage), up from 110, plus 9 Timeouts:
every's paging loop;- the open pull requests' loop;
- Dependabot's record-read loop.
The range now ends at line 738, not 705
The rewrites below add lines above the boundary. Part 2 (#630) starts at line 739, the first line of sessionToken's body (main's line 706).
How they die
- The very moment. These cases are tested exactly at the moment, not after it, and each is refused:
- an addition at approval;
- a decision, a request or a 👍 at the addition;
- a 👍 at the proposal's edit;
- a State dropped at approval.
- Openings. A
Decision:orProposal:preceded by spaces counts. One named in passing does not. - What counts.
- Only additions count: not another event on the slice's own timeline, and not
sub_issue_removed. - Only comments count: not a
reviewedevent that carries a body. - A proposal with no account is not one.
- The latest addition wins, whichever record names it first.
- Only additions count: not another event on the slice's own timeline, and not
- Unnamed additions. The tests assert which timelines a run reads. A sibling's is read only while an addition is left to put down. The slice's own is never read again, and no sibling is read for an addition at or before approval.
- Another repository's slice.
- A 401, and a 404 with no message.
- A failed read named
owner/name#12, with and without the "this token cannot read" hint. - A closed slice told to file its State in a clone there, as
owner/name#N. - Every request carries the token, here and there.
- Lists that fail. A comments list GitHub does not hold throws. So do open pull requests answered 500 or answered with no list.
- States. A
State:line naming an issue the slice does not hold, or a sub-issue of no type, is refused. So is a fix naming an open Task or an untyped sub-issue. A state of no type is ignored. A decision naming another issue does not settle a dropped state. One that names it is not followed by reading the state's comments or the Approvals issue. prWorkRules.- An unadopted repository, work-rules off, and a personal repository are each checked.
- Each Actions variable is needed on its own.
- The full refusal is compared, its last line included.
- An onboard branch whose repository is gone is covered.
- So are a removed onboard file beside the new cloud setup file, a copy of the cloud setup file under its old name, and a file listed as coming from itself.
- Dependabot. Exactly 250 commits, and a stray commit named by its short id.
- Small helpers.
- A slug with a dot in a request link.
pullUrlwith an address that is not https.deleteBranchCommandonfix-a+b.- Commit ids that start or end with zeros.
Source changes, for mutants no test can see or that hang
- No Timeout left.
every,openPullsand Dependabot's record read recurse rather than loop.- The record read now goes through identity's
recordedPushers, now exported (one word insrc/identity.ts). - The test model refuses any page past the one after the last, so a mutant that never stops paging fails at once.
- Only a full page (
=== 100) reads on. A mutant that skips the list check then returns the non-list, which fails, rather than paging forever. - Without that change, agnipariksha's retry of the
a || bTimeout at line 545 was REFUSED ("Stryker ignored the mutant it was retrying").
- Missing lists. A list that may be missing is read by
everyIfThere, which gives undefined when GitHub holds none. A deleted proposal is skipped, and a missing Approvals issue answers nothing. No empty-list fallback is left for a mutant to fill unseen. - Refusals.
readSlicereturns its problems alone, or the read (string[] | SliceRead), so noowed: []rides along unread.approvalsis always present.owedProblem'sattakes a number, never undefined. - Reactions. Reactions are read for each decision still owed, so
thumbsUpneeds no?? []for reactions never read. - Missing bodies. A missing body is read as
String(body). "null" names no slice or State, links nothing and has no section, and no?? ''literal is left to mutate unseen. - Redundant checks dropped.
parentOfdrops amessage &&that the regex already covers.- onboard's
kept()drops a status check: a removed file's own entry fails anyway. - The moved-file lookup leaves no undefined to test.
- The foreign hint cuts the tag at its last
#. rest's unused default goes.
- Fail-open read. Another repository's Approvals issue is read by
foreignApprovals, whose fail-open catch holds only its comment. - Behaviour. Unchanged, apart from what no client sees: the order of reads, and identity's read loop now used for Dependabot too.
No // Stryker disable, no new dependency, and no guard file changed.
Evidence
agnipariksha --lane src --files src/work.ts --no-reuse
src: 1628 killed of 1767 in 1 file(s) (28 NoCoverage, 1628 Killed, 111 Survived; 0 timeout(s) retried) - 139 blocking
agnipariksha total: 1628 killed of 1767 in 1 lane(s), 139 blocking, 0 refused - exit 1
agnipariksha 0.8.8's --files takes no line range, so the gate judges the whole file and exits 1 on part 2's mutants. The blocking mutants this run lists, by line:
| Lines | Blocking |
|---|---|
| 1–738 (#629) | 0 (849 mutants, all killed, in a direct Stryker run of src/work.ts:1-738) |
| 739–1382 (#630) | 139 (111 Survived, 28 NoCoverage) |
An earlier gate run, before the === 100 change, ended REFUSED. Its two reasons were the retry at line 545 and the 15-minute retry budget, the second on a busy machine. Its 136 blocking mutants were in lines 739 and later too.
pnpm checkexits 0 locally:pnpm test2715 of 2715 andpnpm test:scripts138 of 138. Typecheck, lint, pins, pariksha, hooks, build and smoke pass too.- The pre-push hook passed on the push.
🤖 Generated with Claude Code
Summary by cubic
Kills every surviving and uncovered mutant in the first 738 lines of src/work.ts, part 1 of 2 in the #580 sweep. Part 2 (#630) now starts at line 739.
- Adds tests for work rules: additions and decisions at the moment of approval, proposals and 👍s around edits, unnamed additions, foreign slices, State lines, open pull request listing, onboard file checks, Dependabot commits, and checks skipped before any rule.
- Refactors source for mutants no test can see or that hang: paging recurses instead of loops, the test model refuses a page past the last, and only a full page reads on, so no mutant times out.
- Reads lists that may be missing through
everyIfThere, returns undefined when GitHub holds none, and letsreadSlicereturn problems or the read alone. - Reads reactions per decision still owed, missing bodies as
String(body), and exportsrecordedPushersfromsrc/identity.tsfor Dependabot's record read. - Removes redundant checks and unused defaults; behavior is unchanged except for read order and Dependabot's loop reuse.
- Adds no
// Stryker disablecomments, no new dependency, and changes no guard file.