Skip to content

Spec #33: Broadside v1 (integration) - #83

Merged
michaelstonis merged 248 commits into
mainfrom
spec/33-broadside-v1
Oct 12, 2026
Merged

michaelstonis merged 248 commits into
mainfrom
spec/33-broadside-v1

Conversation

@michaelstonis

@michaelstonis michaelstonis commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Integration branch for Phases 1 and 2 of the spec #33 (43 tickets). The spec itself stays open: Phases 3 to 6 are not yet ticketed. Each ticket is built on its own branch by an implementer agent, test-first, then merged here by a merger agent after a green gate (build with warnings as errors, all tests, conformance checker). Progress is tracked with the integrated label on each ticket; GitHub closes them when this PR merges.

This PR is the owner-review point required from Phase 2 on (CLAUDE.md). All 43 tickets are integrated and the code review fix pass is done; this is ready for the owner's review.

Review and fix pass

A two-axis code review (Standards: repo conventions plus a code-smell baseline; Spec: fidelity to the tickets and the spec) ran over the whole branch, split into five areas so each reviewer could read its part: file structure and security, filters and images, fonts, content and graphics, document model. Findings and the triage are summarised below; one fix pass per area then landed on this branch, each through the full gate (build with warnings as errors, all tests including the real-world corpora, conformance checker, format, corpus determinism).

Notable fixes: severity-aware diagnostic deduplication (an Error was hidden behind an Information with the same code); cross-reference entries at offset 0 recovered instead of dropped; filtered linearization hint streams decoded; non-embedded CID fonts resolved through the font resolver; live views whose caches ignored edits (annotation index, field tree, optional content) now keyed on container versions; Type 1 honours the shared charstring budget; CCITT uncompressed mode implemented; DCT frames with more than four components decoded; lazy decryption; files encrypted only for embedded files (AuthEvent EFOpen) open without a password, as in poppler; CI fuzz smoke split into a matrix and a format job added. Every conformance row whose notes admit a gap is now partial. After the fix pass, CI's fuzz smoke found two more issues, both fixed: a checkbox value string containing a zero byte threw instead of reading as Off (regression test added), and the predictor fuzz target's invariant had not been updated for the new partial-row decoding.

Decisions flagged for the owner

  • Predefined CMap metadata in the core (names, ROS, WMode, codespaces; never mappings), so codes split correctly without the CMaps package. ADR 0007 has an addendum explaining it.
  • Core package licence is now a PackageLicenseFile (MIT plus the APAFML, BSD-3-Clause and IJG notices for bundled data and ported code), so the declared licence matches what ships.
  • JPEG with component ids R, G, B and no APP14 or ColorTransform is not colour-transformed, contrary to ISO 32000-2 Table 13, because the one real file affected visibly breaks otherwise. It records an Information diagnostic; row 7.4.8 explains.
  • Type 6/7 mesh patches are read byte-padded per the spec, with an unpadded fallback (and diagnostic) that pdf.js and PDFBox use; no real-world file needs it.
  • Default CMYK→RGB is a polynomial fitted to public SWOP data; the §10.4.2.5 formula is available as ManagedColorManagement.Classic.
  • EFOpen documents open without a password; embedded files stay encrypted until the user password is given.
  • Public API added beyond the ticket text, kept: PdfAnnotation.ProcessAppearance, axial/radial TryGetParameter, ContentContext.FindStructureElement, optional-content ApplyAutoStates/ApplyUsageStates, PdfLinkAnnotation.ActivationRegion, inherited page Annots (with a diagnostic), PdfCidFont.Substitute, new PdfFontDescriptor members, PdfNamedDestination.ResolveStructureDestination, GlyphEvent device-space members, PdfFieldFlags/PdfOutlineItemFlags enums (a breaking change to unshipped API).

Deferred (known, not in this PR)

  • Saving encrypted documents (and so the encrypted corpus files in the save round trip) — Phase 4E tickets.
  • ADR 0003 strict-mode refusal to raise the file version — Phase 4 prefactor ticket.
  • JBIG2 extended templates (normative text is a paid ISO document; no corpus image uses them) and JPX fragment-table reassembly; rows 7.4.7 and 7.4.9 are partial.
  • qpdf/minimal-linearize-pass1.pdf now reports 0 pages (previously rebuilt to 1); qpdf and poppler also fail on it. Rebuilding on PagesMissing would change ten real-world files and needs its own look.
  • Large-file refactors (JpegDecoder, PdfAnnotation), moving diagnostic-code partials out of Parsing/, the public ReadAssociatedFiles naming, free-form security-handler diagnostic codes, SaveAsync overload style, CFF index problem strings as codes.
  • Performance: JPEG 2000 tier-1 (~150 ns/sample), first cold OS font scan, per-engine CMap/UCS2 caches, GraphicsState copy cost.
  • Remote branch 38-filters could not be deleted (permission refused); the owner can remove it.

Closes

The 43 Phase 1 and 2 tickets. The spec #33 is deliberately not closed.

Closes #36
Closes #37
Closes #38
Closes #39
Closes #40
Closes #41
Closes #42
Closes #43
Closes #44
Closes #45
Closes #46
Closes #47
Closes #48
Closes #49
Closes #50
Closes #51
Closes #52
Closes #53
Closes #54
Closes #55
Closes #56
Closes #57
Closes #58
Closes #59
Closes #60
Closes #61
Closes #62
Closes #63
Closes #64
Closes #65
Closes #67
Closes #68
Closes #69
Closes #70
Closes #71
Closes #73
Closes #74
Closes #75
Closes #76
Closes #77
Closes #78
Closes #79
Closes #80

Integrated so far (43 of 43)

🤖 Generated with Claude Code

michaelstonis and others added 30 commits October 9, 2026 12:44
Adds the COS object layer in Broadside.Objects: CosBoolean, CosNumber
(CosInteger, CosReal), CosString, CosName, CosArray, CosDictionary,
CosStream, CosNull and CosReference, with CosObject.Parse/TryParse,
WriteTo and DeepEquals. ISO 32000-2 §7.2, §7.3.

- Allocation-free internal lexer (ref struct over a span), proven by
  LexerAllocationTests and LexerBenchmarks.
- Lenient internal parser that never throws and reports repairs with
  stable codes; the public Parse is strict on top of it.
- Literal string escapes, octal, line continuation; hex strings with
  odd-digit padding; #xx name escapes; streams from a direct Length or
  from endstream.
- Dirty flag on every object: false after parse, true after any
  mutation through the public API, aggregated over direct children.
- Text strings decode PDFDocEncoding, UTF-16BE and UTF-8 with BOM
  detection (§7.9.2.2, Annex D).
- Fuzz targets lexer and object-parser replace the pdf-header
  placeholder; object-parser checks the write-then-parse round trip.
- Conformance rows 7.2.x, 7.3.x, 7.9.x and Annex D updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The checker (#7) resolves Implementing types by simple name; the skill
still showed fully qualified names. Found by the #36 implementer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PdfDocument.Open (path, stream, bytes) and PdfEngine read the header,
the last startxref, classic cross-reference tables through the Prev
chain, the trailer and the catalog, then walk the page tree lazily.
PdfPage is a live view: media, crop, bleed, trim and art boxes with the
Table 31 defaults and clipping to the media box (14.11.2), rotation
normalized to 0-270, user unit, and Resources/MediaBox/CropBox/Rotate
inherited as-is from the nearest ancestor. The effective version is the
later of the header and the catalog Version.

Offsets are long and relative to the %PDF- header (7.5.2). Lenient
reading records Diagnostics (public Diagnostic, DiagnosticSeverity,
DiagnosticException); strict mode throws the first one. PdfOptions
(UseLenient/UseStrict) is snapshotted by the engine; the static entry
points use the same engine code path. Create is a stub.

Internal seams for the next tickets: PdfSource (positional reads, #45),
CrossReference with per-section data and Compressed entries (#39, #40),
ObjectLoader with hooks in fixed order (stream extent #41, decryption
#42, cache #45), DiagnosticSink with an observer (#46), and
EngineConfiguration for new options. The COS parser resolves indirect
stream Length through the loader.

Adds the `document` fuzz target, DocumentOpenBenchmarks and conformance
rows 7.3.10, 7.5.1-7.5.8, 7.7.1-7.7.4, 7.9.5 and 14.11.1-14.11.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AddBroadside registers one PdfEngine singleton built from PdfOptions through
the options pattern (TryAddSingleton, so a second call only adds its
configure delegate). The engine's new PdfEngine(IOptions<PdfOptions>,
ILoggerFactory?) constructor snapshots IOptions.Value once through the same
EngineConfiguration.From the fluent path uses, so both open documents
through one code path.

Diagnostics are also logged through source-generated [LoggerMessage]
methods (category Broadside.PdfDocument, event 1 "Diagnostic", Warning or
Error after the severity), via the DiagnosticSink observer, before strict
mode throws. PdfOptions.WithLoggerFactory lets the static path log too and
wins over the container's factory. No observer is installed without a
logger factory.

The core keeps referencing only DI.Abstractions, Logging.Abstractions and
Options; hosts bind configuration with their own
Options.ConfigurationExtensions. Test-only packages: DependencyInjection,
Logging, Configuration, Options.ConfigurationExtensions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and annex titles

The original skeleton was written from memory. Titles now match the
spec's table of contents: chapter 10 rows were shifted by one, 12.10 is
Geospatial features with Document requirements at 12.11, and the annex
list is A-Q as published (Annex K XFA forms is n/a, parse-and-preserve).
Found by the Phase 2 exploration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ion (#40)

Revisions (ISO 32000-2 §7.5.6): PdfDocument.Revisions lists the original
file and each update, oldest first, as the byte prefix up to the %%EOF
marker (and end-of-line) that terminates the revision's trailer, with the
revision's own trailer. A linearized file's first-page and main sections
form one revision (the first-page Prev points forward); a hybrid XRefStm
joins its table's revision. Root, Info, Encrypt or ID missing from the
newest trailer are taken from an older one with a
TrailerEntryFromOlderRevision diagnostic; an earlier revision without its
%%EOF reports EndOfFileMarkerMissing.

Linearization (Annex F): PdfDocument.IsLinearized and Linearization expose
the parameter dictionary (Table F.1, validated, L checked against the file
length per G.7), the first-page object set (the in-use entries of the
first-page cross-reference section) and, lazily, the page offset and
shared object hint tables (F.4.1-F.4.3, qpdf's per-column byte alignment,
offsets at or after H[0] moved past the hint stream).

Corpus: linearized.pdf is qpdf 12.4.2 output from page-tree-inherited.pdf
(classic tables, unfiltered hint stream), checked in with its command.
hybrid-xref.pdf now ends its main section with startxref and %%EOF as the
7.5.8.4 example does (7.5.6 requires it).

Fuzz: new hint-tables target; the document target reads revisions and
hints. Benchmark: DocumentOpenBenchmarks covers the updated and linearized
files and reads the file structure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cremental-linearization

# Conflicts:
#	docs/conformance/iso-32000-2.md
Adds the filter extension point and the managed non-image filters of
ISO 32000-2 §7.4.

- Contract: IStreamFilter (Name, Decode(ReadOnlyMemory<byte>,
  IBufferWriter<byte>, FilterContext)) and FilterContext (parameters,
  stream dictionary, Resolve, DecodeStream for auxiliary streams such as
  JBIG2Globals, Report, reading mode, decoded-length limit), sized for the
  Phase 2B image codecs.
- Registry per engine, built from the options: PdfOptions.UseFilter
  replaces or adds a filter; no static registry.
  PdfOptions.WithMaxDecodedStreamLength bounds decompression bombs.
- Defaults: ASCIIHexDecode, ASCII85Decode, LZWDecode (EarlyChange),
  FlateDecode (BCL DeflateStream, zlib header checked, raw-deflate
  fallback, truncation detected), RunLengthDecode. TIFF predictor 2 and
  PNG predictors 10-15 run in the pipeline after LZW and Flate, so a
  replacement gets them too.
- PdfDocument.DecodeStream (array and IBufferWriter overloads). Table 5
  deviations, abbreviations, unknown filters, external files and
  over-long output are repaired with diagnostics; strict mode throws.
- Crypt filter slot (Identity only) for the security handler (#42).
- Fuzz targets filter-asciihex, filter-ascii85, filter-lzw, filter-flate,
  filter-runlength, filter-predictor; document target decodes contents.
- Benchmarks per filter and for the predictors; allocation tests prove no
  per-byte or per-row allocation.
- Conformance rows 7.4.1-7.4.10; adding-a-filter skill carries the real
  contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lters

# Conflicts:
#	docs/conformance/iso-32000-2.md
#	src/Broadside/EngineConfiguration.cs
#	src/Broadside/PdfDocument.cs
#	src/Broadside/PdfOptions.cs
#	tests/Broadside.Fuzz/FuzzTargets.cs
#	tests/Broadside.Fuzz/README.md
)

Files that use the PDF 1.5 compressed structures now open and read like
classic files (ISO 32000-2 §7.5.7, §7.5.8).

- XrefStreamReader reads a cross-reference stream section: W (0 to 8 bytes
  per field, W[0] = 0 means type 1), Index (default [0 Size]), Size, big-endian
  fields, type 0/1/2 entries, other types as the null object. Data is decoded
  through the filter pipeline, which PdfDocument.Read now builds before the
  cross-reference information; the stream is never decrypted. The trailer is
  the stream dictionary without its stream-only keys.
- Hybrid files: a table's XRefStm stream is inserted right after the table in
  CrossReference.Sections (XRefStreamOffset set to its absolute offset), so
  lookup is table, then XRefStm, then Prev; the stream's own Prev is not
  followed and its dictionary is not a trailer. Stream sections end past
  endobj, so revisions still find each %%EOF.
- ObjectLoader.LoadCompressed loads type 2 entries: the container is an
  ordinary object (hooks included, so decrypted as a whole), decoded once per
  document into an ObjectStream; each member is parsed over exactly the bytes
  up to the next offset; wrong indexes, unordered offsets, nested containers
  and self-referencing containers are repaired or end with a diagnostic.
- New corpus file linearized-xref-stream.pdf (qpdf --object-streams=generate).
- Removes every "Needs cross-reference streams (#39)" skip and the
  not-readable-yet boundary test.
- Fuzz targets xref-stream and object-stream; DocumentOpenBenchmarks covers
  the compressed-structure files. Conformance rows 7.5.7 and 7.5.8 done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ISO 32000-2 §7.5.8.4: "A PDF reader shall look in the cross-reference
stream first, find the object there, and shall ignore the free entry"; the
NOTE places the free entry only typically in a previous section. A free
entry in a hybrid table now gives way to its XRefStm stream's entry for the
same number; an in-use table entry still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Damaged files open and say what was repaired (ADR 0005, ISO 32000-2 7.5):

- One windowed scan of the file (FileScan) finds object headers, xref
  and trailer keywords and /XRef, /ObjStm, /Catalog names, linearly and
  without materializing the file.
- A startxref or Prev offset at neither xref nor N G obj reads the
  nearest section (table wins ties, never one already read).
- An entry whose offset does not hold its object is searched near the
  offset, then in the whole-file scan (XrefEntryOffsetInvalid, Warning
  when found, Error when not).
- Missing or unusable startxref, or a Root that does not lead to the
  catalog, rebuilds the cross-reference from the scan: newest copy of
  each object, object stream members indexed, newest trailer whose Root
  leads to a catalog (Encrypt/ID/Info from any trailer), else the newest
  /Catalog (TrailerMissing / RootMissing); no catalog -> CatalogNotFound.
- Stream lengths that refer to each other no longer loop; a stream
  without endstream ends at endobj.
- Classic tables: entries not 20 bytes long reported once per section;
  a subsection numbered from 1 starting with the free-list head is
  renumbered from 0.

Diagnostic model: DiagnosticSeverity gains Information (never thrown,
logged at Information); strict mode throws Warning and Error. The sink
records each repair once (same code, offset and object) and offers
ReportOnce (one per code per object) for hot paths.

The five broken corpus files record exactly the diagnostics now listed
in tests/Corpus/README.md; wrong-stream-length.pdf recovers 46 bytes
(the EOL before endstream is not data, 7.3.8.1). New fuzz target
`repair`, benchmarks RepairBenchmarks and ReconstructionBenchmarks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PdfDocument.Save(Stream|path[, PdfSaveOptions]) and SaveAsync write a
complete file: header with binary comment, every in-use object under its
own number and generation, a classic cross-reference table or a
cross-reference stream, with or without object streams
(PdfCrossReferenceLayout), and a trailer with file identifiers.

Objects that are unchanged and were read without repair are copied from
their source bytes, which the loader now records per object (file body
ranges and object-stream member slices); changed and repaired objects
are serialized. Old xref streams, object streams and linearization data
are dropped unless something refers to them. Save and SaveAsync share
one chunked writer, so they write the same bytes. Encrypted documents
are refused until Phase 4E.

PdfDocument.Create / PdfEngine.Create build a PDF 2.0 document with one
empty Letter page.

Adds the `save` fuzz target, DocumentSaveBenchmarks, qpdf/pdfinfo checks
in tests (skipped when absent; CI installs them on Linux).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…contract (#45)

Sources: bytes (zero-copy, stream data slices the caller's memory), paths
and FileStreams (memory-mapped, windows are views of the mapping), any
other seekable stream (read in place under a lock, in growing windows),
and non-seekable streams (copied at open into memory up to
PdfOptions.StreamBufferLimit, then into a delete-on-close temp file).
PdfDocument/PdfEngine.OpenAsync copy a non-seekable stream asynchronously.

Objects are parsed once per (number, generation) through a shared
OnceCache helper that waits for in-flight loads and refuses waits that
would close a cycle (same thread or across threads), so malformed
self-referring files neither throw nor deadlock. Object streams are
decoded once. Stream data stays in the source and is read on access, so
a 2.1 GiB file opens and reads its last page with ~10 MiB managed growth.
Parses and object-stream decodes are traced at Trace level (events 2, 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve-and-create

Saving a document #41 repaired writes a new cross-reference section; a
theory saves every broken corpus file in every layout and reopens it
without warnings or errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…zy-loading-concurrency

# Conflicts:
#	src/Broadside/Parsing/ObjectLoader.cs
#	src/Broadside/PdfDocument.cs
#	tests/Broadside.Fuzz/README.md
…zy-loading-concurrency

# Conflicts:
#	docs/conformance/iso-32000-2.md
#	src/Broadside/Parsing/ObjectLoader.cs
#	src/Broadside/PublicAPI.Unshipped.txt
#	tests/Broadside.Fuzz/FuzzTargets.cs
#	tests/Broadside.Fuzz/README.md
A seekable non-FileStream source read cross-reference tables and streams
in one 4 MiB window, silently truncating a larger section. Tables, xref
stream objects and reconstruction trailers now parse through
PdfSource.ReadGrowing: the window doubles until the parse ends inside it
and the next token is whole inside it; table diagnostics are held back
until the window is final. Object headers and end tokens cut by a window
boundary also grow the window. The windowed-document fuzz target adds a
pass with 16-byte initial windows; tests open a 6 MB table and a 5.6 MB
xref stream through a seekable stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… integrity MAC (#42)

Encrypted documents open transparently with the default user password, a
user password or the owner password: ISO 32000-2 §7.6.1-7.6.4 and §7.6.6
(revisions 2-6, RC4, AES-128, AES-256, crypt filters, EncryptMetadata),
ISO/TS 32003 (V 6 / R 7, AES-256-GCM) and ISO/TS 32004 (standalone and
signature-attached PDF MAC tokens).

- Security handler extension point (ISecurityHandler, registered through
  PdfOptions.UseSecurityHandler, chosen by Filter or SubFilter); the
  standard handler is the default and only authenticates; the engine
  applies Algorithm 1/1.A/GCM per string and stream in loader hook 2.
- Distinct PdfPasswordException (Required/Incorrect) and
  PdfEncryptionNotSupportedException; PdfDocument.Security/Permissions.
- RC4 managed; MD5, AES, AES-GCM from the BCL with managed fallbacks
  where the platform has none; RFC 3394 key wrap managed.
- Corpus: R3 40-bit, crypt filters, AES-GCM, MAC (+ tampered copy),
  owner-key variant, and a password-protected table.
- Fuzz targets encrypted-document, decrypt, mac-token; SecurityBenchmarks.
- Conformance: 7.4.10, 7.6.1-7.6.7 rows; ISO/TS 32003 and 32004.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaelstonis and others added 18 commits October 10, 2026 09:13
9.7.4 done (non-embedded CIDFonts through the resolver chain), 9.8.3 done (Style, Lang, FD, CIDSet), 9.9.1 done (no gap left: Type 1 shares the charstring limits and budget, sfnt offset recovery, Length3 and writer-side requirements stated); 9.6.2.1, 9.6.4, 9.6.5.2 and 9.6.5.4 notes and tests for the width fallbacks, ISOLatin1Encoding and the shared cmap ranking. The font program parser skill describes the shared charstring limits and reporter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pair

IStreamExtentResolver (hook 1) and the loader's private LengthResolver
adapter existed only to forward to the parser's IStreamLengthResolver;
nothing ever replaced the hook. StreamLengthResolver now implements the
parser contract directly for one object load, with the same cycle guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gest table

The standard and public-key handlers carried identical private
Fail(context, message) helpers; SecurityHandlerContext.Fail (internal)
replaces both.

IntegrityVerifier mapped ISO/TS 32004 Table 8 twice (OID to algorithm,
algorithm name to hash function): one table of OID, name and platform
support now feeds both, hashing through IncrementalHash. The hex token
of an attached MAC is validated with Convert.FromHexString's
OperationStatus overload instead of catching FormatException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PdfDocument.Save(Stream) and Save(string) each looped over the writer's
chunks; both call WriteTo now. FileWriter's object-stream and
cross-reference-stream builders each opened their own ZLibStream; one
Deflate helper does it (still direct: encoders join the filter extension
point in Phase 4A, as its remark says).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fuzz-smoke ran 60 s per target sequentially (42 targets now) against a
45-minute timeout. It is a six-shard matrix: shard k smokes every target
whose --list index modulo 6 is k (about 7 minutes each), with
fuzz-findings-<k> uploaded on failure. A new format job runs
dotnet format --verify-no-changes on Broadside.Core.slnf and on the fuzz
and benchmark projects, which the filter leaves out; the
picking-up-an-issue skill's gate lists them too. tests/Broadside.Fuzz is
formatted (Program.cs indentation, FuzzTargets.cs import order).
Validated with actionlint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y notices

The core package declared PackageLicenseExpression MIT while shipping
APAFML-licensed metrics, BSD-3-Clause glyph-list and CMap data and
IJG-licensed DCT code. It now uses PackageLicenseFile LICENSE.txt: the
repository's LICENSE followed by THIRD-PARTY-NOTICES.txt, joined at pack
time by a small inline MSBuild task so neither text is duplicated.
Verified with dotnet pack src/Broadside -c Release: the nuspec has
<license type="file">LICENSE.txt</license> and LICENSE.txt holds the MIT
text and all five notice sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md: sealed unless designed for inheritance. The 46 test classes
under tests/Broadside.Tests/{Document,Security,Writing,Objects,Hosting}
that were not are now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…file-structure

The filtered hint stream fix landed through the filters pass: its
HintTableReader, LinearizationReader, row F.4.1 and corpus README row are
kept, and this branch's duplicate test and ObjectLoader.Streams are
dropped; the filter-failure test stays and is listed in row F.4.1.
Row 7.3.8 names StreamLengthResolver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…file-structure

The core package's PackageLicenseFile landed through the fonts fix pass
(src/Broadside/LICENSE.txt): its Broadside.csproj is kept and the
pack-time join this branch had added is dropped. dotnet pack
src/Broadside -c Release succeeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pen.pdf

After merging the integration tip, the pdf.js gate combines this branch's
newly opened AuthEvent EFOpen file (one more run, five operators) with
the integration branch's counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ISO 32000-2 §7.8.3 requires an annotation appearance stream to carry its
own Resources; the earlier-version allowance in its last bullet covers
only form XObjects and Type 3 fonts. RunAppearanceCore fell back to the
page's resources silently, a repair ADR 0005 says must be recorded. The
fallback stays; the run now records AppearanceResourcesMissing (Warning,
like PatternResourcesMissing for a tiling pattern under the same bullet)
on the appearance stream.

annotations-appearance.pdf now gives every appearance an empty Resources
so it stays a well-formed file. The content corpus gate allowlists the 44
well-formed pdfium/pdf.js files whose appearances omit Resources; the
pdfbox, pdfium and pdf.js gate snapshots gain the new histogram rows
only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CLAUDE.md: sealed unless designed for inheritance. Seals the 151 test
classes under tests/ that were still unsealed. Left as they are: the
abstract ContentCorpusGateTests base (its per-corpus subclasses were
already sealed), the ConformanceCheck.Tests fixtures (sample repositories
the checker reads as data, not compiled tests), and the benchmark classes
in bench/ (BenchmarkDotNet derives a generated class from each one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review fix pass made data shorter than one row decode as a single
partial row. The filter-predictor target still required whole rows and
measured the short-data threshold without the PNG tag byte, so CI's
fuzz-smoke shard 4 flagged a correct 6-byte input (seed 1280006559).
Short data must now yield at most one partial row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A string value is read as the name it spells, but no name can contain
the byte 0 (ISO 32000-2 7.3.5), so CosName threw ArgumentException from
PdfCheckBoxField.IsChecked in lenient mode. Such a string now reads as
Off with FieldValueTypeInvalid; strict mode throws that diagnostic.
Found by CI fuzz-smoke shard 0 (document target, seed 273653498).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelstonis
michaelstonis marked this pull request as ready for review October 10, 2026 15:25
Copilot AI balanced review requested due to automatic review settings October 10, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several public views accept invalid spec structures or become stale after COS mutation, and public documentation contains contradictory contracts.

5 open findings
What changed in this PR

Integrates Broadside v1 Phases 1–2 across parsing, security, fonts, images, content interpretation, and document-model APIs.

Changes:

  • Adds managed PDF parsers, codecs, font support, graphics, annotations, forms, structure, and metadata models.
  • Expands fuzzing, benchmarks, corpus tests, concurrency tests, and allocation gates.
  • Updates public APIs, conformance maps, ADRs, packaging, and licensing.
File Description
.claude/​skills/​picking-up-an-issue/​SKILL.md Expands verification commands.
.gitattributes Marks compressed assets binary.
.gitignore Ignores Python artifacts.
Broadside.Core.slnf Adds globalization tests.
Broadside.slnx Adds globalization project.
Directory.Packages.props Adds test-hosting packages.
bench/​Broadside.Benchmarks/​DocumentSaveBenchmarks.cs Benchmarks document saving.
bench/​Broadside.Benchmarks/​LexerBenchmarks.cs Benchmarks tokenization.
bench/​Broadside.Benchmarks/​RepairBenchmarks.cs Benchmarks lenient repair.
bench/​Broadside.Benchmarks/​SystemFontBenchmarks.cs Benchmarks font resolution.
docs/​adr/​0007-standard-14-glyphs-in-separate-package.md Documents CMap metadata decision.
docs/​adr/​0009-font-resolver-contract.md Defines resolver architecture.
docs/​conformance/​pdf-declarations.md Records declaration conformance.
docs/​conformance/​pdf20-an002.md Records associated-file conformance.
docs/​conformance/​pdf20-an003.md Records metadata-location conformance.
site/​articles/​architecture.md Links resolver ADR.
src/​Broadside.Fonts.Cmaps/​AssemblyMarker.cs Removes obsolete marker.
src/​Broadside.Fonts.Cmaps/​CmapsPdfOptionsExtensions.cs Adds CMap configuration API.
src/​Broadside.Fonts.Cmaps/​PublicAPI.Unshipped.txt Records CMap public APIs.
src/​Broadside.Fonts.Cmaps/​licenses/​cmap-resources/​LICENSE.md Adds CMap licence.
src/​Broadside.Fonts.Cmaps/​licenses/​mapping-resources-pdf/​LICENSE.txt Adds mapping licence.
src/​Broadside.Fonts.Standard14/​AssemblyMarker.cs Removes obsolete marker.
src/​Broadside.Fonts.Standard14/​PublicAPI.Unshipped.txt Records font package APIs.
src/​Broadside.Fonts.Standard14/​Standard14PdfOptionsExtensions.cs Adds Standard 14 configuration.
src/​Broadside.Fonts.Standard14/​licenses/​liberation/​AUTHORS Adds attribution.
src/​Broadside/​Annotations/​PdfAppearanceMode.cs Models appearance modes.
src/​Broadside/​Annotations/​PdfBorderEffect.cs Models border effects.
src/​Broadside/​Annotations/​PdfBorderEffectStyle.cs Models effect styles.
src/​Broadside/​Annotations/​PdfBorderSource.cs Models border provenance.
src/​Broadside/​Annotations/​PdfBorderStyle.cs Models border styles.
src/​Broadside/​Annotations/​PdfCaretAnnotation.cs Adds caret annotation.
src/​Broadside/​Annotations/​PdfCaretSymbol.cs Models caret symbols.
src/​Broadside/​Annotations/​PdfCircleAnnotation.cs Adds circle annotation.
src/​Broadside/​Annotations/​PdfDeviceColorSpace.cs Models annotation colours.
src/​Broadside/​Annotations/​PdfFileAttachmentAnnotation.cs Adds attachment annotation.
src/​Broadside/​Annotations/​PdfHighlightAnnotation.cs Adds highlight annotation.
src/​Broadside/​Annotations/​PdfHighlightMode.cs Models highlight behavior.
src/​Broadside/​Annotations/​PdfInkAnnotation.cs Adds ink annotation.
src/​Broadside/​Annotations/​PdfLineCaptionPosition.cs Models caption placement.
src/​Broadside/​Annotations/​PdfPrinterMarkAnnotation.cs Adds printer-mark annotation.
src/​Broadside/​Annotations/​PdfProjectionAnnotation.cs Adds projection annotation.
src/​Broadside/​Annotations/​PdfRectangleDifferences.cs Models annotation insets.
src/​Broadside/​Annotations/​PdfReplyType.cs Models reply relationships.
src/​Broadside/​Annotations/​PdfRichMediaAnnotation.cs Adds rich-media view.
src/​Broadside/​Annotations/​PdfSoundAnnotation.cs Adds sound annotation.
src/​Broadside/​Annotations/​PdfSquareAnnotation.cs Adds square annotation.
src/​Broadside/​Annotations/​PdfSquigglyAnnotation.cs Adds squiggly annotation.
src/​Broadside/​Annotations/​PdfStampAnnotation.cs Adds stamp annotation.
src/​Broadside/​Annotations/​PdfStrikeOutAnnotation.cs Adds strikeout annotation.
src/​Broadside/​Annotations/​PdfTextJustification.cs Models annotation justification.
src/​Broadside/​Annotations/​PdfTextMarkupAnnotation.cs Adds markup base model.
src/​Broadside/​Annotations/​PdfUnderlineAnnotation.cs Adds underline annotation.
src/​Broadside/​Annotations/​PdfUnknownAnnotation.cs Preserves unknown annotations.
src/​Broadside/​Annotations/​PdfWatermarkAnnotation.cs Adds watermark annotation.
src/​Broadside/​AssemblyMarker.cs Removes obsolete marker.
src/​Broadside/​Content/​ClipKind.cs Models clipping nodes.
src/​Broadside/​Content/​ContentOperandKind.cs Models operand types.
src/​Broadside/​Content/​ContentPart.cs Tracks content stream parts.
src/​Broadside/​Content/​ContentRunKind.cs Models content run kinds.
src/​Broadside/​Content/​ContentVisit.cs Controls nested traversal.
src/​Broadside/​Content/​PathPaint.cs Models path painting.
src/​Broadside/​Content/​TextClipGlyph.cs Records text clipping glyphs.
src/​Broadside/​Diagnostics/​DiagnosticSeverity.cs Defines diagnostic severity.
src/​Broadside/​EntryReport.cs Centralizes entry diagnostics.
src/​Broadside/​Filters/​Dct/​IJpegRowSink.cs Adds JPEG row sinks.
src/​Broadside/​Filters/​ImageHeader.cs Defines image header metadata.
src/​Broadside/​Fonts/​CharacterCode.cs Models composite codes.
src/​Broadside/​Fonts/​CharStrings/​CharStringLimits.cs Defines charstring limits.
src/​Broadside/​Fonts/​CidGlyph.cs Models CID glyph selection.
src/​Broadside/​Fonts/​CidSystemInfo.cs Models CID compatibility.
src/​Broadside/​Fonts/​CidVerticalMetrics.cs Models vertical metrics.
src/​Broadside/​Fonts/​CodespaceRange.cs Implements codespace matching.
src/​Broadside/​Fonts/​Data/​Afm/​MustRead.html Adds AFM licence notice.
src/​Broadside/​Fonts/​Data/​CMaps/​LICENSE.md Adds CMap licence.
src/​Broadside/​Fonts/​Data/​GlyphList/​LICENSE.md Adds glyph-list licence.
src/​Broadside/​Fonts/​FontCharacterMap.cs Defines font cmap API.
src/​Broadside/​Fonts/​FontMatchKind.cs Models font match quality.
src/​Broadside/​Fonts/​FontProgramFormat.cs Enumerates font formats.
src/​Broadside/​Fonts/​FontProgramSource.cs Models font program origin.
src/​Broadside/​Fonts/​FontResourceKind.cs Models named resources.
src/​Broadside/​Fonts/​GlyphIdCache.cs Adds thread-safe glyph cache.
src/​Broadside/​Fonts/​GlyphMetrics.cs Models glyph metrics.
src/​Broadside/​Fonts/​GlyphOutlineStatus.cs Models outline outcomes.
src/​Broadside/​Fonts/​PdfCidFontType.cs Models CIDFont types.
src/​Broadside/​Fonts/​PdfFontStretch.cs Models font stretch.
src/​Broadside/​Fonts/​PdfFontType.cs Models PDF font types.
src/​Broadside/​Fonts/​ShownGlyph.cs Records interpreted glyphs.
src/​Broadside/​Fonts/​UnicodeSource.cs Tracks Unicode mapping source.
src/​Broadside/​Fonts/​WritingMode.cs Models writing direction.
src/​Broadside/​Forms/​PdfNonTerminalField.cs Adds field-tree containers.
src/​Broadside/​Graphics/​BlackPointCompensation.cs Models black-point policy.
src/​Broadside/​Graphics/​CieXyz.cs Defines CIE XYZ values.
src/​Broadside/​Graphics/​CmykConversion.cs Selects CMYK conversion.
src/​Broadside/​Graphics/​ComponentRange.cs Models component ranges.
src/​Broadside/​Graphics/​DeviceColorModel.cs Models output colour models.
src/​Broadside/​Graphics/​FillRule.cs Models fill rules.
src/​Broadside/​Graphics/​Functions/​CompiledFunction.cs Tracks compiled evaluators.
src/​Broadside/​Graphics/​Functions/​FunctionDependency.cs Tracks live dependencies.
src/​Broadside/​Graphics/​Functions/​FunctionForms.cs Models accepted function forms.
src/​Broadside/​Graphics/​Functions/​FunctionStatus.cs Models evaluation outcomes.
src/​Broadside/​Graphics/​IColorConverter.cs Defines conversion contract.
src/​Broadside/​Graphics/​LineCap.cs Models line caps.
src/​Broadside/​Graphics/​LineJoin.cs Models line joins.
src/​Broadside/​Graphics/​ObjectDiagnostics.cs Reports graphics diagnostics.
src/​Broadside/​Graphics/​PathPoint.cs Defines path coordinates.
src/​Broadside/​Graphics/​PathVerb.cs Defines path segments.
src/​Broadside/​Graphics/​PdfColorSpaceFamily.cs Enumerates colour spaces.
src/​Broadside/​Graphics/​PdfDeviceCmykColorSpace.cs Adds DeviceCMYK singleton.
src/​Broadside/​Graphics/​PdfDeviceGrayColorSpace.cs Adds DeviceGray singleton.
src/​Broadside/​Graphics/​PdfDeviceNProcess.cs Models DeviceN process data.
src/​Broadside/​Graphics/​PdfDeviceRgbColorSpace.cs Adds DeviceRGB singleton.
src/​Broadside/​Graphics/​PdfFunctionType.cs Enumerates function types.
src/​Broadside/​Graphics/​PdfShadingType.cs Enumerates shading types.
src/​Broadside/​Graphics/​PdfTransferFunction.cs Models transfer functions.
src/​Broadside/​Graphics/​RenderingIntent.cs Models rendering intents.
src/​Broadside/​Graphics/​TextRenderingMode.cs Models text rendering modes.
src/​Broadside/​Images/​ImageColorModel.cs Models codec colour output.
src/​Broadside/​Objects/​CosBoolean.cs Implements COS booleans.
src/​Broadside/​Objects/​CosInteger.cs Implements COS integers.
src/​Broadside/​Objects/​CosNull.cs Implements COS null.
src/​Broadside/​Objects/​CosNumber.cs Adds numeric base type.
src/​Broadside/​Objects/​CosReal.cs Implements finite COS reals.
src/​Broadside/​Objects/​IStreamDataFactory.cs Supports deferred stream data.
src/​Broadside/​Objects/​IStreamLengthResolver.cs Resolves indirect lengths.
src/​Broadside/​Objects/​KnownNames.FileStructure.cs Adds file-structure names.
src/​Broadside/​Parsing/​DiagnosticCodes.Actions.cs Adds action diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Ccitt.cs Adds CCITT diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Cff.cs Adds CFF diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.CharStrings.cs Adds charstring diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.CidCff.cs Adds CID-CFF diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Color.cs Adds colour diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.ContentObjects.cs Adds content diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.FontResolver.cs Adds resolver diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Images.cs Adds image diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Structure.cs Adds structure diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Text.cs Adds Unicode diagnostics.
src/​Broadside/​Parsing/​DiagnosticCodes.Type3.cs Adds Type 3 diagnostics.
src/​Broadside/​Parsing/​HintTableLayout.cs Converts linearization offsets.
src/​Broadside/​PdfAccessLevel.cs Models security access.
src/​Broadside/​PdfCheckSumStatus.cs Models checksum results.
src/​Broadside/​PdfDatePrecision.cs Models date precision.
src/​Broadside/​PdfDestinationTarget.cs Models destination targets.
src/​Broadside/​PdfDestinationView.cs Models destination views.
src/​Broadside/​PdfDocument.Content.cs Adds shared content cache.
src/​Broadside/​PdfDocument.Images.cs Adds image lookup API.
src/​Broadside/​PdfDuplex.cs Models duplex preference.
src/​Broadside/​PdfFileIdentifier.cs Models trailer identifiers.
src/​Broadside/​PdfFileRelationship.cs Models associated-file roles.
src/​Broadside/​PdfGoToDocumentPartAction.cs Adds DPart action.
src/​Broadside/​PdfHideAction.cs Adds hide action.
src/​Broadside/​PdfIntegrityStatus.cs Models MAC verification.
src/​Broadside/​PdfOptionalContentOrderItem.cs Models layer ordering.
src/​Broadside/​PdfOptionalContentUsageContext.cs Defines auto-state context.
src/​Broadside/​PdfOutlineItemFlags.cs Models outline styling.
src/​Broadside/​PdfPageBoundary.cs Models page boundaries.
src/​Broadside/​PdfPageLabelStyle.cs Models page labels.
src/​Broadside/​PdfPageLayout.cs Models page layout.
src/​Broadside/​PdfPageMode.cs Models viewer panels.
src/​Broadside/​PdfPrintScaling.cs Models print scaling.
src/​Broadside/​PdfReadingDirection.cs Models reading direction.
src/​Broadside/​PdfReadingMode.cs Models strictness.
src/​Broadside/​PdfRelatedFile.cs Models related files.
src/​Broadside/​PdfSharedObjectHint.cs Models shared-object hints.
src/​Broadside/​PdfTransitionAction.cs Adds transition action.
src/​Broadside/​PdfTrapped.cs Models trapping status.
src/​Broadside/​PdfUnknownAction.cs Preserves extension actions.
src/​Broadside/​PdfVisibilityExpression.cs Models layer expressions.
src/​Broadside/​Structure/​PdfArtifactAttributes.cs Adds artifact attributes.
src/​Broadside/​Structure/​PdfStructureItem.cs Defines structure-tree items.
src/​Broadside/​Structure/​PdfStructureNamespaceKind.cs Models structure namespaces.
src/​Broadside/​Structure/​PdfUserProperty.cs Models user properties.
src/​Broadside/​Structure/​StructureNamespaceSuppression.cs Suppresses namespace warning.
src/​Broadside/​XmpPropertyKind.cs Models XMP property forms.
tests/​Broadside.Fonts.Cmaps.Tests/​Broadside.Fonts.Cmaps.Tests.csproj Links fixtures and notices.
tests/​Broadside.Fonts.Cmaps.Tests/​PackageSmokeTests.cs Removes obsolete smoke test.
tests/​Broadside.Fonts.Standard14.Tests/​Broadside.Fonts.Standard14.Tests.csproj Links shared font fixtures.
tests/​Broadside.Fonts.Standard14.Tests/​PackageSmokeTests.cs Removes obsolete smoke test.
tests/​Broadside.Fuzz/​Broadside.Fuzz.csproj Links additional fuzz walkers.
tests/​Broadside.Fuzz/​build-libfuzzer-dotnet.sh Builds pinned fuzz driver.
tests/​Broadside.Globalization.Tests/​Broadside.Globalization.Tests.csproj Adds non-invariant test host.
tests/​Broadside.Globalization.Tests/​SaslPrepTests.cs Tests NFKC passwords.
tests/​Broadside.Rendering.Skia.Tests/​PackageSmokeTests.cs Seals smoke fixture.
tests/​Broadside.Rendering.Tests/​PackageSmokeTests.cs Seals smoke fixture.
tests/​Broadside.Tests/​Annotations/​LinkAnnotationTests.cs Tests link annotations.
tests/​Broadside.Tests/​Broadside.Tests.csproj Adds hosting dependencies/assets.
tests/​Broadside.Tests/​Content/​StateRecorder.cs Records graphics states.
tests/​Broadside.Tests/​CorpusSmokeTests.cs Updates package smoke check.
tests/​Broadside.Tests/​Document/​DocumentProjection.cs Compares document projections.
tests/​Broadside.Tests/​Document/​HeavyTestCollection.cs Serializes expensive tests.
tests/​Broadside.Tests/​Document/​WellFormedCorpusTests.cs Validates clean corpus files.
tests/​Broadside.Tests/​Filters/​JpxAllocationTests.cs Gates JPX allocations.
tests/​Broadside.Tests/​Fonts/​FontProgramAllocationTests.cs Gates glyph lookup allocations.
tests/​Broadside.Tests/​Fonts/​Standard14FontTests.cs Tests Standard 14 metrics.
tests/​Broadside.Tests/​Graphics/​FunctionConcurrencyTests.cs Tests concurrent evaluation.
tests/​Broadside.Tests/​Hosting/​CapturingLoggerProvider.cs Captures structured logs.
tests/​Broadside.Tests/​Objects/​LexerAllocationTests.cs Gates lexer allocations.
tests/​Broadside.Tests/​OptionalContent/​OptionalContentPdf.cs Builds layer fixtures.
tests/​Broadside.Tests/​StructureTree/​Snapshots/​StructureCorpusTests.Every_real_world_structure_tree_walks_leniently_and_the_summary_matches_the_snapshot.verified.txt Adds structure corpus baseline.
tests/​Broadside.TestSupport/​Broadside.TestSupport.csproj References core library.
tests/​ConformanceCheck.Tests/​ConformanceCheckerTests.cs Seals conformance fixture.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Broadside/PdfUnknownAction.cs Resolved
michaelstonis and others added 3 commits October 10, 2026 14:35
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PdfUserProperty is a live view over its dictionary (ADR 0004); it
  no longer snapshots N, V, F and H.
- A stamp's Name is ignored with a diagnostic when IT is present and
  not Stamp (Table 184), so strict mode rejects it.
- A DeviceN Process ColorSpace outside the device and non-Lab
  CIE-based families reads as absent and is reported (Table 71).
- A GoToDp action's Dp must be an indirect reference; a direct
  dictionary reads as absent with ActionEntryInvalid (Table 206).
- PdfUnknownAction's summary now says only unlisted types reach it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelstonis
michaelstonis merged commit f9c40e6 into main Oct 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants