✅ test(board): every mutant in board.ts, review-thread.ts and approvals.ts dies

Merged
AT
8h ago
+611-54

Slice: #608

Every Survived and NoCoverage mutant in src/board.ts, src/review-thread.ts and src/approvals.ts now dies.

Re-measured on main: none of the three files, their suites or fake-board.test.ts changed since 0a9c8be. The count is the inventory's: 199 blocking, of which 180 Survived and 19 NoCoverage.

FileSurvivedNoCoverageNow
src/board.ts135111070 killed of 1070 (8 Timeout, retried)
src/review-thread.ts418637 killed of 637
src/approvals.ts4040 killed of 40

How they die

  • Constants written out in the test. The tests used to compare LABELS, VIEWS and viewsChecklist with themselves. They now assert the labels' colours and descriptions, the views' show and hide, and the checklist's lines as literals.

  • What each call sends. The tests now record the step each confirm names. They assert the questions' text, the label bodies, the retitle and items queries, the view query and the token on every request.

  • One condition at a time. Each a || b guard has a case where only one operand fails. This covers the repository read, GraphQL in both files, REST status bounds, the cloud comment read and the parent check.

  • Answers the fakes never give. The tests now feed:

    • a repository with no owner;
    • plain option names, and an option with no name;
    • an item hidden, with no fields or with no sub-issues;
    • a Project closed by state alone or by closed_at alone;
    • a Link header with no space;
    • a thread with no comments;
    • a reply with spaces around it;
    • a proxy thread list where the thread is not first.

    They come through RestBoard.refuse or by wrapping the /graphql route in the test. The shared fakes are unchanged.

  • A move GitHub refuses (board.ts's move catch, which was NoCoverage) is named while the other moves are still made.

  • Rewrites where a mutant was equivalent. None changes what a caller sees on a real answer:

    • approvals.ts: batchAnswers reads a body only when it is a string.
    • review-thread.ts:
      • threadArgs keeps its switches in a Set.
      • Both branches share one empty last page of comments.
      • A cloud comment's pull request URL, which must be a string, is matched once, so a URL that does not match is a comment that cannot be read. Before, it became a request to /repos//pulls/0.
      • A POST passes its body as it is.
      • Two guards drop checks that threadArgs already makes.
    • board.ts:
      • itemsOf reads each page's fields once, and casts the names and draft text that GitHub's schema never leaves out.
      • setUpViews no longer asks whether a view it just made is settled. A new view has no filter, so it never is.
      • visibleNames keeps a nameless field, which columns already maps to no id.
      • settled compares the filter as it is.
      • The Link header is read as text.
      • projectItems skips an item on its own content's number.
      • stepDue relies on rank(undefined) being -1.
      • A field gains options only when both it and the work model have them. A test now covers a Review date the owner gave options.

Evidence

pnpm exec agnipariksha --lane src --files src/board.ts,src/review-thread.ts,src/approvals.ts --no-reuse
src: 1747 killed of 1747 in 3 file(s) (1739 Killed, 8 Timeout; 8 timeout(s) retried) - pass
agnipariksha total: 1747 killed of 1747 in 1 lane(s), 0 blocking, 0 refused - exit 0
  • The 8 Timeouts are board.ts's existing loop-body mutants, the same 8 as on main, and their retry ends well inside agnipariksha's budget.
  • The total fell from 1794 mutants on main to 1747 because the rewrites removed the equivalent ones.
  • approvals.ts's new lone \r / U+2028 test pins existing behaviour: such a first line approves nothing. It was the only input that tells the $ in BATCH from no $.
  • pnpm check passes locally, and so does the pre-push.

🤖 Generated with Claude Code