perf(apple): read a single-panel simulator's rotation beside its screenshot

Merged
TH
1h ago
+507-45

Summary

On a single-panel iOS simulator, the display-inventory read only supplies displayRotation. Once a resolved table shows one panel, the read runs beside simctl io screenshot, with a 2 s budget and a 250 ms grace after the image and the status-bar release, as on Android. A late read is aborted and the rotation is absent, as documented. Multi-panel and unknown devices keep the read first, so a folded Duo names its lit panel (#2703). Only the multi-panel verdict is cached. 11 files; ADR 0025 is amended.

Diagnostics: a canceled CoreDevice read logs probe-canceled at info. A read beside the capture that finds several panels emits apple_display_single_panel_count_stale.

Validation

Live runs used head 284db40716 and base b13b016e9b (main), on the iPhone 18 Pro simulator. Arms were interleaved, n=24 per arm, with a 1-minute load average of 8–20. The table shows the daemon's durationMs.

screenshotbase p50 / p95head p50 / p95
plain615 / 1578533 / 1497 (−82 / −81)
--normalize-status-bar1058 / 1316911 / 1100 (−147 / −216)

At this load the probe alone takes a median of ~120 ms. Every shot carried a rotation.

  • Rotation, Safari: 24/24 shots matched the image shape with plain screenshots, and 24/24 with --normalize-status-bar.
  • iPhone Duo, 5 fold cycles each way: 0 of 20 PNGs were black with plain screenshots, and 0 of 20 with the status-bar override. Every capture had the lit panel's size.
  • Locally, the focused Android and Apple screenshot tests, lint, typecheck and pnpm gate layering pass. CI owns check:affected.

🤖 Generated with Claude Code