Skip to content

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

Open
thymikee wants to merge 7 commits into
mainfrom
t3/parallel-ios-display-probe
Open

thymikee wants to merge 7 commits into
mainfrom
t3/parallel-ios-display-probe

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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.

screenshot base p50 / p95 head p50 / p95
plain 615 / 1578 533 / 1497 (−82 / −81)
--normalize-status-bar 1058 / 1316 911 / 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

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.33 MB 6.33 MB +1.3 kB
Package (unpacked) 6.33 MB 6.33 MB +1.3 kB
Package (download) 1.92 MB 1.92 MB +560 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 31.1 ms 34.0 ms +3.0 ms
CLI --help 66.9 ms 84.3 ms +17.4 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 10 files

You’re at about 97% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/adr/0025-foldable-apple-panels.md Resolved
Comment thread docs/adr/0025-foldable-apple-panels.md Resolved
@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (b13b016e9bc1).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of 8ee29b53 · 16.11.2026 17:40 UTC

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (cb335952017e).

Review of 5cd98288 · 16.11.2026 17:30 UTC

Apex Sentinel · ✅ Approve

Since the last review: 1 new · 0 still open · 1 no longer raised (1 marked fixed)

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-apple/src/core/screenshot.ts:283 🆕 Stale single-panel count goes unreported when the beside-capture read cannot identify a panel

Reviewed with this repository's own Sentinel configuration (cb335952017e).

Review of 38ae500c · 16.11.2026 17:17 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-apple/src/core/display-inventory.ts:137 Suppressed unresolved diagnostic still leaves hints that tell the operator to read it

Reviewed with this repository's own Sentinel configuration (b3c1a3c8abd9).

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 38ae500. The verdict and the full list are in the summary comment.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 5cd9828. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 8ee29b5, and the checks pass (22 pass, 2 skipped, 0 failing) with no conflicts. Nothing blocks merge.

Not blocking, and fine to take or leave: when the caller aborts on a scoped-set simulator, readGuestPanelTable throws instead of returning probe-canceled, so the claim in the PR body and test comment holds only for the default set; the grace wait in captureWithFallback runs inside the status-bar hold and could move after it; settledWithin now shares a name with a different function in provider-app-log-poller.ts; and a rotation read that misses the 250 ms grace now logs a warn-level probe-canceled at display-inventory.ts:138, which may be noisy under load.

The timing, rotation and Duo fold runs were taken at 38ae500; the later diff changes only diagnostics, tests and docs.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 16, 2026
thymikee and others added 5 commits November 16, 2026 21:57
…enshot

A simulator whose panel table already resolved to one integrated panel never
names a display, so its per-capture panel table read only supplies the
display rotation. Start that read beside simctl io screenshot and attach its
rotation within a 250 ms grace after the image is written; a later read is
aborted and the rotation is absent, as the screenshot contract already states.
Multi-panel and unknown devices keep the sequential read, so a folded device
still names its lit panel.

The resolved panel count moves from the foldable rotation module into the
display inventory, which records it on every resolved read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A read beside a single-panel capture that resolves a named panel now emits
apple_display_single_panel_count_stale. ADR 0025 records that only the panel
count is kept and that a single-panel table read runs beside the capture.
The runner-fallback inventory tests pin the sequential path explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verdict cache

The rotation read test now asserts the 2 s budget and drives the 250 ms grace
with fake timers. ADR 0025 states that a stale single-panel verdict sends one
capture without --display, and that the resolved read replaces the verdict so
the next capture names the lit panel. The cache is described as a multi-panel
verdict, not a count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts diagnostic

Fold and orientation hints point at apple_display_inventory_unresolved, so a
caller-canceled read must still emit it. The diagnostic fires again for every
unresolved read; a read whose caller aborted it reports reason probe-canceled
instead of probe-failed, without the toolchain hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…names no panel

A read beside a single-panel capture that refuses with
capture-panel-unidentified resolved a multi-panel table too, so that capture
also went out without --display. It now emits
apple_display_single_panel_count_stale. The refused read already records the
multi-panel verdict, so the next capture reads the table first; a test pins
that. Other read failures stay silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/parallel-ios-display-probe branch from 8ee29b5 to d385f4b Compare November 16, 2026 21:00
thymikee and others added 2 commits November 16, 2026 22:02
…ed reads

The single-panel rotation grace now runs after the simulator's status bar is
released, so the lock is not held for metadata. A canceled panel table read
reports apple_display_inventory_unresolved at info level. The shared grace
helper is renamed resolvedWithinGrace so it no longer shares a name with the
app-log poller's own helper, and the canceled-read test states that only a
CoreDevice read reaches the fold hint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R11 pins capture-kit's export list; the shared settledWithin helper that
Android and Apple screenshots use is a new deliberate subpath.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the t3/parallel-ios-display-probe branch from d385f4b to 284db40 Compare November 16, 2026 21:02
@thymikee

Copy link
Copy Markdown
Member Author

Rebased onto main after #4603. In the Android screenshot, the helper rotation still comes first, and the dumpsys fallback now uses the shared grace helper. Applied all four notes in 8a2dbe3 (head 284db40):

  • Scoped-set cancel: the claim now covers the default set only. The test comment says a CoreDevice read that its caller cancels still emits probe-canceled and reaches the fold hint, while a guest read rethrows the cancellation and never reaches a hint. I updated the PR body to match.
  • Grace inside the status-bar hold: readCaptureFacts now runs after holdStatusBar returns, so the lock is free before the 250 ms wait. A new test has the read answer only after release, so it fails if the grace runs inside the hold. I updated the config comment and the ADR wording.
  • Name clash: the shared helper is now resolvedWithinGrace.
  • Warn noise: a probe-canceled read emits apple_display_inventory_unresolved at info; other reasons stay warn. A test pins the level.

Locally, the focused Android and Apple screenshot, display-inventory, foldable and ADR-citation tests pass, along with lint and typecheck. pnpm gate layering passes (483/0).

@thymikee

Copy link
Copy Markdown
Member Author

Live evidence at head 284db40716 against main b13b016e9b, on the iPhone 18 Pro simulator. Arms were interleaved, n=24 per arm, with a load average of 8–20. Numbers are the daemon's durationMs:

  • Plain: p50 615 → 533 ms (−82), p95 1578 → 1497 (−81).
  • --normalize-status-bar, the path whose grace moved after the status-bar release: p50 1058 → 911 (−147), p95 1316 → 1100 (−216).
  • All 48 head shots carried a rotation. At this load the probe alone takes a median of ~120 ms.

Rotation across orientation changes in Safari: 24/24 shots matched the image shape with plain screenshots, and 24/24 with the status-bar override. iPhone Duo, 5 fold cycles each way: 0 of 20 PNGs were black with plain screenshots and 0 of 20 with the override, at the lit panel's size.

Side note: orientation tripped the runner's main-thread watchdog on a long-lived Safari session in both main and head. Relaunching Safari cleared it, so it is unrelated to this diff.

@thymikee

Copy link
Copy Markdown
Member Author

I reviewed 284db40 and found no problems in the code. The new status-bar-ordering test fails on the 8ee29b5 code path, so it covers the regression it targets. The live timing, rotation and fold numbers in your comment are at this head. There are no conflicts. All 25 checks pass. No review threads are open. Nothing else needs to change before merge.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant