Repository navigation
perf(mobile): WAL index scales with changes, live transcript/Tasks first build, device perf harness - #23859
Merged
Conversation
…aunch
HOST_GUARD is empty on every physical-device run, and macOS /usr/bin/env bash
(3.2) treats "${HOST_GUARD[@]}" of an empty array as unbound under set -u, so
every physical iPhone batch failed before receipt 1. Expand it only when set.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
On an iPhone 15 Pro Max (iOS 27.0.1) about one frame in seven starts building ~0.85 ms before its recorded vsync, so FrameTiming.totalSpan (raster finish - vsync) is negative. Total p50/p90 were contaminated in every window, and cold_start's p50 went negative, failing report validation for every batch. Measure total from the earlier of vsync and build start. This changes the total metric: earlier total percentiles are not comparable; qualify a new baseline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the Way windows Three heavy-profile windows after the unchanged five, for the changes in #23819, #23822 and #23853: - home_live_preview: Home with the live episode row while a scripted on-device preview revises its newest line every 200 ms over a ~1,000-segment session (LivePreviewCoverage on every update and clock tick). - live_episode_page: LiveEpisodePage on the transcript tab over the same session, scrolled while words arrive. - device_settings_on_the_way: Device Settings (Catching up) and On the Way (day-grouped) over the 6,500-WAL backlog, each opened and scrolled. The preview controller is installed through CaptureController.installLivePreview and admitted through LivePreviewController.admit; only the socket admission flag is asserted, since the fixture runs no listen socket. Device Settings gets an interface fake: the production DeviceProvider subscribes to ServiceManager, which this harness never initializes. Reports now require the eight windows; comparisons list windows absent from the reference instead of failing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… idle sync window The field lag log that matters (iPhone 15 Pro Max, 10-26) is 133 main-isolate stalls, mostly on idle Home and around sync phases, with a 71,536-record WAL index. Drawn-frame timings could not see any of it. - HeavyStallProbe: every window reports stalls over 50/100 ms, blocked time and the worst stall from a 20 ms timer's late ticks; reported, never variance-gated. - --synced-wals N (0..80000): adds synced history on top of the pending backlog; such a batch changes the dataset and is never baseline-eligible. - home_idle_sync_refresh: Home left alone while SyncProvider refreshes the inventory five times, as sync phase ends and upload callbacks do. - Runner preflight: refuses a phone that is not on a wired USB connection before the multi-minute build. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Semantics label called previewText() twice per 1 s rebuild; each call runs LivePreviewCoverage.uncovered over every final segment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rame stays cheap Measured on an iPhone 15 Pro Max (heavy profile harness): - Opening LiveEpisodePage on the transcript tab took one 153 ms layout with 1,775 builds (140-157 ms every run) and peaked RSS at 612 MB: following the latest jumped to maxScrollExtent on a variable-height lazy list, laying out every row. TranscriptWidget now anchors layout at the newest segment; a 1,000-segment open builds 9 rows and lands on the newest. - Preview revisions (every ~200 ms) no longer rebuild the transcript or rescan final history: LivePreviewCoverage prepares merged final spans once per transcript snapshot and answers each line by binary search, same results. - The first Tasks tab switch spent 128 ms in one build (240-319 ms frame): ActionItemsPage now uses one lazy delegate across date sections, deferring offscreen sorting, headers and rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecord ever kept A heavy phone's index held 71,536 records (66,222 synced). Its lag watchdog logged 133 main-isolate stalls over ~10 h (24 s blocked, worst 1.6 s), mostly on idle Home and ~20x more often right after sync phases and uploads. Every index save copied, keyed and fingerprinted every record on the main isolate and copied the full List<Wal> into an encoding isolate; sync screens rescanned the inventory on every notify; reconcile polled ~2/s after a reconnect. - Saves: Wal persisted-field setters mark dirty identities; a long-lived index worker owns the serialized rows and receives only changed JSON maps and removed tokens. Durable is acknowledged only after flush + atomic rename; failed deltas are retained and retried. No whole-index fingerprint. - Load: decode and Wal construction run off-isolate; the worker seeds unchanged rows from disk, so the first save sends zero unchanged records. - Format: unchanged version-1 wals.json, backup and quarantine recovery; retired/foreign/synced records and upload-order tie-breaks preserved. - Views: SyncProvider derives pending/uploaded/attention/refusal lists and per-day totals incrementally (WalDerivedViews); Home, On the Way and Device Settings read them. Integration and widget fakes derive the same views from their raw inventory (WalDerivedSyncViews). - Reconcile: visits uploaded rows only, joins an active pass, spaces passes by 20 s; job backoff, fairness and acknowledgement unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…irst frame The newest-anchored layout needed extra frames for its anchor correction, so a short live transcript (even one segment) was blank on its first frame; capturing_empty_state_test failed 20 of 23. The viewport now measures its anchor and initial latest position during layout, before paint. Short transcripts show immediately; a 1,000-segment open still builds about one screen of rows. The extra pumps added to episodes_ui_test are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bove grow Review finding (GLM): on a short scrollable live transcript, a photo group or an older row growing during a drag or fling changed the newest-anchored viewport's anchor with pixels unchanged, moving every visible row by the inserted height under the reader's finger, and the correction bailed for the whole gesture. The viewport now compensates the leading-edge shift with offset.correctBy in the same layout pass. Regression tests cover short and long histories, photo insertion/growth and older-row growth across drag, fling and idle; first-frame rendering and 1,000-segment laziness still hold. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecover in-session Review findings (GLM) on the delta index worker: - A dead worker isolate (OOM/VM kill) left apply() awaiting forever, wedging every later save and the capture flush queue. Exit/error listeners now fail pending requests and release the queue; the replacement worker is seeded from a full snapshot of the in-memory index, preserving tokens, admitted deltas and every custody bucket. - After loading from the backup because wals.json was corrupt and could not be quarantined, the worker seeded from the corrupt main file and every save failed for the session. Workers now receive the exact source the loader validated; a failed startup retries from memory. - The load-time invalid-entry repair used the legacy whole-file writer on the same wals.json(.tmp) as the live worker with no shared lock. Loading, quarantine/repair, worker seeding and writes now share one lock. Every failure fails closed: no durable acknowledgement before flush + rename. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e grow Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecovery Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion sweep Dated syncedAt stamps were older than the synced-copy retention cutoff, so the startup sweep removed all seeded synced records and Home saw only the pending backlog. Legacy syncedAt 0 is never auto-removed, matching a long-lived phone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o a part file Keeps transcript.dart under its line-count ratchet (1590) after the newest-anchored viewport landed; no behavior change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ider stand-ins Co-Authored-By: Claude Opus 5.5 <[email protected]>
Attribution-only runs (never baselines) enable debugProfileBuildsEnabled so a slow first build, such as the first Tasks switch, names its widget in the trace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… rows Device regression (iPhone 15 Pro Max, 3 runs before/after): opening a saved conversation's transcript and flinging it went from 0/101/100 ms of main-isolate stalls per run to 223/257/116 ms. The trace put ~15% of samples in _TranscriptPlaybackScrolling._reportTopVisibleSegment, which walked the sliver tree on every scroll notification. Sliver discovery is now cached, each sliver needs one reveal calculation, and remaining row positions use existing layout offsets; first-frame layouts and reveal calls per frame are unchanged from 120 to 1,200 rows (test). Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict in live_preview_coverage.dart: keep main's settled-tail and untimed-grace semantics, prepared once per final snapshot so the live transcript view can reuse it across preview revisions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PostHog mobile-wal-delta-index-off (ops_kill, default false). True makes the next launch save every index change through the pre-delta full-snapshot writer; both writers produce the same version-1 file, so flipping either way needs no migration. Read once per process with a 1 s bound; offline or failed reads keep the delta writer on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level
marked this pull request as ready for review
October 28, 2026 16:10
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.
Why
A heavy phone (iPhone 15 Pro Max) logged 133 main-isolate stalls over about 10 hours. Its WAL index held 71,536 records, 66,222 of them synced.
The device harness measured only drawn frames, used a 6,500-record fixture, and never saw any of this.
What
App: WAL index work now scales with what changed (
perf(sync), plus thefix(sync)round from review)wals.jsonformat, backup and quarantine handling are unchanged.mobile-wal-delta-index-off(ops_kill, default false, registered inconfig/feature-flags.yaml). True makes the next launch save through the pre-delta full-snapshot writer; both writers produce the same file, so either flip needs no migration. Read once per launch with a 1 s bound; offline or failed reads keep the delta writer on.App: live transcript and Tasks (
perf(mobile)x2, plus thefix(mobile)round from review)Harness (
test(mobile-perf), plus thefix(mobile-perf)rounds)home_live_preview,live_episode_pageanddevice_settings_on_the_way.home_idle_sync_refresh.HeavyStallProbe).--synced-wals Nruns a field-shaped diagnostic; it is never eligible as a baseline.Review
Evidence
flutter test --no-pub test/services test/providers test/unit test/pages test/perf test/widgets test/spine: 7,327 passed, 4 skipped, 0 failed (merged head).--synced-wals 65000), 3 runs before vs 3 after. Main-isolate blocked time over 100 ms per run:test/unit/knowledge_graph_prebuild_test.dartfailed once under full-suite load and passes 3/3 in isolation on this branch and on the untouched tree (no knowledge-graph code changed)./Volumes/scratch/mobile-heavy-profile/2026-10-28-*(scratch, not committed).UI-Evidence: none -- no visual change intended; transcript, Tasks and the live row render the same layout, with laziness, anchoring and caching changes only
Product invariants affected
mobile-wal-delta-index-offkill switch restores the previous full-snapshot writer without a release; worker death, unseedable index and repair writes fail closed (no false durable ack) and recover in-session without losing admitted deltas. No capture, uplink or frame path changed.Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code