Skip to content

fix(layout,kernel): tag a table span with what the page actually covered - #493

Merged
Tim81 merged 10 commits into
mainfrom
fix/table-span-attrs
Sep 12, 2026
Merged

Tim81 merged 10 commits into
mainfrom
fix/table-span-attrs

Conversation

@Tim81

@Tim81 Tim81 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

The rowspan half of #480, split out of #486 after review found that the attributes as first written
introduced a PDF/UA-1 regression of their own. #486 is merged, and this is rebased onto it.

Measured on adf6acf, the commit before either pull request, and on this branch, with veraPDF
1.30.2 and every structure tree expanded by qpdf --qdf --object-streams=disable.

Fix Before After
The duplicated span draw a RowSpan cell's text drawn twice, and tagged, a second structure element parented to the wrong row once
/RowSpan and /ColSpan never emitted, so a tagged table with a span of three or more could not be PDF/UA-1 conformant emitted per ISO 32000-1:2008 Table 349
The emitted value the span the caller declared the span the page actually covered
A row that draws no cell tagged as a row element with no children and no page not tagged

Why the attributes were needed, and why the first version of them was wrong

DrawCell wrote only /Scope, and nothing in the layout package emitted either span. Table 349
defaults an absent value to 1, so a spanning cell's single element claimed a one-by-one slot and the
row it covered read one column short. ISO 14289-1:2014 clause 7.5 requires a table header to be
tagged according to that table.

The draw this pull request deletes was accidentally filling that slot, for a span of exactly two,
because it fired on the last covered row. Measured on the oracle generator's own shape:

adf6acf   RowSpan 2   PASS      RowSpan 3   FAIL      RowSpan 4   FAIL
this      RowSpan 2   PASS      RowSpan 3   PASS      RowSpan 4   PASS

So deleting the duplicate without the attributes would have turned a compliant document
non-compliant, and a span of three or more was already refused before either change.

But writing the declared value is wrong in two shapes, and both were measured before the clamp:

A span reaching past the last row claims rows that do not exist. On a two-row table, a declared 5 and
a declared 50 each failed veraPDF's row-width check. A declared int.MaxValue produced no verdict at
all: veraPDF tried to allocate a row array of that size and abandoned the job with "Requested array
size exceeds VM limit" and exit code 3, which VeraPdfExitCode had no case for. It does now.

A header row carrying a span is worse, because Draw repeats the header run at the top of every
continuation page while the span's occupancy is keyed to the row it was declared over. The expanded
tree on a three-page fixture:

Page Header row Row below it Consistent
1 two cells, first claiming two rows one cell yes: 1 drawn plus 1 covered is 2
2 two cells, first claiming two rows two cells no: 3 against the header's 2
3 two cells, first claiming two rows two cells no, the same

That document is compliant on the base and reports two failed checks with the declared value.

The decision this needed, rather than a clamp

Clamping only the attribute would leave the tag and the paint disagreeing, because a repeated header
cell is still painted across two row heights on a continuation page. So both now come from one
number: the run of rows the page actually draws starting at the cell's own row, capped by the
declared count. A data-row span is unaffected, since Layout walks a page break back out of a
rowspan group.

/ColSpan is bounded the same way, for a narrower reason, and I got this one wrong twice before
settling it. A span wider than the widths the caller supplied is not an overrun: TableGridResolver
sets the column count to the widest row's own span sum (#485), so the grid widens to it. That is why
the first attempt at a column clamp was removed, after its test asserted a clamped 2 and measured 3.

But col is not always the running total of a row's own cells: a span from an earlier row advances it
by that cell's width instead. Row 0 summing to three columns and spanning its first two downward
leaves row 0's neighbour row starting at column 2 of 3. A ColSpan = 2 cell there is painted one
column wide by ColSpanWidth and used to tag two. Measured: two /ColSpan 2 attributes before,
one after — row 0's, which really does cover two columns. This changes no drawn byte, because the
painted width was already bounded.

What this moves for a document that renders today

A spanning cell's text stops being drawn twice, which changes the bytes of any table whose span
actually covers a row below it. A span declared on the last row, or past it, never reached the second
draw: both such documents are byte-identical across the change, hashed over their decompressed
content streams, while the control with a span that does cover a row goes from four text runs to
three.

A repeated header cell carrying a span is painted one row tall on a continuation page instead of two,
where it used to overlap the first data row's rectangle.

A table with no span moves only if it holds a row that draws no cell, which loses its empty row
element. That is a fix rather than a side effect: veraPDF refuses a tagged three-row table with no
span anywhere whose middle row is empty, reporting its rows as spanning two and zero columns, and
accepts it after.

Read off the corpus fixture added for this shape, untagged, three pages:

adf6acf   page 1  runs=12  header rect 20 110 130 40      page 2 and 3  same 40pt rect
this      page 1  runs=11  header rect 20 110 130 40      page 2 and 3  20 130 130 20

Page 1 keeps its 40pt rectangle because the span is real there. The single lost run across the
document is the duplicate draw.

Evidence

  • Byte identity. 238 documents rendered on both sides and hashed over their decompressed content
    streams, each row carrying a text-run count. Seven rows moved. Four are fix(layout): stop losing a table row and doubling its margins #486's and are unchanged by
    this branch. The three that are this branch's own are the two rowspan fixtures, 4 text runs to 3 and
    23 to 22, and the repeated-header fixture added here, 30 to 29.

    That last fixture is new because the corpus held a paginating table and a repeated header but never
    both with a span, which is exactly the shape this pull request moves. The column bound moved no
    corpus document, which is consistent with it changing an attribute and not a drawn byte.

  • Discrimination, by mutation in a detached worktree. Reverting the row clamp to the declared
    value, with the original loop bounds restored so the mutant is faithful rather than crashing, fails
    eight tests: all four attribute cases, the repeated-header case, and all three veraPDF cases.
    Reverting the column clamp fails exactly one, the case written for it. Reverting the empty-row fix
    fails exactly one, likewise.

    Two defects in my own tests came out of that pass rather than out of reading them. The first
    mutation I wrote dropped the loop bounds along with the clamp, so it crashed rather than
    discriminating, and its failures proved nothing. And /RowSpan 2 is a prefix of
    /RowSpan 2147483647, so that case passed on the faithful mutant until the assertion required a
    delimiter.

  • The test that did not discriminate. The empty-row fix shipped with a case that passes with the
    fix reverted. Its fixture's covered row declares no cell, so it measures zero height,
    _occupied.Bottom lands on its own top edge and the draw loop stops before reaching it. That case
    is kept with a doc saying what it actually pins, and the discriminating one uses a covered row that
    declares a cell.

  • Gates. 6961 tests across the seven projects, no failures, in Release and in Debug. With the
    oracle gates required rather than skipped, the Layout and Conformance projects run their veraPDF
    and poppler cases rather than skipping them, so the verdicts above are part of the suite rather
    than a local run.

On the Kernel change

The two properties go on PdfStructElem, which is Kernel, and 2.3.2 is cherry-picked from the
v2.3.1 tag. That type lives in PdfStructureTree.cs rather than a file of its own, and that one
file is byte-identical between the tag and main — the blob hash is the same object — so the commit
applies cleanly. The entries are in PublicAPI.Unshipped.txt and the shipped
file is untouched, which is how the 1.5.1 patch added Kernel API before.

The review round this went through

