Skip to content

prototype(dev): pnpm dev compare and film show a change before and after - #726

Closed
allisonmahmood wants to merge 3 commits into
mainfrom
prototype/pr-visuals
Closed

allisonmahmood wants to merge 3 commits into
mainfrom
prototype/pr-visuals

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Prototype, not for merge. Part of #725. It's up so the team can try the two commands and see what they produce on a real PR. What we learn goes on #725.

A UI or flow change is quick to review as code but slow to check by eye: today that means checking out the branch and running a dev server. This prototype gives agents two commands that put the evidence in the PR instead:

  • pnpm dev compare <person> <path>... shoots each page on the PR's base and on the working tree, at 1280 and 390px, and writes the Before/After section below.
  • pnpm dev film <person> <flow.ts> records a short Playwright flow on both sides, with a cursor, click rings and step captions, and joins the two takes side by side.

Both sides run the same scenario. The base is a shared clone of the repo beside the environment folder, running its own pnpm dev up, and stays up between runs. This worktree restarts first, so "after" is always the current code. pnpm dev down removes both.

What it produced

Everything below is the commands' own output, uploaded with gh pr edit --attach. The base is adb9aa1^, from before the card got tabs (#717) and before the Home polish in #718 to #721, so both comparisons show changes that landed today.

/ as Allison Mahmood (admin)

1280px, after

After: / at 1280px

1280px, before: adb9aa1^ (0fd3764)

Before: / at 1280px

Width Before: adb9aa1^ (0fd3764) After: this PR
390 Before: / at 390px After: / at 390px

/patches/kudos as Allison Mahmood (admin)

1280px, after

After: /patches/kudos at 1280px

1280px, before: adb9aa1^ (0fd3764)

Before: /patches/kudos at 1280px

Width Before: adb9aa1^ (0fd3764) After: this PR
390 Before: /patches/kudos at 390px After: /patches/kudos at 390px

Flow: card-tabs, as Allison Mahmood (admin)

  • Before (adb9aa1^ (0fd3764)): stopped at "Its versions": locator.click: Timeout 5000ms exceeded., 11.5s
  • After: finished, 8.3s
side-by-side.mp4

The base stops at "Its versions" because the tabs didn't exist yet. The take keeps the failure on screen, captioned, so the "before" still shows something.

What we learned

The approach works, and gh --attach handles all the hosting. Fixed along the way: tsx's __name breaking page code, full page loads wiping the overlay, Playwright's 30-second wait, gh ignoring bare video paths, and tables shrinking desktop shots. Still open: "No visible change" rarely fires because of minute-level timestamps, patch frames are cut at the viewport, and the worktree's data drifts. The full write-up and the recommended shape for the build are on #725.

Try it

git switch prototype/pr-visuals && pnpm install
pnpm dev up brightline
pnpm dev compare allison / /patches/kudos --base adb9aa1^
cat > /tmp/card-tabs.ts <<'FLOW'
export default async ({ page, step }) => {
  const tabs = page.getByRole("navigation", { name: "kudos" });
  await step("Open kudos' card");
  await page.goto("/patches/kudos");
  await step("Its versions");
  await tabs.getByRole("link", { name: /Versions/ }).click();
  await step("Its settings");
  await tabs.getByRole("link", { name: "Settings" }).click();
};
FLOW
pnpm dev film allison /tmp/card-tabs.ts --base adb9aa1^
pnpm dev down

From cold, both sides take about a minute and a half, most of it the base's install and scenario. Warm re-runs take 13 to 30 seconds.

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

@allisonmahmood allisonmahmood added the area:ci CI, shared testing infrastructure, development scripts and tooling label Oct 16, 2026
@github-actions github-actions Bot added the size:l 501-1,000 changed lines label Oct 16, 2026
…e, video reference plays inline

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added size:xl Over 1,000 changed lines; review in multiple passes and removed size:l 501-1,000 changed lines labels Oct 16, 2026
allisonmahmood added a commit that referenced this pull request Oct 19, 2026
…803)

## What changed

A reviewer can't see a UI or flow change without checking out the branch
and running it. Now two `pnpm dev` commands put the change in the PR
body, before and after:

- **`pnpm dev compare <person> <path>...`** takes full-page PNGs of each
page at each width on both sides. Patch frames grow to their content.
- **`pnpm dev film <person> <flow>`** records a Playwright flow on both
sides and joins the takes side by side.
- **`--pr <number>`** puts the section in the PR body and uploads its
files. A re-run replaces only its own section.

Both sides run on **evidence instances**: throwaway clones at the base
and at `HEAD`, each on fresh scenario data, never the developer's own
instance. So the uploads only ever hold scenario data, and a flow that
writes runs the same every time. This builds on the prototype in #726.

Closes #725

