Skip to content

fix(app): report only real crashes as fatal; keep known People stats when a scan is truncated - #20428

Merged
Git-on-my-level merged 8 commits into
mainfrom
lane/mobile-error-reporting-wave
Oct 3, 2026
Merged

Git-on-my-level merged 8 commits into
mainfrom
lane/mobile-error-reporting-wave

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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

  • Zone and platform-dispatcher handlers use one Firebase-free, process-local StartupErrorRouter. Before a successful full boot, reports remain fatal with error_origin=boot; afterwards they are non-fatal with error_origin=uncaught_async.
  • The full-boot boundary is immediately before normal runApp(MyApp), after successful initialization and boot bookkeeping. Recovery/failure screens never mark full startup complete; retries reset the policy.
  • All existing error reporting is retained. Custom-key failure cannot suppress recordError. FlutterError.onError already uses non-fatal recordFlutterError and is unchanged. Native crash reporting and PhysicalQualification paths are untouched.
  • Tests: flutter test test/unit/startup_error_router_test.dart test/unit/boot_crash_handlers_test.dart test/unit/boot_journal_test.dart test/unit/boot_recovery_test.dart — 20 passed, including 6 new routing tests (pre/post boot, platform true, retry reset, exact error/stack, synchronous classification).
  • Not verified: real Firebase transport, release/device startup, native crashes, or post-release crash-free metrics. No app was launched against a deployed backend.
  • Local commit: 4966903.

Part 2 — dropped-future audit

Audited and fixed these exposed branches:

  • Conversation detail assignment tail: source can throw from reconciliation/feedback callbacks or finalization; an unobserved derived tail can duplicate the caller-observed error. Added ignore() to the bookkeeping tail only; pending still reaches the caller unchanged.
  • Conversation detail rejection tail: ordinary rejection failures are caught, but awaited finalization is outside that catch; the retained tail has no observer unless another save happens. Added ignore() to that tail. Regression injects a throwing refresh override into the real queue-drain/finally boundary; it is not evidence that ordinary production transport rejection escapes.
  • Capture Process Now result branch: dropped error-propagating branch next to an error-safe request listener; also owns asynchronous result/stamping work. Explicit catchError consumes failures and reports once via the existing non-fatal Crashlytics reporter as capture_process_now: <exception type>, forwarding the stack but not message contents; scheduling/in-flight semantics remain unchanged. Explicit then<void> permits the async reporting continuation without a Future catchError type mismatch.
  • Capture speaker-suggestion refresh completion: retained for deduplication but never awaited/observed. One observer per newly created refresh reports capture_people_refresh_suggestion: <exception type> as non-fatal; joined suggestions cannot duplicate the report, and reset/rescheduling remains unchanged.
  • Capture incoming-segment refresh completion: same treatment, reporting capture_people_refresh_segments: <exception type>. A suggestion joining a segment-owned refresh keeps the original single observer.
  • These are terminal operation failures, not a new provider/mode/fail-open substitution, so fallback-telemetry's error-reporter branch applies. Reporter transport failures are contained with type-only logging, without retries or recursive zone errors.
  • Analytics initialization cleanup: safe, unchanged. The original operation catches failures, its failure-health report is guarded, and cleanup only compares identity and resets the field.

