Skip to content

feat(ios): pair plain and honor-modal AX reads in the alert surface corpus - #4124

Merged
thymikee merged 4 commits into
mainfrom
feat/ios-modal-scope-capture
Nov 1, 2026
Merged

thymikee merged 4 commits into
mainfrom
feat/ios-modal-scope-capture

Conversation

@thymikee

@thymikee thymikee commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Summary

PR 1 of 3 for modal-scoped alert. No behavior change for alert or snapshot.

  • The runner reads one app three times: honor-modal (snapshotKeyHonorModalViews), plain, honor-modal again. Each node carries its AX identity and its parent's. Pairing is linear on (element, parent). Typed outcomes cover unsupported, failed, and unstable (truncated, unmatched, reparented, moved, screen changed).
  • Corpus format 2 records both trees, the read order, timings, and the toolchain. All fixtures are re-recorded. New: Settings page sheet, Settings without a modal. The sheet's expect pins today's dismissPopup output.
  • Finding: XCUIApplication.snapshot() equals the honor-modal tree on all 7 recordings, so expect replays on honorModal.
  • The capture runner has its own bundle id, so it runs beside a session runner.

20 files.

Validation

check:affected --run --head f7d69df7b9 passed. Host swift test 36/36. iOS and macOS runner builds pass.

iPhone Duo, iOS 27.1. Nodes plain/honor; ms honor/plain/confirm:

Scenario Nodes ms
Settings, no modal 237/237 144¹/40/40
Settings sheet 426/86 21/104/14
SpringBoard alert, folded 248/41 14/44/12
SpringBoard alert, unfolded 243/40 13/38/10
SpringBoard, no alert 337/337 57/48/45
Safari prompt, folded 85/67 29/15/22
Safari prompt, unfolded 93/75 16/15/12

¹ Warm-up read.

Positive control: each prompt removes nodes; each screen without one removes none (asserted per recording).

Not verified: physical devices, iOS before 27.1, iPad popovers, React Native Modal, SFSafariViewController.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

…orpus

The runner reads one app three times through the private AX client: the
tree with snapshotKeyHonorModalViews, the plain tree, and the honor-modal
tree again. Each node carries its AX identity (pid:elementOrHash.elementID)
and parent identity. The plain and honor-modal trees are matched by element
and parent element in linear time; a truncated, unmatched, reparented, or
moved pair, or two honor-modal reads that differ, is unstable.

The corpus moves to format 2 with both trees, read order, timings, and
toolchain. All fixtures are re-recorded, and a Settings page sheet and a
Settings screen without a modal are added. `expect` replays on honorModal,
which matched XCUIApplication.snapshot() on every recording. No behavior
change for alert or snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agent-device-website Ready Ready Preview Oct 31, 2026 7:06pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.63 MB 5.66 MB +24.4 kB
Package (unpacked) 5.63 MB 5.66 MB +24.4 kB
Package (download) 1.72 MB 1.72 MB +5.2 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.2 ms 29.3 ms +0.1 ms
CLI --help 57.8 ms 60.4 ms +2.6 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 20 files

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

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

Comment thread scripts/capture-alert-surface.ts Resolved
@thymikee

Copy link
Copy Markdown
Member Author

I found no new code problems in f7d69df. Smoke Tests is still in progress and has not failed; the diff touches only the iOS runner sources, the snapshot-presentation package with its fixtures, and scripts/capture-alert-surface.ts, so I expect no overlap with that job. No conflicts are known. Before merge, please fix the open P2 thread on the runner bundle id below.

