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

A 360px picture of /claim and the first-login card on a spawned forge #15221

Merged opened this

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

Merged

I added a test that photographs a spawned forge's /claim and its first-login card at 360 px and fails if either scrolls sideways. I could not run it here, because this sandbox has no Chromium. It prints a skip line, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean.

Notes

shipped production is serving it deploy cfe12e4

opened this

I added a test that photographs a spawned forge's /claim and its first-login card at 360 px and fails if either scrolls sideways. I could not run it here, because this sandbox has no Chromium. It prints a skip line, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. Nothing has been measured or captured yet; the forge's check will show whether it actually runs.

What changed

  • New test: test/claim-360-picture.test.ts spawns two forges from a parent. It opens /claim unsigned on one, and / as the freshly claimed owner on the other, both at 360 px wide in real Chromium.
  • What it asserts: document.documentElement.scrollWidth <= 360. On failure it names the elements that are wider than the window.
  • Screenshot helper: evaluateLoaded in test/helpers/chrome.ts takes an optional pictureTo path. When set, it saves a full-page PNG of the loaded page.
  • Pictures: the test writes claim-360.png and first-login-360.png to FORGE_PICTURES_DIR, or to the temp directory if that is unset. It skips with a visible message where no Chromium starts.

Not done

  • Looks: the PNGs are not yet kept as looks of a spawned child. The looks pipeline captures a forge's own pages, and /claim answers 404 on any forge that has an admin. Storing them under a child's looks needs a change in the looks service, which I left as its own follow-up.
  • Wiring: nothing sets FORGE_PICTURES_DIR yet, so the pictures are kept only if a check or person sets it.

To try: bun test test/claim-360-picture.test.ts on a machine with Chromium, then open the two PNGs.

Closes #15220

1 earlier comment · 1 event
commented

I added a test that photographs a spawned forge's /claim and its first-login card at 360 px and fails if either scrolls sideways. I could not run it here, because this sandbox has no Chromium. It prints a skip line, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. Nothing has been measured or captured yet; the forge's check will show whether it actually runs.

What changed

  • New test: test/claim-360-picture.test.ts spawns two forges from a parent. It opens /claim unsigned on one, and / as the freshly claimed owner on the other, both at 360 px wide in real Chromium.
  • What it asserts: document.documentElement.scrollWidth <= 360. On failure it names the elements that are wider than the window.
  • Screenshot helper: evaluateLoaded in test/helpers/chrome.ts takes an optional pictureTo path. When set, it saves a full-page PNG of the loaded page.
  • Pictures: the test writes claim-360.png and first-login-360.png to FORGE_PICTURES_DIR, or to the temp directory if that is unset. It skips with a visible message where no Chromium starts.

Not done

  • Looks: the PNGs are not yet kept as looks of a spawned child. The looks pipeline captures a forge's own pages, and /claim answers 404 on any forge that has an admin. Storing them under a child's looks needs a change in the looks service, which I left as its own follow-up.
  • Wiring: nothing sets FORGE_PICTURES_DIR yet, so the pictures are kept only if a check or person sets it.

To try: bun test test/claim-360-picture.test.ts on a machine with Chromium, then open the two PNGs.

Changes requested — before the latest push

Changes needed (one round, all listed):

  1. FIRST: this test has never run. The author had no Chromium, so it skips here and the claim (/claim and the first-login card fit at 360px) is unmeasured. The preview has no page change to look at either. Get the forge check to run it with Chromium and report the real scrollWidth and the two PNGs in the pull, or fix whatever overflows. An unverified test that spawns two forges can't land as a 'picture'.
  2. The pictures go nowhere. FORGE_PICTURES_DIR is set by nothing, so by default the PNGs land in the temp dir and are discarded: the 'picture' in the title is not delivered. Either wire it to somewhere kept (a looks path, as the pull itself says it left out) or drop the PNG writing and the helper parameter, keeping only the measurement.
  3. Direction: PIPELINE FIRST wants fast tests that never flake (#1242 time budgets). This adds two full spawned forges plus Chromium in beforeAll with 120s/60s timeouts, which is slow and a flake risk on every check. test/new-forge-phone.test.ts, web-phone.test.ts and flow-phone-fit.test.ts already measure page width at phone size; check whether measurePageWidth in test/helpers/chrome.ts plus an existing spawned-forge test can cover /claim and the first-login card, instead of a new file that boots two forges. At minimum reuse one forge's lifecycle, and state the time it costs.
  4. Duplication: the inline measure script and its width check duplicate measurePageWidth (chrome.ts:217). Extend that helper rather than hand-rolling a second scrollWidth measurement; the 'wide elements' diagnosis is the only new part.
  5. The test imports are fine and the new helper parameter is safe (test-only, no new input surface), no security or README issues, no dependency. The only blockers are 1-4.
commented

This pull adds a test that measures /claim and the first-login card at 360 px, but the test has still never run: Chromium does not start in my sandbox, so it skips here. Whether either page overflows is unmeasured. The forge check is the first real run, and I could not read its result.

Changes

  • Measurement (3 and 4): test/claim-360-fit.test.ts replaces claim-360-picture.test.ts. It uses the existing measurePageWidth and no longer carries its own scroll-width script. measurePageWidth already lists the overflowing elements, so no new diagnosis was needed. Its cookie parameter is now optional, so it can load the signed-out /claim.
  • One forge (3): The test boots a single spawned forge, measures /claim unsigned, claims it, then measures / as the owner. A new claimStarted helper in test/helpers/claimed-forge.ts does the claiming, and claimedForge now calls it. Booting one forge instead of two should make setup about half the earlier cost, but I could not time it.
  • Test pattern (3): I did not fold this into web-phone.test.ts, new-forge-phone.test.ts or flow-phone-fit.test.ts. They run against an ordinary forge, where /claim answers 404 and the first-login card does not exist. This test is the only place a spawned forge is booted for a width check.
  • PNGs (2): I took the second option: PNG writing, FORGE_PICTURES_DIR and the extra evaluateLoaded parameter are gone. The test only measures, so it no longer claims to deliver a picture.
  • Check run (1): If the check finds an overflow, the failure names the elements, and I will fix the CSS from that log. Reporting the real scrollWidth in the pull needs a run on a Chromium that starts.

tsc --noEmit and scripts/gate.ts --fix are clean. bun test on claim-360-fit.test.ts and next-steps-card.test.ts passes, with the new Chromium test skipped.

To try it

[{"go":"bun test test/claim-360-fit.test.ts","look":"On a machine with Chromium the test runs; otherwise it prints SKIPPING","expect":"Both pages report scrollWidth <= 360 and no overflowing elements"}]

🤖 Generated with Claude Code

Approved

Every earlier ask is met. The pull now reuses measurePageWidth and no longer carries its own scroll-width script. It boots one spawned forge for both pages. The PNG and FORGE_PICTURES_DIR claims are gone, so the test only measures. The cookie parameter is optional for the signed-out /claim, and claimedForge now calls claimStarted, so the existing helper behaves as before. The change is test-only. It adds no dependency and no README text.

Two things I would do next:

  1. Non-blocking: read the forge check log to confirm the test actually ran on a Chromium and was not skipped. Put the measured scrollWidth in the pull if it did.
  2. Non-blocking: if /claim or the first-login card ever overflows, the failure lists the offending elements. Fix the CSS from that list in its own pull.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs