fix(mobile): Persist crash diagnostics before runtime fatals#4033
fix(mobile): Persist crash diagnostics before runtime fatals#4033juliusmarminge wants to merge 4 commits into
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…oads Co-authored-by: codex <codex@users.noreply.github.com>
ApprovabilityVerdict: Needs human review This PR introduces new crash logging infrastructure that installs a global error handler before the app module graph loads. While defensively implemented, changes to fatal error handling at this level warrant human review. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 959a39b. Configure here.
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>

Extracted from #3910.
Adds early JS crash capture, disk-backed breadcrumbs, and a synchronous native write path so release-runtime failures leave recoverable diagnostics before React Native terminates. It also records outbox activity as crash context.
Validation inherited from #3910:
vp checkand mobile native lint passed before the split. The full typecheck is currently blocked in this workspace by unavailable mobile dependencies (expo-blur,expo-quick-actions, and@tabler/icons-react-native).Note
Persist crash diagnostics to disk before runtime fatals in the mobile app
installCrashLoggerthat intercepts fatal errors, writes a JSON crash record to the device'scrash-logsdirectory, then delegates to the previous handler.crash-<epoch>-<seq>.jsonfor stable lexicographic ordering; on next launch, the most recent 3 are logged to the console and files beyond 20 are pruned.installCrashLog.tsis imported at the top ofindex.tsas a side-effect so the handler registers before any other app modules load.ErrorUtilsis unavailable the installer does nothing.Macroscope summarized 6209d13.
Note
Medium Risk
Fatal-error handling performs synchronous document-directory file I/O before the prior global handler runs, which can add latency on the crash path and must not interfere with existing crash reporting.
Overview
Adds early fatal JS crash capture so release-runtime failures leave recoverable diagnostics before React Native tears down.
A side-effect import at the top of
index.tsrunsinstallCrashLogger()before the rest of the app loads. The logger chains React Native’s globalErrorUtilshandler: on fatal errors it synchronously writes a JSON record (message, name, stack, timestamp) undercrash-logsin the document directory, then calls the previous handler. Persistence is wrapped so logging failures never hide the original crash.On the next launch, a deferred
setTimeout(0)pass (no file I/O during install) warns the three newest prior crash files to the console and prunes older logs beyond a cap of 20.Reviewed by Cursor Bugbot for commit 6209d13. Bugbot is set up for automated code reviews on this repo. Configure here.