Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
768ec33
WIP: anchor a mutant by what it sits inside — NOT GREEN, no tests yet
claude Aug 4, 2026
7e24f3a
Record equivalent mutants by what they sit inside, not by line and co…
claude Aug 4, 2026
ba9e5d3
Test the anchors, and update the registry's own instructions
claude Aug 4, 2026
36509a2
Fail on registry drift in precommit, on the branch that caused it
claude Aug 4, 2026
3397c3c
Give the last two Mutant fixtures their anchor
claude Aug 4, 2026
91492fa
Read a registry file one way, not two
claude Aug 4, 2026
2b01588
Cover naming a member written as a string
claude Aug 4, 2026
0b4616c
WIP: merge main — 13 pre-existing stale entries left, NOT GREEN
claude Aug 4, 2026
754f365
Repoint the entries main had already let go stale
claude Aug 4, 2026
583ed06
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
37f70db
Fingerprint the expression, so resolving an anchor verifies it
claude Aug 4, 2026
7bbd57f
Keep the checker's rules apart from its command line
claude Aug 4, 2026
a2ac3fd
Cover a mutant that spans its whole file
claude Aug 4, 2026
f132c51
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
ba55141
Anchor a removed statement on itself, and name the property it sits u…
claude Aug 4, 2026
74f7940
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
a82c6a1
End the upload's client requests when the test server goes away
claude Aug 4, 2026
368b203
Make a registry line hold anything a source file can
claude Aug 4, 2026
cb189da
Keep the body-stream watch up instead of timing it to the upload
claude Aug 4, 2026
17c85b5
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
478e085
Name what carries a name, and let a path hold a comment mark
claude Aug 4, 2026
1d6ac5c
Keep a listener on the request, so a second error is never thrown at …
claude Aug 4, 2026
57a0b86
Take a registry entry's fields off the front by their shape
claude Aug 4, 2026
3b6977a
Tell a comment from a path that starts the same way
claude Aug 4, 2026
c6276ce
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
a1d33ae
Merge remote-tracking branch 'origin/main' into claude/convert-tests-…
claude Aug 4, 2026
b4b0b63
An empty name is still a name, and a reason should be true
claude Aug 4, 2026
9184de7
Name a switch case, and write a path that starts with a comment mark
claude Aug 5, 2026
9ea6e2a
Say which side of a class a static member sits on
claude Aug 5, 2026
c37fae9
Name a case label written as an expression, and scope by the whole path
claude Aug 5, 2026
50ab94b
Carry each entry's path instead of working it back out of the key
claude Aug 5, 2026
de83423
Keep a private member's mark, and name a key written as an expression
claude Aug 5, 2026
28749a4
Tell a getter from its setter, name a default, and let a reason say a…
claude Aug 5, 2026
c0d11af
Take the parser's capture groups without erasing their type
claude Aug 5, 2026
227c086
Name the target a callback is handed to, and the prop it is passed as
claude Aug 5, 2026
233d93d
Hand the node's kind down rather than reading it again
claude Aug 5, 2026
a9f9fbd
Write down a second CI failure that nobody can yet explain
claude Aug 5, 2026
f1182e6
Say where the list of naming kinds stops, and why
claude Aug 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 127 additions & 32 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1933,35 +1933,130 @@ catalog entries beside `payment.error.refunded` in

Not done in that PR only because it was at its agreed `src/` line budget; there
is nothing hard about it.
## Record equivalent mutants by something that survives an edit

*Origin: two breakages on PR #2025, both caught by review rather than by any
check the branch ran.*

`scripts/mutation/equivalent-mutants/*.txt` records each known-equivalent
mutant as `path:line:column`, and `resolveEntries` in
`scripts/mutation/equivalent-audit.ts` matches all three exactly. So any edit
*above* a recorded expression silently invalidates its entry — the mutant stops
being suppressed and `deno task mutation:audit-equivalents` fails.

It happened twice on one branch. Splitting `test-browser.ts` into `parsing.ts`
and `forms.ts` moved six entries; then adding a single doc comment above
`attrValue` moved three of those same entries five lines further down. Neither
was a change to the recorded expressions themselves.

What makes it bite: `mutation:audit-equivalents` is not part of `deno task
precommit`, so a fully green precommit says nothing about whether the registry
still resolves. Both breakages were found by PR reviewers.

Two directions, either of which would help:

- **Key on something stable.** Record the expression text plus its enclosing
function name instead of a line and column, so an entry survives anything
that does not change the expression itself. This changes the file format and
`resolveEntries`, so existing entries need migrating.
- **Run the audit in `precommit`** (or in CI), so drift fails on the branch
that caused it rather than in review. It works in a copy of the checkout and
runs no tests, so it is not obviously too slow — worth timing before
assuming it is.

The first is the real fix; the second would catch the next one either way.

## Split the form-control rules into files about one thing each

*Origin: Codex review on PR #2025. Attempted on that branch and backed out —
see below.*

`test/specs/support/form-controls.ts` is 478 lines, over the ~400 the repo
asks for, and holds four separate jobs:

- reading a page's attributes (`attribute`, `hasFlag`, `usableInputsOfKind`)
- what a page offers (`chooserFor`, `boxFor`, `choicesOffered`, the checkbox
and question readers)
- why a value could not be sent (`whyValueCannotBeSent` and the rules under
it, plus the insisted-control machinery)
- the story-facing helpers (`fillInAndSend`, `takeDownFromActions`)

The first three are pure and the last does the sending, so the natural shape
is `form-controls/reading.ts`, `form-controls/rules.ts`, and a thin
`form-controls.ts` — the same split already done for `test-browser.ts`.

The churn is smaller than it looks: `fillInAndSend` has 15 importers and stays
put, and every reader that would move has between one and five
(`checkboxValueOffered` 5, `tickedCheckboxes` 4, `whyValueCannotBeSent` 3,
`requireCheckboxOffered` 2, `choicesOffered`/`optionsOffered` 1 each). So
about a dozen import lines change. Do not add a re-export layer in
`form-controls.ts` to avoid touching them — that is the alias-export smell the
repo rules out; point each caller at the file that owns what it uses.

**Why it was backed out:** attempted by slicing the file on line ranges, which
produced an unterminated comment, duplicated imports and several unresolved
symbols. Reverted rather than pushed half-done. Whoever picks this up should
move whole declarations (or use an editor that understands the syntax) rather
than cutting on line numbers, and lean on `deno task precommit` — the 214
specs and the coverage gate both exercise this module hard.

## A form found by its words alone can be sent with no button to press

*Origin: Codex review on PR #2025. Real, and deliberately left for its own
change — see the sweep below.*

`findFormByButton` picks a form when the button's words appear anywhere in its
body, then asks `buttonToPress` for the button. When no button matches but the
words do, `buttonToPress` returns `{}` — "no button with that text at all" —
and the form is submitted anyway, with no button data.

That is on purpose for forms found by their body text, and plenty are. But it
means a form whose button is *removed* still submits if the words survive
elsewhere in it. Site-page deletion is exactly that shape: the heading and the
button both say "Delete Page", so deleting the button leaves the heading, and
the story goes on deleting pages the owner has no control to delete.

The fix is not one line. Refusing every no-button case would break every story
that legitimately finds its form by body text, so the change is to tell those
two situations apart — probably by having the caller say which it expects, or
by only allowing the body-text match when the form has no buttons at all.
Either way it needs a sweep of all 215 scenarios to see which rely on which.

## An arrow is found across the whole page, not on its own row

*Origin: Codex review on PR #2025, raised twice. The second raise carried a
case the first did not, which is why it is here rather than declined.*

`canMove`/`move` in `test/specs/support/reordering.ts` look for a row's
`/id/move-up` address anywhere on the page. If that form is rendered against
the wrong row — present, but beside a different item — the story still submits
it and passes, while the organiser looking at the named row sees no arrow.

My first answer to this was that a positive scenario would catch an address
convention changing, which is true but only covers one defect. A form
*relocated* to another row keeps every address the template tests assert, so
nothing catches it.

