Skip to content

Keep the existing grant when the folder picker is dismissed - #221

Merged
mattt merged 1 commit into
mainfrom
mattt/folder-grant-cancel
Sep 17, 2026
Merged

mattt merged 1 commit into
mainfrom
mattt/folder-grant-cancel

Conversation

@mattt

@mattt mattt commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Follow-up to #198 and #220, addressing the review feedback on #198.

Dismissing the folder picker threw invalidFileSelected. When Messages offered the upgrade from a chat.db grant to the Messages folder, that error reached the service toggle and switched Messages off, although the old grant still worked and the alert's own Cancel button already kept it. The picker now returns nil when the panel is dismissed. Messages keeps the old grant during an upgrade and otherwise reports userDeclinedAccess; Phone reports the same instead of claiming a wrong selection. invalidFileSelected is left for a selection that is not the expected folder, which the panel delegate already prevents.

The once-per-launch warning about a file-only Messages grant was a plain check-and-set on a shared flag, and concurrent messages_fetch calls could race on it. It is now guarded by an OSAllocatedUnfairLock, with the log call outside the lock. Phone logs its warning right before prompting and has no shared state, so it needed no change there.

Dismissing the folder picker threw invalidFileSelected. During a Messages
upgrade from a file grant, that error reached the service toggle and turned
Messages off, although the old grant still worked and the alert's Cancel
button already kept it. The picker now returns nil on dismissal; Messages
keeps the old grant during an upgrade and otherwise reports
userDeclinedAccess, and Phone reports the same instead of a wrong selection.

The once-per-launch warning about a file-only Messages grant was a plain
check-and-set on a shared flag that concurrent tool calls could race.
It is now guarded by a lock, with the log call outside it.
@mattt
mattt merged commit d0fa365 into main Sep 17, 2026
1 check passed
@mattt
mattt deleted the mattt/folder-grant-cancel branch September 17, 2026 17:58
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.

1 participant