Repository navigation
fix(app): Finish on the live transcript no longer leaves a black screen after a swipe back - #20375
Conversation
…wipe back Finish awaits the capture's finish and then pops the page. A swipe back during that await pops the route first, but the page stays mounted while it animates out, so the mounted re-check passed and the late pop removed Home, leaving an empty navigator: a black screen until the app was force-quit. The page now pops only while its own route is still the current one. The switch to the conversations tab is kept either way. Adds a regression test that reproduces the timing on the iOS page route, and the failure class FC-late-pop-after-route-left. Fixes BasedHardware#20369
|
Reviewed all four files at 011f1cc — this is a clean, well-scoped fix for #20369. Thanks for the excellent write-up and the deterministic regression test. Per file:
One note for the maintainer merging: the Dart test lanes are skipped on this fork PR, so Leaving for human maintainer review (merge decision plus that pre-merge test run); no blocking concerns from my side. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…0476) ## Summary `main` fails **Dart Analyze & Tests** at 8fb7dc1, so every app PR is red. The analyzer ratchet reports an error-severity diagnostic: ``` RETURN_OF_INVALID_TYPE_FROM_CLOSURE app/test/widgets/capturing_finish_swipe_back_test.dart:120 The returned type 'List<dynamic>' isn't returnable from a 'Future<PeopleListResponse?>' function ``` Two changes collided without a textual conflict: - 677ee83 ("retain known People stats when scans are truncated") changed `PeopleProvider.loadPeople` to return `Future<PeopleListResponse?>`. - f0f2790 (#20375) added this test, which passes `() async => []`. Each was green on its own branch. ## Change The test passes `const PeopleListResponse(people: [])`, the same shape the other People tests use. This is a test-only change; no app code changes. ## Product invariants affected none ## Verification - `flutter analyze` over the whole app: 0 errors. - `flutter test test/widgets/capturing_finish_swipe_back_test.dart`: 2 tests pass. - Seen failing on PR #20474's run 37137363033 (job 111244602814). 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/20476?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
677ee83 changed PeopleProvider.loadPeople to return Future<PeopleListResponse?>, and f0f2790 (BasedHardware#20375) added this test passing `() async => []`. Each was green on its own; together on main (8fb7dc1) the analyzer ratchet fails with RETURN_OF_INVALID_TYPE_FROM_CLOSURE, which fails Dart Analyze & Tests on every app PR. Verification: - flutter analyze (whole app): 0 errors. - flutter test test/widgets/capturing_finish_swipe_back_test.dart: 2 pass.
TL;DR: Tapping Finish on the live transcript and swiping back at about the same moment left the whole app on a black screen until it was force-quit (#20369). The Finish handler's
Navigator.pop()landed after the swipe had already popped the page, so it removed Home and emptied the root navigator. The page now pops only while its own route is still the current one. App only, one line of behaviour, with a regression test that reproduces the timing. No backend change.What changed and why
Fixes #20369.
ConversationCapturingPage._stopConversationawaitsfinishCapture(), re-checksmounted, then pops. A swipe back during that await pops the route first, but the page stays mounted while it animates out (about half a second on the iOS page route), somountedis still true and the pop removes whatever is on top now. That is Home, the only route of the root navigator, and an empty navigator paints black.app/lib/pages/conversation_capturing/page.dart: pop only whenModalRoute.of(context)?.isCurrent. The switch to the conversations tab is kept either way, so Home still lands on the processing row.app/test/widgets/capturing_finish_swipe_back_test.dart: the regression test..github/failure-classes/FC-late-pop-after-route-left.json: the class this is an instance of.app/changelog/unreleased/20261002-capture-finish-swipe-back.json: changelog fragment.No data was lost in the bug: the finish completed and the conversation was processed. It only looked like a crash.
Product invariants affected
none
How it was verified
Expected: exactly one matching candidate / Actual: Found 0 widgets with text "home". With the fix both cases pass.flutter test test/widgets/capturing_finish_swipe_back_test.dart test/widgets/capturing_empty_state_test.dart test/widgets/capturing_wal_backlog_test.dart test/widgets/process_now_conversations_tab_test.dart: 11 passed.bash test.sh: 3,900 passed, 5 skipped, 0 failed.bash scripts/analyze_ratchet.sh: passed.dart format --line-length 120on the two Dart files: no changes.Tests
app/test/widgets/capturing_finish_swipe_back_test.dartpumps the productionConversationCapturingPageon the iOS page route over a Home stand-in, with a capture whose finish resolves when the test says so:Failure class (fixes)
Failure-Class: new
Failure-class transition narrative (only when needed)
New class
FC-late-pop-after-route-left.Navigator.pop()removes whatever route is on top, not the route whose page called it. A page that awaits and then pops assumes it is still on top. A back swipe during the await removes the route first, yet its State stays mounted through the exit transition, so themountedre-check passes and the late pop removes the route beneath.ModalRoute.of(context)?.isCurrent). The guard artifact is the regression test above.FC-continuation-resumed-after-unmount: there the owner is gone and re-checkingmountedis the prevention; heremountedwas re-checked and is true, and the route is what has left. The same await-then-pop shape exists on other pushed pages, which is why this is recorded as a class and not only as an instance.