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

Merged opened this

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

Merged

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

opened this

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 in app.looks in forge.json. The forge already takes light and dark pictures of those pages on every pull's preview. The alternative is No 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 an app.looks page or give a No look: reason. A Looks: path that isn't in app.looks gets its own message.
  • Code: src/kernel/look_rule.ts holds the rule, wired into scripts/gate.ts as lookRefusal next to the both-doors and try-it rules. AGENTS.md has a one-line note. test/look-rule.test.ts covers 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.

Closes #12362

commented

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 in app.looks in forge.json. The forge already takes light and dark pictures of those pages on every pull's preview. The alternative is No 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 an app.looks page or give a No look: reason. A Looks: path that isn't in app.looks gets its own message.
  • Code: src/kernel/look_rule.ts holds the rule, wired into scripts/gate.ts as lookRefusal next to the both-doors and try-it rules. AGENTS.md has a one-line note. test/look-rule.test.ts covers 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.

commented

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.ts flagged one line of src/kernel/look_rule.ts as over 100 columns. I rewrapped that comment, and the gate now passes.
  • Tests: bun x tsc --noEmit is 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

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:

  1. 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.
  2. 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.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs