digidem / digidem/comapeo-core-react-native
Sentry: iOS killed-in-background heuristic (Phase 7b, optional)
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1
- Forks
- 0
- Avg merge
- 8h 24m
- Merged PRs (30d)
- 9
Description
Part of #74. Optional, independent.
Spec: docs/sentry-integration-plan.md Phase 7b.
iOS only tells us "why was the app killed" as 24-hour aggregate counts (Apple's MetricKit reports), with no timestamps. This workblock adds a simple heuristic for per-incident detail: record the app's lifecycle state on disk as it changes, and on the next launch, if the previous run didn't end cleanly, report one "ios kill inferred" event saying whether the app was in the background and roughly how long it had been there.
Deliverables
-
ios/AppKillHeuristic.swift: write background / foreground / terminated-cleanly plus a timestamp to on-device storage on each lifecycle change. On cold start, an unclean previous state produces one event taggedios.killed_in_background, withlast_known_stateandtime_since_last_state_ms - Refresh the marker every 30 seconds while the app is in the foreground, so the "how long" number doesn't badly understate
- Document the limits honestly: this catches any unclean end — the system killing the app to free memory, iOS killing an unresponsive app, user force-quit, OS reboot, or a crash. The MetricKit counts and crash reports help tell those apart on dashboards
Tests
AppKillHeuristicTests.swiftwith a fake store + clock: a clean shutdown suppresses the event; a stale marker fires once then clears; foreground vs background drives the tag correctly- Manual check by forcing a low-memory kill
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Phase 7b in docs/sentry-integration-plan.md, then inspect ios/AppKillHeuristic.swift and the iOS lifecycle integration points. Use AppKillHeuristicTests.swift with a fake store and clock to verify clean shutdowns, stale-marker clearing, and foreground/background tagging. Done means the marker is refreshed in the foreground, inferred events report the required fields, and the documented limitations are honest.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- mobile, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100