Skip to content

fix(selectors): omit target annotation when payload still exceeds ceiling after rect drop - #4344

Open
pcbeingused333 wants to merge 1 commit into
callstack:mainfrom
pcbeingused333:fix/target-annotation-oversize
Open

pcbeingused333 wants to merge 1 commit into
callstack:mainfrom
pcbeingused333:fix/target-annotation-oversize

Conversation

@pcbeingused333

@pcbeingused333 pcbeingused333 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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 d4eb753, head 6be4a4f, 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. The unit stage failed: 7 of 17,722 tests, in 5 files outside this change's code path. The same 7 fail in those files with the base target-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
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

…ling after rect drop

Remeasure after dropping rect; docs and changeset updated.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Target annotation writer can emit a payload over the 4 KiB ceiling

1 participant