Skip to content

feat(drive): Add the jpdrive accessibility driver - #1009

Merged
JeanMertz merged 3 commits into
mainfrom
pr/jpdrive
Aug 21, 2026
Merged

feat(drive): Add the jpdrive accessibility driver#1009
JeanMertz merged 3 commits into
mainfrom
pr/jpdrive

Conversation

@JeanMertz

Copy link
Copy Markdown
Collaborator

Debugging the macOS app from a conversation needs a way to read what is
actually on screen and act on it. Screenshots answer "what does it look
like" but not "what is the button called, is it enabled, does the menu
item exist" — and none of that is reachable from the app's own test
bundle, which runs inside the process and cannot see menu enablement,
the pasteboard, or a relaunch.

jpdrive reads and drives another application through its accessibility
tree, and writes one JSON document to stdout either way: a result, or an
error with a non-zero exit status. It is what the debug_app_* tools
shell out to.

A standalone SwiftPM package rather than a target in the app's Xcode
project, so the binary lands at a predictable path and nothing has to
search derived data for it. The logic lives in a DriveKit library with
a one-line executable on top, because SwiftPM cannot cleanly test an
executable target and the tree traversal is where the bugs are. The
tests run against a fake accessibility tree, so they need no running app
and no accessibility grant.

The package mirrors the app's strictness: Swift 6 language mode,
ExistentialAny, and warnings as errors. SwiftPM 6.0 has no first-class
setting for the last of those, so it goes through unsafeFlags, which
is rejected only for a package consumed as a dependency — this one never
is.

Accessibility is gated by TCC, and a grant given to a terminal does not
obviously reach a tool that terminal started. just drive-doctor
reports whether the calling process may read another app's tree, so that
question is answered by running it under each host rather than guessed
at.

Signed-off-by: Jean Mertz git@jeanmertz.com

@JeanMertz
JeanMertz force-pushed the pr/jpdrive branch 2 times, most recently from d3b5881 to 36ead6f Compare August 21, 2026 05:33
Base automatically changed from pr/macos-app to main August 21, 2026 17:30
Debugging the macOS app from a conversation needs a way to read what is
actually on screen and act on it. Screenshots answer "what does it look
like" but not "what is the button called, is it enabled, does the menu
item exist" — and none of that is reachable from the app's own test
bundle, which runs inside the process and cannot see menu enablement,
the pasteboard, or a relaunch.

`jpdrive` reads and drives another application through its accessibility
tree, and writes one JSON document to stdout either way: a result, or an
error with a non-zero exit status. It is what the `debug_app_*` tools
shell out to.

A standalone SwiftPM package rather than a target in the app's Xcode
project, so the binary lands at a predictable path and nothing has to
search derived data for it. The logic lives in a `DriveKit` library with
a one-line executable on top, because SwiftPM cannot cleanly test an
executable target and the tree traversal is where the bugs are. The
tests run against a fake accessibility tree, so they need no running app
and no accessibility grant.

The package mirrors the app's strictness: Swift 6 language mode,
`ExistentialAny`, and warnings as errors. SwiftPM 6.0 has no first-class
setting for the last of those, so it goes through `unsafeFlags`, which
is rejected only for a package consumed as a dependency — this one never
is.

Accessibility is gated by TCC, and a grant given to a terminal does not
obviously reach a tool that terminal started. `just drive-doctor`
reports whether the calling process may read another app's tree, so that
question is answered by running it under each host rather than guessed
at.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz
JeanMertz merged commit 5d768ef into main Aug 21, 2026
16 checks passed
@JeanMertz
JeanMertz deleted the pr/jpdrive branch August 21, 2026 20:30
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