fix(find): reject ambiguous find get text and get attrs

XI
6d ago
+489-176

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_MATCH with the #1597 candidates, unless --first or --last picks one.
  • exists, wait and list are 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 --first and --last to 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:quick passed. Focused vitest: 2,656 tests pass. The new policy, --last and candidate-issuance tests fail on base.
  • check:affected --run --head 363f5eb9d: format, lint, typecheck, layering, fallow, build and vitest-related passed. unit failed only in android-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 returns dup with exit 0; head returns AMBIGUOUS_MATCH with 2 pinned candidates.
    • --first returns dup.
    • find dup exists is true on both.
    • Combined with #4698, a stale get text @e16 is refused instead of reading "Done".
  • Android was not run.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.