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

Automate a review finding as a lint or test: README.md is capped and is not where a feature's how-to goes; remove the added s #12487

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`bun scripts/gate.ts` now refuses a pull that adds a section to `README.md` or makes it longer. The gate and `tsc` are clean and the four new tests pass. I did not run the wider test files around `gate.ts`. `scripts/fast.ts` said the diff is too broad to name them, and the forge runs the full check on push.

shipped production is serving it deploy d003798

opened this

bun scripts/gate.ts now refuses a pull that adds a section to README.md or makes it longer. The gate and tsc are clean and the four new tests pass. I did not run the wider test files around gate.ts. scripts/fast.ts said the diff is too broad to name them, and the forge runs the full check on push.

  • The rule: src/kernel/readme_cap.ts compares README.md with the pull's base. The ## Dependencies section is left out of that comparison, so a new package's line still goes there.
  • Heading failure: a new heading fails with "README.md is capped and is not where a feature's how-to goes: this pull adds the section "## X" to README.md; move it to docs/features/<name>.md and link it from docs/README.md".
  • Growth failure: growth outside Dependencies fails with the same rule name and the number of lines added.
  • Where it runs: readmeCapRefusal in scripts/gate.ts is added to the gate's refusal list. It passes when no base resolves, as the other pull checks do.
  • Tests: test/gate-readme-cap.test.ts covers an added section, plain growth, the passes (a new Dependencies bullet, an edit in place, a shrink), and a real-repository run against FORGE_CHECK_BASE.

I chose a "no growth" rule because README.md has no numeric cap to test against. It is strict: adding a link to the "Learn more" list also fails. I did not add a numeric cap, change the MCP tools, or touch AGENTS.md.

Closes #12392

commented

bun scripts/gate.ts now refuses a pull that adds a section to README.md or makes it longer. The gate and tsc are clean and the four new tests pass. I did not run the wider test files around gate.ts. scripts/fast.ts said the diff is too broad to name them, and the forge runs the full check on push.

  • The rule: src/kernel/readme_cap.ts compares README.md with the pull's base. The ## Dependencies section is left out of that comparison, so a new package's line still goes there.
  • Heading failure: a new heading fails with "README.md is capped and is not where a feature's how-to goes: this pull adds the section "## X" to README.md; move it to docs/features/<name>.md and link it from docs/README.md".
  • Growth failure: growth outside Dependencies fails with the same rule name and the number of lines added.
  • Where it runs: readmeCapRefusal in scripts/gate.ts is added to the gate's refusal list. It passes when no base resolves, as the other pull checks do.
  • Tests: test/gate-readme-cap.test.ts covers an added section, plain growth, the passes (a new Dependencies bullet, an edit in place, a shrink), and a real-repository run against FORGE_CHECK_BASE.

I chose a "no growth" rule because README.md has no numeric cap to test against. It is strict: adding a link to the "Learn more" list also fails. I did not add a numeric cap, change the MCP tools, or touch AGENTS.md.

Approved

The gate now fails a pull that adds a heading to README.md or grows it outside ## Dependencies, and the message names the rule and points to docs/features/<name>.md. The module is small, has no new dependency, and the tests include a real-git-repo run. This is a lint, so it adds no page, tool or screen and the both-doors rule does not apply. Two things I would do next: (1) skip fenced code blocks in withoutDependencies, because a # comment line in a bash block that replaces another line is read as a new section, and add a test for it; (2) put the cap rule in AGENTS.md or docs so the failing message links to a place that explains the no-growth choice, including that a Learn-more link now fails.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs