Skip to content

feat(ios): name the dismiss controls when back changes nothing - #4628

Merged
thymikee merged 5 commits into
mainfrom
t3/ios-back-dismiss-controls
Nov 17, 2026
Merged

thymikee merged 5 commits into
mainfrom
t3/ios-back-dismiss-controls

Conversation

@thymikee

@thymikee thymikee commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

iOS back still only pops the navigation stack (BackButton, else the verified edge swipe) and never presses Close or Cancel. On back_swipe_no_change (e.g. a full-screen modal) the refusal adds details.dismissControls: [{ selector, label, identifier? }]: hittable buttons in the top band of the window back swiped, named back, close, cancel or xmark*, never Done/Save. The hint names a lone one. Help, commands.md and RUNNER_PROTOCOL.md say iOS back does not close modals or sheets, unlike Android's system back. 12 files.

  • Selector, not ref: back expires the ref frame before it swipes (ADR 0014). Entries carry role=button label="…" or role=button id="…", which resolve only against buttons. A control whose snapshot label or identifier another button in any window shares is omitted; a shared fixture ties the runner's text comparison to normalizeText.
  • Cost: one bounded tree read, only on this refusal.

Validation

iPhone 17 Pro Max simulator, iOS 27.0, head ca13deb:

  • Top up: back --in-app and --system → back_swipe_no_change, dismissControls: [{selector:'role=button label="Close"', label:'Close'}], hint Press 'role=button label="Close"' to dismiss this screen; …. Base 26a8a1b had no list.
  • press 'role=button label="Close"' → kind: unique; snapshot shows Home ("Welcome back", "Hi, Review").
  • Home root: back_swipe_no_change, dismissControls absent.
  • XCUITests passed: testInAppBackNeverPressesABarButtonOnlyTitledBack, both new dismiss-control tests, the normalization test, testInAppBackPressesTheNavigationBarBackButton, testErrorPayloadEncodesEveryField….
  • Lint red is main's package-boundaries max-lines (test(gates): keep package-boundaries.test.ts under max-lines #4630).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.35 MB 6.36 MB +5.8 kB
Package (unpacked) 6.35 MB 6.36 MB +5.8 kB
Package (download) 1.93 MB 1.93 MB +1.6 kB

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 26.0 ms 30.5 ms +4.6 ms
CLI --help 55.6 ms 56.6 ms +1.1 ms

thymikee and others added 3 commits November 17, 2026 12:20
iOS back stays the navigation pop: the BackButton press, else the
verified edge swipe. When the swipe changes nothing, such as on a
full-screen modal, the refusal now lists the hittable Back, Close,
Cancel or xmark buttons in the window's top band as
details.dismissControls, each with a selector the caller can press
without a new snapshot. The hint names a lone control. Back never
presses them: Close or Cancel can discard a draft or end a flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the dismiss controls with an exact predicate and their snapshot
frames, ask hittability last, and have the runner name the attribute
each control is pressed by. A control whose label or identifier another
button shares is left out, since its selector would match both.

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

The every-field ErrorPayload fixture sets dismissControls so the encoder
contract covers it. The back description is rewritten shorter than
before, so the always-loaded MCP tools stay within their byte budget.

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

apex-sentinel-staging Bot commented Nov 17, 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 (fdf595127a75).

💬 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 c13ce51d · 17.11.2026 12:14 UTC

Apex Sentinel · ✅ Approve

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

No open findings.

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

Review of 2df99ee8 · 17.11.2026 11:38 UTC

Apex Sentinel · ✅ Approve

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

2 finding(s): 2 minor.

🟡 Minor (2)

Where Finding
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift:748 Dismiss controls are read from every window but judged in one window's frame space
packages/apple-runner/src/runner-contract.ts:592 Ambiguity is checked among buttons only, but the emitted id= selector matches any role

1 finding below minor hidden (user_settings.min_severity).

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

Review of 8a3d7f07 · 17.11.2026 11:22 UTC

Apex Sentinel · ✅ Approve

2 finding(s): 2 minor.

🟡 Minor (2)

Where Finding
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift:711 Ambiguity is checked among buttons only, but the emitted selector matches any element type
apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift:749 dismissControls is read from every window, so a sheet's button can be pressed for the wrong window

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

@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: 2 new findings on 8a3d7f0. The verdict and the full list are in the summary comment.

@thymikee
thymikee force-pushed the t3/ios-back-dismiss-controls branch from 8a3d7f0 to 2df99ee Compare November 17, 2026 11:22

@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: 2 findings moved to a new line on 2df99ee. The verdict and the full list are in the summary comment.

… selectors

Both dismiss control selectors now carry role=button, so press resolves
them against buttons only, the set the runner checks for uniqueness;
a selectors test pins that scope for the label and id forms. The runner
lists controls only from the window back swiped on and checks each
label or identifier against the buttons of every window, compared the
way the selector engine normalizes text. The test file is renamed for
the module it covers.

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

Copy link
Copy Markdown
Member Author

The change at c13ce51 reads well, but the live device run is stale. It covers 8a3d7f0, and c13ce51 changed the runner read afterwards: listing roots now come from context.resolvedWindow, and uniqueness is split across two queries. A modal whose Close button is not under the resolved window element would silently lose its list, and nothing validated at this head would show it. Please rerun at c13ce51 on an iOS simulator. Back on Wallet Top up should return reason back_swipe_no_change with details.dismissControls equal to [{selector:'role=button label="Close"',label:'Close'}] and the single-control hint. Then press 'role=button label="Close"' should land on Home. Back at the Home root should have no dismissControls. testInAppBackNeverPressesABarButtonOnlyTitledBack and the two new Navigation unit tests should pass at c13ce51. The changed read is here: https://github.com/callstack/agent-device/blob/c13ce51/apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Navigation.swift#L783

