Public: anyone can read this; the crew can change it.

A test file that reads a ratchet list names the one line to edit when it fails #17538

opened this

Merged 12h 58m ago, live in production

Every ratchet failure now ends with a Fix: sentence that names the table to use or the list line to change, and says when lowering the count is the right move. Every assertion still passes and fails exactly as before; only the messages changed.

Notes

opened this

Every ratchet failure now ends with a Fix: sentence that names the table to use or the list line to change, and says when lowering the count is the right move. Every assertion still passes and fails exactly as before; only the messages changed.

  • Where the sentences live: RATCHET_FIX in src/design/ratchets.ts holds one sentence per case:
    • OWN_WORDS over its count, and moved to the table.
    • WIDTH_READS over its count.
    • OWN_SCRIPT with a new page, and with a page gone from it.
    • The empty-states ALLOWED list with the wrong number of links, and with a page that has a link now.
  • Which messages use them: ownWordsOff and widthReadsOver end their messages with these sentences, so bun scripts/design-lint.ts prints the same fix before a push. The failure lines in test/behaviors-rule.test.ts and test/empty-states.test.ts are now built by small named helpers that do the same. The width message also shows the allowed count (n > allowed).
  • Tests: each of the three files has a new test that builds a real failing input and asserts its message ends with its fix sentence. The OWN_WORDS one also checks the "moved to the table" wording.
  • Docs: docs/design/areas/ratchets.md has one line per ratchet (OWN_WORDS, WIDTH_READS, OWN_SCRIPT, ALLOWED): what it holds, the fix, and when its line gets lowered or deleted.

Not done: WIDTH_READS still only fails when a file goes over its count. A file that drops below it passes as it did before, because making that fail would change pass/fail behaviour.

No new function duplicates an existing one; the messages are built from the existing ownWordsOff/widthReadsOver.

Checked: bun x tsc --noEmit and bun scripts/gate.ts --explain (32 of 32 rules met) pass, and bun scripts/design-lint.ts reports nothing added outside the system. bun scripts/fast.ts named 148 test files, over its 5-minute budget, so I ran a hand-picked set instead and all 118 tests pass: the three ratchet tests, unused-exports, design-lint, cold-read and check-script-readers. The forge's full check runs the rest.

To try it: add <p class="muted">No rows</p> to any page under src/web/pages/ and run bun test test/empty-words-all.test.ts. The failure ends with "Fix: add the words to the EMPTY_WORDS table …".

🤖 Generated with Claude Code

Closes #17523

commented

Every ratchet failure now ends with a Fix: sentence that names the table to use or the list line to change, and says when lowering the count is the right move. Every assertion still passes and fails exactly as before; only the messages changed.

  • Where the sentences live: RATCHET_FIX in src/design/ratchets.ts holds one sentence per case:
    • OWN_WORDS over its count, and moved to the table.
    • WIDTH_READS over its count.
    • OWN_SCRIPT with a new page, and with a page gone from it.
    • The empty-states ALLOWED list with the wrong number of links, and with a page that has a link now.
  • Which messages use them: ownWordsOff and widthReadsOver end their messages with these sentences, so bun scripts/design-lint.ts prints the same fix before a push. The failure lines in test/behaviors-rule.test.ts and test/empty-states.test.ts are now built by small named helpers that do the same. The width message also shows the allowed count (n > allowed).
  • Tests: each of the three files has a new test that builds a real failing input and asserts its message ends with its fix sentence. The OWN_WORDS one also checks the "moved to the table" wording.
  • Docs: docs/design/areas/ratchets.md has one line per ratchet (OWN_WORDS, WIDTH_READS, OWN_SCRIPT, ALLOWED): what it holds, the fix, and when its line gets lowered or deleted.

Not done: WIDTH_READS still only fails when a file goes over its count. A file that drops below it passes as it did before, because making that fail would change pass/fail behaviour.

No new function duplicates an existing one; the messages are built from the existing ownWordsOff/widthReadsOver.

Checked: bun x tsc --noEmit and bun scripts/gate.ts --explain (32 of 32 rules met) pass, and bun scripts/design-lint.ts reports nothing added outside the system. bun scripts/fast.ts named 148 test files, over its 5-minute budget, so I ran a hand-picked set instead and all 118 tests pass: the three ratchet tests, unused-exports, design-lint, cold-read and check-script-readers. The forge's full check runs the rest.

To try it: add <p class="muted">No rows</p> to any page under src/web/pages/ and run bun test test/empty-words-all.test.ts. The failure ends with "Fix: add the words to the EMPTY_WORDS table …".

🤖 Generated with Claude Code

commented

Every ratchet failure now ends with a Fix: sentence that names the table to use or the list line to change, and says when lowering the count is the right move. Every assertion still passes and fails exactly as before; only the messages changed.

  • Where the sentences live: RATCHET_FIX in src/design/ratchets.ts holds one sentence per case:
    • OWN_WORDS over its count, and moved to the table.
    • WIDTH_READS over its count.
    • OWN_SCRIPT with a new page, and with a page gone from it.
    • The empty-states ALLOWED list with the wrong number of links, and with a page that has a link now.
  • Which messages use them: ownWordsOff and widthReadsOver end their messages with these sentences, so bun scripts/design-lint.ts prints the same fix before a push. The failure lines in test/behaviors-rule.test.ts and test/empty-states.test.ts are now built by small named helpers that do the same. The width message also shows the allowed count (n > allowed).
  • Tests: each of the three files has a new test that builds a real failing input and asserts its message ends with its fix sentence. The OWN_WORDS one also checks the "moved to the table" wording.
  • Changed test: test/design-lint-ratchets.test.ts checked the old message text word for word, so its two tests failed once the wording changed. That test was out of date rather than catching a bug, so it now expects the RATCHET_FIX sentences.
  • Docs: docs/design/areas/ratchets.md has one line per ratchet (OWN_WORDS, WIDTH_READS, OWN_SCRIPT, ALLOWED): what it holds, the fix, and when its line gets lowered or deleted.

Not done: WIDTH_READS still only fails when a file goes over its count. A file that drops below it passes as it did before, because making that fail would change pass/fail behaviour.

No new function duplicates an existing one; the messages are built from the existing ownWordsOff/widthReadsOver.

Checked: bun x tsc --noEmit passes. test/design-lint-ratchets.test.ts, test/design-lint.test.ts, test/empty-words-all.test.ts and test/behaviors-rule.test.ts pass together (68 tests). test/empty-states.test.ts, unused-exports, cold-read and check-script-readers passed on the first commit and were not re-run after the fix, which only touched the design-lint-ratchets test. The forge's full check runs the rest.

To try it: add <p class="muted">No rows</p> to any page under src/web/pages/ and run bun test test/empty-words-all.test.ts. The failure ends with "Fix: add the words to the EMPTY_WORDS table …".

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs