Repository navigation
Phase 7 sweep: API shaping and coverage before the freeze (#233-#254) - #534
Merged
Merged
Conversation
…pline (#236) Type 0 functions with Order 3 no longer fall back to linear interpolation. Each input with at least 4 samples uses a Catmull-Rom cubic Hermite spline through the samples (straight tangents at the first and last sample); several inputs combine as a tensor product, and an input with fewer than 4 samples stays linear, as ISO 32000-2 7.10.2 says Order 3 is then ignored. Evaluation uses only multiplication and addition and allocates nothing. Removes the FunctionOrderUnsupported diagnostic code. Adds Order 3 cases to the function allocation test and benchmark (0 B in the gate baseline), seeds the function-sampled fuzz target with two Order 3 functions, and sets conformance row 7.10.2 to done.
… readers (#253) Move the subtype-specific entry readers (point lists, quadrilaterals, rectangle differences, line endings, border effect, icon name, byte strings, text streams, dates, choices, actions and form XObjects) out of the PdfAnnotation base class into an internal AnnotationEntryReaders helper that each subtype calls. The old private protected base members stay, marked obsolete, until they are deleted in the contraction ticket. An architecture test lists them and shows no source file calls them. No public API changes.
…rypted payload (#234) A PDF 2.0 unencrypted wrapper (ISO 32000-2 §7.6.7) opens as itself and reports its payload: PdfDocument.IsUnencryptedWrapper and PdfDocument.EncryptedPayload expose the embedded file specification, the cryptographic filter (EP Subtype) and its version (Table 28), and whether the engine has a security handler for it. PdfEncryptedPayload.Open decodes the payload and opens it with the wrapper's engine configuration (security handlers, filters, resolvers, strictness) and the caller's or the options' credentials. Deviations from the clause are reported as one UnencryptedWrapperInvalid warning; a filter no handler provides is an EncryptedPayloadFilterUnknown information, so strict mode accepts a well-formed wrapper. Adds the corpus file encrypted-wrapper.pdf (cover page plus a two-page AES-256 payload), its golden image and benchmark baseline, and updates conformance row 7.6.7.
…250) Every Open and Save overload on PdfDocument and PdfEngine now has an OpenAsync or SaveAsync overload with the same parameters plus a trailing CancellationToken cancellationToken = default, and the reverse. The only async-only overloads are the HttpClient and Uri opens. Options are overloads, never optional parameters: SaveAsync(Stream, PdfSaveOptions? = null, ct) becomes SaveAsync(Stream, ct) and SaveAsync(Stream, PdfSaveOptions, ct); the token-less OpenAsync overloads are folded into the defaulted-token ones. Added OpenAsync for path and bytes (with and without options or credentials), SaveAsync for a path, and credentials overloads on the engine. SaveAsync checks the token before each chunk. A save to a path writes a temporary file beside the destination and moves it over the destination only once complete; a canceled or failed save deletes the temporary file and leaves the destination as it was. API review checklist rule (P29): an asynchronous entry point mirrors a synchronous overload (same parameters) plus a trailing defaulted CancellationToken; options are overloads, never optional parameters; network-only opens are the single async-only exception; a save to a path is all or nothing. RS0026 is disabled in PdfEngine.cs and PdfDocument.cs for this rule. Callers that opened or saved synchronously inside async methods now get CA1849; those call sites in tests, samples and tools use the async overloads.
…otation (#254) #253 moved the readers that only some annotation subtypes use into AnnotationEntryReaders and left 15 [Obsolete] private protected copies on the base class with no callers. Delete them: ReadByteString, ReadTextOrStream, ReadChoice<T>, ReadAction, ReadForm, ReadDate, ReadPoints, ReadPointLists, ReadPath, ReadQuadPoints, ReadRectangleDifferences, ParseLineEnding, ReadLineEndings, ReadBorderEffect, ReadIconName. PdfAnnotation.cs goes from 1,077 to 761 lines (316 removed, about 29% of the file); the bound is that it stays under 800 lines and keeps only the readers for entries every annotation has (Table 166) plus the border readers. The members were private protected, so the public API is unchanged and PublicAPI.Unshipped.txt needs nothing. AnnotationEntryOwnershipTests: the RetiredBaseMembers list and the source scan become a reintroduction guard. The base class must declare none of those method names and no [Obsolete] method.
…s in windows on save (#237) Cross-reference sections and the merged lookup are held in XrefEntryMap: ascending arrays of 16-byte entries (XrefEntry now uses automatic layout) with one record per run of consecutive object numbers, looked up by index within a run and binary search between runs. Tables reserve a subsection's entries at once (bounded by 20 bytes of window per entry), streams one entry per data row (bounded by the entry budget), and sections are merged newest first by a k-way merge that keeps the hybrid XRefStm rule. A five-million- object file now allocates 16.0 bytes per entry while it opens. A full save copies an unchanged object's source bytes longer than 1 MiB in 1 MiB windows through one rented buffer instead of gathering the whole stream, so a file over 4 GiB read from a seekable stream opens, walks and saves with bounded memory. Saved bytes are unchanged for every corpus file. Adds BoundedMemoryTests (five million objects, bounded save windows, a synthetic 4 GiB seekable stream) and CrossReferenceBenchmarks.
The 2,015-line JpegDecoder with about forty mutable fields is split into frame and scan parsing, entropy decoding and sample output, with the per-image state in one object. Behavior is unchanged: same samples, same diagnostics (codes and messages), same allocations. - JpegFrame: per-image state (geometry, flags, output kind, truncation, reporter), holding JpegTables (DHT, DQT, DAC and their readers) and JpegScan (scan parameters, EOBRUN, arithmetic statistics). - JpegMarkerReader: markers, segments, frame and scan headers. - JpegScanDecoder: MCU walk, restart intervals, block dispatch, with JpegHuffmanDecoding (sequential and progressive) and JpegArithmeticDecoding (sequential and progressive). - JpegSampleWriter: colour transform choice and the output stage (scaled IDCT, upsampling, colour, 12-bit reduction). - JpegDecoder keeps its internal surface and is the decoder control. No resulting type exceeds 550 lines (JpegMarkerReader is the largest). No public API change.
Replace PdfDocument.ReadAssociatedFiles and ReadMarkedContentAssociatedFiles with read-only AssociatedFiles list properties on each owner: the document, page, structure tree root and element, annotation (base class), form XObject, image XObject, file specification, and the marked-content event. Each is a live view over the owner's AF (or MCAF) entry, read on every call.
# Conflicts: # docs/conformance/iso-32000-2.md
The software rasterizer and everything a render goes through no longer call the platform's C maths library, whose power, logarithm, trigonometric and cube-root results differ in the last bit between glibc, the Windows CRT and Apple's libm. DeterministicMath implements them with fdlibm's algorithms in plain IEEE arithmetic (no fused multiply-add), with IEEE special values and exact results where callers rely on them. It is compiled into the core and into Broadside.Rendering; in the browser it hands over to the runtime's library, which is faster there, so WebAssembly is outside the guarantee for now. Strokes (round joins and caps), ICC curves and the PCS cube root, CIE spaces, sRGB encoding, Type 2 and Type 4 functions and the JPX colour transform use it. No golden image or snapshot changes. RenderHashTests renders every page of every hand-written corpus file at 72 and 150 DPI twice (cold and warm caches must agree) and, on request, writes a hash manifest with the renders. The render-determinism workflow runs it on Linux x64, Windows x64, macOS arm64 and Linux with hardware intrinsics off, then compares the manifests and fails listing the differing pages, with diff images as an artifact. It runs on every pull request that touches rendering. The guarantee, its scope and what keeps it are documented in RenderOptions, the getting-started article and the adding-a-rendering-backend skill.
…ed payload (#235) PdfDocument.CreateUnencryptedWrapper and PdfEngine.CreateUnencryptedWrapper embed an encrypted PDF file unchanged as the encrypted payload of a new PDF 2.0 document, laid out as ISO 32000-2 §7.6.7 requires: a file specification with AFRelationship EncryptedPayload and an EP dictionary (Type, Subtype, optional Version, Table 28), the one EmbeddedFiles entry, listed in the catalog AF, and a Collection naming it as D with View H. F, UF and Desc name the cryptographic filter, never the file (Table 43). PdfUnencryptedWrapperOptions sets the cover document (its pages are appended unchanged; one blank page by default), the filter (default: the payload's Encrypt Filter), its version, the payload name, description and modification date. The wrapper records a PDF 2.0 versioned feature, so a save declares 2.0. A payload whose trailer has no Encrypt dictionary is reported as EncryptedPayloadNotEncrypted (warning) and refused in strict mode. Conformance row 7.6.7 is done.
# Conflicts: # src/Broadside/PublicAPI.Unshipped.txt
…242) Every diagnostic code now has a public, typed home in the Diagnostics namespace: - DiagnosticCode: the stable name, area, default severity and clause of a kind of deviation; equal by name. - DiagnosticArea and one catalog class per area (FileStructureDiagnostics, ObjectSyntaxDiagnostics, SecurityDiagnostics, ... StructureDiagnostics), grouped so the migration tickets #243 to #246 each own whole classes. - DiagnosticCatalog: every code, and lookup by name. - Diagnostic.Kind: the typed code beside the unchanged string Code, which logs, tests and snapshots keep matching on. The internal DiagnosticCodes and CosRepairCodes entries forward to the public codes, so no report site changes and every diagnostic keeps its name and severity. DiagnosticSink gains overloads that take a typed code for the migrations. Default severities come from the severities the report sites use; a snapshot of the catalog is the parity record the migrations must leave unchanged. The adding-a-filter and adding-a-font-program-parser skills and CONTRIBUTING.md name the catalog as the only place to add new codes.
…ted engine (#239) A reflection guard walks every Use*/With* member of every options type in the core and rendering assemblies and proves it is reachable through the AddBroadside delegate, that value options bind from configuration, and that engine options keep non-bindable state out of public properties. Fixture options types with an unbindable value option, public state and a broken chain fail it. Hosted and static engines are compared over every hand-written corpus file (identical bitmaps, identical unchanged saves), a rendering diagnostic is captured by a test logger with code, severity and object reference, and a scan rejects public mutable static state. The picking-up-an-issue skill mentions the guard.
Brings in #235's EncryptedPayloadNotEncrypted, now forwarded to SecurityDiagnostics with its PublicAPI and catalog snapshot lines.
…by the xref repairs (#238)
…the Android smoke reporting when the app is gone (#233)
…brary, which is up to 3 ulps off on glibc (#233)
…ee sine and cosine (#233) DeterministicMath.Pow composed fdlibm log and exp (two divisions, ScaleB) and ran about twice the platform pow, which put Lab conversion, Type 2 functions and the shading benchmarks over the time gate. Pow now uses a 128-entry log table with an exact z/c - 1 split and a 128-entry exp table (ARM optimized-routines structure, no fused multiply-add, Taylor polynomials), behind a small inlinable fast path for a positive base and a non-integer exponent. Results stay within the previous error budget and remain bit-identical across platforms and with hardware intrinsics off. PostScript sin and cos evaluate only the kernel they need, skip the fmod below 360 degrees, and compute the quadrant without a double remainder; their bits are unchanged. The DeterministicMath fingerprint changes with Pow and now also covers SinDegrees, CosDegrees and a second Pow range.
…gle math for joins too small to need arc points (#233)
This was referenced Nov 14, 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.
The Phase 7 API-shaping and coverage sweep: 22 tickets built in parallel on a local integration branch and verified together. Each ticket is its own commit and merge commit; this PR is one review and one CI run instead of 22.
Tickets
Coverage (track 7A)
DeterministicMathreplaces platform transcendental math on render paths; newrender-determinism.ymlcompares render hashes across Linux x64, Windows x64, macOS arm64 and an intrinsics-off leg. WebAssembly is outside the guarantee for now.PdfDocument.EncryptedPayload,PdfEncryptedPayload) and writing (CreateUnencryptedWrapper,PdfUnencryptedWrapperOptions).XrefEntryMap), windowed copy on full save; a 4 GiB synthetic file opens, walks and saves within the stated bounds.Use*/With*members, render and save parity, logging parity, no public mutable statics.ConformanceCheck --citationswith a reviewed policy file; runs in the conformance job.docs/known-limitations.md.API shaping before the freeze
DiagnosticCode,DiagnosticArea,DiagnosticCatalog, 30 area classes); all report sites migrated; the internal catalog is deleted and an architecture test guards it.DiagnosticCode.Create.AssociatedFilesproperties).ImageGeometry,PdfSoftMaskInData,AdobeColorTransform,IsImageMask,MaxDecodedLength.Verification
Local, on the merged tip: whole-solution build with warnings as errors (platform backends off),
dotnet test Broadside.Core.slnfwith the real-world corpus (18,021 tests; the only failures are 4JpxAllocationTeststhat fail in Debug and pass in Release, which CI uses), format, conformance and citation check, ADR-reference check.Notes for review
XrefEntryBeyondSizewarning, so they no longer count as well-formed in the gates.bench/baselines/gate/allocations.jsonwas updated by Multi-gigabyte files keep memory bounded on open and save #237 from macOS measurements; CI may correct a few bytes.Closes #233, closes #234, closes #235, closes #236, closes #237, closes #238, closes #239, closes #240, closes #241, closes #242, closes #243, closes #244, closes #245, closes #246, closes #247, closes #248, closes #249, closes #250, closes #251, closes #252, closes #253, closes #254