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

Home tiles on a phone: thumbnails are 200×125 corner crops upscaled 1.8×, status badge stretches full width, hero CTA touches the grid #494

Closed opened this in answer to
Closed without merging

This fixes the three defects on the signed-out home's app tiles (#473): the blurry corner-crop thumbnails, the full-width status badge, and the hero button touching the grid. The new test drives Chromium only, not WebKit, and measures layout instead of comparing screenshots (details below).

Notes

stopped closed without shipping deploy cd4c1e5

opened this

This fixes the three defects on the signed-out home's app tiles (#473): the blurry corner-crop thumbnails, the full-width status badge, and the hero button touching the grid. The new test drives Chromium only, not WebKit, and measures layout instead of comparing screenshots (details below).

Thumbnails (src/looks/thumb.ts, src/looks/service.ts, src/core/looks.ts)

  • The forge no longer opens a 200×125 browser window for the thumb, which only kept the page's top-left corner. The thumb is now the 1280×800 desktop picture, whole, scaled down to 640×400. It uses the existing zero-dependency PNG decoder, box-filter downscaler and encoder in src/design/image/, so it costs one browser start fewer per deploy.
  • If the desktop picture failed, the thumb is recorded with the same reason.
  • On boot, any stored thumb that isn't 640×400 (the old crops) is rescaled from the desktop picture of the same commit, without opening a browser. Production tiles are therefore sharp after the next deploy of the forge itself, not after each app's next deploy.

Tile (src/web/studio/home.ts, src/web/style/content.ts)

  • The tile image uses srcset: the thumb at 640w, plus the same commit's desktop picture at 1280w as the 2× source. It is drawn with a 1280/800 aspect ratio, object-fit: cover; object-position: top.
  • The state badge in a tile gets justify-self: start. It is inline-flex, but as a grid item the browser turns it into a block that stretches across the cell.
  • The hero's last child gets a 32 px bottom margin, so there are at least 32 px between the call-to-action and the shelf at every width.

Tests

  • test/home-tiles.test.ts loads the signed-out home in real headless Chromium at 393 px (3×) and 1280 px (1× and 2×). It checks that the chosen picture has at least as many pixels as the tile has device pixels, the image fit and position, the badge narrower than half the tile, a gap of at least 24 px, and no sideways scroll. All three cases fail against the old markup and CSS. It skips when Chromium is missing and says so.
  • It runs on a generalised evaluateInPage in test/helpers/chrome.ts; measurePageWidth now calls it.
  • test/looks-thumb.test.ts checks the thumb is 640×400 and keeps the desktop picture's far corner.
  • test/looks.test.ts gains a test that an old 1×1 thumb is rescaled on boot without calling the browser.
  • Both new test files are added to the forge.json check.

Tests I changed, because they asserted the old behaviour this issue replaces

  • test/looks.test.ts: two browser calls per page instead of three, no 200×125 call, and the thumb is 640×400. The stand-in browser now writes a real 1280×800 picture at desktop width.
  • test/studio.test.ts (#287): the tile is width="640" height="400" with a desktop 1280w source. The other #287 test, for a desktop-only tile, is unchanged and passes.

Not done

  • No Playwright and no WebKit: CLAUDE.md forbids adding runtime dependencies, and neither is installed on this machine.
  • The test measures layout in the browser rather than comparing against stored screenshot images, which tend to be flaky.

Check status: the forge.json check ran 604 tests, with 2 failures in shard 2, neither in looks or the home page. The vitals token test passed when rerun alone. The fork-flow mirror test failed in 2 of 4 runs on this branch and passed once on main, so it looks like a timing flake. tsc is clean.

To try: on the preview, open / signed out at phone width and at 1280 px. Tiles from before this change are rescaled when the forge boots.

🤖 Generated with Claude Code

Closes #473

commented

Parked by the crew: the check failed ("the fork flow > a mirror whose git is not ready yet is fetched again, and lands") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs