Skip to content

test(pdf): pin the object-stream page rewrite - #846

Merged
andiwand merged 1 commit into
mainfrom
test/pdf-writer-object-streams
Sep 6, 2026
Merged

test(pdf): pin the object-stream page rewrite#846
andiwand merged 1 commit into
mainfrom
test/pdf-writer-object-streams

Conversation

@andiwand

@andiwand andiwand commented Sep 6, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Closes the one gap #845 left open, and the last thing docs/design/pdf-annotation.md listed as owed before Phase 2.

A highlight always rewrites the page dictionary, and modern producers put page dictionaries in object streams — so if that case were broken, every annotation on a contemporary PDF would be. opendocument-app-website.pdf is exactly that shape (xref stream, page objects compressed), and nothing had tested it.

It already worked. No code change here, only the test that says so:

  • asserts the page's xref entry is_compressed() before the rewrite and is_used() after — the newer type-1 entry overriding the older type-2 one is the actual mechanism under test
  • rotates page 1, checks the other eight pages and every content stream survive

Externally on the same output: qpdf --check clean, and CoreGraphics renders page 1 rotated. Phase 1 had only validated a classic-table file that way, so the type-2 → type-1 override is genuinely new evidence.

The doc drops the "still untested" note and records what the tests now cover.

37 writer/parser tests pass.

No consumer-visible change, so no changelog entry.

The one case Phase 1 left open. A page dictionary compressed into an object
stream is rewritten uncompressed in the appended section and the newer type-1
entry wins, which is what modern producers make the common case. No code
change: it already worked, and now says so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018e3PEzyU2oAFSzsEoWsSmz
@andiwand
andiwand merged commit 6afbe19 into main Sep 6, 2026
27 checks passed
@andiwand
andiwand deleted the test/pdf-writer-object-streams branch September 6, 2026 15:15
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.

1 participant