Tests and evidence:

  • Six new guarded-zone tests call the real providers/controller, capture harness assertion failures separately, and drain the event queue. Speaker callers still receive their original errors. Both refresh triggers remain deduplicated and reschedule after failure.
  • Before fixes: 98 passed, 6 failed; every new test observed a leaked sentinel error. Log: .agent-briefs/part2-before.log.
  • Broader targeted run: 178 passed across HTTP-pool, capture, speaker-summary, and conversation-detail provider/widget tests. Log: .agent-briefs/part2-after.log.
  • After final diagnostic-observation adjustment: all 104 tests in the three touched test files passed. Log: .agent-briefs/part2-final.log.
  • Formatter and analyzer ratchet passed; narrow analysis reports only existing baseline info.
  • Not verified: real capture/WAL/network flows, native devices, and release telemetry. These are hermetic future-propagation tests, not device E2E.
  • Local commit: b55ca9c. Content-free diagnostic follow-up: 8287faa. Review fix: 1f70dec (type-only non-fatal reporting, exactly-once refresh observation, and contained telemetry failures).
  • Review-fix negative control: all seven selected reporting cases failed against the logger-only production code (zero Crashlytics recordError calls; exit 1). After the fix, all 107 tests across force_processing_placeholder, capture_provider, and optimistic_speaker_assignment passed (exit 0). The actual mocked Crashlytics channel asserts exactly one report, fatal=false, fixed operation/type-only exception, and preserved stack; every failure still leaves the guarded zone empty. Additional coverage includes WAL-stamp failure, reporting transport failure, multiple joined suggestions, mixed refresh triggers, and successful retry without an extra report. Logs: .agent-briefs/review-reporting-before.log and review-reporting-after.log.
  • No other Part 2 catch had the same gap: exactly three catches were introduced, all covered above. Speaker-tail ignore() calls suppress only derived bookkeeping duplicates while leaving caller errors visible; analytics remains unchanged.

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

  • getAllPeople returns PeopleListResponse, preserving response metadata through the existing shared isOmiListTruncated header parser. All in-tree consumers and test loaders are migrated together; no compatibility wrapper or server contract changes.
  • On truncated loads, PeopleProvider preserves all four cached scan-derived aggregates for the same person: conversation_count, last_heard_at, talk_seconds, and auto_conversation_count. Fresh names, samples, confidence, pinning, voice-learning data, and other fields still update. New people/no cached stats use the incoming partial fields; removed IDs are not resurrected and optimistic rows remain display-only.
  • Complete responses remain authoritative, including lower counts after deletions. Partial status is persisted and exposed; it survives recreation and failed refresh, and clears on a complete fetch/account-cache clear. The marker is conservative: a truncated response stays marked partial even where a row displays older retained stats.
  • Home continues requesting People without stats, but its cache write preserves known aggregates and does not clear the partial marker. This closes the other writer that could erase the complete baseline.
  • The shared People list shows one understated localized line, “Counts may be incomplete.”, on nonempty partial results. The key was added using scripts/l10n.py, with translations and generated Dart for every locale listed by template (49 at this revision).
  • Truncated loads emit one bounded degraded event through the existing fallback helper; no IDs, response content, or new telemetry enums are added.

Tests and evidence:

  • 125 focused tests passed across 17 files. New coverage: 6 response/header tests, 12 provider/cache tests, and 3 rendered People-page notice cases. Existing People editing/pinning/deletion/search, Home language/fetch failure, cache decoding/sign-out, and API feedback tests remain green. Log: .agent-briefs/part3-flutter-test.log.
  • Old-behavior negative control used the migrated result interface but temporarily retained the old overwrite/no-marker logic; it was not an unchanged old-source run. Nine provider tests failed, including cached count 10 overwritten by partial count 2. A tenth failure was an incorrect new-test UTC/local expectation, corrected to match the existing decoder. Header propagation tests had the migrated parser already in place, so there is no pre-fix header-test claim. Log: .agent-briefs/part3-before.log.
  • python3 scripts/l10n.py check passed: 49 locales, 3617 keys. Narrow analysis of all six changed production files found no issues. Authored Dart formatted with line length 120; generated localization Dart came from the localization tool.
  • Not verified: deployed response headers, real-device/rendered agent-flutter UI, native-speaker audio flows, or human/native-speaker translation review. Widget tests exercise the real People page without a live app/backend.
  • Local commit: 677ee83. Visual-audit fixture migration follow-up: 09657c4 (five inert loaders updated; analyzer clean, no device audit launched).

Desktop/web inspection

  • macOS getPeople calls v1/users/people without include_stats. The generated client supports includeStats but has no in-tree call sites.
  • Web app getPeople calls /v1/users/people without include_stats. Generated app/admin/personas clients declare the optional parameter, but no non-generated web caller uses it.
  • No desktop, web, or backend files will be changed.

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

  • Before integrating upstream drift: TZ=UTC bash app/test.sh --concurrency=4 --reporter expanded completed with both all-passed verdicts: 138 spine tests and 3955 main-suite tests. The original shell numeric exit was not retained after a session restart; the complete log contains both successful terminal verdicts (.agent-briefs/full-app-tests.log).
  • Analyzer ratchet, authored formatting, and localization checks passed; no baseline changes.
  • origin/main advanced to dd694cc during verification. The initial make/PR-body gates correctly failed because the synthetic merge had localization conflicts. Integrated that pinned upstream commit using a normal merge (no rebase/history rewrite), preserved upstream localization changes, and reapplied only peopleStatsIncomplete through the localization tool.
  • After upstream integration: 111 tests passed across 13 affected files; analyzer ratchet passed; localization consistency passed for 49 locales and 3635 keys. Logs: .agent-briefs/merge-focused-tests.log, merge-analyze.log, merge-l10n.log. The full app suite was not rerun after integration; these are focused combined-tree checks.
  • Local upstream-integration merge: 832fc51. That phase's make preflight and exact requested PR-body gate both passed with exit 0 and 25 checks; the archived .agent-briefs/preflight-832fc515e3-historical.log ends with “PR preflight passed: 25 checks in 355.44s.” Both measured base dd694cc. The 90-day failure-class guard ratchet explicitly skipped because the checkout is shallow; enforcement against full history is not verified here. Other large-file/function warnings were advisory.
  • Continuation integrated current origin/main 159df54 (fix(app): release the pendant backup only for audio the saved transcript covers #20376, pendant WAL retention), which also touches capture_controller.dart, via normal merge fab4dca after review fix 1f70dec. No conflicts occurred; the pre-commit hook formatted eight files with zero changes. Post-merge git diff --name-only origin/main HEAD lists 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.
  • Post-continuation verification on fab4dca against origin/main 159df54: TZ=UTC flutter test across 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.
  • Repeated scripts/pr-preflight --suggest requires INV-DATA-1 only. OMI_PR_BODY_FILE=$PWD/.agent-briefs/pr-body.md make preflight passed (exit 0, 25 checks; review-make-preflight.log). The exact requested realgit-PATH scripts/pr-preflight --pr-body-file .agent-briefs/pr-body.md gate passed (exit 0, 25 checks); .agent-briefs/preflight.log ends with PR 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.
  • No cloud access, production services, app launch, push, PR creation, or PR merge. The local upstream integration merge does not publish anything.

Generated with Devin

🤖 Generated with Claude Code

Review in cubic

Git-on-my-level and others added 8 commits October 3, 2026 13:50
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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 3, 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-03T08:43:10.321522Z fab4dca 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.

@cubic-dev-ai cubic-dev-ai 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.

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 labeled uncaught_async or boot. Clear or scope the key after reporting the original error.
  • In main.dart, post-boot errors reported as non-fatal still update AppReviewBadExperience.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 _filters still shows counts from provider.people. Gate the notice on the counts being shown, not just the filtered rows.
  • In capture_provider_test.dart, reusing suggested-b means 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)

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: 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>
Suggested change
if (provider.statsTruncated && people.isNotEmpty)
if (provider.statsTruncated && provider.people.isNotEmpty)

Comment thread app/lib/main.dart
} else {
await crashlytics.recordError(error, stack, fatal: true);
try {
await crashlytics.setCustomKey('error_origin', errorOrigin);

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: 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'));

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: 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>
Suggested change
SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'suggested-b', personName: 'B', segmentId: 'seg-b'));
SpeakerLabelSuggestionEvent(speakerId: 1, personId: 'joining-suggestion-person', personName: 'B', segmentId: 'seg-b'));

Comment thread app/lib/main.dart
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));

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: 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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
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 đủ.';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>
Suggested change
String get peopleStatsIncomplete => 'Số đếm có thể chưa đầy đủ.';
String get peopleStatsIncomplete => 'Số liệu có thể chưa đầy đủ.';

@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: 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".

Comment thread app/lib/main.dart
unawaited(PhysicalQualification.runtimeEvent('first_frame_callback'));
});
}
if (!PhysicalQualification.enabled) _startupErrorRouter.completeStartup();

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 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 👍 / 👎.

Comment thread app/lib/main.dart
Comment on lines +212 to +214
try {
await crashlytics.setCustomKey('error_origin', errorOrigin);
} catch (_) {}

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 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)

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 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 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 0e21134 into main Oct 3, 2026
50 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/mobile-error-reporting-wave branch October 3, 2026 09:01
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