Repository navigation
perf(app): cut real-time waits from the app test suite (Dart Analyze & Tests overruns its 30m budget) - #23922
Merged
Merged
Conversation
"Dart Analyze & Tests" (mobile-app-checks.yml) overruns its 30-minute timeout on app-touching PRs with zero test failures: #23918 cancelled at 30m16s/30m18s, #23900 passed only on rerun, and main's nightly run is already 27m47s. Per-file timing from the nightly and cancelled-run logs shows the flutter-test span (22m15s on main) is dominated by real event-loop waits, not CPU or test failures. Remove the waits without touching any assertion: - visual_audit harness settle(): 6x80ms real turns -> 6x20ms. The number of event-loop turns is what flushes loopback I/O; the per-turn length was 20-80x the actual loopback RTT. Suite wall (local): 196s -> 75s. - perf gate (production_shell_gate_test): the two outside-the-window settle waits 250ms -> 80ms (27 tests x 3 trials), and drainFixtureIo turns 5x20ms -> 5x8ms (it runs inside every scroll fling iteration of the measured scenarios). Deterministic work-count budgets unchanged. - conversation_playback_sync_test _flushPlatform: 6x30ms -> 6x10ms per flush (70 flushes per run); mock channel replies complete on the microtask queue. - plans_sheet_l10n_test: replace the O(n^2) nested-where duplicate-key scan with a map count. Same duplicates found; 15.5s -> ~50ms. - omi_ring_custody_test: _settle 50ms -> 12ms (probe/opt-in chains settle on microtasks), and the lost-ENABLE-ack test now injects a 200ms enable-ack window and waits 400ms instead of sleeping 6s for the production 5s give-up window. - limitless_golden_test: inject 10ms setup/reconnect settle windows via new LimitlessDeviceConnection params (defaults identical to the old constants); four tests each spent ~4s in the real 1s+1s connect settle windows. - capture_transcript_coverage_test: poll granularity 50ms -> 15ms (settleFiles/walsReach/telemetryReaches wait for real file I/O that completes in ms). Two production seams are added, both default-identical to the constants they replace (LimitlessDeviceConnection setup/reconnect settle, OmiDeviceConnection enable-ack timeout); only tests pass shorter values. The remaining job time is structural: ~800 suites' load/compile on a 4-vCPU runner at flutter test's default concurrency. Raising it needs either the spine-pinned test.sh invocation (contracts/spine/runners.json, immutable by check_spine_contracts.py) or the workflow file — both outside this PR's scope. No .github/ changes. Local verification (m5, nice -19): visual_audit 196s -> 75s, perf gate 74s -> 60s leaf time, playback sync 46s -> 41s, coverage 20s -> 7s, limitless 20s -> 4s, ring custody 15s -> 4s, l10n 19s -> 3s; full `bash test.sh` green. Failure-Class: none
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Dart Analyze & Tests job (mobile-app-checks.yml, 30-minute timeout) now overruns on app-touching PRs with zero test failures: #23918 was cancelled twice (30m16s / 30m18s, the second mid-
conversation_playback_sync_test.dart), #23900 passed only on rerun, and main's nightly run is already 27m47s — one app PR away from the cap, which is why Mobile Release Eligibility fails with it.Per-file timing parsed from the nightly (green main) and cancelled PR run logs shows the flutter-test span (22m15s on main) is dominated by real event-loop waits, not CPU and not failing tests. This PR removes those waits — every assertion and every count is unchanged — and lets
app/test.shoverlap the remaining waits across suites. No.github/changes (the timeout/sharding stay David's call).What was slow (exclusive per-suite time, CI logs)
test/visual_audit/visual_audit_smoke_test.dart(137s)settle()= 6×80 ms real turns, ~500 callstest/perf/production_shell_gate_test.dart(45–78s)drainFixtureIo5×20 ms inside every scroll flingtest/widgets/conversation_playback_sync_test.dart(16–31s)_flushPlatform6×30 ms × 70 callstest/unit/plans_sheet_l10n_test.dart(13–16s)whereduplicate-key scan, one test = 15.5stest/unit/limitless_golden_test.dart(13s)test/unit/omi_ring_custody_test.dart(12–13s)_settle()50 ms × ~50test/services/capture/capture_transcript_coverage_test.dart(23s)Production seams (defaults identical)
Two injectable durations with values bit-identical to the constants they replace; only tests inject shorter ones:
LimitlessDeviceConnection:setupSettleDelay(1s) /reconnectSettleDelay(400ms) — firmware settle windows.OmiDeviceConnection:enableAckTimeout(5s) — custody opt-in give-up window.What is left (out of scope here, needs David)
After these cuts the job's remaining time is structural: ~800 suites' compile/load at
flutter test's default concurrency (CPU count = 4 on the CI runner), while suite wall time is mostly real waiting — 586 s of the nightly's span sits in 1–5 s silent gaps a higher concurrency would absorb. The levers are outside app code: the spine runner contract pinsapp/test.sh'sflutter testinvocations verbatim (contracts/spine/runners.json, enforced bycheck_spine_contracts.py), andflutter testignoresdart_test.yaml, so a concurrency floor needs a runners.json policy change or a workflow edit (-jon the job's test.sh call, sharding, or a timeout bump). Suite growth is also real: 777 → 800 suites in one day on main.Verification
nice -n 19, flutter 3.44.5 = CI pin); numbers above.bash test.sh --reporter expandedgreen locally (exact CI harness, upstream test.sh): 11m59s wall, 8019 passed, 9 skipped on an 18-core m5.Product invariants affected
INV-CAP-1 —
app/test/services/capture/capture_transcript_coverage_test.dartandapp/lib/services/devices/connectors/omi_connection.dartfall under the pendant-audio-retention glob. No retention behavior changes: the coverage suite's assertions and its condition-based polls are untouched (only the 50ms→15ms poll granularity shrinks), and the custody enable-ack timeout stays 5s in production — only tests inject the shorter window.Failure-Class: none
UI-Evidence: none -- app/lib changes are two injectable Duration constructor params with defaults identical to the replaced constants; no widget, page, or behavior changes.
Line-Count-Exception: app/lib/services/devices/connectors/limitless_connection.dart | 2225 -> 2237 | adds the two injectable test settle-window Duration params (defaults identical to the replaced constants) that let the golden tests stop sleeping through the real 1s firmware windows