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

Website spec: Lighthouse lab LCP, CLS and INP for the looks pages, as a report (#2915 check 9) #2965

Parked opened this
Closed without merging

Each preview's look pages are now measured for lab LCP, CLS and TBT (the lab's stand-in for INP), and the pull shows the results as a report. Each number has specification.website's threshold beside it: LCP ≤ 2.5 s, CLS ≤ 0.1, INP ≤ 200 ms. Nothing here fails a check.

Notes

stopped parked by the crew deploy 9cd8812

opened this

Each preview's look pages are now measured for lab LCP, CLS and TBT (the lab's stand-in for INP), and the pull shows the results as a report. Each number has specification.website's threshold beside it: LCP ≤ 2.5 s, CLS ≤ 0.1, INP ≤ 200 ms. Nothing here fails a check.

The new real-Chromium test (test/lab.test.ts) has not passed anywhere yet. It fails in my sandbox because Chromium aborts when the sandbox refuses its socket() call. The existing real-capture test in test/looks.test.ts fails here the same way, and the forge's check, whose image ships chromium, is the first real run. Everything else passes: tsc --noEmit, test/lab.test.ts (15 of 16), test/lab-service.test.ts (4), and the neighbouring looks, design-lint, schema, hollow, variants and pulls suites.

What changed

  • src/looks/lab.ts (new, plain data): the thresholds, the measuring conditions, and the reduction Lighthouse does.
    • LCP is the last candidate.
    • CLS is the largest session window: a 1 s gap or 5 s length closes it, and shifts after input don't count.
    • TBT is each long task's time past 50 ms after first contentful paint; a task that straddles FCP counts from FCP on.
    • It also holds the observer script that goes into the page. The page's report is validated and bounded, since it is the app's own word.
  • src/looks/devtools.ts (new): drives headless Chromium over its DevTools protocol on Bun's own WebSocket, with no Lighthouse and no dependency. It applies Lighthouse's mobile throttling (390×844, CPU 4×, 562.5 ms latency, 1.47 Mbit/s down) and loads the page through the same grant door as the pictures. It waits at the same one-browser gate as the pictures, now exported from capture.ts with the shared launch flags.
  • src/looks/service.ts: after a preview's pictures, each app.looks page is measured once per head. Results are stored in a new look_lab table (src/core/lab.ts); a newer head's numbers replace the older's, and they go when the pull closes. Production is not measured. A test that stands in for the browser measures nothing unless it passes its own measure.
  • src/web/pages/lab.ts (new): a "Lab vitals" card under the Look card on the change page and the variants deck. Each number shows "within" or "over" its threshold in words as well as colour, and the card states the conditions, the commit, and that it is a report only. Who sees it matches who sees the pictures.
  • Docs: docs/APPS.md describes it; docs/DESIGN.md §5d names the three new classes (.lab-card, .lab-good, .lab-over).

What to look at

  • Not built on webspec.ts: the issue says checks 1–4 landed there, but that module is only in open pulls #2937 and #2956. This pull is independent of them and puts the citation (LAB_SECTION) in lab.ts.
  • "Attached to the pull's checks": the forge's check runs in a cell with no preview to load, so the report comes from the looks service, the one place that already opens the preview in a browser. It shows on the pull page beside the pictures.
  • Section citation: I could not open specification.website from the sandbox, so the citation names the section by topic ("Performance — Core Web Vitals") and links the site's root, not an anchor.

Left out on purpose

  • A measured INP: that needs scripted interactions, so TBT stands in for it.
  • A JSON/API form of the numbers.
  • Turning the report into a gate.

How to try it: open a pull on any app repository. Once its preview is green, the Lab vitals card appears under the Look card.

🤖 Generated with Claude Code

Closes #2942

commented

Each preview's look pages are now measured for lab LCP, CLS and TBT (the lab's stand-in for INP), and the pull shows the results as a report. Each number has specification.website's threshold beside it: LCP ≤ 2.5 s, CLS ≤ 0.1, INP ≤ 200 ms. Nothing here fails a check.

The new real-Chromium test (test/lab.test.ts) has not passed anywhere yet. It fails in my sandbox because Chromium aborts when the sandbox refuses its socket() call. The existing real-capture test in test/looks.test.ts fails here the same way, and the forge's check, whose image ships chromium, is the first real run. Everything else passes: tsc --noEmit, test/lab.test.ts (15 of 16), test/lab-service.test.ts (4), and the neighbouring looks, design-lint, schema, hollow, variants and pulls suites.

What changed

  • src/looks/lab.ts (new, plain data): the thresholds, the measuring conditions, and the reduction Lighthouse does.
    • LCP is the last candidate.
    • CLS is the largest session window: a 1 s gap or 5 s length closes it, and shifts after input don't count.
    • TBT is each long task's time past 50 ms after first contentful paint; a task that straddles FCP counts from FCP on.
    • It also holds the observer script that goes into the page. The page's report is validated and bounded, since it is the app's own word.
  • src/looks/devtools.ts (new): drives headless Chromium over its DevTools protocol on Bun's own WebSocket, with no Lighthouse and no dependency. It applies Lighthouse's mobile throttling (390×844, CPU 4×, 562.5 ms latency, 1.47 Mbit/s down) and loads the page through the same grant door as the pictures. It waits at the same one-browser gate as the pictures, now exported from capture.ts with the shared launch flags.
  • src/looks/service.ts: after a preview's pictures, each app.looks page is measured once per head. Results are stored in a new look_lab table (src/core/lab.ts); a newer head's numbers replace the older's, and they go when the pull closes. Production is not measured. A test that stands in for the browser measures nothing unless it passes its own measure.
  • src/web/pages/lab.ts (new): a "Lab vitals" card under the Look card on the change page and the variants deck. Each number shows "within" or "over" its threshold in words as well as colour, and the card states the conditions, the commit, and that it is a report only. Who sees it matches who sees the pictures.
  • Docs: docs/APPS.md describes it; docs/DESIGN.md §5d names the three new classes (.lab-card, .lab-good, .lab-over).

What to look at

  • Not built on webspec.ts: the issue says checks 1–4 landed there, but that module is only in open pulls #2937 and #2956. This pull is independent of them and puts the citation (LAB_SECTION) in lab.ts.
  • "Attached to the pull's checks": the forge's check runs in a cell with no preview to load, so the report comes from the looks service, the one place that already opens the preview in a browser. It shows on the pull page beside the pictures.
  • Section citation: I could not open specification.website from the sandbox, so the citation names the section by topic ("Performance — Core Web Vitals") and links the site's root, not an anchor.

Left out on purpose

  • A measured INP: that needs scripted interactions, so TBT stands in for it.
  • A JSON/API form of the numbers.
  • Turning the report into a gate.

How to try it: open a pull on any app repository. Once its preview is green, the Lab vitals card appears under the Look card.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("every spawn that pipes is listed with the reason it reads the pipe") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs