Files
callstack__agent-device/CONTEXT.md
T
Michał Pierzchała 5492cf4642 refactor(ios): single CommandTraits table for runner command classification (#642)
* refactor(ios): single CommandTraits table for runner command classification

Replace the three hand-maintained switches in RunnerTests+Lifecycle.swift
(isInteractionCommand / isReadOnlyCommand / isRunnerLifecycleCommand) with one
source of truth: CommandType.traits, an exhaustive switch returning a
CommandTraits struct (interaction / readOnly / lifecycle axes), collocated with
CommandType in RunnerTests+Models.swift.

Pure refactor: every command's classification is reproduced verbatim, and the
three predicates become one-line lookups with unchanged signatures, so call
sites are untouched. The exhaustive switch makes it a compile error to add a
CommandType without classifying it, closing the drift that historically let
tapSeries/dragSeries/keyboardReturn fall out of isInteractionCommand.

readOnly is a 3-state enum (.always/.never/.conditional); .conditional preserves
alert's action-dependent read-only behavior, resolved in isReadOnlyCommand.
Classification feeds ADR-0002 session invalidation (the read-only retry that
nulls currentApp/currentBundleId), so behavior is intentionally unchanged.

Adds the "Runner command traits" term to CONTEXT.md.

* docs(ios): note CommandTraits.readOnly .conditional is alert-only (review follow-up)

* fix(ios): classify tapSeries/dragSeries/keyboardReturn as interaction commands (#643)

* fix(ios): classify tapSeries/dragSeries/keyboardReturn as interaction commands

tapSeries and dragSeries are the series forms of tap/drag (already interaction
commands); keyboardReturn is the sibling of keyboardDismiss (already an
interaction command). All three were missing from the historical
isInteractionCommand switch — a drift the new CommandTraits table (#642) makes
visible. Classifying them as interaction commands gives them the foreground-guard
+ stabilization preflight that their single-shot/sibling forms already get.

Behavior change: these three commands now re-activate a backgrounded target to
foreground and pay the stabilization delays before running. Ships separately from
the CommandTraits refactor (#642) and should land after that bakes.

mouseClick left unchanged: macOS-only and the foreground guard interacts with
bespoke macOS activation, so it needs a macOS smoke check first.

* test: cover iOS runner series commands in perf harness
2026-06-01 18:11:04 +02:00

2.4 KiB

Agent Device Domain Context

Terms

  • Provider-backed integration scenario: device-free integration test that runs the real daemon request path and replaces only external device or host tool execution.
  • Provider: request-scoped adapter interface for external device, runner, or host tool execution.
  • Provider transcript: exact record of provider calls used when a test must verify platform command translation.
  • Scenario transcript: command-level integration flow that describes user-visible behavior through daemon commands.
  • In-process provider scenario harness: integration runner that invokes the daemon request handler directly without opening an HTTP listener.
  • HTTP contract test: narrow test that verifies JSON-RPC transport, auth, and response finalization over the daemon HTTP boundary.
  • Interactor: semantic interface between command dispatch and platform behavior.
  • Platform module: platform-specific implementation behind the Interactor.
  • Target: selected automation destination, such as mobile, tv, or desktop.
  • Modality: broad supported device family, such as mobile, tv, or desktop.
  • Session: daemon-owned state for a selected target and opened app or surface.
  • Command surface: catalog of public command identity, interface exposure, adapter policy, and shared command metadata across CLI, Node.js, MCP, and batch entrypoints.
  • Runner command traits: the iOS XCTest runner's per-command-type classification across three independent axes — interaction (gates the foreground-guard and stabilization preflight), read-only (gates the session-invalidating retry; the alert command is read-only only for its get action), and runner-lifecycle (skips the app-activation preflight). One source of truth keyed by command type, distinct from the daemon-side Command surface.

Testing Principles

  • Provider-backed integration scenarios should exercise the public daemon path whenever practical.
  • Prefer the in-process provider scenario harness for broad scenarios; keep HTTP contract tests narrow and transport-specific.
  • Provider seams sit below platform modules so integration tests still cover platform command translation.
  • Provider transcripts are for exact external command contracts.
  • Scenario transcripts are for broad, user-rooted workflows that should replace mocked handler unit tests.
  • Unit tests stay for pure logic, parser matrices, selector matching, capabilities, and important edge cases.