|
| 1 | +# #2682 physical-device checklist — `thymikee-iphone` (coordinator-owned) |
| 2 | + |
| 3 | +Simulator evidence is recorded in `DECISION.md`. This is the same scenario on the physical lane. |
| 4 | +Use a purpose-specific session name; close it afterwards. Do not reuse another lane's session. |
| 5 | + |
| 6 | +```sh |
| 7 | +UDID=<thymikee-iphone udid from: agent-device devices --platform ios> |
| 8 | +S="--platform ios --udid $UDID --session apex2682-physical" |
| 9 | +bin/agent-device.mjs open com.callstack.agentdevicelab $S --foreground |
| 10 | +``` |
| 11 | + |
| 12 | +The fixture must show its own surface (Metro/dev-client per `examples/test-app/README.md`); an |
| 13 | +already-installed bundle id is not evidence. |
| 14 | + |
| 15 | +## Sequence |
| 16 | + |
| 17 | +1. `bin/agent-device.mjs screenshot --out /tmp/2682-1-app.png $S` → fixture app. |
| 18 | +2. Hand off inside the app (prefer a real in-app handoff; the AccessorySetupKit/permission or an |
| 19 | + external link surface both qualify). Fallback that exercises the identical runner path: |
| 20 | + `xcrun devicectl handle URL`/a user tap that opens Safari or Settings. |
| 21 | +3. `bin/agent-device.mjs screenshot --out /tmp/2682-2-foreign.png $S` |
| 22 | +4. `bin/agent-device.mjs snapshot -i $S | tee /tmp/2682-3-snapshot.txt` |
| 23 | +5. `bin/agent-device.mjs snapshot -i $S` (again, app already foreground) |
| 24 | +6. `bin/agent-device.mjs close $S` |
| 25 | + |
| 26 | +## Expected BEFORE (`main`, no disclosure) |
| 27 | + |
| 28 | +- Step 3 shows the other app; step 4 shows the fixture app's tree. |
| 29 | +- Nothing in either output says why. The only record is in the session's `runner.log`: |
| 30 | + `AGENT_DEVICE_RUNNER_ACTIVATE bundle=com.callstack.agentdevicelab state=<2|3> reason=<reason>`. |
| 31 | +- A run where step 3 still shows the fixture app is not evidence — the handoff must be visible. |
| 32 | + |
| 33 | +## Expected AFTER (PR1 head) |
| 34 | + |
| 35 | +- Step 4 carries, as a warning line and as `data.targetActivation` from PR2: |
| 36 | + `The session app was not foreground when this command arrived (prior state runningBackground), so |
| 37 | + the runner activated it before answering (reason |
| 38 | + <stale_target|bundle_changed|missing_after_wait|interaction_foreground_guard>). Any capture taken |
| 39 | + earlier in this session described the only app other than the session app with an active |
| 40 | + accessibility session (pid <N>), not the session app. Re-capture now that the session app answers, |
| 41 | + or drive the other app in its own session.` |
| 42 | +- Step 5 carries no disclosure — the fact belongs to the command that activated. |
| 43 | +- `<N>` is a **liveness** claim and the sentence is written to claim no more: `otherActiveApplicationPid` |
| 44 | + is present only when exactly one application other than the session app held an active accessibility |
| 45 | + session. `activeApplications` exposes no ordering, so nothing here proves which app owned the screen. |
| 46 | + A pid that is not an AX-active application of the session is a bug; an absent pid is not. |
| 47 | + |
| 48 | +## Proving the disclosure comes from activation, not a later state read |
| 49 | + |
| 50 | +`priorState` is read at `RunnerTests+Lifecycle.swift` inside `activateTarget` **before** |
| 51 | +`XCUIApplication.activate()` runs, and the fact is stamped only in the branch where `activate()` is |
| 52 | +actually called. Assert the pair on the same device run: |
| 53 | + |
| 54 | +- `runner.log`: `AGENT_DEVICE_RUNNER_ACTIVATE_FACT bundle=... reason=... priorState=2 |
| 55 | + otherActiveApplicationPid=<N>` — the same line's `priorState` is what the response must carry; |
| 56 | + `state=` on the preceding `AGENT_DEVICE_RUNNER_ACTIVATE` must be non-foreground. |
| 57 | +- The response can therefore never report `priorState: runningForeground`. Both directions are pinned |
| 58 | + in the runner unit lane (`UnitTests/RunnerTests+LifecycleCacheTests.swift`): the already-foreground |
| 59 | + call asserts `pendingTargetActivation == nil` and the backgrounded call asserts the stamped |
| 60 | + `priorState` equals `XCUIApplication.State.runningBackground.rawValue`. |
| 61 | +- Correlate `<N>` with the app from step 3: `xcrun devicectl list processes --device $UDID` (or the |
| 62 | + physical-lane equivalent of the simulator's `ps`) should find that pid alive. Confirming it is |
| 63 | + AX-active is what the runner probed; confirming it *owned the screen* is not what this fact claims. |
| 64 | + On a physical device `proc_pidpath`-style resolution is deliberately NOT attempted. |
| 65 | + |
| 66 | +## Still to prove on this lane (PR1 risk list) |
| 67 | + |
| 68 | +- Whether `activeApplications` reports more than the session app while a foreign app is foreground |
| 69 | + on real hardware (decides how often `otherActiveApplicationPid` is present at all). |
| 70 | +- That screenshot stays lifecycle, #2438 in-place system-host serving still applies (Apple Pay sheet |
| 71 | + from **Automation lab → Open Apple Pay**), and ADR 0005 `targetReset` on external relaunch is |
| 72 | + untouched. |
| 73 | + |
| 74 | +## Not covered by the disclosure shipped in PR2 |
| 75 | + |
| 76 | +`press <x> <y>` and `press @ref` answered from a live ref frame consume no capture, so they carry no |
| 77 | +disclosure even though the runner may have re-activated the app to serve them. Treat a silent |
| 78 | +interaction as "unknown", never as "no repair". Follow-up: callstack/agent-device#2694. |
| 79 | + |
| 80 | +## PR2 simulator lane — daemon disclosure (apex-2682-proto, iOS 26.2) |
| 81 | + |
| 82 | +Driven with `bin/agent-device.mjs` after `pnpm build && pnpm clean:daemon`, session `apex2682-pr3`, |
| 83 | +off-app handoff via `xcrun simctl openurl <UDID> https://example.com` before each command. Every |
| 84 | +command below re-activated the session app, and each answered with `targetActivation` plus the |
| 85 | +appended warning: |
| 86 | + |
| 87 | +| Command | Result | |
| 88 | +| --- | --- | |
| 89 | +| `snapshot -i` | warning first in `warnings`, ahead of the AX-backend warning; `targetActivation` carried | |
| 90 | +| `snapshot -i --level digest` | `targetActivation` survives the digest projection | |
| 91 | +| `find "Tab Bar" --first` | disclosed on the matched response | |
| 92 | +| `press 'label="INFO"'` | disclosed on the interaction response | |
| 93 | +| `wait 'label="INFO"' 8000` | disclosed on the satisfied response | |
| 94 | + |
| 95 | +`otherActiveApplicationPid` on the simulator was the Safari process, consistent across commands (pid 33878). |
| 96 | + |
| 97 | +### Proof the review asked for on this lane |
| 98 | + |
| 99 | +The false-attribution class is covered by unit tests rather than a device run, because the device |
| 100 | +cannot show a cache hit on command: `src/daemon/__tests__/capture-disclosure-target-activation.test.ts` |
| 101 | +pins that a cache-reused tree discloses nothing, and |
| 102 | +`src/daemon/interaction/internal/__tests__/interaction-target-activation-disclosure.test.ts` pins that |
| 103 | +a press which consumed no capture is not disclosed against an older tree. |
| 104 | + |
| 105 | +## Why the live activation lane is manual |
| 106 | + |
| 107 | +`test/integration/smoke-ios-target-activation.test.ts` is env-gated and deliberately absent from the |
| 108 | +`ios.yml` / `replays-manual.yml` test lists. On GitHub-hosted simulators the runner reads its own |
| 109 | +target as `.runningForeground` while a foreign app is provably on screen (uploaded artifact of |
| 110 | +https://github.com/callstack/agent-device/actions/runs/35460535722/job/105943468492: rendered app |
| 111 | +screenshot, Settings screenshot, 31 captures in ~450 ms each, no repair). The runner is then correct |
| 112 | +to activate nothing, so a CI assertion on the disclosure measures `XCUIApplication.state` on that |
| 113 | +host rather than this feature. Tracked as callstack/agent-device#2696. |
| 114 | + |
| 115 | +Manual evidence stands in for it, and both are reproducible: |
| 116 | +- local simulator (`apex-2682-proto`), first capture after the handoff: the shared sentence in |
| 117 | + `data.warnings`, printed under the snapshot node count and naming a non-foreground prior state and the |
| 118 | + pid probe — `The session app was not foreground when this command |
| 119 | + arrived (prior state runningBackground), so the runner activated it before answering (reason |
| 120 | + stale_target). Any capture taken earlier in this session described the only app other than the |
| 121 | + session app with an active accessibility session (pid 33878), not the session app. Re-capture now |
| 122 | + that the session app answers, or drive the other app in its own session.` — and, on this head, the |
| 123 | + typed fact beside it as `data.targetActivation`: |
| 124 | + `{"reason":"stale_target","priorState":"runningBackground","otherActiveApplicationPid":33878}`. |
| 125 | + PR1 alone carries the sentence only; the typed field is this PR's daemon seam. Either way the |
| 126 | + following capture reports neither. |
| 127 | +- the physical device sequence in this file, which the coordinator runs. |
0 commit comments