You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2df8924
Browse filesBrowse the repository at this point in the historyBrowse files
fix(apple-runner): serve a macOS read of a background app without raising it
On a desktop, the XCTest foreground repair is not a no-op for the user: a read that
names a session app sitting behind other windows took their frontmost app away for a
command that only asked to look (#3254). The activation axis already routes by
`launchPolicy`, so the fix goes on the existing `.existingApp` arm of
`prepareActiveCommandContext`: on macOS, a read whose app answers
`.runningBackground` is served in place through `resolveAppWithoutActivation`, and
no activation fact is booked for it. Scoping is exact:
- a stopped app keeps the launch the activating route performs for it today: `state`
answers `.notRunning` and the arm declines, so `open`-then-read still works and no
macOS refusal is invented (`notRunningRefusal` stays iOS-only);
- interactions keep activating: the macOS XCTest path drives events through the
foreground window, and a background click would land on whatever window is on top;
- a window-level screenshot keeps its raise (measured: a backgrounded
`screenshotRoot(app:).screenshot()` returns the occluding window's content inside
the session window's rect), but a `--fullscreen` capture of a running app no longer
raises — `XCUIScreen.main` answers from any foreground, and the 0.5 s settle waits
belong to the raise and are skipped with it. A stopped app keeps launching either way.
The two conditions are functions the call sites read (`macReadMayBeServedInBackground`,
`macAppCaptureNeedsRaise`) so the host lane pins every state they branch on. Four
host-lane tests: the background read served without a raise or a fact across its three
shapes, the interaction on the same app still activating, a stopped read still
launching, and the raise-condition table. The canary is the arm's removal: the read
test goes red with the app left foreground and a `bundle_changed` fact booked. A live
run on the default backend confirms it: with Finder frontmost, `snapshot` and `get`
answered from the background app, Finder stayed frontmost, and runner.log booked zero
activation facts; the click after them activated with priorState=3 as it must.
`help macos` states the new read behavior.
Also records at the `.presentedSurface` arm why its macOS route is unreachable from
the host (`alert` answers through the helper; `action-button` is refused by its owner
fact before dispatch), so no second activation axis is proposed against it.
Partial #3254
Copy file name to clipboardExpand all lines: src/commands/schema/cli-help.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -739,7 +739,8 @@ Rules:
739
739
Context menus are not ambient UI: secondary-click a visible target, then re-snapshot and use the new menu-item refs.
740
740
Do not let iOS simulator-set scoping hide macOS desktop targets.
741
741
Prefer refs/selectors over raw coordinates.
742
-
macOS snapshot rects are window-space; use current refs or overlay refs instead of guessing coordinates.`,
742
+
macOS snapshot rects are window-space; use current refs or overlay refs instead of guessing coordinates.
743
+
On the default XCTest backend a read (snapshot, get, find) of a session app that sits behind other windows is answered from where it sits, without raising the app; interactions and a window-level screenshot of that app still bring it forward.`,
743
744
},
744
745
web: {
745
746
summary: 'Minimal browser workflow with the managed web backend',
0 commit comments