refactor(apple-runner): extract the keyboard return control lookup

Merged
TH
2h ago
+154-5

Summary

Extracts the keyboard return-control lookup from the keyboard enter press path into one reusable function, so a later PR can report the return key in keyboard status (approved design, Feature C). No behavior change.

Layer 1 of 2: kind(of:) and its cases are read by #4602. Per review on 1a6fc6c, the mapping and its tests stay with the lookup they name.

  • findKeyboardReturnControl(app:) owns the ordered label probe (RunnerKeyboardReturnKey.probeLabels, same labels, same order); tapKeyboardReturnControl taps what it returns.
  • New pure rule RunnerKeyboardReturnKey.kind(of:) maps a return key's label/identifier to go|search|send|next|done|join|route|continue|enter|unknown. Exact case-insensitive matches only; Apple's branded Google/Yahoo keys, Emergency Call, and localized or ambiguous labels stay unknown on purpose.

Touched files: 3. No TypeScript changes, no public API change.

Validation

Tested at cc7940a31646865a7f452fbb9f81eabd60d188c5.

  • pnpm check:affected --run --head cc7940a: passed, exactCommit: true (native-dupes, xctest-selection, packaged-runner-swift). swift-runner-* and replay-* are GitHub-authoritative lanes (CI obligations). At head 1a6fc6c all 20 CI checks passed, including both swift-runner lanes.
  • iOS XCUITest build with AGENT_DEVICE_XCUITEST_INCLUDE_UNIT_TESTS=1: succeeded. Method-selected simulator run: 7 executed, 0 failures, including the 5 new mapping tests and the existing keyboard-return tests. At 1a6fc6c the busy-keyboard tap path also passed locally.
  • macOS host lane: builds locally; its XCTest run cannot start on this machine (automation-mode timeout), so host-lane execution of the new tests is CI evidence.
  • pnpm format, pnpm check:quick: clean.