Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Explain EventKit's shared-list move limitation when `edit --list` or `--list-id` fails with ReminderKit error -3002, and direct users to move the reminder in Reminders.app. Thanks @paulchiu.

- Resolve all-digit reminder ID prefixes when the number is outside the current index range, while preserving valid index precedence. Thanks @goutamadwant.

- Use the shared Swift CLI release workflow for macOS-only signed releases and no-publish rehearsals, replacing the duplicated release pipeline.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ If a calendar is missing after `add`, `edit`, or `complete` saves a reminder, th

Supporting those would require Apple to expose new public APIs or a separate non-EventKit backend.

Moving reminders with `edit --list` or `edit --list-id` can fail when either list is shared. If EventKit rejects the move with `com.apple.reminderkit error -3002`, move the reminder in Reminders.app, then retry any other edits. `remindctl` does not copy and delete reminders to work around this restriction because EventKit cannot preserve all Reminders.app metadata.

## Development

The package manager is pinned in `package.json`, and `.node-version` selects the docs runtime.
Expand Down
5 changes: 4 additions & 1 deletion Sources/RemindCore/EventKitStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public actor RemindersStore {

public func updateReminder(id: String, update: ReminderUpdate) async throws -> ReminderItem {
let reminder = try reminder(withID: id)
let originalCalendarID = reminder.calendar?.calendarIdentifier

if let title = update.title {
reminder.title = title
Expand Down Expand Up @@ -174,7 +175,9 @@ public actor RemindersStore {
reminder.isCompleted = isCompleted
}

try eventStore.save(reminder, commit: true)
try ReminderUpdateSave.save(isMoving: reminder.calendar?.calendarIdentifier != originalCalendarID) {
try eventStore.save(reminder, commit: true)
}

return try item(from: reminder)
}
Expand Down
19 changes: 19 additions & 0 deletions Sources/RemindCore/ReminderUpdateSave.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Foundation

enum ReminderUpdateSave {
static func save(isMoving: Bool, using save: () throws -> Void) throws {
do {
try save()
} catch {
let failure = error as NSError
guard isMoving, failure.domain == "com.apple.reminderkit", failure.code == -3002 else {
throw error
}
throw RemindCoreError.operationFailed(
"Unable to move reminder between lists: EventKit rejected the move (com.apple.reminderkit error -3002). "
+ "Moves involving shared lists may not be supported. Move the reminder in Reminders.app, "
+ "then retry any other edits."
)
}
}
}
41 changes: 41 additions & 0 deletions Tests/RemindCoreTests/ReminderUpdateSaveTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Foundation
import Testing

@testable import RemindCore

struct ReminderUpdateSaveTests {
@Test("A rejected list move explains the shared-list limitation")
func rejectedMove() {
let error = NSError(domain: "com.apple.reminderkit", code: -3002)
#expect(throws: RemindCoreError.operationFailed(
"Unable to move reminder between lists: EventKit rejected the move (com.apple.reminderkit error -3002). "
+ "Moves involving shared lists may not be supported. Move the reminder in Reminders.app, "
+ "then retry any other edits."
)) {
try ReminderUpdateSave.save(isMoving: true) { throw error }
}
}

@Test("Unrelated save errors are preserved", arguments: [
(false, "com.apple.reminderkit", -3002),
(true, "OtherDomain", -3002),
(true, "com.apple.reminderkit", -3001),
])
func unrelatedErrors(input: (Bool, String, Int)) {
let (isMoving, domain, code) = input
let original = NSError(domain: domain, code: code, userInfo: [NSLocalizedDescriptionKey: "Original failure"])
do {
try ReminderUpdateSave.save(isMoving: isMoving) { throw original }
Issue.record("Expected the original save failure")
} catch {
#expect(error as NSError === original)
}
}

@Test("Successful saves run exactly once", arguments: [true, false])
func successfulSave(isMoving: Bool) throws {
var calls = 0
try ReminderUpdateSave.save(isMoving: isMoving) { calls += 1 }
#expect(calls == 1)
}
}
2 changes: 2 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ remindctl edit 4A83 --list-id 7A12
remindctl edit 4A83 --no-repeat
```

Moving a reminder with `--list` or `--list-id` can fail when the source or destination list is shared. If EventKit rejects the move with `com.apple.reminderkit error -3002`, move the reminder in Reminders.app, then retry any other edits. The command does not fall back to copying and deleting the reminder, since public EventKit cannot preserve all Reminders.app metadata.

Commands that target reminders accept indexes from the current default listing or ID prefixes.
An in-range numeric value always selects that index. An out-of-range numeric value falls back to ID-prefix matching and returns an error when no reminder ID matches.
`complete` and `delete` process each reminder once, even when repeated indexes, IDs, or prefixes identify the same reminder. Previews and delete confirmation counts use these unique targets in first-input order; every input must still be valid and unambiguous.
Expand Down
Loading