Skip to content

fix(ios): refuse a press whose target is not hittable - #4596

Merged
thymikee merged 2 commits into
mainfrom
fix/ios-press-not-hittable-target
Nov 16, 2026
Merged

thymikee merged 2 commits into
mainfrom
fix/ios-press-not-hittable-target

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

On iOS, press/click on a closed swipe action (RN ReanimatedSwipeable) reported success but tapped the row beside it: snapshot hittable is geometric only. A press now refuses before dispatch with target_not_hittable, dispatched: no.

  • Gate (snapshot only): isNestedTouchControl selects touch controls inside a larger touch control (the swipe-action shape). Other presses pay nothing.
  • Gated target: one lean runner read (querySelector with hittabilityProbe: counts every match, reads isHittable and frame of a single one). notHittable refuses. unknown (no selector, ambiguous, frame not the target's, read failure) proceeds as before.
  • Hook: new probeTargetHittability backend sibling of the offscreen probe, called in admitResolvedTarget before the motion check. iOS only; snapshot output and latency are unchanged. No coveredBy is claimed.

20 files. Refs #4568 (iOS part).

Before: press @e15 on closed Delete Avocado → Tapped @e15 (338, 467), row toggled ("2 items still to buy").
After:

Error (COMMAND_FAILED): "Delete Avocado" is not hittable: a tap would land on another element. Not dispatched. Next: Reveal the control (for example swipe its row), then take a fresh snapshot -i.
details: {reason: target_not_hittable, ref: @e15, rect: {294,425.67,88,82}, dispatched: no}

Row unchanged. After the row is swiped open, the same press deletes it.

Validation

Tested head 10e38f8da8, base cfe08502f0. pnpm check:affected --run --head HEAD: 25 checks passed (receipt run-ezpc0k). Native RunnerTests probe and selector tests ran with INCLUDE_UNIT_TESTS=1: 2/2 passed. CI owns coverage and device lanes.

Device (iOS 26.2 sim, Pantry RN app): closed Delete refused, open Delete pressed; the 22x22 Recipes "Save" button is not nested, so it is ungated and unchanged.

Press latency, ms (base → head):

Press base head
ungated tab press, 6 runs 532–572 524–549
gated open-row Delete, 9 samples 527–702 526–832, medians within noise
refused press, 5 runs n/a 253–332

Not covered: native UITableView swipe actions (no fixture), Android.

View guided diff Turn on auto-fix

A press on a control the platform reports not hittable now refuses before dispatch with target_not_hittable instead of tapping the row beside it. Only a touch control nested in a larger touch control pays for the lean runner read.

Refs #4568
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.32 MB 6.32 MB +3.7 kB
Package (unpacked) 6.32 MB 6.32 MB +3.7 kB
Package (download) 1.92 MB 1.92 MB +725 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 21.6 ms 22.4 ms +0.8 ms
CLI --help 47.1 ms 57.1 ms +10.0 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

You’re at about 96% 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 website/docs/docs/commands.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 · 1 no longer raised (1 marked fixed)

No open findings.

1 finding below minor hidden (user_settings.min_severity).

1 new finding away from what changed since 10e38f8 not shown. Comment @apex-sentinel-staging review for a full review.

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

💬 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 10e38f8d · 16.11.2026 15:12 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/command-runtime/src/commands/interaction/runtime/pre-dispatch-admission.ts:231 Unhittability gate ignores the Maestro non-hittable fallback on the runtime click path

1 finding below minor hidden (user_settings.min_severity).

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

@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 10e38f8. The verdict and the full list are in the summary comment.

- Add the hittability-probe request to runner-requests.json with its producer drive.
- Thread the admission read signal into the native probe read.
- Skip the probe for the Maestro replay non-hittable fallback.
- Cover the cancellation reason, the Maestro skip and the overlap fixture.
- Correct the admission comment and the Maestro wording in the docs.
@thymikee

Copy link
Copy Markdown
Member Author

Follow-up pushed: 8b1b21ad62 on base cfe08502f0.

CI failure: RunnerTests.testEveryRunnerRequestFieldHasAProductionRequest failed on Command fields with no production request: [hittabilityProbe]. I added the ios-simulator.runner-selector-query.hittability-probe entry to contracts/fixtures/runner-requests.json and its producer drive. Locally, with INCLUDE_UNIT_TESTS=1 on the iOS 26.2 simulator, the test ran 1 test and failed without the entry, then passed with it.

Review threads (9, all replied and resolved):

  • Cancellation test now asserts request_canceled and dispatched: no.
  • The admission read signal now reaches the native probe read.
  • The Maestro replay fallback (allowNonHittableCoordinateFallback) now skips the hittability read (Sentinel), with a scenario test and doc wording.
  • Fixture overlap case, stale comment reference and doc wording corrected.
  • Declined with reasons: probe only for non-idle admissions, the @ref hint wording and the "tap" message wording. The last two are the maintainer-specified text.

Validation at 8b1b21ad62: pnpm check:affected --run --head HEAD passed 25 checks (receipt run-7Oqyw2). Device re-run (iOS 26.2 sim, Pantry): closed Delete Avocado refused with target_not_hittable, rows unchanged; after swiping the row open, the same press deleted it. Device closed with shutdown. CI is running on the new head.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready: I found no problems in the code at 8b1b21a. The checks are green (21 checks, 0 failing), and the earlier runner-request failure is fixed by the new fixture entry and its producer drive. There are no conflicts.

Not blocking, and you can take or leave these: find ... click and replayed presses return before the hittability read at pre-dispatch-admission.ts:59, so they can still tap a closed swipe action (move the read above that bypass, or say in the docs they are not covered); identical swipe labels with no testID give N>1 raw matches in hittable-target-probe.ts:21 and fall back to 'unknown' (sending the target rect would let the runner filter by position); the click and press help in metadata.ts:68 does not mention target_not_hittable; isNestedTouchControl at interaction-targeting.ts:442 could reuse rectContains, and the probe repeats the selector setup and raw-match enumeration of the offscreen rescue and findElement; and the guarantee matrix at interaction-guarantees.ts:223 should record the new native hittability refusal and the preresolved/replay gap.

On evidence: the device results (closed Delete refused, revealed Delete pressed at 8b1b21a, ungated presses checked at 10e38f8) are your report, and I had no log or recording to inspect. One open question: does isHittable ever report false negatives on legitimate nested controls, such as a Switch or accessory button in a Cell, an RN overlay with pointerEvents none, or SwiftUI combined elements? A live check of one of those would settle it. Only the revealed swipe action has live evidence of a gated target passing. On tvOS a gated target could now fail with target_not_hittable instead of the unsupported-tap hint, and that is not validated. Native UITableView swipe actions and the snapshot-marking half of #4568 are not covered, which matches 'Refs #4568'.

The review threads: the threads on cancellation test, signal threading, commands.md wording and the Maestro flag (thread) are fixed at this head, and the lower-priority threads on the fixture button position and module comment are fixed too. These no longer apply, so please resolve them. The idle press probe thread is benign because the read already covers nested controls. The fresh snapshot hint thread is benign because the hint already says to take a new snapshot. The message vs typed reason thread is benign because callers branch on the typed reason. Please resolve those three as well.

Nothing blocks merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 16, 2026
@thymikee
thymikee merged commit c3e5ab1 into main Nov 16, 2026
21 checks passed
@thymikee
thymikee deleted the fix/ios-press-not-hittable-target branch November 16, 2026 17:21
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