feat(crash): flag recovered crash context and cache it per key #1341
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.46) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 467 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1341"
general
weight: 0.35
aranhave
Summary
Two changes to
KSCrashInstrumentationthat came out of #1337.Per-key user info. The crash context was written through
KSCrash.userInfo, which KSCrash 2.6 deprecates in favour of the per-key API inKSCrash+UserInfo.h. That API writes to a memory-mapped sidecar with no crash-time cost, and KSCrash merges it into the report'susersection on the next launch, sorecoverCrashContextreads it as before, and reports written by earlier versions still recover. Each key is now set on its own: a session without a predecessor removessession.previous_idinstead of keeping the last one. Every KSCrash version the package allows (upToNextMinor(from: "2.6.0")) has the API. It is also what #1337's proposal needs, since each context provider can then update its own key without rewriting the others.crash.context.recovered. When the crashed run's timestamp and session can't be read back, the crash gets the reporting launch's time and session, and nothing on the record says so. Everydevice.crashrecord now carriescrash.context.recovered,trueorfalse, as suggested in this comment.Refs #1337
Testing
main.session.previous_id.testCacheCrashContextis renamedtestReporterCachesCrashContextso it sorts aftertestInstallMethod, because per-key writes are ignored before install.OTEL_CONCURRENCY_TESTS=1.make integ-tests-iosrun of this branch, all 12CrashTestsassertions pass against the crash and crash-report launches, so the session written through the per-key API survives a real crash. The run itself stopped later, at theapp-start-backgroundlaunch: my simulator (Xcode 27.2) rejects the silent push withUNErrorDomain1401, which is unrelated to this change, so I ran the crash assertions on the collected output.swift test --enable-all-traitspasses locally.Limitations
crash.context.recoveredis not a semantic convention. The name is a proposal and easy to change before a release.service.versionandos.versioncome from the resource, which describes the reporting launch, so a crash from before an app or iOS update is reported under the new versions. KSCrash records the crashed build's versions in the report, butservice.versionis only defined as a resource attribute, so how to carry it on the record belongs in the #1337 discussion.Checklist
swift test --enable-all-traitspasses locallyTests/IntegrationTestsare updated. Anything that adds, removes orrenames a span, log record, event name, or attribute emitted by an
instrumentation (
Sources/Instrumentation/**) must be exercised byIntegrationTestScenarioinExamples/HackerNewsDemoand asserted onin
Tests/IntegrationTests/Assertions. Runmake integ-tests-iostoverify, and see
Tests/IntegrationTests/README.md.🤖 Generated with Claude Code