Skip to content

Let agents show a UI change as an annotated before and after image - #346

Merged
quanvu309 merged 1 commit into
mainfrom
before-after
Nov 12, 2026
Merged

quanvu309 merged 1 commit into
mainfrom
before-after

Conversation

@quanvu309

@quanvu309 quanvu309 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The owner's goal is to finish AirDesign as a product real people can use end to end: make a slide deck from an idea or a PowerPoint, edit it together with AI agents, and export to PowerPoint with no loss. A person judging a UI change should see what changed, and where, without reading code or opening a file on someone's machine.

The owner's words: "I think you also add some annotation skills for the verify design. and when you do a PR related to design the UI, you add before and after screenshot. please learn from this PR, skip the council stuff on this PR, learn how they have table and annotation on screenshot: pingdotgg/t3code#24776".

Today a UI PR here lists paths such as /home/.../01-empty.png in its body. Nobody reading the PR on GitHub can see them.

What I took from the reference PR

  • The body opens with the problem in plain words, then short themed lists of what changed, each line concrete ("the base radius goes from 10px to 8px").
  • One annotated image. Each screen area gets a titled block with BEFORE (main) and AFTER (this PR) at the same crop and scale. Numbered circles with arrows point at the same spots in both crops. Under each pair is a two-column numbered legend with one short, concrete sentence per number ("Card corners 22px to 16px").
  • Then a | main | this PR | table of full, unannotated screenshots, one row per state.
  • Every image is a link GitHub can show.

What changed

verify-airdesign before-after <callouts.json> (bin/proof.mjs, look/before-after.mjs, look/annotate.mjs)

  • The input is a callouts file the agent writes: [{ "state", "title", "crop", "click"?, "callouts": [{ "at", "note" }] }]. state names an entry in PR 341's state registry. crop and at are selectors or a box in CSS px. An empty note, an unknown key or a bad box is refused, with the block and callout it means. A note over 90 characters warns.
  • BEFORE is the merge base with origin/main (or --base), checked out in a scratch git worktree under ~/tmp/verify-airdesign-scratch/, installed, built, and launched with the existing launch (VERIFY_AIRDESIGN_REPO points it at that tree). AFTER is this checkout (or --head). That makes two private stacks, each on its own Postgres.
  • Each side reaches the state with its own driver. It uses its own look/states.mjs when it has the state, and otherwise this registry walking that side's own journey files. A base journey that expects airdesign_edit_deck still passes on the base. Each run also loads its own catalog routes, and one Node resolve hook shares a single Playwright between the trees.
  • A state the base cannot reach shows AFTER only, with a "New in this PR" badge. A callout whose selector is missing on one side keeps its number at the same spot, drawn grey with no arrow, and the legend says "(not in main)".
  • The image is an HTML page with the packages/theme tokens and Geist, screenshotted at 850 CSS px and scale 2, so it is 1700 px wide. Text is real text. A new image starts every 6000 px. Narrow crops sit side by side; wide ones stack BEFORE over AFTER. The same run renders byte for byte the same image.
  • The placement rule (look/placement.mjs) puts each circle on the side of its target with the most free room. It stays off every target and every other circle, uses the frame's 30 px margin when the crop has no room, and sits at the same spot on both sides. The arrow stops 3 px outside its target.
  • The output is one JSON line, annotated-N.png, each full screenshot unannotated, before-after.json, and before-after.md with the ## Before / after heading, the image, and the | main | this PR | table.
  • --keep keeps both stacks and the worktrees, so the next try passes --before-run and --after-run and takes about 8 s. Without it, the stacks stop and the worktree is removed.

verify-airdesign annotate <run> <callouts.json> draws the same callouts on one run's states, for comments and look.