Not blocking, take or leave: (1) the corpus now records an AX read with snapshotKeyHonorModalViews, but production alert rules read XCUIApplication.snapshot(), and nothing ties the two together (RunnerTests+AlertSurfaceTests.swift#L58). The replayed tree should always be the tree production reads, so testCaptureAlertSurfaceTree could also take app.snapshot() and fail when its (type, identifier, label, frame) preorder differs from honorModal, which makes every recapture enforce what the README states. (2) The AX capture bridge, status enum, ModalScopeAcquisition and its failure type ship in the runner target, but only the test-gated capture calls them, and it folds every non-paired case into one XCTFail string (RunnerModalScopeAcquisition.swift#L21). Landing it as is works if the next PR in the stack is named as the consumer and keeps this shape.

Of the open inline threads, the P2 on AGENT_DEVICE_IOS_BUNDLE_ID overriding the runner bundle still stands, and so do the two P3 threads. The P2 on the node cap in RunnerAXModalScopeCapture.m does not apply: the cap is checked before append, so a tree of exactly maxNodes nodes is complete and only a further node sets truncated. It is safe to resolve: #4124 (comment)

I did not rerun the live captures, swift test, check:affected or the runner builds. I read the diff and the CI results (17 of 18 checks green). I could not confirm that snapshot() equals honorModal on all 7 recordings, since no recorded artifact holds snapshot() output. I also did not check that XCUIElement.ElementType(rawValue:) maps the AX element type one-to-one for every fixture node type.

A read that reached maxNodes on its last walked child was reported as a
complete tree, so a clipped pair could be paired as stable. The tree build
moves into modalScopeTreeFromSnapshot so fabricated snapshots can drive it.

The capture also drops AGENT_DEVICE_IOS_BUNDLE_ID and
AGENT_DEVICE_IOS_RUNNER_TEST_BUNDLE_ID from its build env, since either
would override its own runner bundle id. The fixtures' capture.commit now
names f7d69df, whose capture code is identical to the squashed commit
that recorded them. The reparentedElement doc covers an element listed
more often under the same parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

apex-sentinel-staging Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Apex Sentinel could not review commit d8eb5a9a. No review ran, so there are no findings; this is not a verdict on the change.

Apex Sentinel did not review this pull request, as input_limits.pr_max_diff_size is exceeded (686,503/500,000 characters), and the diff is too large even for @apex-sentinel-staging review force, which takes at most 589,824 characters. Make the change smaller or split it into several pull requests, then push a new commit or comment @apex-sentinel-staging review.

@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 12 files (changes from recent commits).

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

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

thymikee and others added 2 commits October 31, 2026 19:48
maxChildren and maxArrayCount bound children per element and maxDepth
bounds levels; the total is bounded only by the client-side count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NSValue(cgRect:) is iOS-only, so the macOS runner unit variant failed to
compile. The test also checks the frame the tree reads back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member Author

The code looks good at d8eb5a9. The earlier findings from f7d69df are fixed, and the iOS and macOS runner builds are green in CI.

Not blocking: the new test's doc comment at https://github.com/callstack/agent-device/blob/d8eb5a9/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+ModalScopeCaptureTests.swift#L5 still says the server stops at maxNodes, which the .m comment no longer claims. Consider rewording it so the client stops keeping nodes at maxNodes and a read that fills the cap may miss nodes, or leave it as is.

Of the open inline threads, these no longer apply and are already resolved: the bundle-id env cleanup in capture-alert-surface.ts (#4124 (comment)), the truncation flag in the modal scope capture (#4124 (comment)), the fixture commit reference (#4124 (comment)), the reparentedElement doc (#4124 (comment)), and the cap comment in the .m file (#4124 (comment)). Each is fixed at this commit.

The only check that did not pass is the Apex Sentinel review. It declined because the diff, mostly the corpus JSON fixtures, exceeds its size limit, so it says nothing about the code. There are no conflicts.

I did not run swift test, the runner unit tests, the runner builds or check:affected, and I relied on CI for the macOS compile fix. I did not re-record any fixture live; the unchanged fixture provenance rests on node counts staying far below the cap. I read #4125 only by title, body and file list, so its use of ModalScopePair is not reviewed here.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 31, 2026
@thymikee
thymikee added this pull request to stack #4126 November 1, 2026 06:12
@thymikee
thymikee merged commit e3f3920 into main Nov 1, 2026
18 of 19 checks passed
@thymikee
thymikee deleted the feat/ios-modal-scope-capture branch November 1, 2026 06:22
thymikee added a commit that referenced this pull request Nov 1, 2026
#4127)

The modal-scope capture from #4124 has one caller, the alert surface
corpus capture test, yet its ObjC reader, the Swift acquisition, and
the bridge's internal header shipped in the runner source. They move
under UnitTests/, which the packager drops, and compile only under
AGENT_DEVICE_RUNNER_UNIT_TESTS. The bridging header imports the capture
header only when it exists, since OTHER_CFLAGS defines do not reach
Swift's clang importer.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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