fix(find): reject ambiguous find get text and get attrs
XI
6d ago+489+489+012345678901234567890123456789-176-176-012345678901234567890123456789
Summary
find <q> get text|attrs silently took the first of several matches. It now follows mutating find's #1625 contract:
- Several matches give
AMBIGUOUS_MATCHwith the #1597 candidates, unless--firstor--lastpicks one. exists,waitandlistare unchanged.
To make that work:
- The read capture is now unscoped, because a scoped capture holds only the first match (
CONSERVATIVE:). - The daemon now forwards
--firstand--lastto the read-only runtime. - The printed candidates follow the strict-read issuance rule, so they come out pinned.
- Help, the selectors docs and the policy comments are updated.
16 files.
Fixes #4685
Blocked by #4698. Merge it first: an unscoped read publishes a full frame, which would let a plain ref from an earlier snapshot -i resolve to the wrong node. #4698 refuses that read. With both branches combined, tests pass (30/30), and help workflow is 9,099 bytes against the 9,100 budget.
Validation
Head 363f5eb9d on base aa600e980.
check:quickpassed. Focused vitest: 2,656 tests pass. The new policy,--lastand candidate-issuance tests fail on base.check:affected --run --head 363f5eb9d: format, lint, typecheck, layering, fallow, build and vitest-related passed.unitfailed only inandroid-sdk-setup-action.test.ts, which fails the same way on base on this host. docs-links and docs-prose passed when run directly.- iOS 27.2 simulator, MultiTodo:
find dup get text: base returnsdupwith exit 0; head returnsAMBIGUOUS_MATCHwith 2 pinned candidates.--firstreturnsdup.find dup existsis true on both.- Combined with #4698, a stale
get text @e16is refused instead of reading "Done".
- Android was not run.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.