Repository navigation
feat(browser,webview): screen_size and main_thread_lag_ms traces (ST4c) - #75
Conversation
screen_size reports {width, height, dpr} as a held step trace, re-read on
resize/orientationchange. main_thread_lag_ms is a MessageChannel round-trip
delta, measured only while the page is visible (hidden aborts the ping and
clears the value), re-armed on every receipt and emitted once per tick.
Both come from the injected window and sit behind the lifecycle gate.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ize-main-thread-lag # Conflicts: # docs/PROGRESS.md
…sume document listeners 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ize-main-thread-lag
…ST4c review) Re-arming on every receipt was a continuous task loop and overwrote a long-task delta with a ~0 one. A receipt now only stores the delta; each 1 s tick emits it and posts ONE new ping, and a ping still in flight at a tick reports its age (a lower bound) instead of posting another. Also: wire the clock only when performance.now is a function, wrap the screen-size tracker's reporter, and document screen_size staleness. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ize-main-thread-lag
… ping (ST4c review) A ping only sees a block that begins while it is in flight, so most real freezes read ~0.1 ms in Chromium. The tracker now measures how late the 1 s sampling timer fires (max(0, now - (previousTick + interval))), emitted every tick while visible, with a fresh baseline on every visible start. The MessageChannel machinery and its env plumbing are deleted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…ow binding; read the clock once (ST4c review) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @krassx's task in 36s —— View job Review of PR #75:
|
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @krassx's task in 24s —— View job Review of PR #75:
|
Summary
screen_size:{ width, height, dpr }(CSS px of the injected window'sscreenand livedevicePixelRatio), emitted at start and onresize/orientationchange, held and de-duplicated, omitted when the screen or ratio is absent or not a finite positive number. Deliberately NOT nameddisplays(Android's display LIST shape).main_thread_lag_ms: TIMER DRIFT — on each 1 s sampling tick while the page is visible,lag = max(0, now() − (previousTick + interval))from the injected window'sperformance.now; fresh baseline on every visible start (a hidden stretch is never lag), timer torn down while hidden, failed start rolled back, throwing/non-finite clock skips only that interval. A measured 0 is emitted.app_state/fps(under the shared lifecycle gate, sosensors:false/asystemMetricsSampleroverride omits them).Why drift, not a MessageChannel ping (measured)
Two ping designs were built and rejected after review: re-posting on every receipt is a continuous task loop (~2.2M receipts/s = a pinned core, and it overwrites a freeze's delta microseconds later); a per-tick ping reads ~0.1 ms through most real freezes in headless Chromium (a block that starts after the ping returned has nothing in flight to delay, and the 'in-flight age' branch never fires because the tick timer shares the blocked thread).
Drift, validated in real headless Chromium: idle page 0.1 ms median / 3 ms max, no positive bias; blocks ≥ 1 s always show (≥ 907 ms; 1800 ms read 907..1797, 2500 ms read 1807); one block is reported once. Honest limit: a block shorter than 1 s that crosses no due tick reads exactly 0 (≈ 1 − B/1000 of the time); catching short jank needs a finer timer (max per window) or
PerformanceObserver('longtask')— documented, not built. The occluded-window throttling note is unverified (headless can't reproduce it).Review
performance.nowthis-binding test gap, a duplicate error report.The viewer has no definition for either name yet (generic value blocks).
Test plan
pnpm ci:local🤖 Generated with Claude Code