Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: First fix: item 1 (make the record reachable). #11851
Check · Review · Land · Live done — Landed and live in production.
A new test now fails when a migration creates a table that no `src/` code reads, and its failure message says: `rule "make the record reachable": no src/ code reads table X (no FROM/JOIN); show it on a page, a /system line or an MCP tool, or it is not done (docs/VISION.md)`. That is my reading of the four "First fix: item 1" reviews (#9975, #10663, #10664, #11735). I could only see the first line…
shipped production is serving it deploy b4c82c4
A new test now fails when a migration creates a table that no src/ code reads, and its failure message says: rule "make the record reachable": no src/ code reads table X (no FROM/JOIN); show it on a page, a /system line or an MCP tool, or it is not done (docs/VISION.md). That is my reading of the four "First fix: item 1" reviews (#9975, #10663, #10664, #11735). I could only see the first line of two of those comments, so it is an inference. #9975's own "Left out" note says nothing shows the new last-fire record, which fits. test/unread-tables.test.ts passes, and bun x tsc --noEmit and bun scripts/gate.ts are clean. I did not run any other test file.
What changed
scripts/unread-tables.ts: it collects every table the migrations create. It followsDROP TABLEandALTER … RENAME TO, so the temporary tables from table rebuilds don't count. "Read" means the name followsFROMorJOINin asrc/file that is neither a migration nor a test.test/unread-tables.test.ts: it holds the rule and the shrink check. A fixture test covers FROM/JOIN, write-only tables, drops, renames, and migrations and tests not counting. The gate picks it up on its own, soscripts/gate.tsis unchanged.scripts/unread-tables-allow.json: three tables are allowed today:keeper_beat(kept on purpose for the release still running),proof_runandsentinel_kept. If an allowed table later becomes read, the test fails until it is removed from the list, so the list only shrinks.
Left out
- Weak reader check: a reader that nothing calls still counts as a reader. For example,
lastFiresforfeature_firereads it, but no page or tool callslastFires. Catching that needs a call graph. The existingunreachedcheck covers whole modules but not single functions. - Other reachability: only tables are checked, not new settings or event kinds.
- Review comments: I did not read the reviews in full, so any other ask in them ("then the screenshots") is not covered.
To try it, run bun test test/unread-tables.test.ts. To see it fail, add a CREATE TABLE migration that nothing reads.
Approved. A small, dependency-free lint with a fixture test, an allow-list that can only shrink, and a failure message that names the rule. No page, terminal or README surface is touched, so the both-doors and README checks do not apply. I read the diff and did not run the tests myself. Next, two things: (1) DELETE FROM t and a FROM inside a comment or string count as reads, so a table that is only pruned or only mentioned passes; match SELECT ... FROM/JOIN only, and add a fixture for DELETE FROM. (2) Move the check into scripts/gate.ts or a CI step with the same message, so it fails before the test run and names the rule in the gate log.
A new test now fails when a migration creates a table that no
src/code reads, and its failure message says:rule "make the record reachable": no src/ code reads table X (no FROM/JOIN); show it on a page, a /system line or an MCP tool, or it is not done (docs/VISION.md). That is my reading of the four "First fix: item 1" reviews (#9975, #10663, #10664, #11735). I could only see the first line of two of those comments, so it is an inference. #9975's own "Left out" note says nothing shows the new last-fire record, which fits.test/unread-tables.test.tspasses, andbun x tsc --noEmitandbun scripts/gate.tsare clean. I did not run any other test file.What changed
scripts/unread-tables.ts: it collects every table the migrations create. It followsDROP TABLEandALTER … RENAME TO, so the temporary tables from table rebuilds don't count. "Read" means the name followsFROMorJOINin asrc/file that is neither a migration nor a test.test/unread-tables.test.ts: it holds the rule and the shrink check. A fixture test covers FROM/JOIN, write-only tables, drops, renames, and migrations and tests not counting. The gate picks it up on its own, soscripts/gate.tsis unchanged.scripts/unread-tables-allow.json: three tables are allowed today:keeper_beat(kept on purpose for the release still running),proof_runandsentinel_kept. If an allowed table later becomes read, the test fails until it is removed from the list, so the list only shrinks.Left out
lastFiresforfeature_firereads it, but no page or tool callslastFires. Catching that needs a call graph. The existingunreachedcheck covers whole modules but not single functions.To try it, run
bun test test/unread-tables.test.ts. To see it fail, add aCREATE TABLEmigration that nothing reads.Closes #11843