Repository navigation
render-pipeline: the \columnseprule oracles compare rules in both directions - #290
Conversation
…ections
page_frame.rs and footnotes_oracle.rs both totalled and verified only the
REFERENCE rules: for each pdflatex rule, `ours.iter().any(|r| within_tol(r))`.
A rule our renderer paints with no pdflatex counterpart was counted in neither
direction, so over-painting could not fail the oracle, and the scoring
denominator was the reference count -- a spurious rule could not even move the
score.
Both files shared that sweep and the per-page Item::Rule extraction verbatim.
Both now live in tests/common/mod.rs:
rules_of(&Rendered) -> Vec<Vec<Rule>>
match_rules(want, got, tol_bp) -> RuleMatch { matched, missing, extra }
match_rules is a bijection by greedy match-and-consume, not two independent
exists-sweeps: each reference rule takes the NEAREST still-unused rule of ours
and consumes it (nearest = smallest max-of-four-coordinate deviation, so the
pairing does not depend on emission order when several candidates sit inside
the tolerance). Leftovers on our side are `extra`. This also catches many-to-one:
two of our rules collapsing onto one reference rule leaves one unpaired.
Tolerances and the match predicate are unchanged -- page_frame keeps
TOL_BP = 0.1 * 72.0 / 72.27, footnotes_oracle keeps RULE_TOL_BP = 0.1, and a
match is still all four of (x, top, width, height) within tolerance. Only the
bookkeeping changed.
The denominator is matched + max(missing, extra): identical to the old
reference-rule count whenever extra == 0, so passing summary lines print the
same numbers, while any extra forces total > matched so a spurious rule can
never score clean. footnotes_oracle now also walks max(want_pages, got_pages)
rather than only reference pages, so rules on a page we invent cannot escape
the pairing.
Result: PASS, no over-painting defect. Verified non-vacuous -- page_frame's
09-article-twocolumn-rule scores rules 3/3 (the only page-frame fixture with
rules) and 21 gated footnote fixtures score 1-3 rules each; rules_ok ==
rules_total implies extra == 0, so every gated fixture is confirmed free of
spurious rules.
One new signal in fixtures that were already ungated: the extra direction shows
two REPORTED footnote fixtures paint the rule at the wrong `top`, previously
scored only as "missing" -- 14-multipar-note p1 off by ~18.93bp, 15-math-note p1
off by ~1.44bp. Both are downstream of the note-layout gaps those fixtures
already document; they remain ungated and the gate's verdict is unchanged.
Nothing was weakened and the renderer was not changed.
Demonstrated failing, both directions:
* Over-paint (duplicate our first rule on page 1, which is also the many-to-one
case): the OLD code passes -- that is the bug. The new code fails both tests:
"09-article-twocolumn-rule: ... rules 3/4 ... p1: ours paints rule
(305.42, 124.80, 0.398, 547.95) with no pdflatex counterpart".
* Under-paint (drop one of our rules): still fails, with a message byte-identical
to the pre-existing one -- "rules 2/3 ... p1: pdflatex rule (...) ours []".
Side finding, untouched: crates/render-pipeline/tests/multicol_oracle.rs (~:198)
has the same asymmetric sweep. Measured non-invasively: currently clean
(09-columnseprule pairs 1-for-1, every other fixture paints no rules), but the
check is equally incapable of failing on over-painting. match_rules is reusable
there once its tuple carries the page number.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…acle-symmetry # Conflicts: # crates/render-pipeline/tests/footnotes_oracle.rs # crates/render-pipeline/tests/page_frame.rs
What changed: Rebasing PR #290 onto main pulled in fixture 35-article-maketitle-thanks (added by 7185035 after this PR was authored). Its \thanks-triggered \footins material is already documented here as unimplemented and its body baselines were already reported-not-gated via MAKETITLE_Y_UNGATED. The same unimplemented \footins material also paints a spurious footnote-separator rule pdflatex doesn't. The old one-directional rule check couldn't see it (want_rules was empty, so 0/0 passed either way), but this PR's new symmetric match_rules counts it as `extra`, newly failing page_frame_against_pdflatex on a fixture this PR's diff never touched. Extended the same ungating to rules for that one fixture, with a comment explaining why, rather than leave it gated on a pre-existing, already-documented, unrelated gap. What was run: CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-pr290 CARGO_BUILD_JOBS=4 cargo test --no-run (crates/render-pipeline) -> all targets built, 0 compile errors cargo test --test page_frame --test footnotes_oracle --test multicol_oracle: test footnotes_against_pdflatex ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.42s test multicol_fixtures_against_pdflatex ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.63s test page_frame_against_pdflatex ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.84s Next step: none; rebase complete, PR ready for review/merge. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Rebased onto Conflicts resolvedBoth real conflicts ( Silent breakage caught by the mandatory post-merge build (no conflict markers here): the PR's own new New signal from the rebase itselfRebasing pulled in fixture No silent duplicates: Test results🤖 Generated with Claude Code |
Closes the audit's #5 (issue #2, comment 5657695144): the
\columnsepruleoracles compared rules in one direction only.The hole
page_frame.rs:264-272andfootnotes_oracle.rs:163-172both totalled and verified only the reference rules — for each pdflatex rule,ours.iter().any(|r| within_tol(r)). A rule our renderer paints with no pdflatex counterpart was counted in neither direction, and the scoring denominator was the reference count, so a spurious rule could not even move the score.The fix
Both files shared that sweep and the per-page
Item::Ruleextraction verbatim. Both now live intests/common/mod.rs:match_rulesis a bijection by greedy match-and-consume, not two independent exists-sweeps: each reference rule takes the nearest still-unused rule of ours and consumes it (nearest = smallest max-of-four-coordinate deviation, so the pairing does not depend on emission order when several candidates sit inside the tolerance). Leftovers on our side areextra. This also catches many-to-one: two of our rules collapsing onto one reference rule leaves one unpaired.Tolerances and the match predicate are unchanged —
page_framekeepsTOL_BP = 0.1 * 72.0 / 72.27,footnotes_oraclekeepsRULE_TOL_BP = 0.1, and a match is still all four of(x, top, width, height)within tolerance. Only the bookkeeping changed.Denominator is
matched + max(missing, extra): identical to the old reference count wheneverextra == 0, so passing summary lines print the same numbers, while any extra forcestotal > matchedso a spurious rule can never score clean.footnotes_oraclenow also walksmax(want_pages, got_pages), so rules on a page we invent cannot escape the pairing.Result: PASS — no over-painting defect
Verified non-vacuous:
09-article-twocolumn-rulescoresrules 3/3(the only page-frame fixture with rules) and 21 gated footnote fixtures score 1–3 rules each. Sincerules_ok == rules_totalimpliesextra == 0, every gated fixture is confirmed free of spurious rules.One new signal, in fixtures that were already ungated. The extra direction shows two
REPORTEDfootnote fixtures paint the rule at the wrongtop, previously scored only as "missing":14-multipar-notep1 —topoff by ~18.93 bp15-math-notep1 —topoff by ~1.44 bpBoth are downstream of the note-layout gaps those fixtures already document (
\long \@footnotetext, math at body size). They remain ungated and the gate's verdict is unchanged. Nothing was weakened and the renderer was not changed.Demonstrated failing — both directions
New direction (duplicate our first rule on page 1 — simultaneously the over-paint and many-to-one case). The old code passes with the spurious rule; that is the bug:
Original direction (drop one of our rules) still fails, with a message byte-identical to the pre-existing one:
All injections reverted; restored files diffed identical to the pre-injection copies and re-run green.
Side finding, left untouched
crates/render-pipeline/tests/multicol_oracle.rs(~:198) has the same asymmetric sweep. Measured non-invasively with a temporary greedy-pairing probe: currently clean (09-columnseprulepairs 1-for-1; every other fixture paints no rules), but the check is equally incapable of failing on over-painting.match_rulesis reusable there once its tuple carries the page number. Out of scope for this PR — happy to follow up.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu