fix(selectors): omit target annotation when payload still exceeds ceiling after rect drop
Fixes #4333
Summary
finalizeOversizedCandidate (packages/selectors/src/target-evidence.ts) drops rect from an over-limit payload but never measured again. The 256-byte field caps apply before JSON escaping and the 4 KiB ceiling applies after it, so escape-heavy values (a control character serializes to 6 bytes) could leave a parent-only payload over the ceiling, and the writer emitted an annotation its own parser rejects.
It now measures again after the drop and, if still over, returns undefined, which computeTargetEvidence and its callers already allow. No annotation is written, and that action replays without a target check.
5 files: the fix, a regression test, a patch changeset, and the two docs that described the old behavior (packages/ad-script/docs/target-annotation.md, docs/adr/0012-interactive-replay.md). No scope expansion.
Testing
Base d4eb753cc, head 6be4a4fe6, in a node:22 container running as root.
pnpm vitest run --project unit-core packages/selectors/src/target-evidence packages/ad-script: base source 1 failed (the new test), 191 passed; head 192 passed.pnpm check:affected --run --head 6be4a4fe6: format, lint, layering, typecheck, fallow, build and vitest-related passed. Theunitstage failed: 7 of 17,722 tests, in 5 files outside this change's code path. The same 7 fail in those files with the basetarget-evidence.ts, so they do not come from this change.
No device run; CI has not run yet. This change was prepared with the assistance of an AI coding agent (Claude).
![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.