Repository navigation
feat(shake): add a shake command for iOS simulators and Android emulators - #4741
Conversation
|
A note on how the iOS evidence was produced: I'm on Linux with no Mac, so the simulator runs come from GitHub-hosted macOS runners on a branch of my fork (shake-ios-evidence). It builds this branch's CLI, compiles a tiny app that counts motionEnded(.motionShake), and asserts the counter after each agent-device shake. The Intel image passes; on the Apple-silicon image the session start times out, as described under Risks. Happy to rerun anything there, or drop in a check you'd rather see |
|
Thanks! The code in 0ab11ff looks good, with no changes needed. No conflicts are known. Repository CI has not run on this head yet because the fork workflow needs approval, so it must run and pass before merge. The Android, Pixel 10a and Intel iOS simulator runs in the description are your own reports. Not blocking, and you can take or leave each: the Apple silicon simulator was not shown end to end (one hosted run hit the 10 s timeout on |
|
Thanks for the quick look. On the rotation question: yes, the reading still follows the device afterwards. On the API 35 emulator at 0ab11ff, I'll leave the head where it is so CI and the Apple silicon run are against the commit you reviewed. Happy to send the abort-reason assertion and the positive Android cell derivation as a follow-up, or push them here if you'd rather have them in this PR. |
|
This branch now conflicts with main after recent merges. Please rebase onto main; the earlier review points still apply, and the next review will cover the rebased head. |
0ab11ff to
af6d39a
Compare
|
Thanks for the update. At af6d39a the earlier conflict is resolved. One docs issue remains. website/docs/docs/commands.md:150 says that on Apple silicon end to end is still not shown, which is the earlier non-blocking note. The delta does not touch the iOS shake path. The Android live run and local |
Add `agent-device shake` and `client.command.shake()`. On an iPhone or iPad simulator the Apple owner posts the notification that the Simulator app's Device > Shake menu posts (`simctl spawn <udid> notifyutil -p com.apple.UIKit.SimulatorShake`), which UIKit delivers to the app as a motion-shake event. It injects no accelerometer data. `shake` joins the system-button family as one more argumentless cell that returns nothing, so it adds a row to the family table instead of a module, a dispatcher arm and a conformance entry. It is served by host simctl and never waits for the XCTest runner. The result reports that the shake was sent; what the app did with it is not observed. Physical iPhones and iPads refuse with `unsupported-device-kind`, the other Apple leaves with `unsupported-platform-leaf`, and a provider-owned simulator with `unsupported-provider-mode`, because the shake is posted by simctl on the daemon host. Android and WebDriver state their own refusals. Every other owner takes its family denial. The session journal's fixed summaries for the argumentless system commands move to one table, which keeps `buildStructuredActionSummary` under the complexity threshold. The perf suite does not time `shake`, because the fixture handles none. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`agent-device shake` now also works on an Android emulator. The Android owner overrides the accelerometer through the emulator console (`adb emu sensor set acceleration`): ten swings of about 2 g in alternating directions along the screen's X axis, 80 ms apart, then the reading it found. A detector that counts direction changes above a force threshold, as React Native's dev-menu detector does, sees one shake. The rest reading is restored even when the swings are cancelled or the console refuses one. A console refusal fails with `COMMAND_FAILED`, `reason: shake-console-refused`; an unreadable rest reading fails before any swing with `reason: shake-rest-acceleration-unreadable`. Physical Android devices refuse with `unsupported-device-kind`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…lure A TV emulator was admitted by kind alone; it now refuses like the other handheld-only cells. A console that refuses the rest reading reports dispatched: no, and a restore that fails after a refused or cancelled swing no longer replaces that error. Help and docs state the measured duration and name the provider devices that refuse. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
R89 (callstack#4779) requires a wire-published error reason to come from a declared table. The two shake reasons now live in SHAKE_FAILURES, and commands.md documents both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A refused swing is followed by an attempted, unconfirmed restore; a refusal on the initial read dispatched nothing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
af6d39a to
c22b8c1
Compare
|
You're right, that sentence claimed more than the code does. Fixed in c22b8c1 with the rule you gave:
Wording only; reporting the restore failure as its own detail is a follow-up I can send if you want it. The head is rebased onto de36d03 and |
|
This PR is ready for maintainer review at c22b8c1. The |
* origin/main: refactor(apple-runner): generate the Swift runner error-code enums from runner-contract.ts (#4810) fix(daemon-client): report a newer daemon that won a startup race as daemon-incompatible (#4801) feat(shake): add a shake command for iOS simulators and Android emulators (#4741) fix(daemon): give a closing daemon its full teardown before anything kills it (#4806) fix(android): use typed evidence in the readiness boot poller (#4717)
Summary
Adds a
shakecommand to the CLI, Node client and MCP. e2e needs it fordevice.shake()(e2e-inc/e2e#1855), where it was asked to land here first.com.apple.UIKit.SimulatorShakethroughsimctl spawn <udid> notifyutil -p, as Device > Shake does. It carries no accelerometer data, so CoreMotion detectors don't see it.54 files. The Android failure reasons come from a typed table (R89). Scope expansion: the session-journal summaries of argumentless system commands now come from one table, which keeps Fallow complexity under the threshold.
Validation
Tested
c22b8c1econde36d03b7(rebased onto main), with the branch-built CLI.pnpm check:affected --run --head c22b8c1ec: 43 checks passed,exactCommit: true(Linux).af6d39aca(one docs sentence and a rebase since): three shakes moved a shake-detecting app's counter 0→1→2→3; the rest reading was unchanged afterwards.Recorded at
0ab11ff92, not rerun:unsupported-device-kind,dispatched: no.motionEnded(.motionShake)went 0→1→2→3 (job).Risks:
0ab11ff92). On the hostedmacos-26-arm64image (iOS 26.5) the rawsimctlcall shook the app (run), but three agent-device attempts timed out: twice insideopen, once inshake's 10 ssimctlcall.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.