Skip to content

Perf: deterministic mobile interaction harness + UI-thread jank fixes (home/detail/chat) - #21323

Merged
Git-on-my-level merged 4 commits into
mainfrom
perf/mobile-interaction-harness
Oct 12, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
perf/mobile-interaction-harness

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Deterministic mobile interaction performance harness + two verified UI-thread jank fixes + one blocker fix the harness/review loop caught.

What

  1. Perf harness (add-only) — app/integration_test/perf/ + driver app/tool/perf_harness.sh: four seeded scenarios (home_scroll, detail_scroll, memory_scroll, chat_tap) running the real production pages/providers against the hermetic loopback fixture backend. Produces a JSON scorecard per scenario: FrameTiming p50/p90/p95/p99 (build/raster/total), jank %, top app rebuilders with source files, ticker census, build-bound vs raster-bound janky-frame split. A budget gate group asserts per-scenario p90 against budgets.json; budgets only move with accepted, verified wins. Lane: host flutter-tester (UI-thread visibility; GPU raster not measured — documented in the README).
  2. perf: isolate transcript highlight from list rebuilds — detail transcript no longer rebuilds the whole list to move the playback highlight; per-line ValueNotifier consumption instead. detail_scroll p90 22.7→15.5 ms, jank 26.9%→8.2%.
  3. perf: scope chat rebuilds to the message that changed — mic/send swap listens to the text controller locally; existing transcript rows stay mounted across append/in-place edits. Typing frames 31–33→17 ms; chat_tap p90 39.8→29.0 ms.
  4. fix: unique chat row identity for duplicate placeholder message ids — failed replies share placeholder id 0000; the new row-relocation callback resolved by id lookup, so two mounted failed replies collided in the sliver relocation map on older-history prepend, corrupting/dropping a failed-reply row and its Try Again surface. Rows are now keyed by id (persisted) / ObjectKey(message) (placeholders); relocation, shouldRebuild, and visibility tracking share one identity. Regression test chat_duplicate_failed_reply_test.dart verified RED on the parent commit, GREEN here.

Measurement (median p90 total-frame ms, host lane, same-session controls)

scenario before after
home_scroll 33.6 17.0
detail_scroll 33.8 16.5
memory_scroll 10.8 6.1
chat_tap 35.0 29.0

Remaining chat residual is the send/navigation frame; home/detail sit at the ~60 fps line on this lane. Accepted via median-of-N improvements ≥10% with no sibling-scenario regression >5%; rejected candidates were restored (log retained out of tree).

Failure-Class

Failure-Class: new

Duplicate placeholder reply identity colliding in sliver child relocation (indexOf-by-id when ids are non-unique).

UI-Evidence

UI-Evidence: none -- behavior-neutral performance work; no visual or interaction changes

Line-Count-Exception

Line-Count-Exception: app/lib/widgets/transcript.dart | 1516 -> 1619 | perf rework inside the frozen widget: playback-highlight follow scope + per-line notifier extracted in place; split was rejected to keep the reviewed diff bytes identical to the CLEAN-reviewed commit

Test plan

  • bash app/tool/perf_harness.sh — gate group + scorecard emission green
  • bash integration_test/journeys/run_journeys.sh — 6/6 journeys incl. negatives
  • cd app && bash test.sh — 5,325 passed, 21 skipped
  • flutter analyze clean on all changed files
  • chat_duplicate_failed_reply_test.dart fails on parent 59bc23eb11 (relocation assertion), passes on this head

View guided diff Turn on auto-fix

Git-on-my-level and others added 4 commits October 12, 2026 09:06
Placeholder replies share id 0000, so loading older history mapped both mounted failed rows onto one sliver index and dropped a Try Again surface.

Co-authored-by: Cursor <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 821b500 into main Oct 12, 2026
39 checks passed
@Git-on-my-level
Git-on-my-level deleted the perf/mobile-interaction-harness branch October 12, 2026 16:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7949fc726a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1581 to +1582
final phase = SchedulerBinding.instance.schedulerPhase;
if (phase == SchedulerPhase.persistentCallbacks || phase == SchedulerPhase.midFrameMicrotasks) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Defer highlight rebuilds instead of dropping them

During a paused transcript fling, ballistic ScrollUpdateNotifications call readerMovedTo while the scheduler is in persistentCallbacks. This branch updates _current but never dirties the line, while _PlaybackFollowScope intentionally skips rebuilding when following is suspended; subsequent notifications are then deduplicated against the already-updated _current. Consequently, the pre-fling line can remain visually highlighted and the settled top line remains unhighlighted until an unrelated parent rebuild. Schedule a post-frame rebuild for this phase rather than returning.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

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-12T16:19:23.352223Z 7949fc7 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.

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