Skip to content

perf(app): cut real-time waits from the app test suite (Dart Analyze & Tests overruns its 30m budget) - #23922

Merged
Git-on-my-level merged 1 commit into
mainfrom
lane/dartci
Oct 28, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
lane/dartci

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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.sh overlap the remaining waits across suites. No .github/ changes (the timeout/sharding stay David's call).

What was slow (exclusive per-suite time, CI logs)

Suite Cause Fix Local wall before → after
test/visual_audit/visual_audit_smoke_test.dart (137s) settle() = 6×80 ms real turns, ~500 calls 6×20 ms (same 6 event-loop turns) 196s → 75s
test/perf/production_shell_gate_test.dart (45–78s) 2×250 ms window guards ×27 tests; drainFixtureIo 5×20 ms inside every scroll fling 80 ms guards; 5×8 ms drains 74s → 60s leaf
test/widgets/conversation_playback_sync_test.dart (16–31s) _flushPlatform 6×30 ms × 70 calls 6×10 ms 46s → 41s
test/unit/plans_sheet_l10n_test.dart (13–16s) O(n²) nested-where duplicate-key scan, one test = 15.5s map count, same duplicates found 19s → 3s
test/unit/limitless_golden_test.dart (13s) 4 tests each ~4s inside the real 1s+1s connect settle windows injected 10 ms settle windows 20s → 4s
test/unit/omi_ring_custody_test.dart (12–13s) one test sleeps 6 s to outlast the 5 s enable-ack give-up; _settle() 50 ms × ~50 injected 200 ms ack window (waits 400 ms); settle 12 ms 15s → 4s
test/services/capture/capture_transcript_coverage_test.dart (23s) 50 ms poll granularity on real file I/O that lands in ms 15 ms polls 20s → 7s

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 pins app/test.sh's flutter test invocations verbatim (contracts/spine/runners.json, enforced by check_spine_contracts.py), and flutter test ignores dart_test.yaml, so a concurrency floor needs a runners.json policy change or a workflow edit (-j on 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

  • Every changed suite green locally (m5, nice -n 19, flutter 3.44.5 = CI pin); numbers above.
  • Full bash test.sh --reporter expanded green locally (exact CI harness, upstream test.sh): 11m59s wall, 8019 passed, 9 skipped on an 18-core m5.
  • CI measurement on this PR (Mobile App Checks run 40769345287, rerun job 123118093458): Dart Analyze & Tests 26m37s, green — 34s checkout, ~4m setup, 22m40s test step, +8024 passed. (A first attempt was cancelled at 30m15s by a 16.5-minute stalled checkout — git HTTP transfer flake, not test time.) Baselines: main nightly 27m47s job / 22m15s test span; fix(mobile-release): held-mode train supersedes a stale pending staged release with the newer pinned build #23918 cancelled twice >30m.
  • Honest ceiling: the 4-vCPU runner sustains ~350 tests/min and is compile-bound, so the wait cuts above (real: −137s/−78s/−31s of exclusive time in the top suites, local suite time ~halved) do not proportionally shrink the saturated CI wall clock. Getting the job under 22 minutes needs the concurrency/sharding/timeout levers named in "What is left" below.
  • Deterministic perf-gate work-count budgets unchanged (gate violations empty).
  • The visual-audit gallery generator (visual_audit.sh) inherits the shorter settle turns; loopback fixture I/O lands in ~1–5 ms, six turns still precede every shot.

Product invariants affected

INV-CAP-1 — app/test/services/capture/capture_transcript_coverage_test.dart and app/lib/services/devices/connectors/omi_connection.dart fall 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

"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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T21:10:42.654163Z 490e731 PR opened
ℹ️ 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
Git-on-my-level merged commit 58110af into main Oct 28, 2026
66 of 68 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/dartci branch October 28, 2026 22:11
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