## Look at

**1. This PR's own evidence, published with `--pr`.** This branch
changes no page, so both runs use `--base df65c5b`, the commit before
the Home redesign (#713–#719).

<!-- patchy-dev:compare:allison -->

#### Before and after, as Allison Mahmood (admin)

Before is `df65c5b` (--base) and after is `ae4fe0f`
(dev/725-compare-film), both on the `brightline` scenario, from `pnpm
dev compare`.

##### `/`

**1280px, after**

![After: / at
1280px](https://github.com/user-attachments/assets/c95298e3-2057-4854-ab99-2ce755de4c6d)

<details><summary>1280px, before</summary>

![Before: / at
1280px](https://github.com/user-attachments/assets/2839acb9-c8ba-4aa6-ac4b-c93b330837ec)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: / at
390px](https://github.com/user-attachments/assets/a835c941-b828-4b9c-be23-b0f8078d86b8)
| ![After: / at
390px](https://github.com/user-attachments/assets/ce0dbd43-9325-4e56-b4b2-50b06ced2c1d)
|

##### `/patches`

**1280px, after**

![After: /patches at
1280px](https://github.com/user-attachments/assets/b6a4bd3b-dd5f-42c9-9f17-94c9858d7252)

<details><summary>1280px, before</summary>

![Before: /patches at
1280px](https://github.com/user-attachments/assets/ec9c0fa0-fc8c-4aae-8785-97b551a3b621)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /patches at
390px](https://github.com/user-attachments/assets/5b0a6e50-a130-4efa-961f-0d1aa233f419)
| ![After: /patches at
390px](https://github.com/user-attachments/assets/e3270da4-c68b-4eb0-9923-4eb9b42255ee)
|

- Before at 1280px answered 404; 1 browser error(s): `Failed to load
resource: the server responded with a status of 404 (Not Found)`.
- Before at 390px answered 404; 1 browser error(s): `Failed to load
resource: the server responded with a status of 404 (Not Found)`.

##### `/brightline/kudos`

**1280px, after**

![After: /brightline/kudos at
1280px](https://github.com/user-attachments/assets/c4ee9d1d-7c46-4e16-b585-2016c65705f2)

No visible change at 1280px.

| Width | Before | After |
| --- | --- | --- |
| 390px | No visible change | ![After: /brightline/kudos at
390px](https://github.com/user-attachments/assets/9ad87ebd-04e2-45c8-9b52-1f47a409ef35)
|

<!-- /patchy-dev:compare:allison -->

<!-- patchy-dev:film:find-a-patch -->

#### Flow `find-a-patch`, as Allison Mahmood (admin)

Before is `df65c5b` (--base) and after is `ae4fe0f`
(dev/725-compare-film), both on the `brightline` scenario, from `pnpm
dev film`.

- Before: stopped at "Search Home for kudos" after 10.2s: `locator.fill:
Timeout 5000ms exceeded.`
- After: finished in 6.9s

Before is on the left, after on the right.


https://github.com/user-attachments/assets/63035395-64f3-4985-b633-94a351979f5c

<!-- /patchy-dev:film:find-a-patch -->

**2. Cleanup holds however a run ends.** Each run takes both instances
down and deletes their data on success, on failure and on Ctrl-C. Before
this branch, Ctrl-C skipped that: Playwright and embedded-postgres each
hook SIGINT and exit the process before Effect's finalizers run.
Browsers now launch with Playwright's handlers off and close with their
scope, and the supervisor (with embedded-postgres) only loads in
`supervise`. Details are under How it was verified.

## How it was verified

- **Focused tests**, `pnpm exec vitest run scripts/dev` (10 files, 48
tests). The new ones cover:
- the section's insert and replace: before a final "Made by" paragraph,
at the end when there is none, in place among other keys, ignoring
markers and "Made by" inside code fences, and refusing duplicate or
unclosed markers;
- the layout per width, what each section attaches (an identical
"before" is left out), and page errors quoted so their text can't name a
file;
- attachments only from the run's own folder, and which references a
partial publication left as local paths, read from the real section
rather than a fenced example of one;
- the lock: a second run refused and the lock freed afterwards, six runs
starting together never giving two holders, a dead run's entry deleted,
and `down` refused while a run holds it;
- the reuse-or-move decision for a clone, and shot filenames for paths
that slug alike.
- **Real runs** on a shared Linux machine:

  | Run | Took | What it showed |
  | --- | --- | --- |
| `compare ada /` on `team`, from cold (clone, install, up, both sides)
| 44 s | both instances down afterwards, nothing left running |
| `compare` on five `brightline` pages at two widths | 1 min 59 s |
patch frames grown to their content (the tier 0 brief to 3,398 px, tier
1 Kudos to 2,594 px); the four patch pages said "No visible change" |
| `compare … --pr 803`, above | 1 min 21 s | 10 files attached, section
replaced in place |
| `film … --pr 803`, above | 1 min 3 s | 0.25 MB side by side, the base
take stopping in red |
| both again after the last push, from cold (`pnpm dev down` had deleted
the checkouts) | 1 min 54 s and 1 min 5 s | each replaced only its own
section, now naming `ce97595`; again at `ae4fe0f` after round 3 |

- **Failure paths, run for real:**
- **A base before `pnpm dev up` existed** (`--base af2aead`): before
unavailable, with "Bringing the before instance up failed (exit 1)." in
the section, after only, exit 0.
- **A flow broken on this branch:** footage kept, nothing published,
exit 1.
- **A second `compare` while one ran, and `pnpm dev down`:** both
refused at once, naming the running pid. Once the run ended, `pnpm dev
down` printed "Removed the evidence checkouts" and deleted them; it
keeps the empty lock folder beside them, since deleting it could cost a
starting run its entry. In a worktree that never ran one, it still
prints "Nothing to take down." and creates nothing.
- **Ctrl-C during setup and during capture:** both instances taken down;
no state dir, environment, lock entry or process left. Before the fix in
this PR, both exited 130 and left both instances running.
- **`--pr` checks**, before anything starts:

  ```
$ pnpm --silent dev compare allison / --pr 803 # with an uncommitted
edit
Evidence shows commits, and this worktree has uncommitted changes.
Commit and push them first, so the PR shows what the evidence shows.
  exit 1
$ pnpm --silent dev compare allison / --pr 803 # one local commit past
the PR
PR #803's head is bbe4fe5, but HEAD here is 5bfbf35. Push this branch
(or check out the PR's head) so the evidence is of the commit the PR
shows.
  exit 1
  ```

The head check also caught GitHub's lag for real: run straight after a
push, it refused until the PR showed the new head a few seconds later.

- **Partial publication, as far as it goes from here.** gh 2.102 refuses
an empty file and an 11 MB one itself, before uploading anything.
Through the publishing code, that left the body unchanged, passed gh's
error through and exited 1 saying nothing was published. GitHub accepted
random bytes named `.png` and `.mp4`, so I couldn't make one upload fail
and another succeed. What a partial publication leaves behind is covered
by the `notUploaded` test; gh's help says it updates the body with the
uploads that succeeded and exits non-zero. That test section was removed
from this body afterwards.
- **What was uploaded:** only `brightline` scenario data. I read every
PNG from an identical run without `--pr` before publishing. Pages show
the instance's local hostname.
- **`pnpm verify --changed`:** all passed (format, lint, typecheck,
synth and 1,967 tests). It skipped the acceptance suites, since only the
runner and docs changed.
- **Hit every surface:**
- **The dev loop:** `docs/DEVELOPMENT.md` (the command table and
"Showing a change in a PR") and the `patchy-dev-loop` skill. The seed
and the vitest template are unchanged.
- **The evidence skill:** `pr-evidence` gains `compare` and `film` and
loses the `shot` caveat. The throwaway-checkout recipe moved to Command
output until `transcript` (#792) lands.
- **Vocabulary:** "evidence instance" is defined in DEVELOPMENT, beside
the runner's other terms; no context glossary covers the runner.
- **Reverse states:** `compare` and `film` make the evidence checkouts,
and `pnpm dev down` deletes them. A run's lock entry goes when it ends,
and the next run deletes a dead run's entry.
- **Doesn't apply:** the wire contract, the CLI in `packages/patchy`,
migrations, company resources, served pages and the repo layout.
- **Reviewed by GPT 6.1 Sol** over three rounds. Round 1 had 1 blocking
and 4 should-fix findings; rounds 2 and 3 had no blocking ones, with 2
and 1 should-fix. All are fixed; the summaries are in the comments.
- **Not checked:** macOS; a real partial upload; a non-Claude harness
reading the skills.
- **Done means:** #725 has no Done means section. Its spec's tests and
docs are covered above, and this body's two sections show both commands
working.

## Release impact

Tick exactly one.

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — dev tooling and docs; nothing ships to
production

- **What does a revert leave behind?** Evidence checkouts under
`$XDG_DATA_HOME/patchy-dev/<label>.evidence/`, which the older `pnpm dev
down` doesn't know to delete (`rm -rf` them), and evidence sections
already in PR bodies.
- **Does the release before it still work with that?** Yes. Nothing here
runs in production.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

The build landed. #725 shipped as #803, on throwaway evidence instances instead of reusing this prototype's environment, and with --pr publishing. #792 (transcript), #793 (trial) and #794 (acceptance) build on it. The rest of #787 is merged too, so this prototype closes unmerged, as planned. Its branch stays for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant