Repository navigation
fix(app): report only real crashes as fatal; keep known People stats when a scan is truncated - #20428
Conversation
Failure-Class: new Classify zone and platform errors at the full-boot boundary so runtime errors remain reported without inflating fatal-crash counts. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Failure-Class: FC-dropped-derived-future-rethrows-handled-error Consume speaker-save bookkeeping errors separately from caller futures, and observe best-effort capture work without duplicate zone errors. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Failure-Class: none Carry truncation metadata through People refreshes, preserve cached aggregates without discarding fresh person data, and disclose partial counts. Home's stats-less fetch must not erase those cached aggregates. This is a wire-metadata/cache completeness defect, distinct from the startup severity and detached-future classes in the other commits. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Log exception types rather than arbitrary messages that could contain response data. Future observation and caller behavior stay unchanged. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Keep the inert visual fixtures compiling against PeopleListResponse, without changing their seeded data or launching device audits. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Integrate dd694cc without rewriting this lane's commits. Preserve upstream localization changes and reapply peopleStatsIncomplete through the localization tool so the final PR can merge cleanly. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Failure-Class: FC-dropped-derived-future-rethrows-handled-error Report detached Process Now and People refresh failures once without leaking zone errors or exception contents. Attach refresh reporting only when creating the deduplicated future, and contain telemetry failures. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…orting Integrate #20376 without rewriting the lane's commits, retaining the bounded detached-work error reporters and People truncation behavior. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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. |
There was a problem hiding this comment.
7 issues found across 133 files
Confidence score: 3/5
- In
main.dart, the Crashlytics origin key can carry over to later unrelated crashes, so they may be labeleduncaught_asyncorboot. Clear or scope the key after reporting the original error. - In
main.dart, post-boot errors reported as non-fatal still updateAppReviewBadExperience.fatalError, which can skew the fatal-error signal. Only record that timestamp for fatal reports. - In
people_list.dart, filtering out all rows can hide the incomplete-count notice even while_filtersstill shows counts fromprovider.people. Gate the notice on the counts being shown, not just the filtered rows. - In
capture_provider_test.dart, reusingsuggested-bmeans the test can skip the refresh-joining path because the person is already cached. Use a fresh ID or clear the cache before the case.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/lib/pages/settings/widgets/people_list.dart">
<violation number="1" location="app/lib/pages/settings/widgets/people_list.dart:230">
P2: The notice is gated on filtered `people`, but `_filters` still shows counts from `provider.people`; when a query or filter removes every row, those counts can remain incomplete without any warning. Gate the notice on `provider.people.isNotEmpty` so it remains visible while source people exist.</violation>
</file>
<file name="app/lib/main.dart">
<violation number="1" location="app/lib/main.dart:182">
P2: Post-boot zone/platform errors are now reported to Crashlytics with `fatal: false`, but `_reportBootCrash` still records `AppReviewBadExperience.fatalError` unconditionally for every report. That timestamp is consumed by `AppReviewPolicy` (app_review_policy.dart:78) as a too-recent bad experience, so a non-fatal runtime error now suppresses app review prompting exactly like a real crash, which contradicts this PR's fatal/non-fatal split. Gate the bad-experience recording on the `fatal` flag so only true crashes affect the review policy.</violation>
<violation number="2" location="app/lib/main.dart:213">
P2: `setCustomKey` leaves this origin on subsequent Crashlytics events, so a later unrelated Flutter or native crash can be labeled `uncaught_async` or `boot` from an earlier error. Clear or otherwise scope the key after reporting so later events do not inherit stale origin metadata.</violation>
</file>
<file name="app/test/providers/capture_provider_test.dart">
<violation number="1" location="app/test/providers/capture_provider_test.dart:1035">
P2: This event reuses `suggested-b`, which the preceding test leaves in `cachedPeople`, so it skips the refresh-joining path. Use a fresh person ID or clear the cached people before this case to ensure it actually tests observer deduplication.</violation>
</file>
<file name="app/test/support/crashlytics_recorder.dart">
<violation number="1" location="app/test/support/crashlytics_recorder.dart:18">
P3: This Firebase-core fake duplicates the implementation in `device_provider_disconnect_telemetry_test.dart`, so future changes to the mock response must be kept in sync. Update that test to use this shared fake.</violation>
</file>
<file name="app/lib/l10n/app_localizations_fr.dart">
<violation number="1" location="app/lib/l10n/app_localizations_fr.dart:12398">
P3: “Les comptes” can read as user or financial accounts here rather than aggregate counts. Use “Les chiffres peuvent être incomplets.”</violation>
</file>
<file name="app/lib/l10n/app_localizations_vi.dart">
<violation number="1" location="app/lib/l10n/app_localizations_vi.dart:12291">
P3: “Số đếm” sounds unnatural for statistical counts in Vietnamese; use “Số liệu có thể chưa đầy đủ.”</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| children: [ | ||
| ...widget.leading, | ||
| _filters(provider), | ||
| if (provider.statsTruncated && people.isNotEmpty) |
There was a problem hiding this comment.
P2: The notice is gated on filtered people, but _filters still shows counts from provider.people; when a query or filter removes every row, those counts can remain incomplete without any warning. Gate the notice on provider.people.isNotEmpty so it remains visible while source people exist.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/pages/settings/widgets/people_list.dart, line 230:
<comment>The notice is gated on filtered `people`, but `_filters` still shows counts from `provider.people`; when a query or filter removes every row, those counts can remain incomplete without any warning. Gate the notice on `provider.people.isNotEmpty` so it remains visible while source people exist.</comment>
<file context>
@@ -227,6 +227,15 @@ class _PeopleListState extends State<PeopleList> {
children: [
...widget.leading,
_filters(provider),
+ if (provider.statsTruncated && people.isNotEmpty)
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: OmiSpacing.xs),
</file context>
| if (provider.statsTruncated && people.isNotEmpty) | |
| if (provider.statsTruncated && provider.people.isNotEmpty) |
| } else { | ||
| await crashlytics.recordError(error, stack, fatal: true); | ||
| try { | ||
| await crashlytics.setCustomKey('error_origin', errorOrigin); |
There was a problem hiding this comment.
P2: setCustomKey leaves this origin on subsequent Crashlytics events, so a later unrelated Flutter or native crash can be labeled uncaught_async or boot from an earlier error. Clear or otherwise scope the key after reporting so later events do not inherit stale origin metadata.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/main.dart, line 213:
<comment>`setCustomKey` leaves this origin on subsequent Crashlytics events, so a later unrelated Flutter or native crash can be labeled `uncaught_async` or `boot` from an earlier error. Clear or otherwise scope the key after reporting so later events do not inherit stale origin metadata.</comment>
<file context>
@@ -195,7 +209,10 @@ Future<void> _reportBootCrash(String kind, Object error, StackTrace? stack, {Flu
} else {
- await crashlytics.recordError(error, stack, fatal: true);
+ try {
+ await crashlytics.setCustomKey('error_origin', errorOrigin);
+ } catch (_) {}
+ await crashlytics.recordError(error, stack, fatal: fatal);
</file context>
| SpeakerLabelSuggestionEvent(speakerId: 0, personId: 'suggested-a', personName: 'A', segmentId: 'seg-a')); | ||
| expect(actions.setPeopleCallCount, 1); | ||
| provider.onMessageEventReceived( | ||
| SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'suggested-b', personName: 'B', segmentId: 'seg-b')); |
There was a problem hiding this comment.
P2: This event reuses suggested-b, which the preceding test leaves in cachedPeople, so it skips the refresh-joining path. Use a fresh person ID or clear the cached people before this case to ensure it actually tests observer deduplication.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/test/providers/capture_provider_test.dart, line 1035:
<comment>This event reuses `suggested-b`, which the preceding test leaves in `cachedPeople`, so it skips the refresh-joining path. Use a fresh person ID or clear the cached people before this case to ensure it actually tests observer deduplication.</comment>
<file context>
@@ -927,6 +979,111 @@ void main() {
+ SpeakerLabelSuggestionEvent(speakerId: 0, personId: 'suggested-a', personName: 'A', segmentId: 'seg-a'));
+ expect(actions.setPeopleCallCount, 1);
+ provider.onMessageEventReceived(
+ SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'suggested-b', personName: 'B', segmentId: 'seg-b'));
+ expect(actions.setPeopleCallCount, 1);
+ first.completeError(sentinel, deterministicStack);
</file context>
| SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'suggested-b', personName: 'B', segmentId: 'seg-b')); | |
| SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'joining-suggestion-person', personName: 'B', segmentId: 'seg-b')); |
| Future<void> _reportBootCrash(String kind, Object error, StackTrace? stack, {FlutterErrorDetails? details}) async { | ||
| final StartupErrorRouter _startupErrorRouter = StartupErrorRouter( | ||
| report: (error, stack, {required fatal, required origin}) { | ||
| unawaited(_reportBootCrash('platform_error', error, stack, fatal: fatal, errorOrigin: origin)); |
There was a problem hiding this comment.
P2: Post-boot zone/platform errors are now reported to Crashlytics with fatal: false, but _reportBootCrash still records AppReviewBadExperience.fatalError unconditionally for every report. That timestamp is consumed by AppReviewPolicy (app_review_policy.dart:78) as a too-recent bad experience, so a non-fatal runtime error now suppresses app review prompting exactly like a real crash, which contradicts this PR's fatal/non-fatal split. Gate the bad-experience recording on the fatal flag so only true crashes affect the review policy.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/main.dart, line 182:
<comment>Post-boot zone/platform errors are now reported to Crashlytics with `fatal: false`, but `_reportBootCrash` still records `AppReviewBadExperience.fatalError` unconditionally for every report. That timestamp is consumed by `AppReviewPolicy` (app_review_policy.dart:78) as a too-recent bad experience, so a non-fatal runtime error now suppresses app review prompting exactly like a real crash, which contradicts this PR's fatal/non-fatal split. Gate the bad-experience recording on the `fatal` flag so only true crashes affect the review policy.</comment>
<file context>
@@ -176,7 +177,20 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
-Future<void> _reportBootCrash(String kind, Object error, StackTrace? stack, {FlutterErrorDetails? details}) async {
+final StartupErrorRouter _startupErrorRouter = StartupErrorRouter(
+ report: (error, stack, {required fatal, required origin}) {
+ unawaited(_reportBootCrash('platform_error', error, stack, fatal: fatal, errorOrigin: origin));
+ },
+);
</file context>
| } | ||
| } | ||
|
|
||
| class _CrashlyticsCapableFirebaseCore implements TestFirebaseCoreHostApi { |
There was a problem hiding this comment.
P3: This Firebase-core fake duplicates the implementation in device_provider_disconnect_telemetry_test.dart, so future changes to the mock response must be kept in sync. Update that test to use this shared fake.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/test/support/crashlytics_recorder.dart, line 18:
<comment>This Firebase-core fake duplicates the implementation in `device_provider_disconnect_telemetry_test.dart`, so future changes to the mock response must be kept in sync. Update that test to use this shared fake.</comment>
<file context>
@@ -0,0 +1,64 @@
+ }
+}
+
+class _CrashlyticsCapableFirebaseCore implements TestFirebaseCoreHostApi {
+ @override
+ Future<PigeonInitializeResponse> initializeApp(
</file context>
| } | ||
|
|
||
| @override | ||
| String get peopleStatsIncomplete => 'Les comptes peuvent être incomplets.'; |
There was a problem hiding this comment.
P3: “Les comptes” can read as user or financial accounts here rather than aggregate counts. Use “Les chiffres peuvent être incomplets.”
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/l10n/app_localizations_fr.dart, line 12398:
<comment>“Les comptes” can read as user or financial accounts here rather than aggregate counts. Use “Les chiffres peuvent être incomplets.”</comment>
<file context>
@@ -12393,4 +12393,7 @@ class AppLocalizationsFr extends AppLocalizations {
}
+
+ @override
+ String get peopleStatsIncomplete => 'Les comptes peuvent être incomplets.';
}
</file context>
| String get peopleStatsIncomplete => 'Les comptes peuvent être incomplets.'; | |
| String get peopleStatsIncomplete => 'Les chiffres peuvent être incomplets.'; |
| } | ||
|
|
||
| @override | ||
| String get peopleStatsIncomplete => 'Số đếm có thể chưa đầy đủ.'; |
There was a problem hiding this comment.
P3: “Số đếm” sounds unnatural for statistical counts in Vietnamese; use “Số liệu có thể chưa đầy đủ.”
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At app/lib/l10n/app_localizations_vi.dart, line 12291:
<comment>“Số đếm” sounds unnatural for statistical counts in Vietnamese; use “Số liệu có thể chưa đầy đủ.”</comment>
<file context>
@@ -12286,4 +12286,7 @@ class AppLocalizationsVi extends AppLocalizations {
}
+
+ @override
+ String get peopleStatsIncomplete => 'Số đếm có thể chưa đầy đủ.';
}
</file context>
| String get peopleStatsIncomplete => 'Số đếm có thể chưa đầy đủ.'; | |
| String get peopleStatsIncomplete => 'Số liệu có thể chưa đầy đủ.'; |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fab4dcaa6a
ℹ️ 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".
| unawaited(PhysicalQualification.runtimeEvent('first_frame_callback')); | ||
| }); | ||
| } | ||
| if (!PhysicalQualification.enabled) _startupErrorRouter.completeStartup(); |
There was a problem hiding this comment.
Mark startup complete only after runApp returns
In the normal _start path, if runApp throws synchronously while attaching the root widget or scheduling the first frame, the app never starts, but completeStartup() has already flipped the router state. The surrounding guarded zone therefore reports this genuine boot failure with fatal: false and origin uncaught_async; move the completion boundary until after runApp returns so failures that prevent startup remain fatal.
Useful? React with 👍 / 👎.
| try { | ||
| await crashlytics.setCustomKey('error_origin', errorOrigin); | ||
| } catch (_) {} |
There was a problem hiding this comment.
Avoid persisting per-report origin as a custom key
setCustomKey changes process-wide Crashlytics state rather than metadata scoped to the following recordError call. After any routed Dart error, later Flutter or native crashes therefore inherit error_origin=boot or uncaught_async, and concurrent unawaited reports can overwrite the key before an earlier report is recorded; this makes origin attribution inaccurate and means native crash metadata is no longer unaffected.
Useful? React with 👍 / 👎.
| children: [ | ||
| ...widget.leading, | ||
| _filters(provider), | ||
| if (provider.statsTruncated && people.isNotEmpty) |
There was a problem hiding this comment.
Keep the truncation warning visible for empty filtered results
When a stats-derived filter such as “Not Heard” has no matches, _visible(provider) is empty and this condition hides the truncation warning even though provider.people still contains a partial result set. The page then presents “No matching people” as if the empty filter result were authoritative, while an incomplete scan may be exactly why matches are absent; base the nonempty check on the unfiltered provider list instead.
Useful? React with 👍 / 👎.
Summary
One Flutter-only PR: reserve fatal Dart reports for failed startup, observe detached future branches, and preserve cached People stats when the server reports a truncated scan.
Part 1 — startup-aware error classification
Part 2 — dropped-future audit
Audited and fixed these exposed branches:
capture_process_now: <exception type>, forwarding the stack but not message contents; scheduling/in-flight semantics remain unchanged. Explicitthen<void>permits the async reporting continuation without a Future catchError type mismatch.capture_people_refresh_suggestion: <exception type>as non-fatal; joined suggestions cannot duplicate the report, and reset/rescheduling remains unchanged.capture_people_refresh_segments: <exception type>. A suggestion joining a segment-owned refresh keeps the original single observer.Tests and evidence:
Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 3908 -> 3925 | Seventeen net lines observe and report the three detached-work sites through one guarded non-fatal helper; extracting capture orchestration would widen this targeted future-propagation fix.
Part 3 — truncated People stats
Tests and evidence:
Desktop/web inspection
Product invariants affected
INV-DATA-1: main.dart changes preserve all existing Firebase/API routing authorities. This is diagnostics-only, not a data-plane migration. PhysicalQualification paths are unchanged.
Failure class (fixes)
Failure-Class: new
Adds FC-nonterminating-dart-error-reported-as-crash with a shared startup policy and Firebase-free routing contract tests. No existing class covers nonterminating runtime Dart errors being counted as crashes; FC-dropped-derived-future-rethrows-handled-error instead covers duplicate unhandled errors from detached derived futures, and FC-retired-transaction-treated-as-fatal concerns Firestore retry semantics.
Part 2 commit declares FC-dropped-derived-future-rethrows-handled-error. Only one new definition is added; no existing definition is modified.
Final verification
git diff --name-only origin/main HEADlists only this PR's 133 files (the prior 132 plus the new Crashlytics test recorder); all upstream-only WAL files/tests/changelog match origin/main exactly. No restore or amend was needed.TZ=UTC flutter testacross 21 affected/guard files passed all 356 tests (exit 0), including this PR's 14 changed test files, upstream capture transcript/WAL tests, and boot/HTTP-pool/speaker-summary guards. Analyzer ratchet passed; localization consistency passed for 49 locales and 3635 keys; formatter checked 30 authored non-generated Dart files with zero changes. Logs: .agent-briefs/review-merged-tests.log, review-merged-analyze.log, review-merged-l10n.log, review-merged-format.log. The full app suite was not rerun in this continuation; earlier full-suite results remain historical.scripts/pr-preflight --suggestrequires INV-DATA-1 only.OMI_PR_BODY_FILE=$PWD/.agent-briefs/pr-body.md make preflightpassed (exit 0, 25 checks; review-make-preflight.log). The exact requested realgit-PATHscripts/pr-preflight --pr-body-file .agent-briefs/pr-body.mdgate passed (exit 0, 25 checks); .agent-briefs/preflight.log ends withPR preflight passed: 25 checks in 378.29s.Both gates measured base 159df54 and 133 PR files. The shallow-history 90-day failure-class guard skipped as before; size/function notices were advisory, with no failures. Working tree clean; no new tracked changes arose from verification.Generated with Devin
🤖 Generated with Claude Code