fix(refs): refuse reads of refs a partial frame did not issue

Merged
XI
10d ago
+220-3

Summary

A read-only find, a settled diff or a replay divergence that prints a ref activates a partial ref frame over its own capture. A plain @ref from the earlier snapshot -i was then resolved by number against that newer tree. So get text @eN could silently read a different element, the #1076 class of bug.

get and wait now refuse a ref outside the current partial frame's issuance set. They use the existing ref_not_issued reason, and the hint names the partial publication instead of a UI change, as ADR 0014 requires for reads without retained evidence. Refs the partial result printed still resolve. 8 files.

This fixes the wrong-node part of #4686. Keeping earlier refs resolvable after a read-only find needs an ADR 0014 decision, which is left to the maintainers on the issue. The options are to stop publishing the get text ref, or to retain the prior complete frame for reads.

Refs #4686

Validation

Head adf612a2b on base aa600e980.

  • check:quick passed. packages/daemon and src/commands vitest: 5,277 tests pass. The new partial-frame test fails on base, where the stale read succeeds on the wrong node, and passes on head.
  • check:affected --run --head adf612a2b: 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 because of a local SDK path. docs-links and docs-prose passed when run directly.
  • iOS 27.2 simulator, after snapshot -i:
    • find 'label="Speakers (4)"' get text then get text @e51: base returns "Dictate" (wrong node), head returns ref_not_issued.
    • Text find then get text @e2: base returns "Speakers (4)", head returns ref_not_issued.
    • The printed @e1 still reads "Speakers (4)".
  • Android and web were not run live. Ref consumers outside get and wait, such as snapshot -s @ref, are not covered.

🤖 Generated with Claude Code


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