fix(runner): type the refusals for a control the target cannot supply

Merged
TH
19h ago
+471-32

Summary

Four refusals answered a generic code plus prose, so a caller could tell which one it got only by reading message. Each now answers with the runner's own code; the host maps it to the code its command already refused with and publishes details.reason. Public codes are unchanged (19 files).

Refusaldetails.reasondispatchedcode
keyboard enter, no return key and no fieldkeyboard_return_unavailableunknown (sole-field route taps before typing)UNSUPPORTED_OPERATION
Action Button on a model without onehardware_control_unavailablenoUNSUPPORTED_OPERATION
macOS back, no in-app back controlin_app_back_control_unavailablenoCOMMAND_FAILED (what the code-less reply had)
Android keyboard dismiss, IME ignored escapekeyboard_dismiss_unavailable (one reason across platforms)unknown (keyevents sent)UNSUPPORTED_OPERATION

iOS keyboard dismiss with no dismiss key was already typed by #4536; skipped. Simulator volume and non-tvOS remote presses are refused by runtime admission before the runner, so they keep unsupported-device-kind / unsupported-platform-leaf — the prose names the reachable route only. No issue was filed.

Validation

Base d78be6c887, tested head 93dc052e06.

  • vitest --project apple-runner 967 passed; unit-core (src/__tests__ src/commands packages/command-output) 3923 passed, 2 skipped; repo-guards, command-surface, platform-android, schema passed.
  • tsc -b tsconfig.typecheck.json clean; pnpm format/lint clean; check:xctest-selection clean (722 methods, 0 unreachable).
  • macOS host XCTest lane (test-without-building, -skip-testing:.../testCommand) at 1d453224ed: 433 tests, 0 failures, including both new refusal tests. Swift is comment-only since that SHA.

Unresolved: iOS-simulator and tvOS lanes for the new codes are CI's; the Action Button emission site has no Swift falsifier (deferred, comment-only diff since).

Guard

test/repo-guards/runner-refusal-reason-docs.test.ts fails if a reason joins the union without appearing in commands.md.

šŸ¤– Generated with Claude Code


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