Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Noise: the comment rewraps in route_marks.ts and forge-looks.test.ts are unrelat #13914
Check · Review · Land · Live done — Landed and live in production.
The gate now refuses a diff hunk that only moves a comment's words onto other lines, and --fix no longer rewraps comments the pull didn't write. The new tests (test/gate-rewrap-noise.test.ts) and the existing comment-wrap and nightly-rewrap tests pass. bun x tsc --noEmit is clean and bun scripts/gate.ts exits 0.
shipped production is serving it deploy 4adf612
The gate now refuses a diff hunk that only moves a comment's words onto other lines, and --fix no longer rewraps comments the pull didn't write. The new tests (test/gate-rewrap-noise.test.ts) and the existing comment-wrap and nightly-rewrap tests pass. bun x tsc --noEmit is clean and bun scripts/gate.ts exits 0. I did not run the whole suite; the forge runs it on the push.
What changed
- Cause:
bun scripts/gate.ts --fixrewrapped every over-long comment in any file the pull touched. That is where the unrelated rewraps in the four reviews came from. - The rule: it is called
rule "the diff is the change"and is insrc/kernel/rewrap_noise.ts. It is wired intogateVerdictinscripts/gate.tsasrewrapNoiseRefusal. It only looks at.tsfiles undersrc/,test/andscripts/(notvendor/). A refusal reads likerule "the diff is the change": src/a.ts:1 only rewraps a comment this pull did not write; restore the lines…. - The fixer: in
wrapFix, a rewrap is kept only where it touches a line the pull added. New untracked files are still rewrapped whole, and--fix --allis unchanged. - Tests: a pure rewrap is refused with the rule named. An edited comment or line of code is not.
--fixfolds the new comment and leaves an old one alone.
What I chose not to do
- The rule is not turned off for the nightly rewrap of
main, which is not a pull, so it never reaches the check. - A hunk that rewraps a comment and also changes a word is not flagged. The rule only catches pure rewraps.
- A comment the pull edited is still rewrapped as a whole when the edit touches it, since that is the pull's line.
To try it: rewrap a comment you didn't write in a branch and run bun scripts/gate.ts. It exits 2 and names the rule. After bun scripts/gate.ts --fix, only your own comments change.
Approved. The gate now refuses a hunk that only rewraps a comment, naming rule "the diff is the change" and the file:line. --fix rewraps only comments the pull wrote. This is a gate change with no served page, so the experience checks do not apply; the pull stays small and serves the pipeline direction by cutting reviewer round-trips.
Two things I would do next:
- The header comment of src/kernel/rewrap_noise.ts cites
pullRanges, which does not exist. Delete the reference. - Add tests for the untracked-new-file path in
wrapFix, which is rewrapped whole, and for a rewrap under vendor/, which must not be refused. Both are claimed in the description and neither is covered. The base-resolution lines are also now repeated in three places in scripts/gate.ts and could share one helper.
The gate now refuses a diff hunk that only moves a comment's words onto other lines, and
--fixno longer rewraps comments the pull didn't write. The new tests (test/gate-rewrap-noise.test.ts) and the existingcomment-wrapandnightly-rewraptests pass.bun x tsc --noEmitis clean andbun scripts/gate.tsexits 0. I did not run the whole suite; the forge runs it on the push.What changed
bun scripts/gate.ts --fixrewrapped every over-long comment in any file the pull touched. That is where the unrelated rewraps in the four reviews came from.rule "the diff is the change"and is insrc/kernel/rewrap_noise.ts. It is wired intogateVerdictinscripts/gate.tsasrewrapNoiseRefusal. It only looks at.tsfiles undersrc/,test/andscripts/(notvendor/). A refusal reads likerule "the diff is the change": src/a.ts:1 only rewraps a comment this pull did not write; restore the lines….wrapFix, a rewrap is kept only where it touches a line the pull added. New untracked files are still rewrapped whole, and--fix --allis unchanged.--fixfolds the new comment and leaves an old one alone.What I chose not to do
main, which is not a pull, so it never reaches the check.To try it: rewrap a comment you didn't write in a branch and run
bun scripts/gate.ts. It exits 2 and names the rule. Afterbun scripts/gate.ts --fix, only your own comments change.Closes #13913