Skip to content

feat: support standalone Maestro clearState command - #2366

Open
Rohit3523 wants to merge 2 commits into
callstack:mainfrom
Rohit3523:feat/maestro-clearState-standalone
Open

feat: support standalone Maestro clearState command#2366
Rohit3523 wants to merge 2 commits into
callstack:mainfrom
Rohit3523:feat/maestro-clearState-standalone

Conversation

@Rohit3523

@Rohit3523 Rohit3523 commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Maestro YAML flows using standalone clearState (- clearState / - clearState: <appId>) no longer fail with Maestro command "clearState" is not supported. Previously only launchApp.clearState (clear-then-open) existed.

Before: any flow with a bare clearState step (e.g. a login helper doing stopApp → conditional clearState: ${APP_ID}setPermissions → open deeplink) was rejected at parse time.
After: the step parses, resolves ${VAR}/config appId like stopApp, and clears app state without relaunching — the daemon projects it to settings clear-app-state <app> (session app when the id is omitted).

Examples a reviewer can run:

appId: com.example.app
---
- clearState: com.example.app
- clearState
agent-device replay ./flow.yaml --maestro --platform android

Scope stayed inside the Maestro command family (packages/maestro + its daemon adapter + the generated-help/user-docs strings the sync test enforces): 16 files, +201/−20, no new packages or registries.

Validation

Evidence gathered at ea4b179a9:

  • New regression tests fail without the fix (implementation stashed: exactly the 2 new tests fail, 26 pass) and pass with it.
  • pnpm typecheck clean; pnpm test:maestro-compat 331 pass; pnpm maestro:conformance 57 pass (coverage gate satisfied via UNVERIFIED_COMMANDS, unit-tested by other means); fuzz-arbitraries, help/docs-sync, export, and daemon-adapter suites green.
  • pnpm check:affected --run: all runnable checks passed on a solo run. One full-gate run under concurrent load showed 2 subprocess-backed flakes (session-open-runtime metro-port) that pass in isolation; unrelated files, untouched by this diff.

Claim: published and reported — branch is pushed, CI on the head is still to come.

Accept '- clearState' / '- clearState: <appId>' in Maestro YAML flows.
Unlike launchApp.clearState (clear-then-open), the standalone form clears
app state without relaunching, projecting to 'settings clear-app-state'
on the daemon. Covers the Rocket.Chat login-with-deeplink helper, which
previously failed with 'Maestro command "clearState" is not supported'.
@thymikee

thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member

The implementation at ea4b179 reuses the existing clear-app-state operation without relaunching, and the focused tests cover the new dispatch path. Please replace the UNVERIFIED_COMMANDS exemption with an authored clear-state corpus flow and regenerated upstream parser fixture. The corpus already supports these coverage gaps; tests of our own parser do not verify Maestro compatibility.

This head also needs CI and a live Android/iOS Simulator flow showing that explicit and default app IDs clear the intended app without reopening it. No live evidence or checks are reported yet.

Replace the UNVERIFIED_COMMANDS exemption with an authored
clear-state flow exercising default and explicit appIds, plus the
regenerated upstream parser fixture proving Maestro compatibility.

Live iOS Simulator evidence (iPhone 16, com.apple.mobilesafari):
- marker files in the data container, then replay '- clearState'
  (default) and '- clearState: <appId>' (explicit) via
  'replay --maestro'; both replay 1/1, wipe the container, and leave
  MobileSafari not running (no reopen).
@thymikee

thymikee commented Sep 7, 2026

Copy link
Copy Markdown
Member

Reviewed 7acf98e. The authored corpus and upstream fixture resolve the compatibility finding, and the reported iOS runs cover default and explicit app IDs without reopening the app. No remaining code finding. Please add the equivalent Android replay evidence; that is the remaining human-readiness gap. CI is not reported on this head.

@Rohit3523

Copy link
Copy Markdown
Author

Android evidence on 7acf98e (Pixel 9 emulator, com.callstack.agentdevicelab, local 0.20.11-dev build): marker file in the data container, then replay --maestro of - clearState: <appId> (explicit) and - clearState (default, session-bound) — both replay 1/1, wipe the container, and leave the app not running (pidof exit 1, no reopen).

Gates on this head: typecheck clean, test:maestro-compat 331 pass, maestro:conformance 57 pass, check:affected --run all runnable checks passed. gh pr checks still reports no CI on this branch.

@thymikee

thymikee commented Sep 7, 2026

Copy link
Copy Markdown
Member

The reported Android runs on 7acf98e resolve the remaining validation gap: explicit and default app IDs both clear data without reopening the app, alongside the earlier iOS evidence. No remaining code findings; ready for human review. CI still has no reported checks, so this is not a CI-green merge verdict.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 7, 2026
@thymikee

thymikee commented Sep 8, 2026

Copy link
Copy Markdown
Member

Coverage now reports failures in the eager-closure approval, screenshot-crop, and iOS runner-prewarm tests, plus a slow-test limit. These appear unrelated to the clearState change, but the run is not green. The code and device-evidence verdict is unchanged; ready-for-human stays applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants