Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Screenshots: the pull has no before/after of the open prompt in light and dark ( #12364
Check · Review · Land · Live done — Landed and live in production.
The gate now refuses a pull that changes `src/web/` (`.ts` or `.css`) without saying which page's before/after pictures show the change. The new test passes, as does the existing both-doors gate test. `bun scripts/gate.ts` and `bun x tsc --noEmit` both came back clean.
shipped production is serving it deploy 97489a2
The gate now refuses a pull that changes src/web/ (.ts or .css) without saying which page's before/after pictures show the change. The new test passes, as does the existing both-doors gate test. bun scripts/gate.ts and bun x tsc --noEmit both came back clean.
What changed
- Rule: a commit message must carry
Looks: <path>, where the path is a page inapp.looksinforge.json. The forge already takes light and dark pictures of those pages on every pull's preview. The alternative isNo look: <why>, with a reason of 10+ characters. - Failure message: it names the rule,
rule "before/after looks", plus the changed files, and says to name anapp.lookspage or give aNo look:reason. ALooks:path that isn't inapp.looksgets its own message. - Code:
src/kernel/look_rule.tsholds the rule, wired intoscripts/gate.tsaslookRefusalnext to the both-doors and try-it rules.AGENTS.mdhas a one-line note.test/look-rule.test.tscovers refusal, a valid path, an unknown path, the waiver, short reasons,.css, and deletions, tests and other files being exempt.
What I left out
- The check can't read the pull description, so it cannot verify that screenshots are actually pasted there. It checks that the pull names a pictured page; the forge's own previews supply the pictures.
- It does not check that the named page really renders the changed component, or that light and dark are both taken.
How to try it
Change a file under src/web/, commit without a Looks: line, and run bun scripts/gate.ts. It exits 2 with the rule's message. Add Looks: /flow to a commit message and it passes.
I merged main into this branch and pushed it. The merge had one conflict, in scripts/gate.ts. The check list there now runs both lookRefusal (from this pull) and dependencyRefusal (from main).
- Gate fix: after the merge,
bun scripts/gate.tsflagged one line ofsrc/kernel/look_rule.tsas over 100 columns. I rewrapped that comment, and the gate now passes. - Tests:
bun x tsc --noEmitis clean. I ran the 13 test files covering the look rule, the review rules and the gate; all 72 tests pass. I did not run the full suite: the changed-file helper (scripts/fast.ts) reported the diff as too broad to name tests, so I picked the covering tests myself. The forge's check runs the full suite on this push.
Approved. The gate now refuses a src/web .ts/.css change that has no Looks: <path> naming a page of app.looks (I checked forge.json: it has the list) and no No look: <why> waiver. The failure message names the rule. The tests cover refusal, a valid path, an unknown path, short waivers, css, and deletions/tests being exempt. It is small, a single concept, with no new dependency. This pull touches no src/web, so the preview has nothing to show.
Two things I would do next:
- Accept
Looks:paths from looksAsOwner too, and have the message list a few valid app.looks pages, so a builder can fix it in one step. - Match the path ignoring a trailing slash or query order, and warn when the named page is unrelated to the changed file (for example by a page-to-file map), so
Looks: /is not a blanket pass.
The gate now refuses a pull that changes
src/web/(.tsor.css) without saying which page's before/after pictures show the change. The new test passes, as does the existing both-doors gate test.bun scripts/gate.tsandbun x tsc --noEmitboth came back clean.What changed
Looks: <path>, where the path is a page inapp.looksinforge.json. The forge already takes light and dark pictures of those pages on every pull's preview. The alternative isNo look: <why>, with a reason of 10+ characters.rule "before/after looks", plus the changed files, and says to name anapp.lookspage or give aNo look:reason. ALooks:path that isn't inapp.looksgets its own message.src/kernel/look_rule.tsholds the rule, wired intoscripts/gate.tsaslookRefusalnext to the both-doors and try-it rules.AGENTS.mdhas a one-line note.test/look-rule.test.tscovers refusal, a valid path, an unknown path, the waiver, short reasons,.css, and deletions, tests and other files being exempt.What I left out
How to try it Change a file under
src/web/, commit without aLooks:line, and runbun scripts/gate.ts. It exits 2 with the rule's message. AddLooks: /flowto a commit message and it passes.Closes #12362