Three reviewers, disjoint lenses, each in its own worktree: one on the rendering and tagging
behaviour, one on whether the tests prove anything, one on every sentence and number. They returned
one high, four medium and eight low, and the high was mine.

  • The high. This branch's changelog headline said a table with a span could not be PDF/UA-1
    conformant while the same paragraph said deleting the duplicate draw would have made a compliant
    document non-compliant. A span of two was conformant on the base; three and up were not. Corrected.
  • The kernel guard was unfalsified. Changing "write the span only when greater than one" to write
    it always left all 1,810 layout and kernel cases green, because the only in-tree caller never
    passes one. Both properties are public, so a caller can. A kernel case now kills that mutant.
  • Two byte-identity quantifiers were false, both corrected above and both re-measured here rather
    than taken from the reviewer.
  • The effective-span documentation over-reached twice. It said a data-row span is never clipped,
    when the clip applies to any span past the last row on any row; and that a span group always lands
    whole on one page, when a group too tall to fit raises instead. Measured under a repeated header on
    a 300x170pt page: groups of two to five keep their span, six and up raise.
  • Two test gaps closed with cases. The owner entry on the span-only attribute dictionary was
    caught by veraPDF alone, which skips on a bare run; dropping it now fails two local cases. And the
    column bound had no oracle case while the row bound had six; reverting the bound now fails both its
    byte-level case and its oracle case.

One medium filed rather than fixed

A cell covering every column of a row produces a structure tree whose rows differ in width, and
veraPDF refuses it. It is refused on adf6acf too, so this branch does not introduce it; the branch
strictly reduces the span shapes that fail. The obvious repair, keeping an empty row element for the
covered row, was built as a valid file and veraPDF refuses that as well, crediting the empty row with
no coverage from above. No accepted encoding of the shape was found, so settling it needs the
specification read against what the validator implements rather than a patch. Filed as #489 against
this milestone.

One citation corrected

The clause number veraPDF prints on this rule is its own rule identifier, not an ISO clause. In ISO
14289-1:2014, read from the held copy, clause 7.2 is Text and clause 7.5 is Tables. The first draft
of these commits wrote 7.2 as an ISO clause in a comment, a test doc and a commit message.

Refs #365, #480

DrawRow drew a RowSpan cell immediately at its origin row, spanning
the full combined height of every row it covers, then drew it again
when the span map reached the last spanned row (remainingRows == 1)
- the same cell, recomputed to the same height, a second time. Delete
the redundant draw and keep the slot cleanup that lets the column
resume ordinary cells on the next row.

Tagged, the second draw also attached a duplicate structure element
to the wrong row, so a duplicated grid was the shape a table
conformance rule inspects.

