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

A look keeps its page's size: scrollWidth, scrollHeight, innerWidth and innerHeight are stored on it and read back #10205

Merged opened this

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

Merged

A look now keeps its page's size, so you can answer "does this page scroll sideways" from the row without starting a browser.

shipped production is serving it deploy 9e8c29c

opened this

A look now keeps its page's size, so you can answer "does this page scroll sideways" from the row without starting a browser.

  • Migration: 20261109180000-a-look-keeps-its-page-size.ts adds four nullable integer columns to look: scroll_width, scroll_height, inner_width and inner_height. Its pin file is committed with it.
  • Reading: toLook in src/core/looks.ts returns size: { scrollWidth, scrollHeight, innerWidth, innerHeight }. When any of the four is null the look has no size key at all.
  • Writing: recordLook takes an optional size. A retake overwrites the stored size, so a retake without one clears the old one. In src/looks/service.ts the successful-capture save passes along the size the capture recorded. A look without one stores nulls and does not fail.
  • Tests: test/look-page-size.test.ts has five cases: with a size, without, a retake that clears it, a row inserted before the migration, and a row with only some columns set. No browser starts.
  • Checks: The new test, scripts/gate.ts and tsc --noEmit pass. Three Chromium tests in test/looks.test.ts fail in this sandbox, and fail the same way with my change stashed, because the sandbox blocks the browser's socket. I didn't run the rest of the suite; the forge's check runs it on push.

I did not touch the capture itself, the pages or the API, and nothing displays the size yet. Failed captures and attached looks store nulls.

To try it, call recordLook(db, { ..., size }) and then getLook(...).

Closes #10202

commented

A look now keeps its page's size, so you can answer "does this page scroll sideways" from the row without starting a browser.

  • Migration: 20261109180000-a-look-keeps-its-page-size.ts adds four nullable integer columns to look: scroll_width, scroll_height, inner_width and inner_height. Its pin file is committed with it.
  • Reading: toLook in src/core/looks.ts returns size: { scrollWidth, scrollHeight, innerWidth, innerHeight }. When any of the four is null the look has no size key at all.
  • Writing: recordLook takes an optional size. A retake overwrites the stored size, so a retake without one clears the old one. In src/looks/service.ts the successful-capture save passes along the size the capture recorded. A look without one stores nulls and does not fail.
  • Tests: test/look-page-size.test.ts has five cases: with a size, without, a retake that clears it, a row inserted before the migration, and a row with only some columns set. No browser starts.
  • Checks: The new test, scripts/gate.ts and tsc --noEmit pass. Three Chromium tests in test/looks.test.ts fail in this sandbox, and fail the same way with my change stashed, because the sandbox blocks the browser's socket. I didn't run the rest of the suite; the forge's check runs it on push.

I did not touch the capture itself, the pages or the API, and nothing displays the size yet. Failed captures and attached looks store nulls.

To try it, call recordLook(db, { ..., size }) and then getLook(...).

Approved

Does what #10202 asked: four nullable columns, toLook returns size or nothing, the save passes the capture size, and the test file covers with, without, retake and pre-migration rows. No browser starts. No user-facing surface changes, so the phone/keyboard checks do not apply. Next two things: (1) LookSize in src/core/looks.ts duplicates PageSize in src/looks/capture.ts; share one type. (2) Show the size where looks are listed or served (API/page, plus terminal screen and docs/features entry) so a person can see sideways scroll, which is the point of storing it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs