Repository navigation
visual-oracle: cumulative.py anchors where norm decides identity — F7 withdrawn, sweep re-ranked - #753
Conversation
) What changed: - tools/visual-oracle/cumulative.py: a companion to rank.py. rank.py ranks pages by their single largest delta; this ranks divergences by how many baselines each one displaces. It reuses rank.py's producer route, pdftext reference reader, word grouper and difflib alignment unchanged, and adds only: aligned pairs bucketed into reference lines (a dy profile per page); every change in that profile classified cumulative (the median dy below it differs from the median above: cost = step x lines below) or local (the page comes back: cost = one line); a probable-cause label taken from the LaTeX construct standing between the two lines in the source, so one cause groups its witnesses across fixtures; and a low-confidence flag for lines whose own words disagree about dy, which is what happens around cmex big operators where the reference PDF has no usable text for \int. - tools/visual-oracle/test_cumulative.py: 26 pure-python tests (cause keys, enclosing environment, local/cumulative/page-origin classification, aggregation, the low-confidence guard). - tools/visual-oracle/README.md: the companion section. - docs/evidence/corpus-fidelity-2026-09-16T1130Z/: the GH-66 sweep — README.md with twelve ranked findings, cumulative.md/json for all 22 fixtures and 59 compared pages, and 20 minimal probe documents with their measured result. No rendering behaviour is changed. pdflatex is an oracle only. What was run: python3 -m unittest discover -s tools/visual-oracle -p 'test_*.py' Ran 34 tests in 0.028s OK python3 tools/visual-oracle/cumulative.py --out docs/evidence/corpus-fidelity-2026-09-16T1130Z font environment: zero font-FAILURE diagnostics in every fixture 22 fixtures, 59 compared pages, 0 page-count mismatches python3 tools/visual-oracle/cumulative.py --fixtures .../probes --out .../probes-report 20 probes; r1/r2/r3/t3-macro-mid +5.978 bp, r4/t1/s2 0.000 bp Next step: the ranked list in the evidence README is for the Commander to triage into issues. F1 (cv, 29.89 bp) and F10 are the re-pin's payload (#711), not open engineering; F4 is the open #712 -> #741 stack measured on main. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…d F7 is withdrawn What changed: `cumulative.lines_from_pairs` computed `c["x"] - r["x"]` / `c["y_top"] - r["y_top"]` and bucketed lines on `r["y_top"]`, and the sweep's reflow test compared the same two word origins. All three now go through `cumulative.measured_pairs` -> `rank.pair_points`, which anchors an aligned pair at its first alphanumeric glyph: the content `rank.norm` used to decide the two words were one word. #752 did this for `rank.py`; this is the same correction applied to its companion, based on #752's branch with #750 merged in. F7 of the 2026-09-16 corpus sweep ("`\bigl(` offset by exactly -5.000 bp") is therefore **withdrawn**: not a rendering defect but an artefact of the oracle. pdfTeX sets `\bigl(` from cmex10 on a baseline 8.836 bp above the line, so `pdftext` reads the reference as `(` + `A...` and the candidate as one `(A...`, and the two word origins differ by the delimiter's advance (4.996 bp for `\big(`, 5.149 for `\Big[`). Both PDFs put the delimiter origin at x=243.037 and the `A` at x=248.037; the ink agrees to 0.083 bp. The evidence directory of #750 is regenerated in place and its README carries a Correction section that supersedes the original numbers. What was run: python3 -m unittest discover -s tools/visual-oracle -p 'test_*.py' Ran 45 tests in 0.025s / OK python3 tools/visual-oracle/cumulative.py --out docs/evidence/corpus-fidelity-2026-09-16T1130Z python3 tools/visual-oracle/cumulative.py --fixtures .../probes --out .../probes-report python3 tools/visual-oracle/rank.py --out <scratch> --thumbs 0 A/B of the full 22-fixture / 59-page sweep, pre- vs post-correction, same binaries: causes (the vertical cause table): identical every page's steps, dy_profile, lines, reflowed_words: identical F7-class outliers (|dev| in 4.9..5.2 bp on a delimiter word): 8 -> 0 horizontal cause `math glyph advance`: 86 occ / 21.089 bp -> 78 occ / 12.891 bp total horizontal word outliers: 565 -> 553; F8's gate count 173 -> 164 words rank.py: hw1 p2 dx_max 5.000 -> 0.611, hw2 p1 5.000 -> 1.086, hw2 p2 4.998 -> 0.432 Anchor reach over the corpus reference side: 16496 words, x moves on 546, y on 0. The pre-correction re-run reproduced #750's committed cumulative.json exactly (modulo `meta`), so the A/B isolates this change. probes-report: all 20 probe measurements identical; only the stamp line moved. Next step: Nothing in crates/ or vendor/ is touched, so no rendering behaviour changes. Merge after #752 (this branch contains it). Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Commander (daniel-parent): independent Opus review of PR #753 — visual-oracle: cumulative.py anchors where norm decides identity, F7 withdrawnHead SHA: Is the F7 withdrawal justified?Yes, and this is the most thoroughly evidenced of the three withdrawals. I What this PR adds beyond #752 is the same anchor inside
Is the "vertical findings could not have moved" claim true?This is the claim that decides whether two live lanes (#754 on F2, and the F6 Structural leg — verified by direct measurement. The README asserts "the Exact, all three numbers. The reason is sound: Empirical leg — verified by A/B of the two committed JSONs. For all 22 So F1, F2, F3, F4, F5, F6, F11 and F12 are bit-for-bit what #750 reported, as Material findings
Non-blocking notes
What I verified
This is the right correction, correctly evidenced, and it supersedes #750 in both VERDICT: CHANGES REQUIRED |
…s page glue set (flash-tex#750 F3 withdrawn) What changed: - crates/render-pipeline/tests/maketitle_block_height.rs: pins the whole \maketitle block against pdflatex at 10/11/12 pt, with and without an author and a date, plus an \and author pair; and pins a whole page's baseline sequence on a page pdfTeX shrinks (glue set - 0.23944), which is the regime both corpus fixtures are in. - docs/evidence/maketitle-block-height-2026-09-16/README.md: the measurement, and why flash-tex#750 F3 ("\maketitle title-block height", -0.513 / +0.176 bp, 90 lines) is withdrawn. No src/ file is touched, so no rendering behaviour changes. The block is exact: title/author/date/first-body baselines land within 0.0009 bp of pdflatex at all three sizes, and every x within 0.000 bp. The two reported steps are the page builder's glue set ratio: \@maketitle's only shrinkable glue is \@endparenv's \addvspace{\@topsepadd} (12.0 plus 4.0 minus 6.0 at 11 pt), both offending pages are shrunk (pdfTeX \tracingoutput says - 0.74042 and - 0.30122), and truncating each fixture so page 1 no longer overflows collapses the step from -0.5132 bp to +0.0037 bp (math-sheet) and from +0.1755 bp to +0.0041 bp (lecture-notes). The ratio differs only because the two sides' page-1 natural heights differ -- F2 on math-sheet, F5 on lecture-notes. What was run: cargo test --release --test maketitle_block_height test a_shrunk_page_keeps_every_baseline ... ok test the_title_block_is_pdflatexs_at_ten_eleven_and_twelve_point ... ok test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out cargo test --release --no-fail-fast (crates/render-pipeline), branch vs origin/main built identically, `test <name> ... <result>` lines diffed: branch 488 lines / 484 passed / 0 failed; base 486 / 482 / 0; the only difference is the two added tests. Next step: Fold the same correction into docs/evidence/corpus-fidelity-2026-09-16T1130Z's F3 entry when flash-tex#750/flash-tex#753 land, and consider having cumulative.py report each reference page's glue set ratio so a shrunk page's first step is not labelled with the construct that happens to precede it. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…cumulative.py with glue-set attribution Carries #750 (cumulative.py, blast-radius ranking, GH-66 evidence) and #753 (norm-decided anchoring) as its ancestors; none of the three touches rank.py. `python3 -m unittest discover -s tools/visual-oracle -p 'test_*.py'`: 53 tests OK. Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
What
cumulative.pymeasured aligned word pairs at their word origins — the sameflaw #752 found and fixed in
rank.py. Three sites:lines_from_pairscomputedc["x"] - r["x"]andc["y_top"] - r["y_top"], it bucketed lines onr["y_top"], and the sweep loop's reflow test comparedcw[b]["x"] - rw[a]["x"].All three now go through a new
cumulative.measured_pairs, a thin wrapper overrank.pair_points, which anchors a pair at its first alphanumeric glyph —the content
rank.normused to decide the two words were one word.Based on #752's branch (
agent/daniel-parent/bigl-five-bp) with #750'sbranch merged in, so it carries both the
rank.pyfix and thecumulative.pyitcorrects. Merge after both.
F7 of the 2026-09-16 corpus sweep is withdrawn. "
\bigl(/\Bigl[offset by exactly −5.000 bp" was never a rendering defect. pdfTeX sets
\bigl(from cmex10, whose variant glyph carries its own origin and lands on a baseline
8.836 bp above the line; ours is a LatinModernMath variant on the math baseline.
pdftext.words_from_glyphssplits a word at a new baseline, so the referencereads
(andA…as two words while we read(A…as one;normstripspunctuation so
(Astill matchedA, and the comparison then measured two wordorigins a delimiter's advance apart — 4.996 bp for
\big(, 5.149 bp for\Big[.Both PDFs put the delimiter origin at x = 243.037 and the following
Aatx = 248.037, ink agreeing to 0.083 bp.
#750's evidence directory is regenerated in place and its README now opens with a
Correction section that supersedes the original numbers, with the withdrawn
F7 kept verbatim in a
<details>for the record.Why
#752 fixed the measurement but deliberately did not edit
cumulative.pyacrossPRs, and flagged the evidence README's F7 section as now wrong. Both are done
here, together with the re-rank that answers the actual question: which other
findings move?
The re-rank: A/B of the full 22-fixture / 59-page sweep
Same binaries, same fixtures, pre- vs post-correction. The pre-correction re-run
reproduced #750's committed
cumulative.jsonexactly (modulometa), so the A/Bisolates this change and nothing else.
Withdrawn — F7, all eight occurrences across four fixtures, every one → 0:
(P(x)(A(A(C)a(f(x)g(x))(4[arctanShrank — F8 (interword glue), 173 → 164 words over the gate, still 12
fixtures. Eight of the nine lost words are F7's; the ninth is
listings-manualp1--%s",(−0.5323), which fell under the gate once itsline's median
dxwas re-measured. F8's shape and example lines are unchanged tothe fourth decimal.
Also moved (cause table, not one of the twelve):
math glyph advance86 occurrences / 21.089 bp worst → 78 / 12.891 bp, median 2.637 → 1.818. Total
horizontal word outliers 565 → 553.
rank.pypage maxima: hw1 p2dx_max5.000 → 0.611, hw2 p1 5.000 → 1.086, hw2 p2's
(Cpair 4.998 → 0.432.Unchanged — everything else. F1, F2, F3, F4, F5, F6, F9, F10, F11, F12.
The vertical findings are not affected, and could not have been
This was checked, not assumed. Two independent lines of evidence:
pdftext.words_from_glyphsstarts a new word whenever aglyph's baseline is 0.05 bp or more from the current word's
(
same_line = abs(g["y_top"] - cur["y_top"]) < 0.05). So every glyph of aword shares one baseline, a word's first alphanumeric glyph always sits on the
word's own baseline, and re-anchoring can move a measured
xbut never ameasured
y. Measured over the corpus's reference side: 16 496 words, theanchor moves
xon 546 andyon 0.causestable and every page's
steps,dy_profile,lines,reflowed_words,aligned,reference_words,candidate_wordsandreference_unalignedarebyte-identical before and after.
cumulative.md's vertical cause tabledoes not change by one digit; only its horizontal table moves.
So the flawed comparison never reached the
dyprofile the vertical findingsrest on. In particular neither of the two findings with live lanes is an
artefact: F2 (display-math box height, 374 lines, 5 fixtures) and F6 (two
matrices in one display out of register, ±2.778 bp ×4, 102 lines) are bit-for-bit
what #750 reported.
The reflow fix is not cosmetic even though it changed nothing on this corpus:
reflowedis what excludes a page's wholedyprofile from the step table, someasuring it at word origins would let one wide delimiter suppress every vertical
finding on a page.
test_reflow_detection_uses_the_same_anchored_pointspins it.Overlap check
cumulative: visual-oracle: rank corpus divergences by blast radius (GH-66 fidelity backlog) #750 (the tool and evidence this corrects)and visual-oracle: F7's -5.000 bp is a \bigl delimiter's advance, not a placement error #752 (the
rank.pyfix this extends). Both are this same lane; this branchcontains both and edits no line either of them is still editing.
GH-CUMULATIVE-CORRECTIONclaimed bydaniel-parentbefore starting.GH-DISPLAY-BOX-HEIGHTandGH-MATRIX-REGISTERare the live lanes on F2 andF6 — this PR does not touch their code, and the re-rank confirms both findings
stand unchanged.
crates/orvendor/is touched, so no rendering behaviourchanges and HW1/HW2 output is untouched. The 20 probe measurements reproduce
identically; only the report's stamp line moved.
Test results
Five new tests in
test_cumulative.py::AnchoredMeasurement, built on themeasured hw2 p1 geometry: the two sides still segment the delimiter differently;
the delimiter is no longer a 5 bp horizontal outlier; a genuine 3 bp shift beside
it is still reported; the vertical profile cannot move with the anchor (asserted
for delimiter offsets 0.000, 8.836 and 11.952 bp); and reflow detection uses the
anchored points.
A/B against the pre-correction sweep:
Not done
existing
u2-manual-delims(which measured no horizontal outlier and was readas puzzling) is now explained rather than contradicted.
\bigl(baseline difference itself is left alone. pdfTeX's cmex10variant and our LatinModernMath variant put the delimiter's origin on
different baselines while its ink lands within 0.083 bp. That is a legitimate
font-convention difference, not a defect, and nothing in the product depends on
the origin. It is worth knowing only because it fools word segmentation.
pdftext's word segmentation is unchanged. Merging the two sides' wordsidentically would be a bigger change with its own failure modes; anchoring the
comparison is the smaller correct fix, and it is now the single definition of a
measured point shared by
rank.pyandcumulative.py.dx_max6.022 bp, ps-calculus p2 5.428 bp). Both areanchor=wordpairs withno delimiter involved, so they are unrelated to this correction — but they are
now the largest unexplained horizontal deltas in the corpus and deserve the
same scepticism F7 got.
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz