macOS permission-free window-origin lookup: window-relative replay resolution goes live#94
Merged
Conversation
…eplay live on macOS The window-relative resolution strategy (#91) was deliberately inert on macOS pending a design that avoids new permissions. This wires it, entirely under the Accessibility permission replay already requires: - The resolution chain's window_origin closure now receives the full recorded ElementInfo instead of just the title — macOS needs the recorded app name to locate the owning process; Windows keeps using only the title (FindWindowA), behavior unchanged. Benchmark and unit tests updated mechanically; all 13 scenarios still pass. - find_window_origin (platform/macos.rs): libproc pid enumeration (proc_listallpids/proc_name — libSystem, no new crate, no new permission), process-name match against the recorded app including the 32-byte proc_name truncation, then an AXWindows walk of the matched app for an AXTitle match whose AXPosition supplies the origin. Deliberately NOT CGWindowList, which would require the Screen Recording permission. Best-effort at every step: any failure returns None and the chain falls through to the spiral / recorded coordinates exactly as before. - AXPosition decoding extracted into ax_element_origin (shared with capture's window_info_for). New CFArray FFI follows the existing extern-block style; array elements follow the CF get-rule and are never released. - Unit tests (macOS CI leg): proc-name matching incl. truncation and the no-short-prefix case; find_window_origin's pure pre-FFI gates. - docs/target-resolution.md platform section + CLAUDE.md accounting updated. Validation: fmt, clippy -D warnings, 348 tests + 13/13 resolution benchmark on Linux/headless. The macOS FFI compiles and its unit tests run only on the macOS CI leg; the live AXWindows walk needs a real macOS session — added to the manual smoke list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019gj5w7gNG2fJpNEE1buXc4
✅ Deploy Preview for muhammadghost ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
11 tasks
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.
Summary
Closes the platform gap left deliberately open in #91: the window-relative resolution strategy (find the recorded window by title, click at the recorded in-window offset, verify the descriptor) now works on macOS — with no new permission and no new crate. Everything runs under the Accessibility permission replay already requires.
Trust & safety
Pipeline checklist:
Changes
core/replay_support.rs: thewindow_originclosure now receives the full recordedElementInfo(macOS needsappto find the owning process; Windows keeps title-onlyFindWindowA, behavior unchanged). Mechanical updates to the Windows wrapper, unit tests, and the benchmark harness — all 13 benchmark scenarios pass unchanged.platform/macos.rs::find_window_origin: libproc pid enumeration (proc_listallpids/proc_name— part of libSystem) → process-name match against the recorded app (including the 32-byteproc_nametruncation) →AXWindowswalk of the matched app →AXTitlematch →AXPositionorigin (decode extracted intoax_element_origin, shared with capture). Best-effort at every step; strict CFRelease discipline; CFArray elements follow the get-rule and are never released.find_window_origin's pure pre-FFI gates.docs/target-resolution.mdplatform section, CLAUDE.md accounting.Validation
cargo fmt -- --check,cargo check --all-targets,cargo clippy --all-targets -- -D warningscargo test— 348 passed, 0 failed;--test resolution_benchmark13/13CI must confirm the macOS leg (new libproc/CFArray FFI compiles; new unit tests run) and the Windows leg (closure change). The live AXWindows walk cannot run on a headless runner — it joins the manual macOS smoke list (move a window across the screen mid-replay; the trace should show
WindowRelative).Risks / follow-up
proc_namematches the process name, which normally equals the AX app title but can diverge (e.g. localized app names). Divergence degrades gracefully to today's behavior (spiral/fallback), never mis-clicks — the candidate is descriptor-verified.FindWindowA.🤖 Generated with Claude Code
https://claude.ai/code/session_019gj5w7gNG2fJpNEE1buXc4
Generated by Claude Code