Repository navigation
Deterministic output: DocumentId pin + determinism tests - #14
Merged
Merged
Conversation
Adds PdfDocument.DocumentId — an optional fixed /ID (the permanent element of the PDF /ID array). When null the ID is derived from content + Timestamp as before; when set it takes precedence, so pinning Timestamp + DocumentId yields byte-identical output. This is the determinism foundation for golden snapshots and reproducible builds. Wired into both Save paths and the signing path. Adds DeterminismTests proving identical content -> identical bytes (including the PDF/A-2b XMP/output-intent path). Part of #5.
This was referenced Jun 9, 2026
Tim81
added a commit
that referenced
this pull request
Sep 6, 2026
Deterministic output: DocumentId pin + determinism tests
Tim81
added a commit
that referenced
this pull request
Sep 6, 2026
Follow-up to #14: - Document that encrypted/signed output stays non-deterministic regardless of the pins (fresh random salts/IVs per save; signatures are time/key-dependent), and note the conventional 16-byte /ID length. - Defensively copy DocumentId on get and set so mutating the array after assignment has no effect on the output. - Add a PrepareForSigning determinism test covering the signing-path /ID wiring.
Tim81
added a commit
that referenced
this pull request
Sep 6, 2026
Follow-up to #14: - Document that encrypted/signed output stays non-deterministic regardless of the pins (fresh random salts/IVs per save; signatures are time/key-dependent), and note the conventional 16-byte /ID length. - Defensively copy DocumentId on get and set so mutating the array after assignment has no effect on the output. - Add a PrepareForSigning determinism test covering the signing-path /ID wiring.
Tim81
added a commit
that referenced
this pull request
Nov 2, 2026
NormaliseWhitespace kept only U+00A0, so a paragraph could wrap at the narrow no-break space French puts before ; ? ! and at the figure space. Treat all three white-space characters in UAX #14 class GL as part of a word, in the paragraph wrap and in ListRenderer's indent bound, from one definition. Keeping them meant deciding how a font draws them. The Standard-14 encoder and metrics now treat U+202F and U+2007 as U+00A0 instead of '?', and an embedded font without the glyph falls back to U+00A0's, then a space's, instead of .notdef. Refs #562
This was referenced Nov 18, 2026
This was referenced Nov 27, 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.
Part of #5 (regression safety & test depth). Establishes the determinism foundation that
golden snapshots and reproducible builds depend on. Build clean; 280 Kernel + 122 Layout
tests pass; format-clean.
What
PdfDocument.DocumentId— an optional fixed/ID(the permanent element of the PDF/IDarray). When null, the ID is derived from content +Timestampexactly as before;when set, it takes precedence. Pin
Timestamp+DocumentIdfor byte-identical output.DeterminismTests(4): identical content → identical bytes for a normal doc and for thePDF/A-2b path (which exercises the timestamp-dependent XMP + output-intent code); the pin
demonstrably changes and stabilises the
/ID; timestamp-only determinism still holds.Why
The
/IDwas already deterministic whenTimestampis pinned (it is an MD5 overcontent + timestamp), but there was no way to set it explicitly. An explicit pin is needed
for reproducible builds and lets golden tests assert a known, fixed
/IDindependent of thehash derivation.
Next in #5 (follow-ups)
Golden snapshot tests (Verify), property-based tests (CsCheck), benchmarks (BenchmarkDotNet),
CI code-coverage, the Ghostscript render oracle, and Linux font-path detection — each a
separate focused PR. This PR unblocks the golden-snapshot work.