Of the open inline threads, #4628 (comment) (frame space) is outdated and fixed at c13ce51, because listing now uses dismissControlRoots(resolvedWindow:) (Navigation.swift:720-722, :783). #4628 (comment) (selector role) is also fixed, because both selector forms carry role=button (runner-contract.ts:595-598) and iOS role=button maps only to XCUIElementTypeButton. Please resolve both.

Not blocking, and you can take or leave these. A listed selector should name exactly one node in the tree press resolves against, but uniqueness at Navigation.swift:748 compares the raw XCTest label while press matches the snapshot's aggregated label (RunnerTests+SnapshotAcquisition.swift:189, 286-297), so a button with an empty label and a child text 'Close' would be missed; compare on the snapshot label or drop pressBy=label in that case. selectorText (Navigation.swift:676) copies normalizeText from packages/selectors, so one shared fixture case such as ' Cancel\t' vs 'cancel' asserted on both sides would tie them together. The new selectors test at match.test.ts:282 pins existing behavior and is fine as a contract pin. When resolvedWindow is nil, matching() runs the same button query twice (Navigation.swift:775), so reusing the first pass's snapshots would avoid that.

The lint failure is oxlint max-lines on scripts/layering/package-boundaries.test.ts (1001 lines). This PR does not touch scripts/, and the file is 1001 lines on main at fce2fa6 too, so it is not caused by this change. There are no conflicts. The live claims in the PR body are from 8a3d7f0. Before merge, we need the live run at c13ce51 described above.

The uniqueness read now compares each button's snapshot label, which
falls back to its value or a child's text as press sees it, and reads
unlabeled buttons for that reason. A shared normalization table ties the
runner's selectorText to the selector engine's normalizeText. With no
resolved window the first read also serves as the listing read.

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

Copy link
Copy Markdown
Member Author

Live run at ca13deb on an iPhone 17 Pro Max simulator (iOS 27.0). It uses this branch's CLI with a private state dir. Wallet was installed and signed up through the UI.

Command Result
back --in-app --json on Top up reason: back_swipe_no_change, dispatched: unknown, dismissControls: [{"selector":"role=button label=\"Close\"","label":"Close"}], hint Press 'role=button label="Close"' to dismiss this screen; back only pops the navigation stack.
back --system --json on Top up Same reason, list and hint
press 'role=button label="Close"' --json success: true, resolution.kind: unique; the next snapshot -i shows Home ("Welcome back", "Hi, Review")
back --in-app --json at the Home root reason: back_swipe_no_change, dismissControls absent, runner hint unchanged

These XCUITests pass on the same simulator at ca13deb, run with xcodebuild test-without-building against a runner built into that state dir:

  • testInAppBackNeverPressesABarButtonOnlyTitledBack
  • testDismissControlsListOnlyTopBandDismissButtons
  • testDismissControlsComeFromTheBackWindowAndAreUniqueAcrossEveryWindow
  • testSelectorTextMatchesTheSelectorEngineNormalization
  • testInAppBackPressesTheNavigationBarBackButton
  • testErrorPayloadEncodesEveryFieldButTheRunnerInternalRetryableFailure

ca13deb applies all three optional notes:

  • Uniqueness label: uniqueness compares the label press resolves (evaluateSnapshot, which falls back to the value or a child's text). The read now includes unlabeled buttons for that reason.
  • Shared fixture: contracts/fixtures/selector-text-normalization.json is asserted against the selector engine's normalizeText and the runner's selectorText.
  • Duplicate query: with no resolved window, the first read also serves as the listing read.

The Lint failure is main's scripts/layering/package-boundaries.test.ts max-lines break, which #4630 fixes. #4630 is still open, so this branch is not rebased.

@thymikee

Copy link
Copy Markdown
Member Author

Both checks still red at ca13deb come from main and are already being fixed. Neither touches this diff.

This branch will rebase onto main once #4630 and #4631 land.

🤖 Generated with Claude Code

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at ca13deb. The findings from the earlier review are fixed, and I found nothing new that needs a change. The live run and the XCUITest pass list are in your comment at this head.

Not blocking: these can be taken or left, namely a test that pins the label == '' predicate and the snapshot-to-name mapping, since no test reaches them (Navigation.swift#L691); the predicate should also admit whitespace-only labels, which aggregatedLabel trims to empty, so a hidden Close is not listed as unique; the read should take one snapshot per search root, not one per unlabeled button, to stay inside the 1 s budget (L780); and the private-AX backend should publish the same aggregated label so a child-text Close still presses there (RunnerTests+PrivateAXPresentation.swift#L72).

Two inline threads no longer apply, so you can resolve them: the listing now reads only the back window's roots (thread), and both selector forms carry role=button (thread).

Lint fails on max-lines in scripts/layering/package-boundaries.test.ts, which #4630 fixed on main. Coverage fails in packages/proxy daemon-proxy-transfer.test.ts (#4631). This PR touches neither area, so both look unrelated. There are no conflicts. Rebase onto main so Lint and Coverage go green before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@thymikee
thymikee merged commit 6952fd1 into main Nov 17, 2026
22 of 26 checks passed
@thymikee
thymikee deleted the t3/ios-back-dismiss-controls branch November 17, 2026 13:11
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