✅ test(onboard): every mutant in src/onboard.ts lines 1–695 dies

Merged
AT
5d ago
+180-28

Slice: #620

Part of #580's one-time sweep. Part 1 of src/onboard.ts: every Survived and NoCoverage mutant in its lines now dies. Parts 2 (#621) and 3 (#622) are left alone.

Re-measured on main (ce8f6c9)

Main still holds the slice's 161 blocking mutants in lines 1–691: 158 Survived and 3 NoCoverage. The whole file has 3,175 mutants. 4 of them time out, all in later parts (lines 1032, 1364, 1377 and 2131 on main).

The range now ends at line 695, not 691

The rewrites below move code above the boundary, so part 1 now ends at line 695. Part 2 (#621) starts at line 696, const OLDER_SECRETS, and ends at 1221. Part 3 (#622) starts at line 1222, main's line 1220.

How they die

  • Older hooks as their releases wrote them. src/older-texts.test.ts gains the pre-push, SessionStart and PreToolUse hooks that process-rules wrote. Each one was produced by evaluating PRE_PUSH_HOOK, HOOK_COMMAND and GUARD_COMMAND from src/onboard.ts at every tag from v0.1.0 to v0.6.7, not by the code that reads them. Each is named after the last release that wrote it. OLDER_PRE_PUSH_HOOKS, OLDER_HOOK_COMMANDS and OLDER_GUARD_COMMANDS must equal those lists exactly. This release's pre-push hook is checked line by line.
  • The workflow as 0.6.8 wrote it. workflow('main', '0.6.8', false), with the ids P-56 renamed put back, must equal WORKFLOW_068_NIYAM as copied from GitHub. That pins the header, the job names, the split comment and the needs-owner comments.
  • prePushHook is called directly:
    • the git calls it makes, with their cwd;
    • a worktree hook, in git's folder but outside the root;
    • a .husky/pre-push hook, inside the root but outside git's folder;
    • hand-offs with odd spacing, a variable of any name, an indented or trailing-space assignment, and an indented comment that looks like a second hand-off;
    • blocks closed by elif, on one line with and without a space after ;, by echo done, and by an expansion holding a brace.
  • Looser matches the hook must not accept, each with the body planted where the looser match would read it: x'…', '…'x, x$B, $B/, export B=, C=B=x, a glob, a hand-off after &&, and a hand-off followed by || exit 1.
  • autoFixRuleNeeds gets:
    • null settings, no permissions, and lists that are not arrays or hold non-text;
    • a glob for another server whose prefix has the same length;
    • a literal dot in a glob;
    • a partial glob, with deniedBy and leftOutBy compared in full;
    • the whole server allowed beside a deny.
  • Literals: OLDER_REVIEW_THREAD_RULE and SETUP_FIRST, inside the pull request body that carries it.

Source changes, for mutants no test can see

  • blockDepths writes depth = depth + …. With +=, the -= mutant only flips the sign of a depth that is only compared with 0. It now strips ${…} with split(…).join() instead of replace(…, ''), whose replacement text no brace count could see.
  • handedOffBody looks for the variable's settings only in lines before the hand-off. No line can match both the hand-off and an assignment, so < and <= were the same.
    • Behaviour change: a variable set again after the hand-off no longer makes the hook the client's own. That line cannot change the file the hand-off ran.
  • handedOffBody reads the path lexically, checks that it is inside the root, and then reads it in one try with an empty catch. A missing file, a folder and an unreadable file now take the same path, so sys.exists and the catch's return are gone.
  • deniesTool drops by === tool and !by.includes('*'). A tool's own name is a glob with no *, which matches only that name.
  • ruleNeeds lists [value].filter(Array.isArray).flat(). A value that is not an array lists nothing, with no [] fallback, which a mutant could replace unseen.
  • workflowHead drops the types and asks parameters. Its one caller always passed their defaults (the 3 NoCoverage mutants).

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

Evidence

agnipariksha --lane src --files src/onboard.ts --no-reuse
src: 2838 killed of 3156 in 1 file(s) (28 NoCoverage, 2834 Killed, 290 Survived, 4 Timeout; 4 timeout(s) retried) - 318 blocking
agnipariksha total: 2838 killed of 3156 in 1 lane(s), 318 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 the later parts' mutants. The blocking mutants this run lists, by line:

LinesBlocking
1–695 (#620)0 (590 mutants, all killed, in a direct Stryker run of src/onboard.ts:1-695)
696–1221 (#621)159 (149 Survived, 10 NoCoverage)
1222–2220 (#622)159 (141 Survived, 18 NoCoverage)

The 4 Timeouts, all in parts 2 and 3, were retried and counted as killed.

  • pnpm check exits 0 locally: pnpm test 2561 of 2561 and pnpm test:scripts 138 of 138. Typecheck, lint, pins, pariksha, hooks, build and smoke pass too.
  • The pre-push hook passed on the push.

🤖 Generated with Claude Code