Skip to content

Commit dce0b7a

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/android-avd-list-banner
2 parents 39478b4 + 4c1c786 commit dce0b7a

76 files changed

Lines changed: 2772 additions & 204 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
- Add `uninstall <app>` and `client.apps.uninstall({ app })` to remove an installed app on adb-backed Android targets, iOS simulators, and CoreDevice iOS devices. Both report `wasInstalled`. A package name or bundle id that is not installed succeeds with `wasInstalled: false`. Other targets, Appium and Limrun sessions included, refuse it before anything runs.
66
- Add `settings mobile-data on|off` for adb-backed Android targets. It switches mobile data through `svc data` and reports the `mobileData` state stored in the global `mobile_data` row; multi-SIM read-back is not covered yet. Every other target refuses it before anything runs, and `--app` is refused because the switch is device-wide.
77
- On iOS, a `fill` that runs under a degraded XCTest snapshot channel now aims at a point, including ref, selector and replay fills. When the runner identifies no text input under that point, it refuses with `NO_TEXT_INPUT_AT_POINT` (`error.details.reason: no_text_input_at_point`, `dispatched: no`) before dispatching its focus tap, and no field changes; when the input lookup itself cannot answer, it refuses with `TEXT_INPUT_PROBE_UNAVAILABLE` (`error.details.reason: text_input_probe_unavailable`). Previously such a fill cleared and typed through the app-level first responder, so it could rewrite a field the caller never named, or report a clear failure after emptying it. A ref or selector fill whose rect centre misses the real field (an outer container, a non-input node) now needs a point inside the input's own rect.
8+
- Opening a macOS app by bundle identifier now waits briefly when the app is already running but not yet registered with LaunchServices — the case when a supervisor or dev script started it directly — and if registration arrives within that bounded window the open attaches to the running copy, so the session drives the app the caller started, with its arguments. A copy still unlisted when the window closes gets the plain `open` as before, which can still duplicate; the wait only bounds the race, it does not close it. Launching an app that is not running costs one extra LaunchServices lookup and one process-table read, plus one bundle-identifier read when app-shaped processes exist.
89
- Limrun iOS snapshots no longer fail when the instance reports a numeric or boolean accessibility value (the system photo picker's tabs report `1`/`0`): the provider seam normalizes variant scalars to text, the way the Apple tree does. Limrun nodes now also publish `selected: true` for nodes carrying the `Selected` trait, so snapshot output and `selected:` selectors can tell a picked photo from an unpicked one.
910
- `settings` refuses a setting the target does not serve before anything changes, with `UNSUPPORTED_OPERATION`, `settings <setting> is not supported on this device`, and the target's `error.details.reason` (such as `unsupported-platform-leaf`). This replaces the macOS `INVALID_ARGS` refusal and the Apple `setting-unsupported-on-leaf` reason, and now also covers settings that used to reach the device first, such as Android `reset-keychain` or Apple `animations`.
1011
- `settings` refuses, before touching the device, a state its setting does not accept (`Invalid <setting> state: …`), a permission action or mode its target does not take (such as `permission deny accessibility`), and a stray extra argument (such as `clear-app-state <app> <extra>`). The CLI and the daemon accept the same state spellings, in any casing or surrounding whitespace.
1112
- `alert wait 0` on Android reports an alert that is already visible instead of timing out.
1213
- `settings --help` describes each setting on its own line, and its usage folds settings that share a form.
14+
- Added (android): `telephony call|accept|cancel <number>` and `telephony sms <number> <text>`, plus `client.command.telephony({ action, number, text })`, simulate an incoming phone call or SMS on an Android emulator through the emulator console (`adb emu gsm …`, `adb emu sms send …`), so a test can check how an app behaves when a call or message interrupts it, such as video playback pausing and resuming. The number must be up to 15 digits with an optional leading `+`; SMS text is sent as one adb argument, with backslashes and line breaks escaped for the console; the emulator drops characters outside the Basic Multilingual Plane, such as emoji. A console refusal (for example `accept` for a number with no call) fails with `COMMAND_FAILED` and `reason: telephony-console-refused`. Physical Android devices, iOS, every other target, and the WebDriver (Appium) and Limrun providers refuse with `UNSUPPORTED_OPERATION`.
15+
- `fold` on Android emulators: the posture and hinge-angle console calls now time out after 10 s instead of waiting on a console that stopped answering, and a failed call names only its first two words (for example `adb emu sensor get`).
1316
- Carry provider keyboard facts through snapshots. Appium captures, including wait polls and fill pre-captures, add one sequential keyboard visibility probe with a 500 ms timeout. Probe results preserve tap-time docked-tree checks; unavailable probes leave visibility unknown.

‎docs/agents/pull-requests.md‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ Do not wait for CI merely to report publication. Do not claim skipped integratio
2222

2323
## Self-review
2424

25-
Give a fresh reviewer the worktree, head, base ref, and this prompt. Do not supply an implementation summary.
26-
27-
> You did not write this change. Assume it has bugs and find them. Read AGENTS.md and docs/agents/review.md.
28-
> Read the full diff against the merge-base and untracked files. Open callers and siblings for each hunk.
29-
> Keep this checkout read-only. Run experiments only in a separate disposable checkout.
30-
> Report only findings with a triggering scenario: file:line, severity, what breaks, and the fix. If none, say so.
25+
Commit the change. Give an independent reviewer the worktree, merge-base SHA, head SHA, and task requirements.
26+
Keep the first review free of implementation summaries.
27+
Review that SHA range using AGENTS.md and [review guidance](review.md).
3128

29+
In later rounds, provide the previously reviewed SHA, findings, and dispositions. Review changes since that SHA and their affected interactions.
30+
After a rebase, compare branch ranges with `git range-diff <old-base>..<old-head> <new-base>..<new-head>`.
3231
Fix accepted findings and rerun affected checks. Record a reason for rejected findings.
3332
If no independent reviewer is available, reread the full diff cold and report that limitation.
34-
An independent reviewer is required at the growth thresholds in [review guidance](review.md).
33+
At the growth thresholds in [review guidance](review.md), this fallback cannot replace the required independent reviewer.
3534

3635
## Scope and commits
3736

‎docs/agents/review.md‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ Keep reviewed source read-only. Run checks in an isolated checkout if they can m
44

55
## Reviewing
66

7-
- Read linked dependencies and relevant ADRs. Resolve prerequisite conflicts first. Update or supersede conflicting decisions explicitly.
8-
- Trace routing and surface changes through daemon and backend. Helper tests bypassing the router do not prove dispatch.
9-
Check affected CLI, Node, daemon, MCP, help, and docs surfaces.
10-
- Trace typed errors from producers through normalization, transport, and sibling consumers. Do not replace lost reason codes with text matching.
11-
- Classify interaction paths in `packages/contracts/src/interaction-guarantees.ts`. Verify each claim against native code.
7+
Review for concrete regressions. Follow callers and siblings as needed to verify changed behavior.
8+
Apply each check only when the change affects its subject. Reopen a resolved concern only when new evidence changes the conclusion.
9+
10+
- Dependencies and ADRs: resolve prerequisite conflicts. Update or supersede conflicting decisions explicitly.
11+
- Routing and surfaces: trace through daemon and backend to affected entrypoints. Helper tests bypassing the router do not prove dispatch.
12+
- Typed errors: follow reasons from producers through normalization, transport, and consumers. Never replace them with text matching.
13+
- Interaction paths: verify `packages/contracts/src/interaction-guarantees.ts` claims against native code.
1214
Error-path delegation does not prove success-path parity. Prove both paths reachable before comparing performance.
13-
- A platform-family claim covers every backend, including Appium and ADB, or names the covered backends.
14-
- Keep snapshot-wide metadata at response level. Append warnings through the shared builder; never replace prior warnings.
15-
Check compact defaults, bounded arrays, and artifact paths for large evidence.
16-
- Before retaining compatibility, run `git tag --contains <commit>`. Unreleased shapes have no external compatibility obligation.
17-
- Require each new test to detect a credible production failure. Test doubles must fail at the same seam as production.
18-
- Find dead code, redundant guards, casts, narrating comments, and competing owners. Fix the owning rule, not only named sites.
15+
- Platform-family claims: cover every backend, including Appium and ADB, or name the covered backends.
16+
- Response shape: keep snapshot-wide metadata at response level. Append warnings through the shared builder.
17+
Preserve compact defaults, bounded arrays, and artifact paths for large evidence.
18+
- Retained compatibility: run `git tag --contains <commit>`. Unreleased shapes have no external compatibility obligation.
19+
- New tests: each must detect a credible production failure. Test doubles must fail at the same seam as production.
20+
- Changed code: flag dead code, redundant guards, casts, narrating comments, and competing owners.
1921

2022
Use CI Size evidence. At about 700 net production lines or 3 kB npm growth, require an independent reviewer to assess a smaller design.
2123
Also assess any new abstraction, dependency, seam, or ownership rule. Weigh gross churn for moves. Explain justified growth.
@@ -25,4 +27,3 @@ Also assess any new abstraction, dependency, seam, or ownership rule. Weigh gros
2527
Report only triggering scenarios: `file:line`, severity, what breaks, and the fix.
2628
If none, say so. Reject incorrect findings with evidence.
2729
Prove claims such as "one reader", "pure move", or "no shim left" with search or `git diff -M90%`.
28-
Encode repeated findings as types, structure, checks, or tests. Remove prose reminders once enforced.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { test } from 'vitest';
2+
import assert from 'node:assert/strict';
3+
import { AppError } from '@agent-device/kernel/errors';
4+
import { runScrollEdgePasses, runScrollPasses } from '../scroll-edge-state.ts';
5+
6+
type Frame = { readable: boolean; done: boolean; fingerprint?: string };
7+
8+
const REFUSED = new AppError('COMMAND_FAILED', 'refused', { reason: 'refused' });
9+
const PASS_LIMIT = new AppError('COMMAND_FAILED', 'limit', { reason: 'limit' });
10+
const NO_PROGRESS = new AppError('COMMAND_FAILED', 'stuck', { reason: 'stuck' });
11+
12+
/** Drives the shared loop over scripted frames, counting what it asked for. */
13+
async function run(frames: Frame[], passLimit = 10) {
14+
const calls = { observe: 0, shouldStop: 0, scroll: 0, settle: 0 };
15+
const outcome = runScrollPasses({
16+
observe: async () => frames[Math.min(calls.observe++, frames.length - 1)]!,
17+
refuse: (frame) => (frame.readable ? undefined : REFUSED),
18+
shouldStop: async (frame) => {
19+
calls.shouldStop += 1;
20+
return frame.done;
21+
},
22+
passLimit,
23+
passLimitError: () => PASS_LIMIT,
24+
fingerprint: async (frame) => frame.fingerprint,
25+
noProgressError: () => NO_PROGRESS,
26+
scroll: async () => ({ pass: ++calls.scroll }),
27+
settleAfterPass: async () => {
28+
calls.settle += 1;
29+
},
30+
});
31+
return { outcome, calls };
32+
}
33+
34+
test('runScrollPasses: a stop on the first observation costs no gesture', async () => {
35+
const { outcome, calls } = await run([{ readable: true, done: true }]);
36+
assert.deepEqual(await outcome, { passes: 0, result: undefined });
37+
assert.equal(calls.scroll, 0);
38+
});
39+
40+
test('runScrollPasses: scrolls and settles once per pass and reports the last gesture', async () => {
41+
const { outcome, calls } = await run([
42+
{ readable: true, done: false, fingerprint: 'a' },
43+
{ readable: true, done: false, fingerprint: 'b' },
44+
{ readable: true, done: true },
45+
]);
46+
assert.deepEqual(await outcome, { passes: 2, result: { pass: 2 } });
47+
assert.equal(calls.settle, 2);
48+
});
49+
50+
test('runScrollPasses: refuses an unreadable observation before asking the stop condition', async () => {
51+
const { outcome, calls } = await run([{ readable: false, done: true }]);
52+
await assert.rejects(outcome, (error) => error === REFUSED);
53+
assert.equal(calls.shouldStop, 0);
54+
assert.equal(calls.scroll, 0);
55+
});
56+
57+
test('runScrollPasses: refuses an observation that goes unreadable after a pass', async () => {
58+
const { outcome, calls } = await run([
59+
{ readable: true, done: false, fingerprint: 'a' },
60+
{ readable: false, done: true },
61+
]);
62+
await assert.rejects(outcome, (error) => error === REFUSED);
63+
assert.equal(calls.scroll, 1);
64+
});
65+
66+
test('runScrollPasses: spends exactly its pass budget, then raises the caller error', async () => {
67+
const budget = 3;
68+
const frames = Array.from({ length: budget + 1 }, (_, index) => ({
69+
readable: true,
70+
done: false,
71+
fingerprint: `f${index}`,
72+
}));
73+
const { outcome, calls } = await run(frames, budget);
74+
await assert.rejects(outcome, (error) => error === PASS_LIMIT);
75+
assert.equal(calls.scroll, budget);
76+
});
77+
78+
/**
79+
* The budget is checked before the stuck window, so an explicit small budget reports the budget
80+
* rather than no-progress (the order `scroll --until` documented before the loops were shared).
81+
*/
82+
test('runScrollPasses: a surface that never shifts stops as no-progress, the budget winning ties', async () => {
83+
const stuck = { readable: true, done: false, fingerprint: 'same' };
84+
const unbounded = await run([stuck], 10);
85+
await assert.rejects(unbounded.outcome, (error) => error === NO_PROGRESS);
86+
assert.equal(unbounded.calls.scroll, 3);
87+
88+
const bounded = await run([stuck], 3);
89+
await assert.rejects(bounded.outcome, (error) => error === PASS_LIMIT);
90+
});
91+
92+
test('runScrollPasses: an observation without a fingerprint never trips no-progress', async () => {
93+
const { outcome, calls } = await run([{ readable: true, done: false }], 5);
94+
await assert.rejects(outcome, (error) => error === PASS_LIMIT);
95+
assert.equal(calls.scroll, 5);
96+
});
97+
98+
test('runScrollEdgePasses: a refused capture raises the typed edge refusal before any gesture', async () => {
99+
let scrolls = 0;
100+
await assert.rejects(
101+
runScrollEdgePasses({
102+
edge: 'bottom',
103+
captureState: async () => ({
104+
refused: { reason: 'sparse-tree', detail: 'AX bridge unavailable' },
105+
}),
106+
scroll: async () => {
107+
scrolls += 1;
108+
},
109+
}),
110+
(error: unknown) => {
111+
assert.ok(error instanceof AppError);
112+
assert.equal(error.details?.reason, 'scroll_edge_capture_unreadable');
113+
assert.equal(error.details?.edge, 'bottom');
114+
assert.equal(error.details?.captureRefusal, 'sparse-tree');
115+
assert.match(error.message, /AX bridge unavailable/);
116+
return true;
117+
},
118+
);
119+
assert.equal(scrolls, 0);
120+
});

0 commit comments

Comments
 (0)