The existing rowspan regression test asserted only that the text
appeared, which passed whether it drew once or twice; it now asserts
the count, and the new row-axis tests do the same for a rowspan that
crosses a page break.
A spanning TH/TD wrote no /RowSpan or /ColSpan, so its structure element
claimed a one-by-one slot and the row it covers read one column short.
veraPDF 1.30.2 flags this as ISO 14289-1 clause 7.2 test 43 ("Table rows
shall have the same number of columns, taking into account column
spans"): a tagged RowSpan=2 table went PASS to FAIL, and RowSpan>=3 was
already failing, once the row-axis fix stopped drawing a span's cell a
second time on its last covered row (that duplicate draw had been
accidentally supplying the missing slot).

PdfStructElem.TableRowSpan/TableColSpan merge into the same /A
dictionary TableHeaderScope already writes, per ISO 32000-1 14.8.5.7
Table 349; an absent value defaults to 1, so a value of 1 or less is
never written and a table with no spans keeps its exact prior bytes
(confirmed against the byte-identity corpus: no row moved).

Cover both fixtures against veraPDF, since nothing in the suite had
rendered a tagged table with a span through TableRenderer before.
Draw created a TR struct elem for every row before DrawRow ran, so a
row entirely covered by a rowspan from an earlier row — one that draws
no cell of its own — left an empty struct elem in the tree: no /K, no
/Pg, just << /Type /StructElem /S /TR /P ... >>. A TR is now added to
the table's tree only once DrawRow has actually populated it.
The attribute commit wrote /RowSpan from the cell's declared value while
the renderer had always clamped what it paints to the rows that exist.
Two shapes came out wrong, both measured with veraPDF 1.30.2 and the
structure tree expanded with qpdf.

A span declared past the last row claimed rows the table does not have.
On a two-row table, a declared 5 and a declared 50 each failed the
row-width check on the row below, and a declared int.MaxValue produced
no verdict at all: veraPDF tried to allocate a row array of that size
and abandoned the job with "Requested array size exceeds VM limit" and
exit code 3. VeraPdfExitCode now names that code, which it did not.

A header row carrying a span was worse, because Draw repeats the header
run at the top of every continuation page. The span's occupancy slot is
keyed to absolute row 1 while dataStartRow on a continuation page is the
split row, so the slot is never consumed: the row below drew all of its
own cells while the header above it claimed to cover one of them. A
paginating table with a header span went from compliant on the base to
two failed checks.

Clamping only the attribute would have left the tag and the paint
disagreeing, since the repeated header cell is still painted across two
row heights on a continuation page and overlaps the first data row's own
rectangle. Both now come from one number: the run of rows this page
actually draws starting at the cell's own row, capped by the declared
span. A data-row span is unaffected, because Layout walks a page break
back out of a rowspan group.

ColSpan gets no equivalent clamp. TableGridResolver sets the column
count to the widest row's own span sum (#485), so a row's spans can
never total more columns than the grid has. The first draft of this
change clamped it anyway; its test asserted a clamped 2 and measured 3,
which is how the clamp was found to be asserting the opposite of the
proof beside it.

Also corrects the clause citation the attribute commit introduced. The
number veraPDF prints on this rule is its own rule identifier. In ISO
14289-1:2014 clause 7.2 is Text; tables are clause 7.5, which requires a
table header to be tagged according to ISO 32000-1:2008 Table 337 and
Table 349, and Table 349 is where the span attributes are defined.
The merged entries never mentioned PdfStructElem.TableRowSpan and
TableColSpan, which are two new public properties on a Kernel type.

Three figures in the entry are measured rather than inherited. On the
base, the oracle generator's own shape passes veraPDF 1.30.2 at a
RowSpan of 2 and fails at 3 and 4, which is the asymmetry the duplicate
draw created: it supplied the missing occupancy slot for a span of
exactly two and for nothing else. A span declared past the last row
failed at 5 and 50 and produced no verdict at int.MaxValue. And the
repeated-header shape went from compliant to two failed checks.

What moves for a document that renders today is now stated and
measured. On the corpus fixture added for the shape, the header cell's
painted rectangle stays 40pt tall on the first page, where the span is
real, and goes from 40pt to 20pt on each continuation page, where it
used to overlap the first data row. Text runs across the document go
from 30 to 29, which is the duplicate draw and nothing else.

Also corrects section (d) of the row-axis tests. Its case was written as
proof of the empty-row fix and does not discriminate it: reverting that
fix in a detached worktree leaves it passing, because a row declaring no
cell measures zero height, so _occupied.Bottom lands on its own top edge
and the draw loop stops before reaching it. The doc now says that is
what the case pins, and the discriminating case lives in the new
TableSpanAttributeTests beside the attribute ones.
Self-review of the row-span clamp claimed ColSpan needed no equivalent,
on the grounds that TableGridResolver sets the column count to the
widest row's own span sum (#485), so a row's cells can never total more
columns than the grid has. That proof has a hole: col is not always the
running total of this row's own cells, because a span from an earlier
row advances it by that cell's ColSpan instead.

Measured. Row 0 holds a ColSpan-2 RowSpan-2 cell and an ordinary one, so
it sums to three columns and the grid is three wide. Row 0's first cell
spans down into row 1, covering columns 0 and 1 there, so row 1's single
ColSpan-2 cell starts at column 2 with one column left. Before this
change the document carried two /ColSpan 2 attributes, one of them on a
cell ColSpanWidth had painted one column wide. After it, one: row 0's,
which really does cover two.

The first attempt at this clamp was removed because its test asserted a
clamped 2 and measured 3. That test's fixture declared a span wider than
the supplied widths, where the grid widens to the span rather than the
span overrunning the grid. Both cases now have a case of their own,
naming which is which, so the next reader does not repeat either
conclusion.
The writer's guard was unfalsified. Changing it from greater-than-1 to
1-or-more left all 1,810 layout and kernel cases green, because the only
in-tree caller never passes 1. Both properties are public, so a caller
can, and the property's own documentation promises an unspanned cell
keeps the exact bytes it had before the attribute existed.
Three reviewers with disjoint lenses; one high, four medium and eight
low. The code is unchanged by this commit except for comments.

The changelog's headline said a table with a span could not be PDF/UA-1
conformant while the same paragraph said deleting the duplicate draw
would have made a compliant document non-compliant. Both cannot hold. A
span of exactly two passed on adf6acf, because the duplicate supplied
the grid slot the missing attribute should have; three and up failed.
The headline now says that.

Two byte-identity quantifiers were false. "Every table that has a span"
moves: a span declared on the last row, or past it, never reached the
duplicate draw, and both come out byte-identical, measured. "Tables with
no span are untouched": a table with an empty row loses its empty row
element, and that is a fix, not a side effect. veraPDF refuses a tagged
three-row table whose middle row is empty and has no span anywhere,
reporting rows spanning 2 and 0 columns, and accepts it after.

EffectiveRowSpan's doc claimed a data-row span is never clipped by it.
It clips any span reaching past the last row, on a data row as readily
as a header row. The pagination half over-reached too: a group that
cannot fit a page raises rather than landing whole on one. Measured on a
300x170pt page at 20pt margins under a repeated header, where the box
holds five 20pt rows: groups of two to five keep their declared span,
six and up raise ElementTooTall.

Two test docs said "before the attribute existed" of a sequence naming
three consecutive commits, while being true of a fourth. They now name
the commit for each state.

"Used to claim" described a state no release ever had; both states
existed only inside this branch. The row-axis test class doc had lost
its section (d), and a cross-reference pointed at the pull request that
explicitly does not contain this fix.

Two gaps closed with cases rather than words. The owner entry on the
span-only attribute dictionary was pinned by veraPDF alone, which skips
on a bare run, so dropping it passed every local case. And the column
bound had no oracle case while the row bound had six, though the shape
it prevents is a real refusal.
The fix round replaced an ambiguous "before the attribute existed" with
four commit hashes. Three of them were pre-rebase objects: reachable
from no branch, local or remote, surviving only in this clone's object
store until the next gc. The repository squash-merges, so no commit of
this branch reaches main either. The measurement behind the sentence is
sound and was reproduced independently, but the trail it pointed a
future reader at was already dead.

The four states are now named by what changed at each, which survives a
rebase and a squash, and the sentence says why a hash was not used.

Three smaller corrections in the same pass. A CHANGELOG paragraph was
left ragged mid-sentence by an earlier edit. "Byte-identical" overstated
what is measurable: two runs of the same build differ in their XMP
timestamps and document identifier, so the claim is now scoped to the
decompressed content streams, which is what the pull request body
already said. And a sentence inserted mid-line left a 169-character
comment where the rest of the block wraps near 100; the six other long
lines in that file predate this branch and are left alone.

One finding left open deliberately. The kernel suite has no case for the
owner entry on the span-only attribute path: dropping it keeps all 1,449
kernel cases green and is caught only by the layout suite. It is covered,
so this is placement rather than a hole, and moving coverage between
suites is not worth a behaviour-free commit in a patch.
@Tim81
Tim81 merged commit 6b66a56 into main Sep 12, 2026
4 checks passed
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
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
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
Tim81 deleted the fix/table-span-attrs branch November 21, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant