Skip to content

test(perf): gate mobile scenarios through production app wrappers - #23419

Merged
Git-on-my-level merged 19 commits into
mainfrom
lane/perf-gate
Oct 24, 2026
Merged

Git-on-my-level merged 19 commits into
mainfrom
lane/perf-gate

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Problem and behavior

The host perf harness omitted production app builders and enabled semantics in both arms, so #23400's lifetime accessibility-tree work could ship. All eight existing Stage 1/2 scenarios now mount a source-checked copy of main.dart's MaterialApp builder chain with the iOS analytics arm enabled and accessibility initially off.

Host admission uses virtual frame time with real fixture I/O drained at explicit boundaries. It gates rebuild/layout/paint counts, retained clip/opacity layers, painted-image decode dimensions, and exactly zero semantics compiles per frame and semantics phase share. Host milliseconds and other phase shares are diagnostics. Initial count caps are measured unchanged-production work +10%+10 events; future caps can only decrease through the existing local/CI manifest.

bash app/tool/perf_gate.sh runs three fresh processes under nice, prints variance, rejects incomplete/failed-process evidence, and has a 9m30s deadline. The same scenarios run as three independently seeded trials in test.sh, so existing Mobile App Checks and exact-source mobile release admission block regressions. No workflow changes.

Product invariants affected

  • INV-PERF-1 — production wrappers participate in admission; source drift, framework errors, missing instrumentation and increased work fail closed. Guard paths are documented in product/invariants/mobile-ui-isolate.md.

Failure-Class: none

Validation

  • Three consecutive fresh-process full runs passed with the fixed calibrated caps: 27.3s, 30.6s and 31.7s (about 90s total). Observed false failures: 0/3; all gated counts had zero standard deviation. These are holdouts, not the calibration trial.
  • Test-only held-ensureSemantics injection rejected all eight scenarios (650–4,846 semantics phase calls, versus zero clean); no tracker mutation or exception suppression.
  • Three same-process CI-style trials passed (27 tests); four Dart budget tests passed.
  • Focused dart analyze --fatal-infos passed with no issues; nine Python shell/evidence tests and three budget-ratchet tests passed.
  • make preflight and push hooks passed; the final push re-runs the exact-head local checks. No merge or force push.
  • A read-only merge-tree check verifies the companion device README append remains compatible.

Boundaries and companion work

Host tests cannot report actual GPU saveLayer/raster truth: saveLayer is explicitly unavailable, and retained layers are not mislabeled as GPU calls. Full native/Firebase MyApp startup is outside the hermetic seam. A shared production-shell/analytics-lifecycle hook is requested from the lead; the current adapter fingerprints all of main.dart and refuses unknown root shapes.

Static ratchets: #23415. Physical-device route/prototype and its access ask: #23414. The seeded debug-auth suite is not advertised as profile-ready. No physical-device run, paid submission or production API/data access occurred.

A separate real-time iOS stress run exposed a live-transcript geometry read during layout. Its stack and owner request are retained in PROGRESS.md for the lag-fix lane; the virtual-frame gate suppresses no framework exceptions.

UI-Evidence: none -- test infrastructure; no shipped UI change.

🤖 Generated with Claude Code

Git-on-my-level and others added 16 commits October 23, 2026 21:59
Repair the historical source link exposed by agent-doc-reference preflight.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use three seeded CI trials per compile and three fresh processes locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Write host scorecards without a VM-service-only trace call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the original budget provenance while the companion device PR appends its route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 24, 2026 02:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T11:25:58.476468Z 724e028 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
…capture is off

#23419 (production-shell perf gate) carries the same host-harness changes
this PR made (semantics off, per-phase split) and more, in the same four
integration_test/perf files, so drop them here to avoid a conflict. The
device-capture how-to moves to app/docs/performance.md.

LagInputScope's callbacks now return at once unless Debug logs capture is
on, and turning capture off forgets an in-flight gesture. The global
listener is annotated for #23415's global-input-listener ratchet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
#23419's production-shell gate fingerprints all of main.dart and copies its
telemetry field and builder chain into a generated shell, so new root
wrappers in main.dart (LagInputScope, _LagHomeTabListener) would make the
shell stale and could not compile there. Take main.dart back to main.

