Skip to content

Stamp data URIs on alarm PendingIntents and add reminder model tests#91

Merged
mapgie merged 2 commits into
mainfrom
claude/alarms-reminders-analysis-w9qkm8
Jul 13, 2026
Merged

Stamp data URIs on alarm PendingIntents and add reminder model tests#91
mapgie merged 2 commits into
mainfrom
claude/alarms-reminders-analysis-w9qkm8

Conversation

@mapgie

@mapgie mapgie commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Follow-up round from the cross-app alarms/reminders review, addressing the remaining cross-cutting concerns.

Alarm identity

PendingIntent identity is (request code + Intent.filterEquals), and filterEquals ignores extras. All alarm intents wrapped the same bare Intent(context, AlarmReceiver::class.java), so the hashCode-derived request codes were the only thing keeping task and reminder alarms apart; two ids with colliding hashes would silently cancel or clobber each other's alarms. Every alarm intent is now stamped with a unique data URI (choredash://alarm/task/<id>, choredash://alarm/reminder/<id>), the same defence GaMeD adopted after hitting this collision class (see its LESSONS entry). BootWorker sweep-cancels alarms registered under the old no-URI identity so they don't double-fire after the update (it runs on MY_PACKAGE_REPLACED).

Tests

The pending-reminder predicate moves out of the repository into the model as ReminderDto.needsScheduling(), and a new JVM test suite covers it plus the instant-parsing helpers, locking in the past-due-inclusion behaviour from the previous PR (a reminder that came due while the phone was off must be delivered late, not dropped). First unit tests in this repo.

Changelog fragment: changelog/unreleased/alarm-identity.json (patch). LESSONS.md gains entry 31 building on entry 13 (request-code namespacing is only half of PendingIntent identity). a11y_check.py passes.

Merged origin/main back into the branch to resolve a LESSONS.md numbering conflict (main added lessons 29 and 30 in the meantime, so the new entry became 31; both sides kept in full).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qs1UZLKHTxtaLpTheoUwTg

- Every task/reminder alarm intent now carries a unique data URI
  (choredash://alarm/...), so two ids with colliding String.hashCode()
  request codes can no longer cancel or clobber each other's alarms;
  filterEquals ignores extras, so the bare shared intent was the only
  thing distinguishing them before
- BootWorker sweep-cancels alarms registered under the old no-URI
  identity so they don't double-fire after the update
- Extract the pending-reminder predicate into the model
  (ReminderDto.needsScheduling) and add unit tests for it and for the
  instant-parsing helpers, locking in the past-due-inclusion behaviour

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qs1UZLKHTxtaLpTheoUwTg
@mapgie mapgie marked this pull request as ready for review July 13, 2026 09:05
…rs-analysis-w9qkm8

# Conflicts:
#	LESSONS.md
mapgie pushed a commit that referenced this pull request Jul 13, 2026
Rebased onto main and numbered #32 to avoid the LESSONS.md numbering
collision with the custom-theme accents PR (#30, surfaces moved to #29)
and the alarm-identity PR #91 (which takes #31).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0154oNEvwJNtprknEQfFAyND
@mapgie mapgie merged commit f2d785e into main Jul 13, 2026
4 checks passed
@mapgie mapgie deleted the claude/alarms-reminders-analysis-w9qkm8 branch July 13, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants