Repository navigation
docs(layout): say what each public member refuses, and what not to pass - #503
Merged
Merged
Conversation
This was referenced Sep 12, 2026
2.3.2 is the release that created these boundaries and documented almost none of them. Layout has 340 public members and one file carrying any <exception> tag. That matters more than the count suggests, because the refusals are raised from Save rather than from the property the caller set: assign a non-finite font size and the exception arrives from a call you never made, while the member you did set says nothing. Twenty-one members now carry the pattern TextStyle.FontSize already used. A bold sentence names what is refused, which call throws it and why. A following paragraph begins "Do not pass" for input accepted today, says what it does now, and says a later major will reject it. Covered: the table cell's two spans and its padding, the table border width, the image width and height, the separator line width, the pie chart's slices, diameter, start angle, stroke width and alignment, the heading level, the list indent and nesting depth, the running band's template, height and alignment, and the document margins. Three sentences I wrote did not survive checking them against the code, and are in as measured rather than as assumed: The pie chart does not skip a zero-width stroke. It strokes on StrokeColor being set, not on StrokeWidth being non-zero, so a zero width still emits 0 w and asks the device for its thinnest line. A table's grid cannot be suppressed at all. BorderColor is not nullable and every cell is stroked unconditionally, so the nearest thing to a gridless table is a border colour matching the page. A non-finite document margin is refused only when it is positive infinity. NaN and negative infinity slip past the margin check, because a comparison against them is false, and surface as "an element is too tall to fit" and as the page-continuation cap. Measured one value at a time, because all three take different branches. Both wrong-cause messages are the defect #481 corrected for other inputs; filed as #502 rather than fixed here, since routing margins through LayoutValidation changes behaviour. The rule itself goes into CLAUDE.md, so a public member's boundary is written in the same commit as the member instead of swept up at a release. Refs #502
A review round read every new sentence against the code. Eight were wrong, and three of those in ways a caller would have acted on. A positive-infinity image width is not refused. #472's over-wide clamp resolves it to the content box before validation sees it, so it renders as a full-width image. The property's pre-existing remarks said exactly that, correctly, and the block added last round contradicted them two lines below. That contradiction was invisible because four members ended up with two <remarks> elements each. Two on one member compiles without a warning and renderers show one of the two, so which sentence a reader gets depends on their tool. The pre-existing blocks on all four were already right, so the added ones are gone and only what was genuinely missing is spliced into the originals. A marker wider than the list indent does not overprint the item text. The gutter is widened to the marker's own width, per item, which is the fix this same branch describes in its own changelog. The threshold figure was wrong too: the first roman marker to exceed a 20-point indent at the default style is item 17, not 38. Padding wider than its column does not produce "a cell of markers and no content", and a table cell has no markers at all. The inner width is clamped to one point on both the measure and the draw path, so the text wraps to one glyph per line and every line is placed at the left padding's offset. Measured with 400 points of padding in a 260-point column on a 300-point page: ten glyphs, ten lines, all at x = 420, off the page. A non-finite running-band height is refused, not accepted. All three values throw and no file is written, by three different exceptions, none of which names the band height. H6 is this library's deepest heading tag, not the format's. ISO 32000-2 Table 366 defines Hn for any unsigned integer from one upward, and NOTE 2 says outright that H7 may be used for a seventh-level heading. Two counts were wrong: the generated documentation has 340 entries of which 42 are types, so 298 members, not 340; and the sweep covers nineteen members, not twenty-one, since the two it was modelled on were already done. Finally, the rule itself was in the wrong file. CLAUDE.md is untracked and excluded, so it appears in no clone and in no diff, and CONTRIBUTING.md — which that file itself calls the human-facing guide — said nothing. The rule now lives there, including the two things this round learned: measure each non-finite value separately, and check the member does not already carry a <remarks> block. The rule asks for an <exception> tag wherever a call can throw, and none of the nineteen had one. Thirteen members now do, up from one. Refs #502
…three more Two things in one pass, both requested. The avoid-ai-writing audit over the 2,489 words of documentation added here found no vocabulary or hedging problems, and two structural ones. Thirty-two bold tags, nearly all of them a bold clause opening a paragraph that the next sentence then repeats, which is the inline-header pattern; and sixteen instances of a bold label terminated with a period where a person writes a colon or no label at all. The voice now follows the Swiss Ephemeris programmer's reference. Bold marks one operative word, a negation or an obligation, rather than a clause. A trap is marked "Attention:" and a fact about history "NOTE:", which is what the reference uses instead of emphasis. The reader is addressed directly, as someone with a job to do, which is how that document talks about anything a caller has to handle itself. Constraints come first in one short sentence, with the reason following as its own. Measured over the added prose: bold per thousand words 13 to 7, "Do not" labels 16 to 2, direct address 1 to 32, median sentence 14 words to 11. Not imitated: the reference's comma before "that", which is its author's German habit and in a .NET public API would read as a typo. Three claims corrected, each measured rather than reasoned about. The 5e-6 boundary names the width, not the height. ValidateImageExtent checks the width first, so a width under the boundary is always what the message names, whatever the source aspect ratio. The height is named only above the boundary, where a legal but small width collapses a non-square image's derived height. The last round had this backwards. The cell-padding figures disagreed with each other. EdgeInsets.Horizontal is Left plus Right, so "400 points of horizontal padding" puts the text at x = 220, not the 420 the same sentence reported. It is Left alone that decides where a line starts, and the figures now say which is which. A non-finite band height is refused by two exception types across three messages, not three types, and the NaN one does name the band height, as "NaNpt of running bands". Worse, "no file is written" is true of the content and false of the file: the string overloads open the target before the layout runs, so a failure leaves a zero-byte file where a 1,535-byte document was. Measured, and filed as #508. Also the three exception tags the sweep's own rule required and did not have, on RunningBand.Height, Cell.RowSpan and Document.Margins, the last of which listed ArgumentException while its own remarks described two InvalidOperationException routes past it. And the four save overloads and PageSize, which every caller touches and which had one-line summaries and no boundary at all: single use, the empty-document refusal, and the destructive truncation. Refs #508, #509, #510
Tim81
force-pushed
the
docs/xml-boundaries-layout
branch
from
September 12, 2026 11:51
bfa9479 to
6163570
Compare
This was referenced Sep 12, 2026
Closed
Open
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three reviewers audited the layout boundary-documentation sweep (#503) and found real problems: CONTRIBUTING.md's rule described a bold/"Do not pass" pattern the tree never used, several XML-doc and CHANGELOG claims were false or unmeasured, two ISO 32000-2 citations overstated what the clause says, and thirteen reachable exceptions had no tag. No behaviour or logic changes; every claim here was checked against the built assembly with a scratch probe, or against the code path that throws. RunningBand.Height's own false refusal claim is left alone, since it is a separate code defect (#520) and correcting the prose now would need doing again once that lands.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three reviewers audited round one (4e80571) and found it had introduced new false claims while fixing the originals. This round corrects those, verified against the built assembly with a fresh scratch probe printing Assembly.Location, plus qpdf --qdf inspection of rendered content streams for the geometry claims. No behaviour or logic change. Cell.ColSpan: round one deleted a true sentence (a span is clamped when an earlier row's RowSpan occupies its leading columns) while replacing a false one (widening always happens). Measured both a 5-column and a 3-column span clamped to one column, ending exactly at the table's right edge, when a prior RowSpan already took the rest. Both mechanisms are now documented. TextStyle.FontSize: the RunningBand exception doc flattened a genuine six-way split (footer/header x Height set/unset x NaN/+inf/-inf) into one sentence. Measured all six; only the fixed-Height case names the band and size for every non-finite value. Also corrected the claim that a heading names itself — Heading delegates to ParagraphRenderer and reports as "A paragraph run", confirmed by direct measurement. Cell.Padding: "400 across both sides puts the text at x = 220" does not reproduce under either reading (EdgeInsets(4,400,4,400) gives 420, same as Left=400 alone; EdgeInsets(400) throws too-tall with no text at all). Splitting the same 400 evenly (Left=200, Right=200) is what gives 220, confirmed via the Tm operator in the rendered content stream. Exception-tag count: recounted <exception> tags across the eleven files round one touched at 486622d, 6db9ef4 and HEAD by scanning each file's XML-doc comments for the tag immediately preceding a public member declaration (tolerating attributes, #pragma and // comments in between, which is what SaveAsync's RS0026 suppression needed). Twenty members carry a tag at HEAD, not eighteen; nineteen are new, not seventeen. CHANGELOG numbers corrected to match. Document.Save(string), SaveAsync(string, CancellationToken) and SaveAsync(Stream, CancellationToken): added UnauthorizedAccessException (directory path, or a read-only existing file), IOException (path held open elsewhere, over-long or invalid name), and TaskCanceledException (pre-cancelled token), all reproduced directly. The local notes file named TextStyle.Leading as a second exemplar of the boundary pattern; it satisfies two of the four rule bullets and carries two untagged reachable exceptions. Dropped it from the exemplar list so The local notes file and CONTRIBUTING.md name the same member. RunningBand.Height's non-finite-value paragraph is given the same #520 caveat the neighbouring refusal sentence already carries, since a footer at negative infinity produces a valid file rather than refusing. Attention triage ran backwards on two of three removals: restored the LayoutImage.Height distortion warning and PieChart.Diameter's "smaller than set, nothing reports it" warning, both silent-output traps. Six markers that were mechanisms, not traps, are removed: TextStyle.Leading, both Save(Stream)-family "calling this twice throws" paragraphs, LayoutImage.Width's token-check note, RunningBand.Alignment, and the second RunningBand.Height marker. Voice: bolded the marker word itself on all 22 Attention/NOTE instances across the package rather than the whole sentence, and added five NOTE markers for facts that had none (the two wrong-cause messages plus #502, and #482/#476/#479/#493). Smaller prose fixes: LineSeparator's resolution and zoom claims separated, Cell.RowSpan's pronoun agreement, PieChart.Diameter's redundant colon, Document.Margins names why the two non-finite forms can't be caught together, Heading's NOTE 2 de-hedged, Document.PageSize's replacement now carries a consequence instead of restating its opening sentence, and Cell.ColSpan's "simply" removed. The #503 CHANGELOG entry had landed inside the released [2.3.2] section because its branch predated the release commit. Moved to [Unreleased] with both rounds' corrections, since a released section must not document work that shipped after it.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three Opus reviewers on disjoint lenses found RunningBand.Height making
five disagreeing statements about the same case, four more members
stating a rule then a case that broke it, and several tags narrower
than the code. All measured against this branch's built assembly via
a scratch probe (ProjectReference into src/VellumPdf.Layout, assembly
path printed on every run) plus qpdf/pdftotext on the fixtures it
wrote, not assumed from the review brief.
RunningBand.Height: `Footer.Height = double.NegativeInfinity` does not
throw (probe: Save writes a 1550-byte file; `qpdf --check` exits 0;
`pdftotext` reports "Syntax Error: Unknown operator 'NaN'" and drops
the footer). qpdf --qdf on the fixture shows the content stream itself:
`1 0 0 1 72 NaN Tm (P {0}) Tj`. The member's opening refusal sentence,
its "produces a valid file" hedge and its exception tag naming
InvalidOperationException for "NaN or negative infinity" disagreed
with this and each other; now say the same thing, in the well-formed/
non-conforming vocabulary TableGridResolver.cs already uses.
CONTRIBUTING.md told a reader to bold one word for a warning paragraph;
grepped, all 23 markers in the package bold two (the marker word and
the negation), including TextStyle.cs's own named exemplar. Rule text
now matches the tree.
TextStyle.Leading: probe on a footer/header with Height null across
Leading 400..1e9 shows 400-670 no throw, 680-692 InvalidOperationException
(content area 13.9pt down to 1.9pt), 694+ ArgumentException, identical
on both bands. Magnitude decides, not the band, contrary to an uncommitted
local note; both throws are now tagged.
TextStyle.FontSize: probe on a footer at FontSize=NegativeInfinity gives
a byte-identical InvalidOperationException message with Height null and
Height=20, so "changes every case" is false for that one pair. The NaN
message probed is `... (header 0.0pt, footer NaNpt) ...`, which does
name both bands, contra "naming neither the band". Document.Save(string)/
SaveAsync(string,ct): probed Save("CON")/("NUL")/("CON.pdf") no throw,
Save("AUX") UnauthorizedAccessException, Save("PRN")/("LPT1")
FileNotFoundException; none IOException, so the "naming a device" clause
is dropped (2 copies).
Cell.ColSpan, LineSeparator, Document.PageSize, and the string save
overloads' "writes nothing" claim each stated a rule and a contradicting
case without reconciling them; softened/corrected/pointed at the actual
mechanism (#508) instead of restating a guarantee that does not hold
once a file already exists at the path.
Cell.Padding and TextStyle.FontSize exception tags were narrower than
measured: probe shows EdgeInsets(400) (finite) throws the generic
too-tall InvalidOperationException, and footer font sizes 570-576 throw
InvalidOperationException while 580/600/1e6 already throw
ArgumentException, well short of positive infinity. Both tags widened.
Document's four save overloads were missing ObjectDisposedException
(probed on all four post-Dispose) and Save(Stream)/SaveAsync(Stream)
were missing ArgumentNullException for a null destination. While
probing, a non-writable stream gave ArgumentException from Save(Stream)
("Stream must be writable") but NotSupportedException from
SaveAsync(Stream,ct) ("Stream does not support writing"); both tags now
name their two causes.
Marker density: five NOTE markers added since #503 point at a live
issue number rather than history or a version; folded into plain
sentences, cutting the package from 23 to 18 (grepped before and after).
LOW: LayoutImage.Width's summary admitted negative infinity, which
probe confirms is refused (only +Inf is accepted); ListElement's roman
marker claim was checked against qpdf --qdf on a 25-item list, where
items 19-21 revert to the plain indent rather than continuing to widen;
CHANGELOG's own #503 entry gains "evenly" to match Cell.cs.
Deviated from the brief on one LOW item: literally copying
LayoutImage.Height's summary to Width would itself be false, since
Width (unlike Height) accepts positive infinity; adjusted instead of
copied.
The local notes file is untracked and left alone per the brief; its Leading/band
sentence is superseded by TextStyle.Leading's own corrected remarks.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Round four on #503: three Opus reviewers plus a fourth pass on top, adjudicated. Item 1 (CHANGELOG diary) is structural and removed most of the smaller findings by construction; everything below is a correction verified against a scratch probe (ProjectReference into src/VellumPdf.Layout, assembly path printed each run) or gh api, never trusted from the brief without reproduction. Bold-marker rule corrected. My round-three instruction said every marker paragraph bolds two words; grepped <b>(Attention|NOTE)</b> across src/VellumPdf.Layout: 18 marker paragraphs, of which counting <b>not</b> or <b>nor</b> co-occurring gives exactly 8 bolding both and 10 bolding the marker alone. CONTRIBUTING.md's rule now says bold the marker always, the negation only where the paragraph turns on one. CHANGELOG #503 block rewritten. Collapsed three rounds worth of "round N found X was wrong" narration into one account of the final state, fixing the specific contradictions named in the brief: the RunningBand.Height "left alone" bullet reversed by round three, the "five paragraphs now carry NOTE" claim (all five were later removed), the abandoned "bold only one word" rule text, the unqualified Document.PageSize wording, the "every one of 23 bolds two" claim (8 of 18 do, see above), the miscounted save-overload exception tags, the "five markers folded" count (four folded, one kept its own paragraph), and both citations of #493 as an open tracker. TextStyle.cs mechanism fix (brief item 2). The "leading inflates the band past the page while the content area is still positive" tag described an impossible state. Probe on a footer, Height null, A4, default margins, TextStyle.Leading: 680: InvalidOperationException, content area 13.9pt 693: InvalidOperationException, content area 0.9pt 694: ArgumentException, content area -0.1pt Content area shrinks toward zero but never goes negative before the ArgumentException case; reworded to "shrinks the content area to a small positive remainder" instead of "past the page". Numeric boundaries corrected (brief item 3), same probe: Leading: last no-throw 679; IOE 680-693; ArgumentException 694+ FontSize: last no-throw 566; IOE 567-578; ArgumentException 579+ matching the brief's 679/680-693/694 and 566/567-578/579 exactly, against the previously documented 670/680-692/694 and 570-576/580. On a 300x300pt page with 10pt margins: Leading 261 no-throw, 262 throws IOE, confirming the figures are page-dependent (both TextStyle tags and the CHANGELOG now state the measurement page). Leading = double.PositiveInfinity: no throw (falls through to auto-leading, since EffectiveLeading requires IsFinite); the CHANGELOG's old "694 upward throws ArgumentException" is now qualified to exclude it. Cell.ColSpan hedge removed (brief item 4). TableGridResolver.cs lines 59-68 read: ColCount = 0; foreach row: rowCols = sum of ColSpan; if greater, ColCount = rowCols. Unconditional, no branch producing anything else. "Normally"/"usually" on the column-count rule itself dropped; "usually widens the grid" kept on the separate claim about whether a given span contributes, which does have the documented RowSpan exception. #493 corrected (brief item 5). gh api repos//issues/493 --jq {number, state, pull_request} printed number 493, pull_request true, state closed. Removed from Cell.cs (RowSpan remarks) and both CHANGELOG mentions. RunningBand.Height wording (brief item 6) plus Addition 2. Probe, footer and header, various Height values: footer 680: no throw footer 684: IOE, content area 13.9pt footer 697.5: IOE footer 697.9: ArgumentException header 697.5: IOE header 698: ArgumentException A finite height was previously untagged for InvalidOperationException; both the IOE tag and remarks now cover it, and "each with its own exception type" (false once IOE covers NaN, header-only negative infinity, and now a finite value) is replaced with "one exception type covers three causes". The double-colon sentence and the unbridged negative-infinity-to-NaN-token jump are rewritten to state the actual arithmetic: with Height at negative infinity, bandY (page height minus margin minus Height) becomes positive infinity, and bandY plus Height computes infinity plus negative infinity, which is NaN under IEEE 754, the token qpdf --qdf shows in the Tm operator (read from DocumentRenderer.cs lines 340 and 404; the byte pattern itself was already established by round three's own qpdf --qdf run, not repeated this round). Cell.cs lines 100-102 wording (brief item 7). "An inset names the row" and "raises the message" corrected to "a message names" and "throws the exception". The Top/Bottom=400 tag reference is left untouched per the brief's refutation note (another reviewer measured EdgeInsets(400, 6, 400, 6) throws while Left alone at 400 does not). Addition 1 (TextStyle.Leading/FontSize scoped too narrowly to a band). Probe with no header or footer anywhere in the document: Paragraph Leading=697: no throw Paragraph Leading=698: InvalidOperationException Heading Leading=1e6: InvalidOperationException Paragraph FontSize=600: InvalidOperationException Both InvalidOperationException tags no longer scope the throw to a RunningBand style whose Height is left null; the ArgumentException tags stay band-scoped, since a plain page's margins do not move as FontSize or Leading grows (DocumentRenderer's content area is margins-and-bands-only, independent of any single run's style), and probing up to 1e6 with no band never reached it. Addition 2: covered under RunningBand.Height above. Addition 3 (PageSize resize byte-identical claim). Same-process back-to-back builds: 0 differing bytes (random ID collided). Builds 2 seconds apart: 8 diff ranges, all inside XMP CreateDate, XMP ModifyDate, and the trailer ID array (both hex halves). "Bar the random ID" corrected to "except the random ID and the XMP CreateDate/ModifyDate timestamps" in both Document.cs and CHANGELOG. Addition 4 (Save(Stream) ArgumentException param name). Probe with a read-only FileStream and a non-writable MemoryStream both printed ArgumentException, ParamName=stream, Message "Stream must be writable. (Parameter 'stream')". The public parameter is destination; the tag now says the exception carries the internal name stream, not destination. AUX conflict: dropped rather than settled, per the coordinator's explicit instruction not to re-run Save("AUX"). CHANGELOG now says its behaviour was not reproducible across runs instead of asserting UnauthorizedAccessException. Deferred per the brief, unchanged this round: bold-run word-count uniformity, Attention density, four mid-sentence rewrap artifacts, "Tracked as #476" stamps, duplicated "unrelated conditions share this type" phrasing, and CONTRIBUTING.md bullet ordering. One untracked local notes file is also stale, which is a maintainer decision and reaches no clone. Not independently re-verified this round, carried forward unchanged from prior rounds and not flagged by any reviewer: the twenty-six members / twenty exception tags count (a crude re-scan of doc-comment blocks containing an exception tag found 21, one more than stated, most likely a private or internal member the original count excluded); the ListElement roman-marker item 17/19-21/22-25 figures; the Document.Margins non-finite routing; the LayoutImage clamp and refusal figures; the pie chart and table-border claims. None of these were named in the brief's findings or the coordinator's four additions. Gates: dotnet build -m:2 (0 warnings, 0 errors), dotnet test (7023 total, 0 failed, 326 skipped, unchanged from before this change), dotnet test -c Release (same), dotnet format --verify-no-changes (exit 0), eng/clean-room-check.ps1 (passed). Dash check: python3, decoding the diff as UTF-8, over every added line: 0 em dashes, 0 en dashes; the only double-hyphen occurrences are the literal qpdf --qdf and qpdf --check command-line flags.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three reviewers audited the layout boundary-documentation sweep (#503) and found real problems: CONTRIBUTING.md's rule described a bold/"Do not pass" pattern the tree never used, several XML-doc and CHANGELOG claims were false or unmeasured, two ISO 32000-2 citations overstated what the clause says, and thirteen reachable exceptions had no tag. No behaviour or logic changes; every claim here was checked against the built assembly with a scratch probe, or against the code path that throws. RunningBand.Height's own false refusal claim is left alone, since it is a separate code defect (#520) and correcting the prose now would need doing again once that lands.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three reviewers audited round one (4e80571) and found it had introduced new false claims while fixing the originals. This round corrects those, verified against the built assembly with a fresh scratch probe printing Assembly.Location, plus qpdf --qdf inspection of rendered content streams for the geometry claims. No behaviour or logic change. Cell.ColSpan: round one deleted a true sentence (a span is clamped when an earlier row's RowSpan occupies its leading columns) while replacing a false one (widening always happens). Measured both a 5-column and a 3-column span clamped to one column, ending exactly at the table's right edge, when a prior RowSpan already took the rest. Both mechanisms are now documented. TextStyle.FontSize: the RunningBand exception doc flattened a genuine six-way split (footer/header x Height set/unset x NaN/+inf/-inf) into one sentence. Measured all six; only the fixed-Height case names the band and size for every non-finite value. Also corrected the claim that a heading names itself — Heading delegates to ParagraphRenderer and reports as "A paragraph run", confirmed by direct measurement. Cell.Padding: "400 across both sides puts the text at x = 220" does not reproduce under either reading (EdgeInsets(4,400,4,400) gives 420, same as Left=400 alone; EdgeInsets(400) throws too-tall with no text at all). Splitting the same 400 evenly (Left=200, Right=200) is what gives 220, confirmed via the Tm operator in the rendered content stream. Exception-tag count: recounted <exception> tags across the eleven files round one touched at 486622d, 6db9ef4 and HEAD by scanning each file's XML-doc comments for the tag immediately preceding a public member declaration (tolerating attributes, #pragma and // comments in between, which is what SaveAsync's RS0026 suppression needed). Twenty members carry a tag at HEAD, not eighteen; nineteen are new, not seventeen. CHANGELOG numbers corrected to match. Document.Save(string), SaveAsync(string, CancellationToken) and SaveAsync(Stream, CancellationToken): added UnauthorizedAccessException (directory path, or a read-only existing file), IOException (path held open elsewhere, over-long or invalid name), and TaskCanceledException (pre-cancelled token), all reproduced directly. The local notes file named TextStyle.Leading as a second exemplar of the boundary pattern; it satisfies two of the four rule bullets and carries two untagged reachable exceptions. Dropped it from the exemplar list so The local notes file and CONTRIBUTING.md name the same member. RunningBand.Height's non-finite-value paragraph is given the same #520 caveat the neighbouring refusal sentence already carries, since a footer at negative infinity produces a valid file rather than refusing. Attention triage ran backwards on two of three removals: restored the LayoutImage.Height distortion warning and PieChart.Diameter's "smaller than set, nothing reports it" warning, both silent-output traps. Six markers that were mechanisms, not traps, are removed: TextStyle.Leading, both Save(Stream)-family "calling this twice throws" paragraphs, LayoutImage.Width's token-check note, RunningBand.Alignment, and the second RunningBand.Height marker. Voice: bolded the marker word itself on all 22 Attention/NOTE instances across the package rather than the whole sentence, and added five NOTE markers for facts that had none (the two wrong-cause messages plus resolution and zoom claims separated, Cell.RowSpan's pronoun agreement, PieChart.Diameter's redundant colon, Document.Margins names why the two non-finite forms can't be caught together, Heading's NOTE 2 de-hedged, Document.PageSize's replacement now carries a consequence instead of restating its opening sentence, and Cell.ColSpan's "simply" removed. The #503 CHANGELOG entry had landed inside the released [2.3.2] section because its branch predated the release commit. Moved to [Unreleased] with both rounds' corrections, since a released section must not document work that shipped after it.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Three Opus reviewers on disjoint lenses found RunningBand.Height making
five disagreeing statements about the same case, four more members
stating a rule then a case that broke it, and several tags narrower
than the code. All measured against this branch's built assembly via
a scratch probe (ProjectReference into src/VellumPdf.Layout, assembly
path printed on every run) plus qpdf/pdftotext on the fixtures it
wrote, not assumed from the review brief.
RunningBand.Height: `Footer.Height = double.NegativeInfinity` does not
throw (probe: Save writes a 1550-byte file; `qpdf --check` exits 0;
`pdftotext` reports "Syntax Error: Unknown operator 'NaN'" and drops
the footer). qpdf --qdf on the fixture shows the content stream itself:
`1 0 0 1 72 NaN Tm (P {0}) Tj`. The member's opening refusal sentence,
its "produces a valid file" hedge and its exception tag naming
InvalidOperationException for "NaN or negative infinity" disagreed
with this and each other; now say the same thing, in the well-formed/
non-conforming vocabulary TableGridResolver.cs already uses.
CONTRIBUTING.md told a reader to bold one word for a warning paragraph;
grepped, all 23 markers in the package bold two (the marker word and
the negation), including TextStyle.cs's own named exemplar. Rule text
now matches the tree.
TextStyle.Leading: probe on a footer/header with Height null across
Leading 400..1e9 shows 400-670 no throw, 680-692 InvalidOperationException
(content area 13.9pt down to 1.9pt), 694+ ArgumentException, identical
on both bands. Magnitude decides, not the band, contrary to an uncommitted
local note; both throws are now tagged.
TextStyle.FontSize: probe on a footer at FontSize=NegativeInfinity gives
a byte-identical InvalidOperationException message with Height null and
Height=20, so "changes every case" is false for that one pair. The NaN
message probed is `... (header 0.0pt, footer NaNpt) ...`, which does
name both bands, contra "naming neither the band". Document.Save(string)/
SaveAsync(string,ct): probed Save("CON")/("NUL")/("CON.pdf") no throw,
Save("AUX") UnauthorizedAccessException, Save("PRN")/("LPT1")
FileNotFoundException; none IOException, so the "naming a device" clause
is dropped (2 copies).
Cell.ColSpan, LineSeparator, Document.PageSize, and the string save
overloads' "writes nothing" claim each stated a rule and a contradicting
case without reconciling them; softened/corrected/pointed at the actual
mechanism (#508) instead of restating a guarantee that does not hold
once a file already exists at the path.
Cell.Padding and TextStyle.FontSize exception tags were narrower than
measured: probe shows EdgeInsets(400) (finite) throws the generic
too-tall InvalidOperationException, and footer font sizes 570-576 throw
InvalidOperationException while 580/600/1e6 already throw
ArgumentException, well short of positive infinity. Both tags widened.
Document's four save overloads were missing ObjectDisposedException
(probed on all four post-Dispose) and Save(Stream)/SaveAsync(Stream)
were missing ArgumentNullException for a null destination. While
probing, a non-writable stream gave ArgumentException from Save(Stream)
("Stream must be writable") but NotSupportedException from
SaveAsync(Stream,ct) ("Stream does not support writing"); both tags now
name their two causes.
Marker density: five NOTE markers added since #503 point at a live
issue number rather than history or a version; folded into plain
sentences, cutting the package from 23 to 18 (grepped before and after).
LOW: LayoutImage.Width's summary admitted negative infinity, which
probe confirms is refused (only +Inf is accepted); ListElement's roman
marker claim was checked against qpdf --qdf on a 25-item list, where
items 19-21 revert to the plain indent rather than continuing to widen;
CHANGELOG's own #503 entry gains "evenly" to match Cell.cs.
Deviated from the brief on one LOW item: literally copying
LayoutImage.Height's summary to Width would itself be false, since
Width (unlike Height) accepts positive infinity; adjusted instead of
copied.
The local notes file is untracked and left alone per the brief; its Leading/band
sentence is superseded by TextStyle.Leading's own corrected remarks.
Tim81
added a commit
that referenced
this pull request
Sep 13, 2026
Round four on #503: three Opus reviewers plus a fourth pass on top, adjudicated. Item 1 (CHANGELOG diary) is structural and removed most of the smaller findings by construction; everything below is a correction verified against a scratch probe (ProjectReference into src/VellumPdf.Layout, assembly path printed each run) or gh api, never trusted from the brief without reproduction. Bold-marker rule corrected. My round-three instruction said every marker paragraph bolds two words; grepped <b>(Attention|NOTE)</b> across src/VellumPdf.Layout: 18 marker paragraphs, of which counting <b>not</b> or <b>nor</b> co-occurring gives exactly 8 bolding both and 10 bolding the marker alone. CONTRIBUTING.md's rule now says bold the marker always, the negation only where the paragraph turns on one. CHANGELOG #503 block rewritten. Collapsed three rounds worth of "round N found X was wrong" narration into one account of the final state, fixing the specific contradictions named in the brief: the RunningBand.Height "left alone" bullet reversed by round three, the "five paragraphs now carry NOTE" claim (all five were later removed), the abandoned "bold only one word" rule text, the unqualified Document.PageSize wording, the "every one of 23 bolds two" claim (8 of 18 do, see above), the miscounted save-overload exception tags, the "five markers folded" count (four folded, one kept its own paragraph), and both citations of #493 as an open tracker. TextStyle.cs mechanism fix (brief item 2). The "leading inflates the band past the page while the content area is still positive" tag described an impossible state. Probe on a footer, Height null, A4, default margins, TextStyle.Leading: 680: InvalidOperationException, content area 13.9pt 693: InvalidOperationException, content area 0.9pt 694: ArgumentException, content area -0.1pt Content area shrinks toward zero but never goes negative before the ArgumentException case; reworded to "shrinks the content area to a small positive remainder" instead of "past the page". Numeric boundaries corrected (brief item 3), same probe: Leading: last no-throw 679; IOE 680-693; ArgumentException 694+ FontSize: last no-throw 566; IOE 567-578; ArgumentException 579+ matching the brief's 679/680-693/694 and 566/567-578/579 exactly, against the previously documented 670/680-692/694 and 570-576/580. On a 300x300pt page with 10pt margins: Leading 261 no-throw, 262 throws IOE, confirming the figures are page-dependent (both TextStyle tags and the CHANGELOG now state the measurement page). Leading = double.PositiveInfinity: no throw (falls through to auto-leading, since EffectiveLeading requires IsFinite); the CHANGELOG's old "694 upward throws ArgumentException" is now qualified to exclude it. Cell.ColSpan hedge removed (brief item 4). TableGridResolver.cs lines 59-68 read: ColCount = 0; foreach row: rowCols = sum of ColSpan; if greater, ColCount = rowCols. Unconditional, no branch producing anything else. "Normally"/"usually" on the column-count rule itself dropped; "usually widens the grid" kept on the separate claim about whether a given span contributes, which does have the documented RowSpan exception. #493 corrected (brief item 5). gh api repos//issues/493 --jq {number, state, pull_request} printed number 493, pull_request true, state closed. Removed from Cell.cs (RowSpan remarks) and both CHANGELOG mentions. RunningBand.Height wording (brief item 6) plus Addition 2. Probe, footer and header, various Height values: footer 680: no throw footer 684: IOE, content area 13.9pt footer 697.5: IOE footer 697.9: ArgumentException header 697.5: IOE header 698: ArgumentException A finite height was previously untagged for InvalidOperationException; both the IOE tag and remarks now cover it, and "each with its own exception type" (false once IOE covers NaN, header-only negative infinity, and now a finite value) is replaced with "one exception type covers three causes". The double-colon sentence and the unbridged negative-infinity-to-NaN-token jump are rewritten to state the actual arithmetic: with Height at negative infinity, bandY (page height minus margin minus Height) becomes positive infinity, and bandY plus Height computes infinity plus negative infinity, which is NaN under IEEE 754, the token qpdf --qdf shows in the Tm operator (read from DocumentRenderer.cs lines 340 and 404; the byte pattern itself was already established by round three's own qpdf --qdf run, not repeated this round). Cell.cs lines 100-102 wording (brief item 7). "An inset names the row" and "raises the message" corrected to "a message names" and "throws the exception". The Top/Bottom=400 tag reference is left untouched per the brief's refutation note (another reviewer measured EdgeInsets(400, 6, 400, 6) throws while Left alone at 400 does not). Addition 1 (TextStyle.Leading/FontSize scoped too narrowly to a band). Probe with no header or footer anywhere in the document: Paragraph Leading=697: no throw Paragraph Leading=698: InvalidOperationException Heading Leading=1e6: InvalidOperationException Paragraph FontSize=600: InvalidOperationException Both InvalidOperationException tags no longer scope the throw to a RunningBand style whose Height is left null; the ArgumentException tags stay band-scoped, since a plain page's margins do not move as FontSize or Leading grows (DocumentRenderer's content area is margins-and-bands-only, independent of any single run's style), and probing up to 1e6 with no band never reached it. Addition 2: covered under RunningBand.Height above. Addition 3 (PageSize resize byte-identical claim). Same-process back-to-back builds: 0 differing bytes (random ID collided). Builds 2 seconds apart: 8 diff ranges, all inside XMP CreateDate, XMP ModifyDate, and the trailer ID array (both hex halves). "Bar the random ID" corrected to "except the random ID and the XMP CreateDate/ModifyDate timestamps" in both Document.cs and CHANGELOG. Addition 4 (Save(Stream) ArgumentException param name). Probe with a read-only FileStream and a non-writable MemoryStream both printed ArgumentException, ParamName=stream, Message "Stream must be writable. (Parameter 'stream')". The public parameter is destination; the tag now says the exception carries the internal name stream, not destination. AUX conflict: dropped rather than settled, per the coordinator's explicit instruction not to re-run Save("AUX"). CHANGELOG now says its behaviour was not reproducible across runs instead of asserting UnauthorizedAccessException. Deferred per the brief, unchanged this round: bold-run word-count uniformity, Attention density, four mid-sentence rewrap artifacts, "Tracked as #476" stamps, duplicated "unrelated conditions share this type" phrasing, and CONTRIBUTING.md bullet ordering. One untracked local notes file is also stale, which is a maintainer decision and reaches no clone. Not independently re-verified this round, carried forward unchanged from prior rounds and not flagged by any reviewer: the twenty-six members / twenty exception tags count (a crude re-scan of doc-comment blocks containing an exception tag found 21, one more than stated, most likely a private or internal member the original count excluded); the ListElement roman-marker item 17/19-21/22-25 figures; the Document.Margins non-finite routing; the LayoutImage clamp and refusal figures; the pie chart and table-border claims. None of these were named in the brief's findings or the coordinator's four additions. Gates: dotnet build -m:2 (0 warnings, 0 errors), dotnet test (7023 total, 0 failed, 326 skipped, unchanged from before this change), dotnet test -c Release (same), dotnet format --verify-no-changes (exit 0), eng/clean-room-check.ps1 (passed). Dash check: python3, decoding the diff as UTF-8, over every added line: 0 em dashes, 0 en dashes; the only double-hyphen occurrences are the literal qpdf --qdf and qpdf --check command-line flags.
Tim81
added a commit
that referenced
this pull request
Sep 14, 2026
The branch predates three merges and needed more than a replay. GifImageLoader is no longer touched. This branch documented the pre-#525 decoder — only the first frame read, the logical screen ignored, a null raising NullReferenceException — and #525 rewrote that loader from the GIF89a specification and wrote its own boundary documentation against the decoder that now exists. Main's version describes the current code; this branch's described code that no longer runs, so the conflict resolves to main and the member drops out of the diff. The four caller-facing warnings it carried, about the null argument, the first-frame-only read, the ignored logical screen and the limits being internal constants, are not lost: they are saved for verification against the current decoder and belong with #498 and the rest of the GIF work rather than in a rebase. CONTRIBUTING.md drops out too. This branch and #503 each added the same twenty-seven lines, byte-identical, and git recognised the block as already applied. The CHANGELOG entry landed in the wrong section. A three-way merge placed all fifty-three lines inside the released 2.3.2 section, matching context against the file's old shape, where they would have rewritten history for a version that already shipped. They are under Unreleased now, in their own Documentation heading beside the other entries waiting on 2.3.3. Documentation only after the rebase: zero non-comment source lines changed across nine files. 7,099 tests pass in Release, format and clean-room clean.
Tim81
added a commit
that referenced
this pull request
Sep 14, 2026
…wed (#526) #503 shipped boundary documentation for Layout on CI alone, before its review ran. This is that review's outcome: 835 added lines and 177 removed across thirteen files, documentation only, with no behaviour change and no public API change. Of Layout's 298 documented public members, exactly one carried an `<exception>` tag before this work. Thirty now carry a boundary block and twenty-six a tag, overlapping in twenty-five; the five with a block and no tag refuse nothing, and `Document.Encrypt` had a tag and no block already. ## What was wrong The documentation was not merely thin, it was false in places a caller would act on. - A footer band height of negative infinity was documented as refused. It is not: the save succeeds and writes `NaN` into the footer's `Tm` operator, which `qpdf --check` accepts and `pdftotext` reports as a syntax error while dropping the footer. - Every numeric boundary was stated as a property of the value. All of them are properties of the page: the first throwing `Leading` moves from 679 on A4 to 262 on a 300 by 300 page. - The list indent's refusal was measured against the wrong width. It is the list's own area, which is the page content width narrowed by the left and right edges of `Margins`, so a caller with a 56pt inset met the exception at an indent both the tag and the prose called safe. - Nesting had a second boundary nothing recorded: a nested list discards its child text from half the area width while still drawing the child marker, as quietly as a flat list does at the full width. - Exception tags promised throws that do not happen and omitted types that do, including one deriving from a tagged base, which is the case `CONTRIBUTING` was rewritten to name. ## What it cost, and what that bought Twenty-one adversarial review rounds, two lenses each: one measuring behaviour with probes, one reading register and ambiguity. The record is worth keeping because the shape of the failure changed twice. Rounds one to eighteen found false facts, and every one of them was a figure *derived* from a rule rather than the rule itself. The four gutter rules were never found wrong. Patching the derivations regenerated them: seventeen rounds, fifty-five medium findings, three separate repair strategies, and each round's corrections produced the next round's defects. Round nineteen returned green on measurement while the prose lens stayed loud, which is the signal that the facts are right and the prose carrying them is too dense. `ListElement.Indent` had reached 792 words across eight paragraphs for one `double`, using the word *content* for three different quantities. Cutting it to 414 words, keeping the mechanism and moving the measured figures to #476 where a fixture can name its page size, did in one round what nineteen rounds of patching had not. Both lenses then judged that nothing load-bearing had been lost. Rounds nineteen to twenty-one found ambiguous referents rather than wrong contracts, which is a milder class and one a careful read catches. ## The rule this earned `CONTRIBUTING.md` now asks for three sets, not two: what a member refuses, what it accepts but should not be relied on, and **what it silently ignores**. The third is the dangerous one, because the call succeeds and returns something different from what was asked for, and the rule being written entirely around refusal is what kept every review lens pointed at the exception list. It is answerable mechanically, by grepping the implementation for each field in the format's own list. ## Verification 7,099 tests passing in Release, 0 warnings, format and clean-room clean, on the final commit rather than on work in progress. The member documentation is verified against measurement: round twenty-one's contract lens found nothing in it, and two checks over the compiler's own generated XML pass — no member carries a tagged exception type its prose never explains, and `Attention` sits exactly once on each of sixteen members. This makes the documented boundaries correct. It does not make the surface documented: thirty of 298 members carry one, and #510 is the measured remainder.
Tim81
added a commit
that referenced
this pull request
Sep 14, 2026
The branch predates three merges and needed more than a replay. GifImageLoader is no longer touched. This branch documented the pre-#525 decoder — only the first frame read, the logical screen ignored, a null raising NullReferenceException — and #525 rewrote that loader from the GIF89a specification and wrote its own boundary documentation against the decoder that now exists. Main's version describes the current code; this branch's described code that no longer runs, so the conflict resolves to main and the member drops out of the diff. The four caller-facing warnings it carried, about the null argument, the first-frame-only read, the ignored logical screen and the limits being internal constants, are not lost: they are saved for verification against the current decoder and belong with #498 and the rest of the GIF work rather than in a rebase. CONTRIBUTING.md drops out too. This branch and #503 each added the same twenty-seven lines, byte-identical, and git recognised the block as already applied. The CHANGELOG entry landed in the wrong section. A three-way merge placed all fifty-three lines inside the released 2.3.2 section, matching context against the file's old shape, where they would have rewritten history for a version that already shipped. They are under Unreleased now, in their own Documentation heading beside the other entries waiting on 2.3.3. Documentation only after the rebase: zero non-comment source lines changed across nine files. 7,099 tests pass in Release, format and clean-room clean. # Conflicts: # CHANGELOG.md
Tim81
added a commit
that referenced
this pull request
Sep 20, 2026
Closes #510. #503 and #526 documented the members found by searching for direct throws. This PR gives the rest of the Layout package's public surface the same contract: what each member **refuses**, what it **accepts but that must not be relied on**, and what it **silently ignores** — the third set being the one that hurts, because the call succeeds and hands back something other than what was asked for. ## What is here The package's public API files list 429 entries. Counted in the compiler's XML output on this head, **137 public members and the `TextRun` type** carry an `<exception>` tag: 82 methods, 55 properties and that one type. Every boundary was measured against a probe built from this branch, not transcribed from the issue. A sample: - `LoadTrueTypeFont` raises `FileNotFoundException` for a missing file and `DirectoryNotFoundException` for a missing directory, from that call rather than from `Save`. - Symbol and ZapfDingbats measure every one of the 63,488 non-surrogate BMP characters as zero width, at each size probed. A paragraph set wholly in either is never wrapped, and a centred line is placed at the exact centre of the content area as if it had no width — 297.64 on A4. - A nested list's indent raises the too-tall `InvalidOperationException` at its own area width exactly and inclusively: 451.2799 saves, 451.28 throws, and the boundary moves with the list's own margins. - `ColorRgb.FromHex(0x00FF0000)` and `0xAAFF0000` give the same colour; the alpha byte is ignored. - `javascript:alert(1)` on `LinkUri` and `not a tag` on `Language` both save. ## Records rewritten as explicit properties `13b1c72` rewrote six shipped positional records — `ColorRgb`, `ColorCmyk`, `EdgeInsets`, `LayoutBox`, `BandTruncationWarning` and `PieSlice` — as explicit properties, because a positional record gives its properties no place to carry remarks. That is a source change to shipped types, so it is proved rather than asserted: **ApiCompat** against the published 2.3.2 package, and `RecordShapeTests`, which pins `ToString`, equality, `with` and `Deconstruct` against the values the positional declarations produced at `574c62b`. The CHANGELOG's `### Changed` entry says so. ## Review 21 rounds. The last three ran four independent lenses each — three contract lenses that measure with probes, one voice lens for register and ambiguity — plus a pre-review of every fix diff before it was committed. Blocking findings fell from roughly 47 in round 1 to 0 HIGH and 6 MEDIUM in round 21. One HIGH has been raised since round 13, in round 18. Round 21's two contract findings were both older than the text under review: a sentence from round 6 claiming a null page leaves *each* structure element without one (`RegisterStructElemTree` never touches `Page`, so a root registered through it keeps the caller's page and the save writes `/Pg`), and round 9's tag sweep, which gave `Add(string, TextStyle)` its save-time exception tags and stopped before the six siblings that reach the same code. Both are fixed, the second across all six overloads with the type set measured per overload. A third finding corrected `Heading.Level`, which said the outline "still nests on the number you gave": the builder hangs an entry under the most recent earlier entry at exactly `Level - 1`, so after a level 0 heading both level 5 and level 500 land beside it at the top level. A pre-round sweep of the three classes behind rounds 19 and 20 found what those rounds had not. The `ArgumentException` tags on `DrawContext` blamed the caller's argument for a value the save never sees — what is written is the flipped value, so a finite `layoutY` is refused when `PageBounds`'s height is not finite or the subtraction overflows. A page from another document drops a link annotation entirely, while still writing an outline entry with a null destination. Behaviour found by probing that no document ever described is filed on #552 rather than fixed here. Defects this PR documents rather than fixes are #543-#551, milestoned v2.3.4. ## Scope Documentation only, apart from the six record rewrites above and five explicit parameterless constructors that exist to carry a doc comment. Layout tests run with `REQUIRE_ORACLES=1`, so no oracle case skips silently: **412 run, 0 skipped, 0 failed.**
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.
2.3.2 created these boundaries and documented almost none of them. Layout carries 340 public members and, before this, one file with any
<exception>tag.That gap matters because of where the refusals fire. They are raised from
Save, not from the property the caller set, so assigning a non-finite font size throws from a call the programmer never made while the member they did set is silent about it.Twenty-one members now follow the pattern
TextStyle.FontSizealready used: a bold sentence naming what is refused, which call throws it and why, then a paragraph beginning "Do not pass" for input accepted today, what it does now, and that a later major will reject it.Covered: the table cell's two spans and its padding, the table border width, the image width and height, the separator line width, the pie chart's slices, diameter, start angle, stroke width and alignment, the heading level, the list indent and nesting depth, the running band's template, height and alignment, and the document margins.
Three claims that did not survive being checked
Each was written, then read against the code, then corrected:
StrokeColorbeing set, so a zero width still emits0 w.BorderColoris not nullable and every cell is stroked unconditionally.NaNand negative infinity slip past the check, since a comparison against them is false, and surface as "an element is too tall to fit" and as the page-continuation cap respectively. Measured one value at a time.That last one is the same wrong-cause defect #481 corrected for other inputs. Filed as #502 rather than fixed here, because routing margins through
LayoutValidationchanges behaviour and this pull request changes none.Standing rule
CLAUDE.mdgains the rule, so a public member's boundary is documented in the same commit as the member rather than swept up at a release. The remaining seven packages follow the same way.Refs #502