- MobilePerformanceTelemetry builds its own LagRecorder and writes through
  the emit main.dart already passes; each lag event names itself in an
  'event' field (lag_report.py reads both shapes).
- Pointers come from GestureBinding's global pointer route: no widget, and
  it runs before the arena sweep that fires onTap. A drag past touch slop
  is a scroll, with an 800 ms tail after lift for the fling; one tracked
  pointer at a time.
- The Home tab comes from a one-line hook in HomeProvider.setIndex.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 24, 2026
* perf(harness): on-device lag capture and production-condition host runs

The host interaction harness could not see the lag David feels: host
flutter test cannot raster, its timings swung 5-10x between runs, and it
ran with semantics on, unlike production. Routine render telemetry was
removed from PostHog on 2026-10-17, so the device signal stays local.

- LagRecorder (lib/utils/analytics/lag_recorder.dart), fed by the existing
  MobilePerformanceTelemetry frame-timings callback while Settings ->
  Developer -> Debug logs is on: per surface (routeToPage page type or Home
  tab) frame counts over 16.7/33.3/100 ms, build- vs raster-bound, slow
  frames while scrolling / after a tap / idle; worst frames with
  wall-clock time; tap-to-frame latency including the tap handler's sync
  work; and UI-isolate stalls from a 250 ms watchdog that runs only while
  capture is on. Writes mobile_lag_* events to the local debug log; a
  report on every background and every ~18k frames.
- app/tool/lag_report.py turns a shared debug log into a ranked table.
- Integration perf scenarios run with semantics off (PERF_SEMANTICS=1 to
  opt back in) and report a per-phase UI split from FlutterTimeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(harness): leave the host harness to #23419; gate lag input when capture is off

#23419 (production-shell perf gate) carries the same host-harness changes
this PR made (semantics off, per-phase split) and more, in the same four
integration_test/perf files, so drop them here to avoid a conflict. The
device-capture how-to moves to app/docs/performance.md.

LagInputScope's callbacks now return at once unless Debug logs capture is
on, and turning capture off forgets an in-flight gesture. The global
listener is annotated for #23415's global-input-listener ratchet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* perf(harness): capture lag input without touching main.dart

#23419's production-shell gate fingerprints all of main.dart and copies its
telemetry field and builder chain into a generated shell, so new root
wrappers in main.dart (LagInputScope, _LagHomeTabListener) would make the
shell stale and could not compile there. Take main.dart back to main.

- MobilePerformanceTelemetry builds its own LagRecorder and writes through
  the emit main.dart already passes; each lag event names itself in an
  'event' field (lag_report.py reads both shapes).
- Pointers come from GestureBinding's global pointer route: no widget, and
  it runs before the arena sweep that fires onTap. A drag past touch slop
  is a scroll, with an 800 ms tail after lift for the fling; one tracked
  pointer at a time.
- The Home tab comes from a one-line hook in HomeProvider.setIndex.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 3 commits October 24, 2026 18:01
--check embedded a SHA256 of all of main.dart, so any main.dart edit failed
mobile-perf-shell-fidelity and app/test.sh until the shell was regenerated.
Hash the mirrored content only (copied imports, telemetry field, builder
chain): a reintroduced app-wide wrapper such as a held ensureSemantics()
holder still turns the gate red, while unrelated main.dart edits stay
green. The drift failure still names the regenerate command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merging origin/main brought #23494's catch-up display floor: a WAL with a
never-set device clock no longer stretches the catch-up range, so the
device_page fixture (timerStart: 1) now renders the no-range card path and
measures 3869 rebuilds / 2405 layouts, deterministically over the old
3449/2050 baseline. Verified locally: reverting only #23494's card restores
3449/2050, and plausible fixture timestamps also restore it, so the delta
is exactly that intentional production rendering, not added per-frame work
in this branch.

Re-baseline only device_page with the same initial-calibration formula
(ceil(baseline*1.1)+10): rebuilds 3804->4266, layouts 2265->2656. The
ratchet still passes (main carries no _gate caps; these remain initial
values), and the other seven scenarios measure identical to their
pre-merge baselines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 70a78b3 into main Oct 24, 2026
54 of 56 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/perf-gate branch October 24, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant