test: pin test files over 1,000 lines at their exact length so they can only shrink - #1843
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
|
P1 gate-honesty blocker: the check compares measured lengths only against the pin map in the same checkout, so the two prohibited changes remain green if the map changes too—grow a pinned file and raise its pin, or add a new >1,000-line file and add a pin. Current planted tests hold pins fixed and miss both bypasses. Add a base/history-backed monotonicity rule: existing pins may decrease/disappear but never increase, and new pins may not appear; plant both pin-edit cases red. Inventory and ordinary append/delete evidence are otherwise correct, and CI is green. |
2239213 to
df0493a
Compare
|
Addressed in df0493a (rebased onto current main). The map is no longer the authority — git is. Two history rules now run beside the equality pin, over every file that is over the tripwire now plus every pinned file: (1) a test file over the tripwire may be no longer than it was at Planted red against real git, map edited to match in both cases: append a line to 🤖 Addressed by Claude Code |
|
P1 gate-honesty gap remains at exact |
…an only shrink AGENTS.md has said for a while that past 1,000 lines is architecture debt and tests are not exempt; nothing enforced it, and the second-largest test file gained 55 lines in the PR before this one. This is the slow-test ratchet's shape for a reader's context instead of wall clock: the 26 test files over the tripwire are pinned at their exact length (R9-style equality pin, #1781 A6); growth fails, shrink fails until the pin is lowered in the same PR, a file that drops under the line leaves the list, and a new file may not cross it. One directory walk per unit run, ~250ms; the pin list emptying deletes it.
…n edits cannot admit growth Review (P1): the equality pin compared measured lengths only against the pin map in the same checkout, so growing a file and raising its pin, or adding a new >1,000-line file with a pin, stayed green. The gate is now history-backed: every test file over the tripwire may be no longer than at the merge-base with origin/main (renames followed; new files may not cross the line), and no pin may exceed its file's base length — one git cat-file --batch spawn, parsed by bytes because the sizes are bytes. Both bypasses planted red against real git on a pinned file and on a fresh 1,001-line file with a pin added.
…inding Review: a new pin for an unchanged sub-tripwire file (900 pinned at 900) passed equality and history and grew the map. Pins now exist only for files over the tripwire — any other pin is red with 'remove it' — which also subsumes the old shrink-under-the-line message. Planted red in-file and against real git (a 186-line test pinned at 186). The android snapshot test pin bootstraps 1636→1660: main grew that file in #1846 before this gate exists, and history agrees (1660 at the merge-base).
df0493a to
e5cfd7f
Compare
|
Addressed in e5cfd7f (rebased onto current main). Pins now exist only for files over the tripwire: a pin whose file is at or under the line is a finding on its own — One bootstrap note visible in the diff: 🤖 Addressed by Claude Code |
|
Re-reviewed exact |
|
#1847 grew the file 2652→2654 and merged minutes before #1843 pinned it at 2652 (measured against the merge-base #1843 had at the time). Both PRs were green alone and main is red together — the cross-PR growth the equality pin exists to catch, landing as a catch-up rather than a raise: the history rule agrees (2654 at the merge-base).
Summary
Retro follow-up, item 6.
AGENTS.mdalready says past 1,000 lines is architecture debt and tests are not exempt; nothing enforced it, andsnapshot-handler.test.ts(2,652 lines) gained 55 lines in #1779 under that rule. This is the slow-test ratchet's shape applied to the other resource a giant test file consumes — a reader's context:src/__tests__/test-file-size-ratchet.test.ts(unit-core) walkssrc,packages,test,scriptsfor*.test.{ts,tsx,mjs}and pins the 26 files over the 1,000-line tripwire at their exact length, R9-style (Prune the test lanes that don't pay for themselves, and add the checks we're missing #1781 A6 equality pin): growth fails ("extract instead of adding"), shrink fails until the pin is lowered in the same PR (so the ratchet keeps the gain), a file that drops under the line leaves the list, a new file may not cross it, a stale pin is reported.docs/agents/testing.md; the AGENTS.md tripwire line now points at the gate.Validation
src/__tests__/cli-network.test.ts→grew to 1093 lines (pinned 1092): extract instead of adding…; deleting one line →shrank to 1091 lines (pinned 1092): lower its pin in this PR…. Restored.remote-connection.test.ts, 2026-07 draft-era branch); anything else in flight that adds to one of the 26 will hit the message and the doc it points to — that is the gate working, not collateral.check:layeringR9/R10 red onorigin/mainitself.3 files touched (1 test, 2 docs).