✅ test(issue-types): every mutant in src/issue-types.ts lines 1–442 dies

Merged
AT
3d ago
+337-24

Slice: #614

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

Re-measured on main (b97fe6c)

Since 0a9c8be, only #642 changed src/issue-types.ts. It added one import, shifting the lines down by one, and moved instant into src/instant.ts. That code sat below this slice's range. Main still holds the slice's 115 blocking mutants in old lines 1–447 (now 1–448): 98 Survived and 17 NoCoverage, plus one Timeout (the pages loop with its body emptied).

The range now ends at line 442, not 447

The rewrites below take lines out above the boundary. Part 1 still ends where it did, at const extra = … in typesDrift, which is now line 442. Part 2 (#615) starts at line 443, const here: string[] = [];. A hand-over note in the sweep's shared notes says so for #615.

How they die

  • Literal expectations. The work model's five types are asserted as the POST bodies GitHub receives, with literal names, colours and descriptions. The question, the drift finding and its fix are compared in full.
  • Hand-built plans. withinApproved, typesChange, typesLines and typesQuestion are pure, so they get plans built by hand (planOf, retyped, orgType). These include issues that differ from the approved plan in repository alone or in number alone. The plans also cover runs that break on each field, unsorted retypes, exactly ten named issues, and two kept types with two archived repositories.
  • Edge rows. The fixtures add a null row, a row with no number, and a parent link that is not text. They also add a parent GitHub answers with no body or a non-text type, and a repository entry with no name.
  • 422s that are not the type filter. A disabled type's 422 counts as the type filter only when every error names type. The tests try a null body, an empty error list, a null error and a mixed list. They also try a non-422 status carrying the type-filter body, and a non-GitHub failure carrying a 422.
  • approvalsOf and pages directly. Whole numbers above 0 count, and 0, negatives, fractions, text, null settings and unparsable settings do not. pages is checked on its 410 handling, its token, and its refusals.
  • typesDrift had no coverage in this suite. It now has a pass case and a case that names all four kinds of drift.
  • An hourly row whose updated_at is not text is read as no time.

Source changes, for mutants no test can see:

  • pages recurses instead of looping, so a mutant that empties its body dies at once on Stryker's hit limit instead of timing out. It takes page as a fifth parameter, which defaults to 1.
  • typesPlan's decide keeps no memo. Deciding an issue again asks GitHub nothing new (parents read from GitHub are still cached in asked) and gives the same answer, so if (known) and decided.set had equivalent mutants.
  • where() cuts the repository name with slice/indexOf. On an owner/name slug, .at(-1) and .at(1) give the same part.
  • approvalsOf parses into a variable and leaves its catch empty. It also drops a typeof approvals === 'number' check, since Number.isInteger is false for anything but a number. That removes the old catch's equivalent return undefined and ?..
  • Behaviour change: asHolder now skips a null row (issue?.…). Before, a null row in GitHub's type=none list threw a TypeError. Now it is passed over, as a row with no number already was.

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

Evidence

agnipariksha --lane src --files src/issue-types.ts --no-reuse
src: 949 killed of 1000 in 1 file(s) (7 NoCoverage, 949 Killed, 44 Survived; 0 timeout(s) retried) - 51 blocking
agnipariksha total: 949 killed of 1000 in 1 lane(s), 51 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. Per line, from the same run's report:

LinesMutantsKilledBlocking
1–442 (#614)7207200
443–623 (#615)28022951 (44 Survived, 7 NoCoverage)

None timed out. The parent session agreed this meets #614's own "done when" for a split file. CI's Mutation lane reports exit 1 as a warning.

  • pnpm check exits 0 locally: pnpm test 2497 of 2497 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


Summary by cubic

Adds tests that kill every blocking mutant in src/issue-types.ts lines 1–442, completing this slice of the mutation sweep.

  • Covers pagination, issue type planning and application, approvals settings, drift reporting, and edge cases in GitHub responses.
  • pages now fetches subsequent pages recursively, and null issue rows are skipped instead of throwing.
  • The full-file mutation run’s remaining blockers are in lines 443 onward, handled by #615.