Reminder actions apply to today, not to the day they asked about #69
Labels
No Label
P0
P1
P2
release-blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Privacy-Period-Tracker#69
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What is true now.
NotificationActionHandler.handle(app/src/main/kotlin/dev/privacyllc/period/notifications/NotificationActionHandler.kt:34-35) writes againstLocalDate.now(clock). The PendingIntent carries only the action string (core/notifications/.../PeriodNotifier.kt:166-172) — no date. A reminder that sat in the shade over a weekend and is tapped on Monday records Monday.Related:
MainActivity.kt:79reads the intent extra inonCreateand nothing ever callsremoveExtra, so a rotation or theme change re-parks the same action and the gate delivers it again. After process-death restore the original Intent is redelivered with its extras intact, soremoveExtraalone is not enough — the parking must also be gated onsavedInstanceState == null.What it costs. A start date silently off by days, which is the single input the whole prediction engine is built on.
confirmPeriodStartis idempotent per date andrecordNotYetignores duplicates, so the re-parking is mostly harmless today — but it re-runs the write path on every recreation and will stop being harmless the moment a non-idempotent action exists.What to do. Add an epoch-day extra alongside the action; parse both into a small
ReminderActionRequest(action, date?); apply the write to that date. Add a pure staleness rule — a request with no date, a future date, one older than the previous day, or one already answered by a newer confirmed start, writes nothing and simply opens the app.AppLockController.holdNotificationActiontakes the request rather than a bare String, so the parked path carries the date too.Traps. Legacy notifications posted before the upgrade have no date extra — parse as stale, write nothing. The parked action is dropped if the session never unlocks (
AppLockViewModel.kt:69), which stays true and is fine; do not persist it.Verify:
ReminderActionRulesTest(table-driven: today applies, yesterday applies, older is stale, future is stale, no date is stale, already-answered is stale) anda stale request writes nothinginNotificationActionHandlerTest.