fix: allow deleting a reminder by external id after it's been completed - #106
Merged
keith merged 1 commit intoJul 31, 2026
Merged
Conversation
`delete` fetched only incomplete reminders before resolving the given index/id, so `reminders delete <list> <external-id>` failed with "No reminder at index ... on ..." whenever that reminder had already been marked complete, even though the id is valid and stable. Widen the fetch to the full (`.all`) display set when the argument is an external id (non-numeric), since ids are unambiguous regardless of completion state. Numeric indexes are left untouched (still scoped to `.incomplete`, matching what `show`'s default output displays), so existing index-based delete behavior is unaffected. Manually verified against a live Reminders store: - create -> complete -> delete by external id -> now succeeds and the item is gone from `--include-completed` output (previously failed). - create -> delete by numeric index on an incomplete item -> still works exactly as before. No automated regression test added: `Reminders` talks directly to a real `EKEventStore()` with no injection seam, and CI has no granted Reminders permission, so this can't be exercised in `swift test` today (same constraint the existing `NaturalLanguageTests.swift` suite works around by only covering pure date-parsing logic).
keith
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
reminders delete <list> <id>fails withNo reminder at index <id> on <list>for a reminder that has already been marked complete, even when<id>is a validcalendarItemExternalIdentifier.Repro:
Cause
delete(itemAtIndex:onListNamed:)always fetches withdisplayOptions: .incompletebefore searching for the given index/id:Once the reminder is completed it's no longer in that fetched set, so lookup fails regardless of whether the id itself is valid.
setComplete/edithave the same.incomplete-only pattern; I left those alone to keep this PR minimal, but flagging in case they're wanted too (e.g.uncompleteon a reminder that was actually completed via Reminders.app rather than this CLI can hit the same class of issue).Fix
Widen the fetch to
.allonly when the argument is an external id (non-numeric). Numeric indexes stay scoped to.incomplete, since that's the same setshow's default output enumerates — widening that path too would let a numeric index silently resolve against a different array than what the user actually saw.Testing
No automated test added —
Reminderstalks directly to a liveEKEventStore()with no injection seam, and CI (macos-14runner) has no granted Reminders permission, so this isn't exercisable inswift testtoday. That's consistent with the existing suite, which only covers pure date-parsing logic inNaturalLanguageTests.swift.Manually verified against a real Reminders store with the built binary:
delete <externalId>→ now succeeds, item is gone fromshow --include-completed(previously failed with the error above)delete <numeric index>on an incomplete item → unchanged, still works exactly as beforeswift build -Xswiftc -warnings-as-errorsandswift test -Xswiftc -warnings-as-errorsboth pass locally (matching.github/workflows/swift.yml)Disclosure
I ran into this bug while automating reminder cleanup from a script and diagnosed/wrote the fix with AI assistance (an agent reading the source, reproducing the bug against a live Reminders store, and drafting this patch), which I reviewed and tested manually as described above. Happy to adjust the approach (e.g. widen
setComplete/edittoo, or handle this differently) if you'd prefer.