webviews: frame and event waits in the latency harness and wheel pass-through (fixed waits 75 → 26)

Merged
TE
15d ago
+93-37

The next batch of the fixed-waits ratchet. The baseline goes from 75 to 26 (base after #23584/#23585, which this PR merged); this PR removes 49 waits.

  • test/latency/actions.ts (23 → 0): between runs, the harness waits for the page to hold still (quiet: 10 painted frames with no DOM change and nothing animating) instead of fixed settle(ms) sleeps. Each prepare step waits for the state it needs:

    • the sidebar slide's end
    • "sidebar reverse": the slide's own currentTime reaching 50 ms, or the slide having ended when a loaded frame outlasts it
    • the rich document shown
    • the model or slash menu closed after Escape

    scripts/latency/run.ts installs the painted-frame helpers once per page.

  • test/latency/picker.harness.tsx (7 → 0) and test/latency/mock-host.ts (3 → 0): the mock hosts' reply delay is the stand-in for the IPC round trip the harness measures against, so it is marked // fixed-wait: rather than removed.

  • test/agent-pane-wheel-pass-through.test.ts (16 → 0): after a wheel, a draft insert or arrow keys, the test waits for the transcript's offset, the draft's offset and the composer card's box to hold for 6 painted frames (still).

Runs on cmux16 at 4eb8754:

  • wheel-pass-through, chromium + webkit: 5/5 (6 tests each).
  • bun run latency, 5 full runs over both engines: every action took all 5 samples with no prepare errors, except "model menu open", which never responds at base either. WebKit's budget passes match base (17–20 of 23 per run, against 17 at base). Chromium on cmux16 paints at 17–30 Hz and fails its budgets at base too.

Agent session: cmux16

🤖 Generated with Claude Code