Skip to content

perf: avoid app frame query in private AX fallback#879

Merged
thymikee merged 1 commit into
fix/ios-snapshot-private-ax-recoveryfrom
codex/ios-snapshot-perf-probes
Jun 25, 2026
Merged

perf: avoid app frame query in private AX fallback#879
thymikee merged 1 commit into
fix/ios-snapshot-private-ax-recoveryfrom
codex/ios-snapshot-perf-probes

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Use the private AX root frame as the fallback viewport before querying app.frame. This avoids an avoidable public XCTest query inside the private AX recovery path, which can record a failure and force the runner to relaunch after an otherwise successful fallback snapshot.

Scope: 1 Swift runner file. This is stacked on fix/ios-snapshot-private-ax-recovery.

Validation

Ran pnpm build:xcuitest; XCTest runner build passed. Prior physical-device probing on thymikee-iphone showed Bluesky private AX fallback warm snapshots avoiding runner restart when the private AX root frame path is used.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.3 MB 1.3 MB +4 B
JS gzip 434.5 kB 434.4 kB -8 B
npm tarball 572.7 kB 572.7 kB -29 B
npm unpacked 1.9 MB 1.9 MB -85 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.8 ms 26.3 ms +0.6 ms
CLI --help 45.5 ms 45.7 ms +0.2 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/2948.js +4 B -8 B

@thymikee

Copy link
Copy Markdown
Member Author

Review — perf: avoid app frame query in private AX fallback

🤖 Automated review (Claude Code). Stacked on fix/ios-snapshot-private-ax-recovery.

Overview
In the private-AX fallback, use the private AX root frame as the primary viewport and only call safeSnapshotViewport(app:) (which queries app.frame — a public XCTest query that can record a failure and force a runner relaunch) when the root frame is empty. This inverts the previous precedence (app frame primary, root frame fallback).

Looks good

  • Minimal and well-scoped; it directly removes the avoidable public query on the success path, matching the stated goal and the validated Bluesky physical-device behavior.

Two small notes

  1. Stale comment. The leading comment ("If the app frame is unavailable, the private root's own frame is the reliable screen rect here") now describes the old precedence — the new code uses rootFrame unconditionally when non-empty and never consults app.frame first. Suggest: "Prefer the private root's own frame as the screen rect; fall back to the public app-frame query only when the root frame is empty."
  2. Precedence inversion — sanity-check beyond Bluesky. Previously app.frame won when both were valid; now a non-empty rootFrame always wins. If any app's private AX root frame is a sub-region rather than the full screen, downstream viewport inference shifts. Validated on Bluesky, so fine to ship — just flagging the inversion for other deep RN apps.

@thymikee thymikee force-pushed the codex/ios-snapshot-perf-probes branch from 01a683a to 56b0ef1 Compare June 25, 2026 16:35
@thymikee

Copy link
Copy Markdown
Member Author

Addressed the stale comment: it now describes the new precedence explicitly, preferring the private AX root frame and falling back to the public app-frame query only when the root frame is empty. The precedence inversion is intentional for this PR; the fallback remains sparse-checked and quality-stamped by the existing capture plan.

@thymikee thymikee force-pushed the codex/ios-snapshot-perf-probes branch from 56b0ef1 to a91dfc4 Compare June 25, 2026 16:39
@thymikee thymikee force-pushed the codex/ios-snapshot-perf-probes branch from a91dfc4 to d35ec34 Compare June 25, 2026 16:43
@thymikee thymikee merged commit e13a008 into fix/ios-snapshot-private-ax-recovery Jun 25, 2026
15 checks passed
@thymikee thymikee deleted the codex/ios-snapshot-perf-probes branch June 25, 2026 16:55
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-25 16:56 UTC

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant