fix(android): refuse a fill whose resolved field left the point
Summary
Invariant: an Android selector or @ref fill must not write into a node other than the one it resolved. If the target moved after resolution, the fill typed into the field now at the point, and verification passed because it checks that same point. Found by #5214.
fillCommand passes the resolved node's identifier, bundleId and type through the fill handoff. The Android pre-read refuses with android_fill_target_moved (dispatched: no) before any input when no visible node with that identity covers the point. This includes a node that is gone or has another class. A Compose node the snapshot published with its role class matches its raw android.view.View. A wrapper with the identity around the point passes. Point fills are unchanged.
The check runs only on a fresh capture. A failed pre-read is tolerated, as on main. When the pre-read fails or is stale, the fill runs and the result carries targetIdentity: 'unverified'.
Before / after
fill id="ā¦:id/amount" 42, after amount and note swap places:
- base:
Filled 2 chars, andnoteholds42 - head:
COMMAND_FAILED,android_fill_target_moved,dispatched: no. Nothing changes.
Validation
android-fill-capture-evidence.test.ts covers moved, gone, other class, Compose role fold, stale pre-read, unmoved and point fill. Its #5214 wrong-field case now expects the refusal. text-input-fill.test.ts covers the failed pre-read. text-input-fill-helper-lifecycle.test.ts keeps #5213's per-fill helper hold. Live proof posted at c5d60e8. CI owns the rest.
Risks:
- Same-id visible siblings are not distinguished.
š¤ Generated with Claude Code