fix(ios): find the navigation bar back button on iPhone Duo layouts

Merged
TH
6h ago
+484-105

Summary

On the iPhone Duo (iOS 27.1) the system BackButton floats below the navigation bar, in another subtree (snapshot: bar About is node 51, parent 50; BackButton is node 113, parent 112). back searched only bar subtrees, found nothing and swiped; open pose: BACK_SWIPE_NO_CHANGE.

  • The lookup reads BackButton in the app's windows. Candidates are decided by geometry alone: buttons inside a navigation bar, or, when none is, buttons below a bar within a third of the window height. Others are not counted or compared; hittability only picks the tap target.
  • Rounds snapshot the buttons until still. The first round and one live read then agree on the bar count and, for an unlabeled button, the bar titles, so a retitling bar is never still. A button with no label under bars with no title is not pressed.
  • Docs: commands.md, RUNNER_PROTOCOL.md.

6 files. Closes #4527. Cut: swipe targeting the focused column (a button exists there in all three poses).

Validation (47ff6dbad7, base d78be6c887)

Before, Duo open: COMMAND_FAILED / BACK_SWIPE_NO_CHANGE, found=no.

After, raw runner lines (Settings > General > About, own state dirs):

  • Duo open: found=yes pressed=yes confirmed=yes lookupMs=755 confirmMs=419
  • Duo, two runs at this head: warm lookup open 748 ms, half-open 773, closed 704, confirm 373–483 ms; a cold first run took 1.1 s per lookup on the two-bar poses and still succeeded.
  • iPhone 17 (labelled, in-bar): found=yes pressed=yes confirmed=yes lookupMs=346 confirmMs=143

Runner unit tests built with the unit flag, run on an iPhone 17 simulator: all 33 back tests pass, including a floating unlabeled button (pressed=yes confirmed=yes), no bar (not pressed), a ticking title (not pressed), and a bar button beside an in-content BackButton, still, moving or just below the bar (pressed), and a back tap that presents an alert (unverified, not a pop). The iOS and macOS unit targets build.

Risk: the Duo has no CI lane; a loaded host can exceed the 1 s round budget and swipe instead.

🤖 Generated with Claude Code