verify-airdesign publish <dir> --pr <n> (bin/publish.mjs)

  • Commits the folder's PNGs to the long-lived orphan branch archive/proof, under pr-<n>/<dir>/. It uses a temporary index (read-tree of the remote tip, hash-object, update-index, write-tree, commit-tree) and git push origin <sha>:refs/heads/archive/proof, so it never touches the working tree, the index or the current branch. A non-fast-forward rejection rebuilds on the new tip and pushes again, up to 5 times.
  • Prints links pinned to the commit, https://github.com/<repo>/blob/<sha>/<path>?raw=true, so a later publish never changes an old PR's pictures. Writes before-after.published.md, ready to paste.
  • Why this is safe for a private repo: the files live in the repo. GitHub renders these links as plain github.com image URLs, not proxied, and checked here in the API's body_html. So a signed-in reader with repo access loads them, and anyone else gets a 404 (checked anonymously). Nothing lands in main.
  • The branch runs nothing. ci runs on pull requests, the merge queue and pushes to main. journeys runs on main only, and bar and closed-branch run on PR events. After the first publish, gh api .../actions/runs lists 0 runs for archive/proof. closed-branch skips archive/ branches. scripts/worktrees.mjs deletes only local branches, and publish makes none.
  • The pre-push hook refused the proof commit, since no pnpm check saw its tree. scripts/checked.mjs now lets a push through only when it goes to refs/heads/archive/proof and every file in the commit is a .png. The same commit pushed anywhere else, or a commit with code pushed to the proof branch, is still refused (scripts/checked.test.mjs).

Agents use it

  • SKILL.md has a short section, "Before / after in the PR": write the callouts with a good and a bad note, run before-after, open every image and check each arrow and note, publish, and paste the fragment.
  • AGENTS.md gets one line under "How agents work here" and one row in "What enforces each rule".
  • The bar workflow (scripts/bar.mjs, with the rule in scripts/before-after.mjs) labels a PR needs-before-after when it changes what a person sees and its body has no Before / after section with a pinned pr-/branch- PNG from this repo. It removes the label once the section is there; bar already reruns on edited. It warns and blocks nothing. Locally, pnpm check's bar step prints the same line.
    • Seen paths: .tsx and .css under apps/web/src, everything under apps/web/src/copy/, .tsx, .astro, .css, .html and .md(x) under apps/site/src, and packages/render/src and packages/theme/src. Tests are skipped.
    • What it misses: a plain .ts file in apps/web/src outside copy/ that changes what is drawn, apps/web/public assets, and words the server sends a person. It checks that the image is pinned and in this repo, not that it is current.

This PR changes what ci checks (scripts/, AGENTS.md), so it will carry changes-ci. It lowers no metric.

What I ran

  • pnpm check: all steps pass on the rebased branch. Unit tests for the placement rule, the callouts reader (12 refusals with their messages, plus the long-note warning), the fragment, publish against a bare remote (a second publisher keeps the first's files, and the checkout's HEAD, status and branches are unchanged), the seen-paths and body rule, and the proof-push exemption.
  • pnpm exec playwright test tests/browser/before-after.spec.ts: on a fixture page, every arrow tip ends 1 to 5 px outside its target, and no circle sits on any target.
  • The default flow, before-after with no flags: it built and launched the merge base and this checkout, drove agent-empty on both, and wrote the image in 42 s. Then it stopped both stacks and removed its worktree.
  • The PR 339 example below: before-after pr339.json --base d044245~1 --head d044245, opened and fixed twice. The editor crop cut the text box, and arrow 3 crossed the Aira mark. Then publish --pr 339, one push. The same section is posted on Give the Agent panel a designed empty state, composer and steps #339.

Before / after

Annotated before and after: Agent panel, empty; Agent panel, run done; Editor, text box selected while offline

d044245~1 d044245
d044245~1: Agent panel, empty d044245: Agent panel, empty
d044245~1: Agent panel, run done d044245: Agent panel, run done
d044245~1: Editor, text box selected while offline d044245: Editor, text box selected while offline

Made with Claude Opus 5.5 in Claude Code, running in T3 Code.

…th a main and this PR table, publish the images to the archive/proof branch, and label a PR that changes what a person sees without one.
@quanvu309
quanvu309 enabled auto-merge November 12, 2026 09:11
@quanvu309
quanvu309 added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit aa886bc Nov 12, 2026
11 of 13 checks passed
@quanvu309
quanvu309 deleted the before-after branch November 12, 2026 09:32
@quanvu309 quanvu309 changed the title Let agents show a UI change as an annotated before and after image, published to archive/proof Let agents show a UI change as an annotated before and after image Nov 13, 2026
@github-actions github-actions Bot added editor Touches the editor: canvas, slides, export and their screens verify Touches the verify-airdesign skills or journeys tooling Touches scripts, rules, workflows or repo config labels Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-ci editor Touches the editor: canvas, slides, export and their screens tooling Touches scripts, rules, workflows or repo config verify Touches the verify-airdesign skills or journeys

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant