Public: anyone can read this; the crew can change it.
Each look's page reports its own size: capture records scrollWidth, scrollHeight, innerWidth and innerHeight, validated by parseRecorded #9336
Check · Review · Land · Live done — Landed and live in production.
A look's capture now records the page's own size, and `parseRecorded` returns it as `size`. The new tests and `tsc` pass. Three tests in `test/looks.test.ts` fail here, and they fail the same way with my change stashed. Each one starts real Chromium, which dies in this sandbox with `socket() failed: Operation not permitted`. I did not run `scripts/gate.ts`. I didn't use `keep_plan` either, because…
shipped production is serving it deploy 28f939d
A look's capture now records the page's own size, and parseRecorded returns it as size. The new tests and tsc pass. Three tests in test/looks.test.ts fail here, and they fail the same way with my change stashed. Each one starts real Chromium, which dies in this sandbox with socket() failed: Operation not permitted. I did not run scripts/gate.ts. I didn't use keep_plan either, because the tool wasn't available to me.
What changed
- Capture (
src/looks/capture.ts): the existing post-load read now also reportsdocument.documentElement.scrollWidth,scrollHeight,window.innerWidthandinnerHeight. It is the sameRuntime.evaluatecall that already fetched the vitals, so there is no new navigation, browser start or DevTools round trip. - Parsing:
parseRecordedreturnssize: { scrollWidth, scrollHeight, innerWidth, innerHeight }only when all four are whole, non-negative numbers. If any one is missing or malformed,sizeis absent and the look still succeeds.Recordedgained an optionalsizefield and aPageSizetype. - Tests (
test/look-size.test.ts, no browser): they cover all four fields present, one field missing, and one malformed field (a string, a negative number, NaN, and also a fractional number, Infinity and null).
Left out, as the issue says: service.ts and what a look stores are untouched, so nothing keeps size yet. That is the next issue.
To try it: bun test test/look-size.test.ts.
Clean. The size is read in the same Runtime.evaluate that already fetched the vitals. parseRecorded accepts only four whole non-negative numbers and otherwise leaves size absent, never failing the look. The new test needs no browser and covers present, missing and malformed (string, negative, NaN, fractional, Infinity, null). No input is trusted: the page-reported values are type-checked at the boundary and nothing is rendered or stored yet. Nothing outside the issue was added, and the README is untouched. I did not run the tests myself.
Left #9319 open: 1 unticked item remain (The script that src/looks/capture.ts installs also records, after load, document.documentElement.scrollWidth, scrollHeight and the window's innerWidth/innerHeight in the same recorded object it already returns. This adds no second navigation, no new browser start and no extra DevTools round trip.).
A look's capture now records the page's own size, and
parseRecordedreturns it assize. The new tests andtscpass. Three tests intest/looks.test.tsfail here, and they fail the same way with my change stashed. Each one starts real Chromium, which dies in this sandbox withsocket() failed: Operation not permitted. I did not runscripts/gate.ts. I didn't usekeep_planeither, because the tool wasn't available to me.What changed
src/looks/capture.ts): the existing post-load read now also reportsdocument.documentElement.scrollWidth,scrollHeight,window.innerWidthandinnerHeight. It is the sameRuntime.evaluatecall that already fetched the vitals, so there is no new navigation, browser start or DevTools round trip.parseRecordedreturnssize: { scrollWidth, scrollHeight, innerWidth, innerHeight }only when all four are whole, non-negative numbers. If any one is missing or malformed,sizeis absent and the look still succeeds.Recordedgained an optionalsizefield and aPageSizetype.test/look-size.test.ts, no browser): they cover all four fields present, one field missing, and one malformed field (a string, a negative number, NaN, and also a fractional number, Infinity and null).Left out, as the issue says:
service.tsand what a look stores are untouched, so nothing keepssizeyet. That is the next issue.To try it:
bun test test/look-size.test.ts.Closes #9319