Repository navigation
feat: add crash history with Android and iOS diagnostics - #158
MaxMichel2 wants to merge 22 commits into
Conversation
| pending.update { | ||
| it.copy( | ||
| reports = (it.reports + report).takeLast(n = MAX_PENDING_REPORTS) |
There was a problem hiding this comment.
record() drops queued reports after 20 entries even when recording has started with a larger maxRecords. With maxRecords = 100, for example, 50 reports arriving while an OS import holds the storage lock leave only the last 20 to save. The others never reach disk. Use the configured limit after startup, and reserve the fixed 20-entry limit for reports made before startup.
| timestampMillis = exit.timestamp, | ||
| processId = exit.pid, | ||
| trace = readTrace(exit = exit), | ||
| metadata = metadata |
There was a problem hiding this comment.
Android history imports attach the current launch's metadata to earlier exits. After an app update, a crash from the previous version is shown and exported as a crash in the new version. This can send testers looking for a bug in the wrong release. Preserve historical values when available; otherwise show unknown values or clearly label these fields as belonging to the current launch.
| val directory = NSTemporaryDirectory() + EXPORT_DIRECTORY | ||
| val files = NSFileManager.defaultManager | ||
| files.removeItemAtPath(path = directory, error = null) |
There was a problem hiding this comment.
Earlier attachments can disappear
Each iOS export deletes every earlier export, and repeated exports reuse the same path. If an earlier recipient still needs the file, a later export can remove or replace its attachment. Give each export a unique filename and remove only aged files, as the Android implementation does.
Summary
Related to #148.
devview-crashhistory-coreand theCrashHistoryoverlay module for bounded, local crash history with list/detail screens, copy, text sharing and JSON export. Records stay on-device unless explicitly copied or shared; existing crash handlers are chained rather than replaced.ApplicationExitInfohistory (including ANRs and system kills), and bridge MetricKit through spmForKmp: the async API on iOS 27+, legacy delivery on iOS 15–26.Compatibility: iOS builds require Xcode 27+; runtime support starts at iOS 15. The bridge uses system MetricKit/CryptoKit without an external Swift package. Downstream Gradle-linked Kotlin/Native executables need the documented Swift-runtime linker configuration; Swift host-app linking was verified with the sample.
Scope: the full committed branch against
main(22 commits, 70 files). No predecessor PR, inherited layer or stack dependency.Validation
Checks below were executed during implementation and cover the final production code; subsequent commits only recorded/removed verification reports.
detektFulland:sample:androidApp:assembleDebugpassed. Android tasks used-Pandroidx.baselineprofile.skipgeneration.zensical buildpassed with two existing unrelated link warnings.Remaining checks and limitations
git diff --check.Fix the report queue before merging; it can lose reports even when the configured history has room.
Findings
Summary
Adds local crash history for Android and iOS.
Acknowledged limits:
Source review only. No runtime tests or UI captures were performed.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Uncaught exception] --> E[CrashRecorderEngine] B[App-reported error] --> E C[Android exit history] --> E D[iOS MetricKit bridge] --> E E --> F[Local JSON records] E --> G[Records StateFlow] G --> H[Crash list and details] H --> I[Copy or share]Reviews (1) · Last reviewed commit: ":memo: Remove completed iOS 27 verificat..." · Reviewed by Greptile