Repository navigation
fix(redact): see the annotations this document has added, not only the file's - #69
Merged
Merged
Conversation
…e file's The annotation check read the SOURCE page's /Annots. A mark and a widget are held on the Doc until the write — each names the page object it sits on, which has no number until then — so neither is in the source at all, and a redaction under one was accepted. The workbench found it within a minute of being wired up, in the flow a reader walks into: highlight a line, then decide to redact it. The text went and the annotation stayed, with the marked-up words still in the file as that annotation's own note. The app's test for "the library's refusal reaches the status line" is what failed, and it was right. Doc.Redact now refuses a region that a pending Markup's quads or a pending field's widget rectangle reaches, telling the caller to drop the mark or the field first. A field's places are its WIDGETS, each with its own page: one field can show on several pages, so the field is not the thing with a position. Seven refusals now, each its own subtest, and the page-number guards are tested with a mark and a widget sitting on page 2 exactly over the region's coordinates on page 1 — a page number is not a position. 393 functions at 100.0%. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #68 (v0.28.0).
The gap
Doc.Redactrefuses a region holding an annotation, because an annotation's own/Contentscan hold the very words being redacted. It read the sourcepage's
/Annots— and a mark or a widget added throughDoc.MarkorDoc.AddFieldsis held on theDocuntil the write, because each names thepage object it sits on and the pages have no object numbers until then.
So neither is in the source at all, and a redaction under one was accepted.
How it was found
The workbench, within a minute of being wired up, in the flow a reader walks
into: highlight a line, then decide to redact it. The text went and the
annotation stayed — with the marked-up words still in the file as that
annotation's own note.
The app's test for "the library's refusal reaches the status line" is what
failed, and it was right to:
A test written to check that a refusal is passed along found that there was no
refusal to pass.
The fix
Redactnow also refuses a region reached by a pendingMarkup's quads or apending field's widget rectangle, saying which to drop first.
⛔ A field's places are its widgets, each with its own page — one field can
show on several pages, so the field is not the thing with a position. That is
why the loop is over
f.Widgetsand not overf.Tests
Seven refusals now, each its own subtest. Both new ones check the page-number
guard the way it can actually go wrong: a mark and a widget on page 2,
sitting exactly over the region's coordinates on page 1, must not stop that
redaction — a page number is not a position. And a mark on another line of the
same page is nobody's business either.
393 functions at 100.0% by
go tool cover -func;go vetand the fullsuite clean.
Still open
The symmetric question for annotations the source file already carries: refusing
is right for one somebody else wrote, but a mark this caller just made is
arguably one to remove along with the text rather than refuse over. That is a
behaviour change worth its own issue, and the refusal names the way out in the
meantime.
🤖 Generated with Claude Code