Repository navigation
Description
The maintainer confirmed this split on 2026-11-18 (decision D7): this issue carries the additive general diagnostics
channel and #304's opt-in strict switch, and #496 stays in v3.0 for unifying TextEncodingWarnings and
BandTruncations.
Where this sits in the tracker
Two open issues already describe parts of this work. This issue states which part it delivers.
- Layout: one diagnostics channel, before a third one-off warning type is invented #496 (v3.0, "Layout: one diagnostics channel, before a third one-off warning type is invented") asks for one channel
that replaces the two existing ones, and recommends v3.0 because replacing a shipped public surface
(TextEncodingWarning) is breaking. This issue delivers only the additive half: one general channel for the
reports v2.4 adds.Document.TextEncodingWarningsandDocument.BandTruncationsstay exactly as they are, and
re-expressing or removing them remains Layout: one diagnostics channel, before a third one-off warning type is invented #496's work in 3.0. - Layout: build-time accessibility diagnostics, with a strict mode #304 (Layout C) describes build-time accessibility diagnostics collected during layout, with a strict mode ("Strict mode throwing with the clause
named") and a default of collect-and-report. This issue delivers Layout: build-time accessibility diagnostics, with a strict mode #304's channel and its
opt-in strict switch. Layout: build-time accessibility diagnostics, with a strict mode #304 keeps its specific accessibility checks (figure without alt text, irregular tables,
missing language, heading mismatch and the rest of its list), which are added on top of this channel.
Problem
Document has two one-off report lists and no place for the many other things the library knows and cannot refuse
in a minor release. (origin/main 1c61fa6, src/VellumPdf.Layout/Document.cs.)
42: private readonly List<TextEncodingWarning> _textEncodingWarnings = [];
44: private readonly List<BandTruncationWarning> _bandTruncations = [];
57: public IReadOnlyList<TextEncodingWarning> TextEncodingWarnings => _textEncodingWarnings;
70: public IReadOnlyList<BandTruncationWarning> BandTruncations => _bandTruncations;
...
1014: private void CollectDiagnostics(DocumentRenderer renderer)
1016: _textEncodingWarnings.Clear();
1017: _textEncodingWarnings.AddRange(renderer.TextEncodingWarnings);The contract for refusals is already decided in the tracker. #474: "The fix must not be a hard refusal at Save", and
the right shape is "the notify-and-continue channel this library already has". #484 (v3.0) is where refusals of
input that renders today move.
Why it matters
Several v2.4 items change from silent to reported, and none may turn a document that renders today into an exception
by default: #592 (glyph 0), #593 (font fallback), #598 (unknown band token), #583 (missing alt text), the
PDF/UA claim checks of #474 (title, language, embedded fonts), the heading checks of #514 (negative or skipped level)
and #611 (control characters in cells). Seven separate lists would add seven public members that behave
differently, which is the pattern #496 warns about.
Scope
Document.Diagnostics(IReadOnlyList<...>): each item has a stable code, a severity, the message, the clause it
comes from when there is one, and the location (element kind and its position in the document). It is empty before
the first save and holds the reports of the save that succeeded; a failed save leaves it untouched, as
CollectDiagnosticsdoes for the two existing lists (:1007-1012).- The two existing lists stay as they are. Whether their items also appear in the new list is a design question for
the brief, which states it in the XML documentation of all three members; unifying them is Layout: one diagnostics channel, before a third one-off warning type is invented #496's. Document.StrictDiagnostics(name open), defaultfalse. When true, a save that would report an item of severity
error throwsInvalidOperationExceptionnaming the code and the clause. The save writes nothing before it throws.- Phrasing rule for every user of the channel: reported; refused only in strict mode (opt-in); default refusal is 3.0
(Refuse the input 2.3.x only reports: the contract changes a patch cannot make #484). - Questions Layout: one diagnostics channel, before a third one-off warning type is invented #496 lists that this issue must answer for the additive channel: one type with a kind discriminator or a
small hierarchy; which package owns it (Kernel: a character missing from an embedded font is written as glyph 0 (.notdef) and the save reports nothing #592 originates in the Kernel and the others in Layout); what a diagnostic
retains (not the caller's text beyond a capped quote, followingBandTruncationWarning's own reasoning, which Layout: one diagnostics channel, before a third one-off warning type is invented #496
cites); and whether collection is always on or on request, since always-on is a cost every caller pays. - Bound: the list is input-driven (a long text with many missing characters). It holds one item per distinct
(code, subject) pair with a count, not one per occurrence, and it has a hard cap with a final item that says items
were dropped. The brief gives the numbers and a test at the cap. - Null handling decided for Harden Layout and Kernel inputs and the save lifecycle (v2.3.4, v2.3.5); read JBIG2 file headers; keep narrow no-break spaces #571 (2026-11-17): a
TextRunwith a null style renders with the default style, and a
nullListItemgrandchild is skipped; both are reported through this channel once it exists. - XML documentation of every member states which items it reports, what is ignored, and what strict mode refuses.
Acceptance
- A document that triggers two different codes lists two items with their codes, clauses and locations (exact strings
asserted). - 100,000 occurrences of one missing character produce one item with a count (assert the count of items and the
count field; no wall-clock assertion). - Strict mode throws on an error item and writes nothing to the stream (assert the stream is empty).
- Default mode with the same document saves with the bytes it saves today.
- A failed save leaves a previous list untouched. A
Documentis single-use (Document.cs:1025-1033: a second save
after a success throws), so the test builds two documents and checks that each reports only its own items. - A document with no problems has an empty list and a strict save succeeds.
TextEncodingWarningsandBandTruncationsreturn what they return on origin/main 1c61fa6 for the same inputs
(test pins both).- The test fails on origin/main 1c61fa6 (no such member), proven by mutation.
Relates to
- Layout: one diagnostics channel, before a third one-off warning type is invented #496 (the additive half is this issue; replacement of the two existing channels stays there), Layout: build-time accessibility diagnostics, with a strict mode #304 (channel and strict
switch here, specific accessibility checks there), Conformance: a PDF/A or PDF/UA claim is stamped on a document the library's own preflight rejects #474, Refuse the input 2.3.x only reports: the contract changes a patch cannot make #484, fix(layout): bound running-band text to the content box #469 (the band-truncation precedent). - Kernel: a character missing from an embedded font is written as glyph 0 (.notdef) and the save reports nothing #592, Layout: lists, tables and running bands ignore SetDefaultFont, so a PDF/A or PDF/UA file silently uses unembedded Helvetica #593, Layout: an unknown placeholder in a running band template is printed literally without a report #598, Layout: a missing alt text is replaced by the English word Figure, and images have no decorative option #583, Layout: a heading level past the fifth clamps to H6, and so does a negative one #514, Layout: a tab or newline inside a table cell is written as glyph 0 (.notdef) with an embedded font, and as a raw control byte with a standard-14 font #611.
Activity
Tim81 commentedon Nov 18, 2026
Requirement added by the maintainer's decision of 2026-11-18. 2.x follows "valid file = keep" (#484's contract): any input for which 2.x writes a valid PDF keeps saving, even when content is lost or misplaced. Examples from PR #571's review, measured on main 1c61fa6 (2.3.3 plus dependency updates): a table with an infinite top margin is not drawn, and a JBIG2 image with an unknown-length segment embeds blank.
For this channel that means:
The umbrella for the 3.0 side is #614. #607 stays the 2.x half: the channel, the codes and the opt-in switch.
fix(layout): walk shared list subtrees once per save and fix the stri…
fix(layout): answer the second review of the diagnostics channel (#607)
fix(layout): visit each list item below the first level once per save (…
fix(layout): let only a list that reports take part in the null walk (#…
docs(layout): say a list reports nulls only when drawn from its first…