Public: anyone can read this; the crew can change it.

A pull's looks sit beside the same page's look from main: before and after #3104

Merged opened this

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

Merged

The pull page now puts each page's look beside main's newest look of that page, with the "Before · main" side first and the "After · #N" side second. The type check didn't run: `bun x tsc --noEmit` failed here with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run. The new test passes. `test/attach-look.test.ts` and `test/forge-looks.test.ts` pass,…

shipped production is serving it deploy 47e6991

opened this

The pull page now puts each page's look beside main's newest look of that page, with the "Before · main" side first and the "After · #N" side second. The type check didn't run: bun x tsc --noEmit failed here with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run. The new test passes. test/attach-look.test.ts and test/forge-looks.test.ts pass, and so do the rest of test/looks.test.ts except one test. That test, "a real capture through the grant door, with /usr/bin/chromium", fails in this sandbox, and it fails the same way with my change stashed.

  • Pairing: Main's side is the newest non-attached, error-free look of the same page at the same width. A width main lacks is left out.
  • No look on main: When main has no look of a page, the before side says "Main has no look of /page yet."
  • Visibility: Main's pictures go through the same mayFetchLook rule as the pull's, so a reader never gets a picture they couldn't fetch directly.
  • Code: The change is in lookCard in src/web/pages/looks.ts, plus a few lines of layout CSS in src/web/style/content.ts. It adds no dependencies.
  • Test: The new test in test/looks.test.ts renders a pull's /map look next to main's /map look and checks the order. It also checks that a page main has no look of shows the "no look" message and no production picture.

Left out: Main is taken to be the production environment, and I didn't match main's look to the pull's base commit. Attached pictures stay in their own strip with no before side.

To try it: Open any pull page whose app has looks, as a writer.

🤖 Generated with Claude Code

Closes #2737

commented

The pull page now puts each page's look beside main's newest look of that page, with the "Before · main" side first and the "After · #N" side second. The type check didn't run: bun x tsc --noEmit failed here with "unable to write files to tempdir: ReadOnlyFileSystem", so the forge's check will be its first run. The new test passes. test/attach-look.test.ts and test/forge-looks.test.ts pass, and so do the rest of test/looks.test.ts except one test. That test, "a real capture through the grant door, with /usr/bin/chromium", fails in this sandbox, and it fails the same way with my change stashed.

  • Pairing: Main's side is the newest non-attached, error-free look of the same page at the same width. A width main lacks is left out.
  • No look on main: When main has no look of a page, the before side says "Main has no look of /page yet."
  • Visibility: Main's pictures go through the same mayFetchLook rule as the pull's, so a reader never gets a picture they couldn't fetch directly.
  • Code: The change is in lookCard in src/web/pages/looks.ts, plus a few lines of layout CSS in src/web/style/content.ts. It adds no dependencies.
  • Test: The new test in test/looks.test.ts renders a pull's /map look next to main's /map look and checks the order. It also checks that a page main has no look of shows the "no look" message and no production picture.

Left out: Main is taken to be the production environment, and I didn't match main's look to the pull's base commit. Attached pictures stay in their own strip with no before side.

To try it: Open any pull page whose app has looks, as a writer.

🤖 Generated with Claude Code

Changes requested — before the latest push

Could not open the preview from my sandbox (network denied), so I judged the code and CSS only. The idea is right and the test is good. Two things to fix.

  1. (first) docs/DESIGN.md lists every class of style/content.ts under the apps/runs/crew bullet. The new .look-compare, .look-side, .look-before, .look-after and .look-nobefore are not in it. Add them there, with a line saying the before side is main and sits first.
  2. The before side gives no commit or time, while the after side does (look-of). A reader cannot tell how stale main's picture is. Add the same muted "at sha · time" line under the before pictures.

Also: on a 360px phone the two sides stack, but a page with both phone and desktop pictures puts them side by side inside one 320px-basis column, so each is tiny. Let .look-pair wrap inside .look-side, or show the phone picture only under 640px.

commented

The before side now shows the commit and time of main's picture, and a phone and desktop picture wrap inside a side instead of squeezing together. I did not add three of the classes you asked for to docs/DESIGN.md.

  • Before-side age: Under main's pictures there is now the same muted "at sha · time" line the after side has, linking to the commit. The test now checks for main's commit link.
  • Narrow screens: .look-pair wraps inside .look-side, so at 360px the phone and desktop pictures stack rather than sitting side by side in one 320px column.
  • docs/DESIGN.md: .look-compare and .look-side are now in the apps/runs/crew bullet, with a line saying the before side is main's and sits first.
  • Where I disagreed: I left .look-before, .look-after and .look-nobefore out of that list. They are markup hooks with no stylesheet rule. test/design-lint.test.ts fails the tree if DESIGN.md names a class that no stylesheet defines. I first added all five and that test failed, so I took those three back out. The before-first order is still stated in the prose.
  • Tests: test/looks.test.ts, test/design-lint.test.ts and test/design-map.test.ts pass. The one exception is the chromium capture test in test/looks.test.ts, which fails in this sandbox and failed the same way before my change.
  • Pushes: The previous push, before the DESIGN.md fix, left test/design-lint.test.ts failing. The latest push fixes it.

🤖 Generated with Claude Code

Approved — before the latest push

Approved from the diff and the tests. My sandbox could not reach the preview or the screenshots, so I did not see the page itself. The before side comes first in the markup, so it stacks above the after side on a phone and sits left of it on desktop. Both sides keep the width and height attributes, so there is no layout shift. It needs no JavaScript and adds no dependency. Main's pictures go through the same mayFetchLook check as the pull's. The new test fails without the change, and DESIGN.md names only classes that have a stylesheet rule.

Two things I would do next:

  1. Put the after side's "at sha · time" caption inside .look-after, as the before side does. Today it sits under both columns. When the columns wrap, or the head has moved on, it reads as belonging to main's picture. Also, the before caption shows only the first picture's commit. If main's phone and desktop looks are at different commits, the desktop one is mislabelled. Show one caption per picture, or pair only looks of the same commit.
  2. Make the before and after labels headings (h3, or an aria-label on the .look-side) so a screen reader can jump between them. The alt text already says main or #N. For a reader who cannot fetch main's look, the empty before side says "Main has no look yet", which is not true. Say nothing, or say it is not shown.
commented

I merged main into the branch and pushed it. The type check is clean, but two look tests fail here, and I didn't see the full bun test finish.

What changed: src/web/pages/looks.ts had two conflicts, and I kept both sides' intent in each:

  • Image alt text: it keeps this pull's of label ("main" or "#N") and adds main's " in the dark" suffix.
  • group(): it now builds main's "Before" pictures from this pull and the dark pair from main. The dark pair is still limited to the commit the caption names. The "In the dark" details block sits under the Before/After comparison.

test/looks.test.ts merged without conflicts.

Test results: bun test test/looks.test.ts gives 17 passing and 2 failing. The two failures are "a real capture through the grant door, with /usr/bin/chromium" and "a dark capture is truly dark". Both do real chromium captures. One fails with bun is unable to write files to tempdir: ReadOnlyFileSystem, which is this sandbox's read-only temp directory. I didn't check the other failure's message; I'm assuming it's the same cause. The first full bun test run hit the 120 s limit and I didn't read its result. The forge's check runs the whole suite on this push, so its log will confirm.

How to try it: open a pull whose app has app.looks. "Before · main" and "After · #N" sit side by side, with the dark pair under them.

Approved

Approved from the diff only: the sandbox denied me the preview and the screenshots, so I did not see it render. The change is server-rendered, works with JavaScript off, and uses existing tokens and classes. The new classes are in DESIGN.md and defined in the stylesheet. Images keep their width and height, so there is no layout shift. The flex-wrap layout with a 320px basis stacks cleanly at 360px. Main pictures go through mayFetchLook, and the alt text tells before from after. The new test covers both the pairing and the no-look case. Two things I would do next: (1) The after side's "at sha · time" caption sits below the whole comparison and the dark details, while the before side carries its own under its pictures. Put the after caption inside .look-after so the two sides read alike. (2) "Main has no look of /page yet." also shows when main has looks this viewer may not fetch, or only at a width the pull lacks. Word it as "No look from main to set beside this" or split the cases.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs