feat(selectors): assert checked state with is checked and checked=

Merged
TH
9d ago
+175-7

Summary

Snapshot nodes already publish checked on Android (ui-hierarchy.ts) and iOS (ios-node-interpretation.ts, which can also produce 'mixed'), and snapshot/get attrs show it, but the selector language could not assert it. This adds checked as a selector boolean key and an is checked predicate, so flows can assert the state of switches, checkboxes, and radios:

agent-device is checked 'role=switch label="Wi-Fi"'
agent-device wait 'id="tos" checked=true' 5000

checked= is three-valued: checked=true matches only node.checked === true and checked=false only node.checked === false; iOS 'mixed' and an absent fact (a non-checkable Android node) match neither, because checked is published only on checkable controls and absent means "not checkable", not "unchecked". is checked passes only on an explicitly checked node and includes checked in its details JSON. 14 files changed: contracts IS_PREDICATES, selectors parse/match/predicates, command-surface metadata, CLI help (via IS_PREDICATES/SELECTOR_KEY_NAMES), fuzz/property arbitries, parity tests, focused unit tests (true/false/mixed/undefined), and website docs. The docs also note that Android id= matches the full pkg:id/name resource-id, React Native testIDs arrive bare, and a Jetpack Compose Modifier.testTag reaches agent-device only with semantics { testTagsAsResourceId = true }.

Validation

  • Head: e6eb985d1d (branch t3/assert-checked-state, rebased on origin/main).
  • pnpm install --frozen-lockfile && pnpm build โ€” pass.
  • pnpm format then local gate set mirroring pnpm check:affected --run (fail-open plan): format:check, lint, typecheck, layering, di-seams, fallow, native-dupes, mcp-metadata, production-exports, bundle-owner-files, gate-manifest(+test), check:affected:test, depgraph:test, tmpdir-leaks(+test), coverage/wire-compat/mutation model tests, replay-compat, daemon-wire-compat, check:package, test:integration:node, test:integration:macos-coverage, test:integration:provider (306 pass), test:integration:progress:check, test:fixture-cache, test:fixture-fallback, maestro:conformance, check:xctest-selection, check:packaged-runner-swift, docs checks (command-docs, doc-links, doc-prose, agent-guidance, adr-citations, capabilities-matrix) โ€” all pass.
  • Focused unit tests: packages/selectors match/parse/predicates (incl. mixed and undefined-checked negatives), packages/contracts, daemon is-predicates/selector-runtime-is, command-runtime selector-is, src/__tests__/is-argument-surface-parity.test.ts, cli-grammar.test.ts โ€” all pass; vitest related over the 14 changed files: 410 pass; apple-runner+fuzz-worker projects: 993 pass; smoke: pass. A full unit-core sweep showed 12 failures in 6 unrelated files (release-publish, fuzz harness, auth-session lane, repo-guards) that pass both with and without this diff in isolation โ€” load flakiness of this sandbox, not this change.
  • CI obligations: device/emulator and coverage lanes remain GitHub-authoritative; no device-facing behavior changed (selector matching only).

๐Ÿค– Generated with Claude Code


Autofix with [code]smith
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.