perf(android): skip the freshness window after a settle on a proved-fresh tree
Summary
After a press/click whose --settle converged, the daemon still armed the Android freshness window, so the next command bypassed the snapshot cache, lost the short helper idle wait, and ran stale-tree recovery. Now the window is skipped only when the settle stored its final capture (diff present) and the helper proved that capture fresh (cache cleared, root present, no truncation, no missing window roots: the #3815 proof, now one shared predicate carried as SnapshotState.freshTraversal). Convergence alone still arms the window, because two stale dumps can agree. back (bare or --settle), open, and unconverged or unproved settles still arm the window; a new test pins bare back. 10 files.
Refs #4105
Validation
Head ae6854459a, rebased on cb33595201. Typecheck, lint and focused vitest pass; request-path test fails without the fix. CI owns check:affected.
Emulator API 35 (Settings), N=16 per arm, interleaved, load avg 25–490. Follow-up wall time (CLI included); measured at ac43329cad (base 244d1ff683); this PR's production diff is unchanged since then:
after press --settle | base p50/p95 | branch p50/p95 | paired p50 Δ |
|---|---|---|---|
navigate → snapshot | 491 / 1589 | 416 / 883 | −108 ms (10/16 faster) |
navigate → press | 1206 / 7990 | 952 / 1953 | −254 ms (12/16) |
toggle → snapshot | 347 / 1980 | 328 / 1086 | ≈0 (7/16) |
Stale-route captures, failed presses, and wrong toggle states: 0 in both arms. Freshness retries: 0 in both arms. On API 34+ the proof already suppresses stuck-route retries, so the gain is the cache and idle-wait path. Devices without the proof keep today's behavior.
Lag check: after a plain navigating press, the first capture showed the new screen in 15/15 runs (done 427–1511 ms after the press, CLI floor ~400 ms). The old ~2 s lag does not appear.
🤖 Generated with Claude Code