Closing it means attributing controls to rows: parse the list into rows and ask
what each row offers, rather than searching the page. `openAtState` in
`statuses.ts` already holds the matched row, so the shape exists — the work is
giving the shared reordering helper the same scope, for every list that uses it
(states, site pages).

### The way *into* a row is found the same way

*Origin: a third Codex raise, on PR #2025, against `findsTheWayInFrom`.*

`findsTheWayInFrom` in `test/specs/support/browser.ts` searches
`row.browser.links` — every link on the page, not the matched row's. Its three
callers all match on something a sibling row could carry:

| Caller | What it matches | Its `openAt` gives |
| --- | --- | --- |
| `statuses.ts` | `href === /statuses/{id}` | the row's markup |
| `site-pages.ts` | `href` matching `/pages/{id}` | the row's markup |
| `api-keys.ts` | link text plus an address pattern | no row at all |

Same defect as the arrow above: a link rendered against the wrong row still
satisfies the search, so a deletion journey passes while the person looking at
that row has no way in.

Do it with the arrow, not before it. Two of the three callers already hold the
matched row, but `api-keys.ts` has no row concept yet, so a real fix has to give
every list the row-parsing shape — which is the same mechanism the arrow needs.
Fixing the two that are easy would leave a helper whose scoping depends on which
caller you came from, which is worse than the page-wide search it replaced.

### An equivalence proof rests on types the anchor cannot see

*Origin: Codex on PR #2037, against `descendTo` in `scripts/mutation/anchor.ts`.*

Nearly every reason in the equivalent-mutant registry is a claim about a type:
"`x` is `string | undefined`, so `??` and `||` agree". An anchor fingerprints
the *expression*, so widening `x` to `number | null` leaves the anchor
unchanged and the entry keeps suppressing a mutant whose proof is now false.
The entry only actually hides something when no test distinguishes the two —
ignored status is applied to survivors only, so a killable mutant still reports
as killed — but that is exactly the case the registry is supposed to guard.

Fingerprinting the enclosing function's head was tried and reverted. It costs
more than it buys: adding or renaming any parameter invalidates every entry in
that function's body, and it still misses the majority of proofs, whose types
come from a called function's return, an imported shape, or a database row
rather than the signature overhead. 166 of the 535 recorded reasons name a
call, a return, or a row. A noisy gate that people learn to re-record past
makes the registry less trustworthy, not more.

A real fix has to re-prove entries rather than re-locate them. The most
promising shape is to give `mutation:audit-equivalents` a way to attempt a
distinguishing input for each entry — or, failing that, an explicit re-audit
stamp so an entry has to be re-confirmed after the file it lives in changes
shape, instead of resting on a proof nobody has re-read since it was written.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"cli:api": "deno run --allow-env --allow-read --allow-run cli/api.ts",
"test:quality-audit": "deno run --allow-read scripts/test-quality-audit.ts",
"mutation": "deno run -A scripts/mutation.ts",
"check:equivalents": "deno run -A scripts/check-equivalent-mutants.ts",
"mutation:audit-equivalents": "deno run -A scripts/audit-equivalent-mutants.ts",
"pr-queue": "deno run --allow-run=gh scripts/pr-queue.ts",
"screenshot": "deno run -A scripts/screenshots.ts",
Expand Down
22 changes: 22 additions & 0 deletions scripts/check-equivalent-mutants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env -S deno run -A
/** Command line over `checkEquivalentMutants`, run by `deno task check:equivalents`. */

import { checkEquivalentMutants } from "#scripts/mutation/check-equivalents.ts";
import { EQUIVALENT_MUTANTS_DIR } from "#scripts/mutation/ignore.ts";
import { projectRoot } from "#scripts/project-root.ts";

const problems = await checkEquivalentMutants({
registryDir: EQUIVALENT_MUTANTS_DIR,
root: projectRoot,
});
if (problems.length === 0) {
console.log("Every equivalent-mutant entry still points at a real mutant.");
Deno.exit(0);
}
console.error(problems.join("\n"));
console.error(
`\n${problems.length} equivalent-mutant entries need attention. Each names the` +
"\nthing it sits inside; re-record it against where that code lives now, or" +
"\nremove it if the expression is gone.",
);
Deno.exit(1);
Loading