feat(settings): set the time zone on iOS simulators and Android

Merged
IM
2d ago
+713-45

Summary

Refs #5005. Split from #5050.

Adds settings timezone <iana-zone|reset> for iPhone and iPad simulators and Android devices and emulators, and introduces the value settings catalog form that drives usage, help, client types, and MCP metadata. Values must be a zone Intl knows, kept as written (offsets and unknown names are refused before dispatch), and --app is refused with setting_app_not_consumed. Each response reports previousTimeZone.

  • iOS simulator: sets or unsets TZ in simulator launchd via simctl spawn launchctl. Applies only to apps launched afterwards and is lost when the simulator reboots; both limits are documented in CLI help and docs. A zone missing from the Mac's time zone database, which simulator apps read, fails with time-zone-unknown-to-simulator.
  • Android: works on emulators, physical devices, and Limrun Android over adb. Turns auto_time_zone off, runs cmd alarm set-timezone, verifies persist.sys.timezone (failing with time-zone-not-applied; any failure restores the previous auto_time_zone), and re-enables automatic time zone on reset.
  • Other targets (including Limrun iOS, tvOS, macOS, and Revyl) refuse with UNSUPPORTED_OPERATION.

Before / after

 $ agent-device settings timezone America/New_York --platform android --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+{"setting":"timezone","state":"America/New_York","timeZone":"America/New_York","previousTimeZone":"Asia/Kolkata","autoTimeZone":false,"message":"Time zone set to America/New_York"}
 $ agent-device settings timezone asia/kolkata --platform android --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+Error (COMMAND_FAILED, reason=time-zone-not-applied): Android kept the time zone America/New_York.
 $ agent-device settings timezone Asia/Kolkata --platform ios --json
-Error (INVALID_ARGS): settings requires <wifi|bluetooth|airplane|mobile-data|keep-awake|location|animations> <on|off>, …
+{"setting":"timezone","state":"Asia/Kolkata","timeZone":"Asia/Kolkata","previousTimeZone":null,"warnings":["Running apps keep the old time zone until they relaunch (run open <app> --relaunch), and the override is lost when the simulator reboots."],"message":"Time zone set to Asia/Kolkata"}

Validation

  • Base 9f7751eeb0, head f9f8282018.
  • Pixel 9 emulator (API 36): America/New_York, lowercase alias read-back (time-zone-not-applied), and reset verified with getprop persist.sys.timezone and auto_time_zone.
  • iPhone 17 Pro simulator (iOS 27.2): Asia/Kolkata and reset verified with launchctl getenv TZ; reset warns about relaunching only.
  • Focused suites: 219 passed (contracts, command-surface, daemon handler, Apple, Android, Limrun); 21 mutants each fail a test, including physical Android admission.
  • Gate at f9f8282018: format, lint, typecheck, layering, fallow, build, vitest-related, provider-integration (324 passed), command-docs, docs-links, and docs-prose passed.