feat(apple): add verified simulator screen lock

Closed
CS
1mo ago
+680-17

Summary

  • add the public screen-lock command through the typed Node client, CLI, MCP, daemon registry, runtime facts, and structured result schema
  • admit only iOS/iPadOS Simulators and return structured UNSUPPORTED_OPERATION refusals on other platform leaves
  • make the transition idempotent and report success only after SpringBoard lock state and a visible non-empty SpringBoard surface agree
  • add deterministic Swift transition tests for already-locked, delayed/booting, unavailable HID, timeout, and unverified-surface cases

Implementation

The Apple runner uses XCTest's simulator-only pressLockButton selector, the same audited route used by Appium WebDriverAgent, and independently verifies com.apple.springboard.lockstate before checking the visible SpringBoard surface. This avoids Simulator.app menu/keyboard automation and does not conflate screen state with process mutexes, device claims, or runner leases.

Reference: https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Categories/XCUIDevice%2BFBHelpers.m

Verification

  • pnpm typecheck
  • focused TypeScript suite: 139 tests passed
  • focused web/Linux runtime and coverage contracts passed
  • pnpm check:packaged-runner-swift (58 packaged Swift files parsed)
  • pnpm check:xctest-selection (all declared tests reachable by a configured lane)
  • pnpm check:affected --run: formatting, lint, typecheck, layering, fallow gate, build, integration coverage, and 5,019 related tests reached green after classification fixes; the full rerun still hit the unrelated timing-sensitive web shutdown cleanup reaps the exact daemon assertion under load. The exact test passed standalone. GitHub's Apple/XCTest and device lanes remain authoritative.

No npm package was published and no live device/simulator green is claimed locally.