Skip to content

render-pipeline: a box argument's leading no longer depends on the build profile (#667) - #696

Merged
d-q222 merged 1 commit into
mainfrom
agent/daniel-parent/debug-release-diverge
Sep 17, 2026
Merged

d-q222 merged 1 commit into
mainfrom
agent/daniel-parent/debug-release-diverge

Conversation

@d-q222

@d-q222 d-q222 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What

adapt_cached paired Parsed::blocks with the compiler's
Parsed::block_par_leading positionally, behind a debug_assert_eq! that the
two lists are the same length:

    #[cfg(feature = "par-leading")]
    let leadings: Vec<ParLeading> = parsed.block_par_leading.clone();
    ...
    debug_assert_eq!(leadings.len(), parsed.blocks.len());
    let paired: Vec<(CBlock, ParLeading)> = parsed.blocks.iter().cloned()
        .zip(leadings.into_iter().chain(std::iter::repeat(None)))
        .collect();

The pairing now goes through a small pure function, block_leadings, which
uses the compiler's list only when it is exactly one entry per block and
otherwise discards it — every block then falls back to the body leading,
exactly as a --no-default-features build does. The decision reads its
arguments and nothing else, so debug and release lay the same document out the
same way. No vendor/ file is touched, and the feature resumes by itself once
vendor/compiler is re-pinned past crates/compiler #517.

Tests added:

  • crates/render-pipeline/src/adapter.rs — block_leadings_are_profile_independent,
    a unit test on the total function (pairs only on an exact length match;
    never truncates a longer list, never pads a shorter one; same answer for the
    same inputs). Runs in one profile and needs no fonts.
  • crates/render-pipeline/tests/par_leading_box_profile.rs — two rendering
    tests that measure the output: a \colorbox/\fcolorbox whose interior
    is \small/\footnotesize/\tiny must not change the surrounding body
    paragraph's line pitch, in the paragraph holding the box or in any later
    one. Both fail in a release build before this change (literal values
    below), so CI's release-only run would have caught it.

Why

Root cause, not the symptom: the pinned vendor/compiler's P::box_inlines
does not truncate block_par_leading after parsing a box argument the way
P::argument_inlines does, so every \colorbox/\fcolorbox leaves one stray
entry behind — the leading of a paragraph that never reaches blocks.
crates/compiler fixed exactly this in #517 (crates/compiler/src/parser/colors.rs
truncates; crates/render-pipeline/vendor/compiler/src/parser/colors.rs, the
pin the pipeline builds against, still does not).

That makes block_par_leading.len() != blocks.len(), which is the left: 2 / right: 1 in #667: \usepackage{xcolor}...\fcolorbox{black}{white}{Hi \textbf{Yo}}
gives one block and two leadings.

The profile dependence followed from how the mismatch was handled:

  • debug — debug_assert_eq! fires and the render panics, which is the
    frame_env failure reported in render-pipeline output differs between debug and release builds (colorbox path count 2 vs 1) #667.
  • release — the assert is compiled out and zip pairs block i with
    entry i anyway. A stray entry is pushed before the block whose
    paragraph holds the box (the box's interior paragraph is flushed while the
    outer one is still being built), so from the first box onwards entry i no
    longer names block i and a body paragraph silently takes the
    \baselineskip of some box's interior.

So this was not floating point, not hashing, and not overflow: a
debug_assertions-gated assert sitting on top of a genuine release-build
layout bug. The release output was the wrong one, which is why the fix is
not "gate the test" or "round it away" — \baselineskip is read at \par in
the outer paragraph's own size, and \colorbox's box never enters the
vertical list at all, so the body leading is the canonical answer here.

A mismatched list cannot be realigned after the fact (the strays are
interleaved, not appended), so the only honest deterministic choice is to drop
it, which is a behaviour the crate already supports and documents.

Overlap check

Test results

Before the change, release build (cargo test --release --manifest-path crates/render-pipeline/Cargo.toml --test par_leading_box_profile):

running 2 tests
test a_box_interiors_size_is_not_the_paragraphs_leading ... FAILED
test a_box_does_not_shift_the_leadings_of_the_blocks_after_it ... FAILED

---- a_box_interiors_size_is_not_the_paragraphs_leading stdout ----
\colorbox of \small: line pitch 14207356 is not the body's 15147549

---- a_box_does_not_shift_the_leadings_of_the_blocks_after_it stdout ----
a \colorbox of \tiny in the second paragraph: line pitch 12117846 is not the body's 15147548

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

Before the change, debug build (the failure reported in #667):

running 1 test
test shared_colorbox_path_draws_border_with_content_inside ... FAILED

thread 'shared_colorbox_path_draws_border_with_content_inside' panicked at src/adapter.rs:1308:5:
assertion `left == right` failed
  left: 2
 right: 1

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 1 filtered out

After the change, debug (--test frame_env --test par_leading_box_profile --test par_leading_oracle):

     Running tests/frame_env.rs
test frame_draws_a_rule_border_around_its_content ... ignored, needs vendor/compiler re-pinned past the frame environment change
test shared_colorbox_path_draws_border_with_content_inside ... ok
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out

     Running tests/par_leading_box_profile.rs
test a_box_does_not_shift_the_leadings_of_the_blocks_after_it ... ok
test a_box_interiors_size_is_not_the_paragraphs_leading ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running tests/par_leading_oracle.rs
test body_text_keeps_the_class_leading ... ok
test a_par_inside_the_group_takes_the_declaration_leading ... ok
test an_environment_that_pars_before_it_closes_uses_its_own_declaration ... ok
test a_group_closing_before_the_paragraph_keeps_the_body_leading ... ok
test the_leading_above_the_first_line_follows_the_paragraph_too ... ok
test a_larger_declaration_opens_the_leading_up ... ok
test a_tall_box_still_falls_back_to_lineskip_at_the_new_leading ... ok
test a_mid_paragraph_switch_does_not_move_the_baselines ... ok
test a_declaration_inside_a_list_reaches_the_item_lines ... ok
test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

After the change, the unit test in both profiles
(cargo test [--release] --lib block_leadings):

test adapter::tests::block_leadings_are_profile_independent ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 165 filtered out

Whole crate, release, --no-fail-fast (the profile CI runs; complete, exit
code 0):

106 test binaries: 485 passed; 0 failed; 4 ignored

The same run in debug was not driven to completion: it reached 286 passed; 0 failed; 2 ignored over 46 of the 106 binaries and then parked in
incremental_output_is_byte_identical_over_200_edits_of_a_27_page_document,
which is minutes of unoptimized work on a shared machine. It is already past
the 253 passed #667 reports, which answers that part of the issue: 253 was a
truncated run, not a missing test set — without --no-fail-fast, cargo test stops after the binary that fails, and frame_env failing in debug cut
the run short there. Every debug test that touches this code path is run
above, and all of them pass.

Not done

  • vendor/compiler is not re-pinned. That is the upstream fix (compiler: boxed arguments and letter \ps no longer leave phantom paragraph leadings #517, in
    crates/compiler) and lanes do not touch vendor/. Until it lands, a
    document containing a \colorbox/\fcolorbox gets the body leading for
    every paragraph — the documented --no-default-features behaviour, and
    strictly better than the current release mis-pairing. After the re-pin the
    lengths agree, the par-leading feature applies again, and both new tests
    still hold.
  • frame_draws_a_rule_border_around_its_content stays #[ignore]d for the
    same reason (unrelated pin gap, pre-existing).
  • cargo check --no-default-features --all-targets does not build, and did
    not before this PR either: 7 pre-existing errors in src/typeset.rs,
    src/adapter.rs:6767/:7929, src/pagebuild.rs, src/incremental.rs,
    src/shape.rs and src/typeset/floatpage.rs (non-exhaustive
    math::Nucleus matches, one arity mismatch). None is in the code this PR
    touches; block_leadings and its test are #[cfg(feature = "par-leading")]
    on both the definition and the single call site, so that configuration is
    unaffected either way.
  • render-pipeline output differs between debug and release builds (colorbox path count 2 vs 1) #667 also notes that ci.yml only ever runs --release, so no debug
    divergence is caught anywhere. This PR removes the one divergence that
    existed in render-pipeline and adds tests that hold in one profile, but it
    does not add a debug CI job — that is a CI-policy call for the Commander,
    not a lane change.

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

…ild profile (#667)

What changed:

`adapt_cached` paired `Parsed::blocks` with the compiler's
`Parsed::block_par_leading` positionally, behind a `debug_assert_eq!` that the
two are the same length. Against the pinned `vendor/compiler` they are not:
its `P::box_inlines` does not truncate `block_par_leading` after parsing a box
argument the way `P::argument_inlines` does, so every `\colorbox`/`\fcolorbox`
leaves one stray entry -- the leading of a paragraph that never reached
`blocks`. `crates/compiler` fixed that in #517; `vendor/` is still pinned
before it.

The consequence was profile-dependent output from one input: a debug build
panicked at `adapter.rs:1308` (`left: 2, right: 1`, the `frame_env` failure in
#667), and a release build compiled the assert away and mis-paired, because a
stray entry is pushed *before* the block whose paragraph holds the box, so
from the first box onwards entry i no longer names block i.

The pairing now goes through `block_leadings`, which uses the compiler's list
only when it is exactly one entry per block and otherwise discards it -- every
block falls back to the body leading, exactly as a `--no-default-features`
build does. The decision reads only its arguments, so both profiles lay the
same document out the same way, and the feature resumes by itself when
`vendor/` is re-pinned past #517. No `vendor/` file is touched.

What was run:

    cargo test --release --test par_leading_box_profile   (before this change)
      a_box_interiors_size_is_not_the_paragraphs_leading FAILED
        \colorbox of \small: line pitch 14207356 is not the body's 15147549
      a_box_does_not_shift_the_leadings_of_the_blocks_after_it FAILED
        a \colorbox of \tiny in the second paragraph: line pitch 12117846 is
        not the body's 15147548
      test result: FAILED. 0 passed; 2 failed

    cargo test --test frame_env --test par_leading_box_profile \
      --test par_leading_oracle          (debug, after)
      test shared_colorbox_path_draws_border_with_content_inside ... ok
      test result: ok. 1 passed; 0 failed; 1 ignored
      test result: ok. 2 passed; 0 failed
      test result: ok. 9 passed; 0 failed

    cargo test --lib block_leadings      (debug and release, after)
      test adapter::tests::block_leadings_are_profile_independent ... ok
      test result: ok. 1 passed; 0 failed (both profiles)

Next step:

Re-pin `vendor/compiler` past crates/compiler #517 so `block_par_leading` is
one entry per block again and the `par-leading` feature applies to documents
that use `\colorbox`/`\fcolorbox`; these tests then still hold.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

@d-q222 d-q222 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent verification — VERIFIED

Reviewed on a detached worktree of refs/review/pr-696 (head af19a349, parent
dbe3cac8 = current main), private CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-verify-696,
CARGO_BUILD_JOBS=4. Diff is crates/render-pipeline/src/adapter.rs +
crates/render-pipeline/tests/par_leading_box_profile.rs only — nothing under
vendor/, no generated artefact.

The central claim to check was that this is not merely a debug assert — that a
release build silently laid the document out wrongly. It is real, and here is the
release-build evidence.

1. The release failure is real

I kept the PR's new test file and reverted only the production change back to the
parent commit, then ran in --release:

$ cd /Users/dqi26/flashtex-wt/verify-696
$ git checkout HEAD^ -- crates/render-pipeline/src/adapter.rs
$ grep -n "debug_assert_eq!(leadings" crates/render-pipeline/src/adapter.rs
1308:    debug_assert_eq!(leadings.len(), parsed.blocks.len());
$ cd crates/render-pipeline
$ CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-verify-696 CARGO_BUILD_JOBS=4 \
    cargo test --release --test par_leading_box_profile
running 2 tests
test a_box_interiors_size_is_not_the_paragraphs_leading ... FAILED
test a_box_does_not_shift_the_leadings_of_the_blocks_after_it ... FAILED

---- a_box_interiors_size_is_not_the_paragraphs_leading stdout ----
thread 'a_box_interiors_size_is_not_the_paragraphs_leading' panicked at tests/par_leading_box_profile.rs:81:5:
\colorbox of \small: line pitch 14207356 is not the body's 15147549

---- a_box_does_not_shift_the_leadings_of_the_blocks_after_it stdout ----
thread 'a_box_does_not_shift_the_leadings_of_the_blocks_after_it' panicked at tests/par_leading_box_profile.rs:81:5:
a \colorbox of \tiny in the second paragraph: line pitch 12117846 is not the body's 15147548

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

That is a wrong page, not a fired assertion. On the parent commit, in the profile
CI actually ships:

  • \colorbox{white}{\small x} at the head of a body paragraph sets that whole
    paragraph's line pitch to 14207356 ticks instead of the body's 15147549 —
    the \small leading, taken from inside a box argument that never reaches the
    vertical list at all;
  • \colorbox{white}{\tiny y} in the second paragraph drags it to 12117846,
    confirming the PR's point that the misalignment shifts every later block, not
    only the one holding the box.

So the claim in the title and body holds exactly: the same input produced two
different outcomes depending on the optimisation level, and the release outcome
was silently wrong.

2. Both profiles are green with the fix

$ git checkout HEAD -- crates/render-pipeline/src/adapter.rs
$ CARGO_TARGET_DIR=... CARGO_BUILD_JOBS=4 cargo test --release --test par_leading_box_profile
test a_box_does_not_shift_the_leadings_of_the_blocks_after_it ... ok
test a_box_interiors_size_is_not_the_paragraphs_leading ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

$ CARGO_TARGET_DIR=... CARGO_BUILD_JOBS=4 cargo test --test par_leading_box_profile
test a_box_does_not_shift_the_leadings_of_the_blocks_after_it ... ok
test a_box_interiors_size_is_not_the_paragraphs_leading ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

$ CARGO_TARGET_DIR=... CARGO_BUILD_JOBS=4 cargo test --lib block_leadings
test adapter::tests::block_leadings_are_profile_independent ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 165 filtered out; finished in 0.00s

$ CARGO_TARGET_DIR=... CARGO_BUILD_JOBS=4 cargo test --test frame_env
test frame_draws_a_rule_border_around_its_content ... ignored, needs vendor/compiler re-pinned past the frame environment change
test shared_colorbox_path_draws_border_with_content_inside ... ok
test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.04s

The integration test is profile-agnostic by construction — it measures line pitch
in ticks rather than relying on a panic — which is the right shape given the PR's
own observation that CI only ever runs --release. It would have caught #667.

3. Code review

  • adapter.rs:715 block_leadings is a total function of its two arguments with
    no cfg!(debug_assertions) anywhere in or under it, which is the property the
    PR claims. The unit test's 6×6 sweep over (compiler_len, blocks) asserting
    got.len() == blocks pins the postcondition the old zip violated.
  • Dropping .chain(std::iter::repeat(None)) from the zip at adapter.rs:1344
    is now safe only because block_leadings guarantees len == blocks; the two
    changes have to land together, and they do. zip would otherwise silently
    truncate blocks, which would be a much worse bug than the one being fixed. No
    other caller constructs leadings.
  • The #[cfg(not(feature = "par-leading"))] arm already produced vec![None; len],
    so the degraded path is byte-identical to a --no-default-features build — the
    PR's stated fallback semantics, and it re-arms automatically on a re-pin.
  • Discarding the whole list on a length mismatch (rather than truncating) is the
    correct conservative choice and is justified in the doc comment at
    adapter.rs:698-706: a stray entry is pushed before the block it belongs to,
    so truncation would still mis-pair from the first box onwards. The unit test
    asserts both "must not truncate" and "must not pad".
  • No new unwrap/expect, no indexing, no panic path on user input; to_vec()
    on the happy path is the same clone the old code did.

One thing for the integration lane to be aware of (not a defect in this PR):
while vendor/compiler is pinned before #517, any document containing a
\colorbox/\fcolorbox now loses per-block \par leading entirely — every
block falls back to the body leading rather than getting a wrong one. That is
strictly better than the release mis-pairing and strictly worse than correct, and
it self-heals on the re-pin. The PR says so; it is just the kind of thing that
should not surprise anyone stacking on it.

Verdict

VERIFIED. The release-build failure was real and I reproduced it on the parent
commit in --release: 14207356 and 12117846 ticks where the body's leading is
15147549. The fix makes both profiles agree, and the test would have caught the
original bug.

— independently verified by daniel-parent's review lane

d-q222 added a commit that referenced this pull request Sep 16, 2026
…697)

What changed:
- The previous commit here also replaced adapter.rs's
  `debug_assert_eq!(leadings.len(), parsed.blocks.len())` with a length-check
  fallback. Overlap check (run against open PRs before opening this one)
  found PR #696 (`agent/daniel-parent/debug-release-diverge`, opened
  2026-09-16T05:34:50Z, before this claim) already fixes that exact assert,
  root-caused to the pinned vendor/compiler's `box_inlines` not truncating
  `block_par_leading` after a `\colorbox`/`\fcolorbox` argument, with its own
  `block_leadings` unit test and two rendering regression tests. Same line,
  same 13 tests (frame_env/letter_class_geometry/uline/underline_sout/
  xcolor_oracle). Keeping my copy here would duplicate #696's work and create
  an unnecessary merge conflict for the integration lane.
- Reverted that one hunk back to the plain `debug_assert_eq!`, unrelated to
  #697's actual scope (the --no-default-features compile failure). #696 owns
  that fix; this PR now touches only what #697 needs: the amsmath-inline
  match-arm catch-alls, the text_kern fallback signature fix, and the
  feature-shaped test gating.
- No vendor/ path touched.

Implementation-Agent: gpt-5.6-luna (Codex) via daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 16, 2026
What changed:
The 28 tests gated behind amsmath-inline (amsmath_inline.rs's 11,
frac_ord_spacing.rs's 1, amssymb_braces.rs's 1, big_delimiter_packages.rs's
2), math-class-override (math_symbols.rs's 3) and par-leading
(par_leading_oracle.rs's 9, tabular_oracle.rs's 1) used
#[cfg(feature = ...)] / whole-file #![cfg(feature = ...)], so with the
feature off (--no-default-features) they vanished from the run instead of
reporting as ignored -- indistinguishable from never having been written.
Converted every one to #[cfg_attr(not(feature = "..."), ignore = "requires
the ... feature")], which keeps the test item compiled and visible in both
configurations, just not run when its feature is off.

Checked each one individually before converting, not assumed: every file
uses only render-pipeline's ordinary public API (FontSet, render(),
positioned_math_glyphs, ...), never a symbol that exists only under its
feature, and `cargo check --no-default-features --tests` and the full
`cargo test --no-default-features` run below confirm all 28 compile and
run (as ignored). None had to be left behind -- there is no test here that
genuinely cannot compile without its feature.

Deliberately NOT touched: math_spacers.rs's
glue_inside_a_fence_pair_is_set (#[cfg(feature = "amsmath-inline")]) and
its sibling glue_inside_a_fence_pair_stays_a_typed_limitation
(#[cfg(not(feature = "amsmath-inline"))]). That pair is not the vanishing-
test problem this fix addresses: they are two distinctly-named tests
asserting the two different, mutually exclusive expected behaviors (glue
is set vs. a typed math_limitation diagnostic fires), so exactly one is
always visible and meaningful per configuration -- there is no silent gap.

What was run (crates/render-pipeline, CARGO_BUILD_JOBS=4):
- cargo check --no-default-features --tests (CARGO_TARGET_DIR=target-fixup-733): clean, no errors.
- cargo check --tests (CARGO_TARGET_DIR=target-fixup-733-default): clean, no errors.
- cargo test --no-default-features --no-fail-fast, summed across all test binaries: 454 passed; 0 failed; 32 ignored (486 total) -- the pass/fail numbers are unchanged from before this PR; ignored grew from 4 to 32, the 28 newly-visible feature-gated tests plus the 4 pre-existing ignores. None of the 28 are among the 0 failures.
- cargo test --no-fail-fast (default features), summed across all test binaries: 469 passed; 13 failed; 4 ignored (486 total) -- identical to this branch's numbers before this commit. The 13 failures are all the pre-existing debug_assert_eq! at adapter.rs:1308 (frame_env/letter_class_geometry/uline/underline_sout/xcolor_oracle test files), owned by #696, not touched here; they are debug-profile assertions and are expected to be absent under --release, so a release run is not independent evidence of their absence.
- Both configurations now compile the identical 486 test items; only the ignore status differs by feature, closing the gap where --no-default-features silently ran a smaller test set that still read as a full "N passed" total.

Next step: none for this item. #696 still owns the 13 adapter.rs:1308 failures.

Implementation-Agent: claude-sonnet-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 16, 2026
… encoding

What changed:

- `mathtext.rs`: the `\hbox{.}` period `\vdots`/`\ddots` are built from now
  goes through a new `period_glyph()`, which calls `shape_run(.., key: None,
  .., text_size_pt)` the same way an ordinary text run does, instead of
  `text_glyph('.', SizeClass::Text)`. `text_glyph` is the math-alphabet route
  (`fontmath.ltx` pins math alphabets to OT1 `cmr` regardless of the
  document's text encoding, which is correct for `\mathrm`/`\mathbf`/etc.),
  but `\hbox{.}` leaves math mode entirely, so the period is ordinary text
  and must follow `\usepackage[T1]{fontenc}` like any other character in
  running text. Verified independently against `/Library/TeX/texbin/pdflatex`
  (PyMuPDF for glyph origins) before applying: at 10pt and 12pt OT1 `cmr` and
  T1 `ec` share the same native METAFONT period design, so flashtex already
  matched both; at 11pt, T1's `ecrm1095` is its own native design where OT1's
  `cmr10 at 10.95` is linearly scaled from the 10pt design, so the two
  differ by 0.059bp -- inside both project gates (0.5bp glyph, 0.1bp rule),
  but a real, measured encoding-dependence bug. Fixed at 11pt; unaffected at
  10/12pt where the two encodings' periods already coincide.

- `tests/math_dots_boxes.rs`: ported from `agent/daniel-parent/matrix-register`
  @ 34bcb8f, a branch published by a separate investigating lane (daniel-parent,
  mac-m5pro-dq222) dispatched at #750's corpus-fidelity finding F6 (two matrices
  of unequal row count in one display; a short `\vdots` row left the matrix's
  own `\vcenter` off-axis, displacing `I_3`, both `=` signs and every line below
  by half the missing height -- 102 baselines on `fixtures/real-world/math-sheet`
  page 2). That lane found #724 already fixed F6 through the same placeholder
  seam, so only the regression test (this file) and the T1/OT1 finding above
  are folded in here; the rest of 34bcb8f (a second, parallel implementation)
  is not used. Credit: daniel-parent (mac-m5pro-dq222),
  #724 (comment).

What was run:

`cargo test -p flashtex-render-pipeline --no-fail-fast`, in
`crates/render-pipeline`, `CARGO_BUILD_JOBS=4`, private target dirs, branch
and base (#724 head a033f58) built identically:

  branch  482 passed; 13 failed; 4 ignored
  base    479 passed; 13 failed; 4 ignored

Line-by-line diff of every `test <name> ... <result>` line: identical except
the 3 new `math_dots_boxes.rs` tests (all `ok`). The 13 failures are the same
named set on both sides, all panicking at `adapter.rs:1308` (the known
pre-existing `vendor/compiler` debug_assert issue, #696). HW1/HW2 unmoved.

The three cherry-picked tests, before this commit's T1 fix (i.e. on #724 as
committed): `two_matrices_of_different_row_counts_hang_from_one_axis` and
`vdots_is_three_text_periods_four_points_apart` already pass;
`ddots_descends_three_points_per_period` fails at 11pt by 0.0586bp -- the
same quantity as the T1/OT1 finding. After this commit's fix: all 3 pass at
all three sizes.

Next step: none for this task; #724 is ready for review with both findings
folded in.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
…ex leaves it

What changed:
- New test crates/render-pipeline/tests/math_symbol_line_height.rs. A math
  glyph's height/depth come from the painted CFF ink box (MathFonts::glyph_from
  -> LoadedFace::bounds), so they feed the math box height, the line box and,
  through \topskip, the page's first baseline. Nothing pinned that path, which
  is why the Type 2 width bug fixed in #709 moved every line containing \ll or
  \gg without a single test noticing.
- The test renders $a<sym> b$ and more text here. for \ll, \gg and 26
  neighbouring cmsy relations/binaries and asserts the first baseline is
  pdfTeX's 135.27038 pt within the project's 0.5 bp glyph gate.

What was run:
  cargo test -q --test math_symbol_line_height
  test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  (with crates/render-pipeline/src/cff.rs reverted to origin/main, i.e. before
  the #709 fix)
  thread 'a_math_symbol_leaves_the_first_baseline_where_pdflatex_leaves_it' panicked
  test result: FAILED. 0 passed; 1 failed
  pdflatex oracle (pdfTeX 3.141592653, TeX Live, PyMuPDF extraction) over 174
  math symbols: pre-fix \ll off by 1.4596 pt and \gg by 2.3696 pt; post-fix
  both 0.0004 pt. No other symbol changed.
  cargo test --no-fail-fast (whole crate): 13 failures, all the known
  adapter.rs:1308 debug_assert_eq! (vendor/compiler pin, PR #696); nothing
  else red.

Next step:
- Merge after #709; this branch is stacked on it.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
…ot a glyph

What changed:
The LaTeX kernel gives neither command a character. Both are boxes built out
of `\hbox{.}` of the *text* font (`fontmath.ltx` 404-409, identical to
`plain.tex` 934-937):

    \vdots {\vbox{\baselineskip4\p@ \lineskiplimit\z@
                  \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
    \ddots {\mathinner{\mkern1mu\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
                       \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}}

Everything there except the period and the `mu` kerns is an absolute length,
so the 6pt kern, the 4pt `\baselineskip` and the 7/4/1pt raises do not move
with the body size, and `\hbox` leaves math mode so the periods do not shrink
in a script. Both boxes come out 14pt plus the period's height tall with no
depth -- 15.05554pt at 10pt -- which is more than `\topskip`, so they push the
first baseline of the page down.

flashtex mapped both to one Latin Modern Math codepoint (U+22EE, U+22F1),
advance 2.18pt and 6.13pt, ink box 5.06pt too short (issue #717).

math-layout has no nucleus for a box the caller builds, and
`crates/render-pipeline/vendor/math-layout` is a frozen pin, so the stacks go
through the placeholder seam `mathtext.rs` already runs nested grids and
`\boxed` frames through: `FrameBoxSpec` is generalised to `BuiltBoxSpec` with
a `BuiltBody` of `Frame(MathList)` or `Dots { diagonal }`, and `built_box`
builds the dot stack out of `MathBox::vbox`/`hbox` with the text-size roman
period. `math_ellipsis_of` returns a `MathDots` so `\vdots`/`\ddots` are read
off the control word the same way `\ldots`/`\cdots` are (#467).

Measured against pdfTeX 3.141592653 (TeX Live 2026), glyph origins by PyMuPDF,
`\documentclass[10pt]{article}` `$a\vdots b$ and more text here.`, TeX pt:

                        before     after    pdflatex
    first baseline     135.2700  140.3256   140.3253
    \vdots `b` origin  156.7359  157.3336   157.3355
    \ddots `b` origin  160.6859  169.5557   169.5555

i.e. the first baseline was 5.0364 bp out and `\ddots` 8.8365 bp wide of
pdflatex; the largest residual now is 0.0019 bp. The three periods of each
stack now land within 0.0006 bp of pdflatex in both axes.

What was run:
    cargo test -p flashtex-render-pipeline --no-fail-fast   (crates/render-pipeline)
    branch: 479 passed; 13 failed
    base  : 474 passed; 13 failed        (e48ea2b, built the same way)
    all 13 failures on both sides panic at adapter.rs:1308 (the vendor/compiler
    pin, fixed by #696); 0 new failures, 5 new tests.

Next step:
None; `\vdots`/`\ddots` stay out of `math_symbol_line_height.rs`'s list on
purpose -- they legitimately move the first baseline, which
`math_dot_stacks.rs` pins separately.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
… encoding

What changed:

- `mathtext.rs`: the `\hbox{.}` period `\vdots`/`\ddots` are built from now
  goes through a new `period_glyph()`, which calls `shape_run(.., key: None,
  .., text_size_pt)` the same way an ordinary text run does, instead of
  `text_glyph('.', SizeClass::Text)`. `text_glyph` is the math-alphabet route
  (`fontmath.ltx` pins math alphabets to OT1 `cmr` regardless of the
  document's text encoding, which is correct for `\mathrm`/`\mathbf`/etc.),
  but `\hbox{.}` leaves math mode entirely, so the period is ordinary text
  and must follow `\usepackage[T1]{fontenc}` like any other character in
  running text. Verified independently against `/Library/TeX/texbin/pdflatex`
  (PyMuPDF for glyph origins) before applying: at 10pt and 12pt OT1 `cmr` and
  T1 `ec` share the same native METAFONT period design, so flashtex already
  matched both; at 11pt, T1's `ecrm1095` is its own native design where OT1's
  `cmr10 at 10.95` is linearly scaled from the 10pt design, so the two
  differ by 0.059bp -- inside both project gates (0.5bp glyph, 0.1bp rule),
  but a real, measured encoding-dependence bug. Fixed at 11pt; unaffected at
  10/12pt where the two encodings' periods already coincide.

- `tests/math_dots_boxes.rs`: ported from `agent/daniel-parent/matrix-register`
  @ 34bcb8f, a branch published by a separate investigating lane (daniel-parent,
  mac-m5pro-dq222) dispatched at #750's corpus-fidelity finding F6 (two matrices
  of unequal row count in one display; a short `\vdots` row left the matrix's
  own `\vcenter` off-axis, displacing `I_3`, both `=` signs and every line below
  by half the missing height -- 102 baselines on `fixtures/real-world/math-sheet`
  page 2). That lane found #724 already fixed F6 through the same placeholder
  seam, so only the regression test (this file) and the T1/OT1 finding above
  are folded in here; the rest of 34bcb8f (a second, parallel implementation)
  is not used. Credit: daniel-parent (mac-m5pro-dq222),
  #724 (comment).

What was run:

`cargo test -p flashtex-render-pipeline --no-fail-fast`, in
`crates/render-pipeline`, `CARGO_BUILD_JOBS=4`, private target dirs, branch
and base (#724 head a033f58) built identically:

  branch  482 passed; 13 failed; 4 ignored
  base    479 passed; 13 failed; 4 ignored

Line-by-line diff of every `test <name> ... <result>` line: identical except
the 3 new `math_dots_boxes.rs` tests (all `ok`). The 13 failures are the same
named set on both sides, all panicking at `adapter.rs:1308` (the known
pre-existing `vendor/compiler` debug_assert issue, #696). HW1/HW2 unmoved.

The three cherry-picked tests, before this commit's T1 fix (i.e. on #724 as
committed): `two_matrices_of_different_row_counts_hang_from_one_axis` and
`vdots_is_three_text_periods_four_points_apart` already pass;
`ddots_descends_three_points_per_period` fails at 11pt by 0.0586bp -- the
same quantity as the T1/OT1 finding. After this commit's fix: all 3 pass at
all three sizes.

Next step: none for this task; #724 is ready for review with both findings
folded in.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent): independent review — CHANGES REQUIRED. (fresh read-only Codex gpt-5.6-luna review of af19a34, findings checked against the code)

  1. crates/render-pipeline/src/adapter.rs:720 (block_leadings) — on any length mismatch between the compiler's block_par_leading and the block count, this discards the entire leading vector and falls every block back to body leading — not just the block(s) actually affected. The vendor compiler is not re-pinned by this PR, and its box_inlines (crates/render-pipeline/vendor/compiler/src/parser/colors.rs) still lacks the block_par_leading.truncate(...) call that argument_inlines has, so \colorbox/\fcolorbox currently do leave a stray entry and trigger this path. Result: a document with \colorbox{white}{x} anywhere loses correct leading for every other paragraph too, e.g. a {\small ...} block elsewhere gets body leading instead of \small's tighter leading — a real, currently-reachable regression vs pdflatex, not just a hypothetical mismatch. Re-pin vendor/compiler past the fix, or make the fallback per-affected-block rather than global.

Please push fixes to this branch and comment here; a fresh re-review follows.

— daniel-parent (triage by Claude Sonnet 5)

d-q222 added a commit that referenced this pull request Sep 17, 2026
…ex leaves it

What changed:
- New test crates/render-pipeline/tests/math_symbol_line_height.rs. A math
  glyph's height/depth come from the painted CFF ink box (MathFonts::glyph_from
  -> LoadedFace::bounds), so they feed the math box height, the line box and,
  through \topskip, the page's first baseline. Nothing pinned that path, which
  is why the Type 2 width bug fixed in #709 moved every line containing \ll or
  \gg without a single test noticing.
- The test renders $a<sym> b$ and more text here. for \ll, \gg and 26
  neighbouring cmsy relations/binaries and asserts the first baseline is
  pdfTeX's 135.27038 pt within the project's 0.5 bp glyph gate.

What was run:
  cargo test -q --test math_symbol_line_height
  test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  (with crates/render-pipeline/src/cff.rs reverted to origin/main, i.e. before
  the #709 fix)
  thread 'a_math_symbol_leaves_the_first_baseline_where_pdflatex_leaves_it' panicked
  test result: FAILED. 0 passed; 1 failed
  pdflatex oracle (pdfTeX 3.141592653, TeX Live, PyMuPDF extraction) over 174
  math symbols: pre-fix \ll off by 1.4596 pt and \gg by 2.3696 pt; post-fix
  both 0.0004 pt. No other symbol changed.
  cargo test --no-fail-fast (whole crate): 13 failures, all the known
  adapter.rs:1308 debug_assert_eq! (vendor/compiler pin, PR #696); nothing
  else red.

Next step:
- Merge after #709; this branch is stacked on it.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
…ot a glyph

What changed:
The LaTeX kernel gives neither command a character. Both are boxes built out
of `\hbox{.}` of the *text* font (`fontmath.ltx` 404-409, identical to
`plain.tex` 934-937):

    \vdots {\vbox{\baselineskip4\p@ \lineskiplimit\z@
                  \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
    \ddots {\mathinner{\mkern1mu\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
                       \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}}

Everything there except the period and the `mu` kerns is an absolute length,
so the 6pt kern, the 4pt `\baselineskip` and the 7/4/1pt raises do not move
with the body size, and `\hbox` leaves math mode so the periods do not shrink
in a script. Both boxes come out 14pt plus the period's height tall with no
depth -- 15.05554pt at 10pt -- which is more than `\topskip`, so they push the
first baseline of the page down.

flashtex mapped both to one Latin Modern Math codepoint (U+22EE, U+22F1),
advance 2.18pt and 6.13pt, ink box 5.06pt too short (issue #717).

math-layout has no nucleus for a box the caller builds, and
`crates/render-pipeline/vendor/math-layout` is a frozen pin, so the stacks go
through the placeholder seam `mathtext.rs` already runs nested grids and
`\boxed` frames through: `FrameBoxSpec` is generalised to `BuiltBoxSpec` with
a `BuiltBody` of `Frame(MathList)` or `Dots { diagonal }`, and `built_box`
builds the dot stack out of `MathBox::vbox`/`hbox` with the text-size roman
period. `math_ellipsis_of` returns a `MathDots` so `\vdots`/`\ddots` are read
off the control word the same way `\ldots`/`\cdots` are (#467).

Measured against pdfTeX 3.141592653 (TeX Live 2026), glyph origins by PyMuPDF,
`\documentclass[10pt]{article}` `$a\vdots b$ and more text here.`, TeX pt:

                        before     after    pdflatex
    first baseline     135.2700  140.3256   140.3253
    \vdots `b` origin  156.7359  157.3336   157.3355
    \ddots `b` origin  160.6859  169.5557   169.5555

i.e. the first baseline was 5.0364 bp out and `\ddots` 8.8365 bp wide of
pdflatex; the largest residual now is 0.0019 bp. The three periods of each
stack now land within 0.0006 bp of pdflatex in both axes.

What was run:
    cargo test -p flashtex-render-pipeline --no-fail-fast   (crates/render-pipeline)
    branch: 479 passed; 13 failed
    base  : 474 passed; 13 failed        (e48ea2b, built the same way)
    all 13 failures on both sides panic at adapter.rs:1308 (the vendor/compiler
    pin, fixed by #696); 0 new failures, 5 new tests.

Next step:
None; `\vdots`/`\ddots` stay out of `math_symbol_line_height.rs`'s list on
purpose -- they legitimately move the first baseline, which
`math_dot_stacks.rs` pins separately.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
… encoding

What changed:

- `mathtext.rs`: the `\hbox{.}` period `\vdots`/`\ddots` are built from now
  goes through a new `period_glyph()`, which calls `shape_run(.., key: None,
  .., text_size_pt)` the same way an ordinary text run does, instead of
  `text_glyph('.', SizeClass::Text)`. `text_glyph` is the math-alphabet route
  (`fontmath.ltx` pins math alphabets to OT1 `cmr` regardless of the
  document's text encoding, which is correct for `\mathrm`/`\mathbf`/etc.),
  but `\hbox{.}` leaves math mode entirely, so the period is ordinary text
  and must follow `\usepackage[T1]{fontenc}` like any other character in
  running text. Verified independently against `/Library/TeX/texbin/pdflatex`
  (PyMuPDF for glyph origins) before applying: at 10pt and 12pt OT1 `cmr` and
  T1 `ec` share the same native METAFONT period design, so flashtex already
  matched both; at 11pt, T1's `ecrm1095` is its own native design where OT1's
  `cmr10 at 10.95` is linearly scaled from the 10pt design, so the two
  differ by 0.059bp -- inside both project gates (0.5bp glyph, 0.1bp rule),
  but a real, measured encoding-dependence bug. Fixed at 11pt; unaffected at
  10/12pt where the two encodings' periods already coincide.

- `tests/math_dots_boxes.rs`: ported from `agent/daniel-parent/matrix-register`
  @ 34bcb8f, a branch published by a separate investigating lane (daniel-parent,
  mac-m5pro-dq222) dispatched at #750's corpus-fidelity finding F6 (two matrices
  of unequal row count in one display; a short `\vdots` row left the matrix's
  own `\vcenter` off-axis, displacing `I_3`, both `=` signs and every line below
  by half the missing height -- 102 baselines on `fixtures/real-world/math-sheet`
  page 2). That lane found #724 already fixed F6 through the same placeholder
  seam, so only the regression test (this file) and the T1/OT1 finding above
  are folded in here; the rest of 34bcb8f (a second, parallel implementation)
  is not used. Credit: daniel-parent (mac-m5pro-dq222),
  #724 (comment).

What was run:

`cargo test -p flashtex-render-pipeline --no-fail-fast`, in
`crates/render-pipeline`, `CARGO_BUILD_JOBS=4`, private target dirs, branch
and base (#724 head a033f58) built identically:

  branch  482 passed; 13 failed; 4 ignored
  base    479 passed; 13 failed; 4 ignored

Line-by-line diff of every `test <name> ... <result>` line: identical except
the 3 new `math_dots_boxes.rs` tests (all `ok`). The 13 failures are the same
named set on both sides, all panicking at `adapter.rs:1308` (the known
pre-existing `vendor/compiler` debug_assert issue, #696). HW1/HW2 unmoved.

The three cherry-picked tests, before this commit's T1 fix (i.e. on #724 as
committed): `two_matrices_of_different_row_counts_hang_from_one_axis` and
`vdots_is_three_text_periods_four_points_apart` already pass;
`ddots_descends_three_points_per_period` fails at 11pt by 0.0586bp -- the
same quantity as the T1/OT1 finding. After this commit's fix: all 3 pass at
all three sizes.

Next step: none for this task; #724 is ready for review with both findings
folded in.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
…ex leaves it

What changed:
- New test crates/render-pipeline/tests/math_symbol_line_height.rs. A math
  glyph's height/depth come from the painted CFF ink box (MathFonts::glyph_from
  -> LoadedFace::bounds), so they feed the math box height, the line box and,
  through \topskip, the page's first baseline. Nothing pinned that path, which
  is why the Type 2 width bug fixed in #709 moved every line containing \ll or
  \gg without a single test noticing.
- The test renders $a<sym> b$ and more text here. for \ll, \gg and 26
  neighbouring cmsy relations/binaries and asserts the first baseline is
  pdfTeX's 135.27038 pt within the project's 0.5 bp glyph gate.

What was run:
  cargo test -q --test math_symbol_line_height
  test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  (with crates/render-pipeline/src/cff.rs reverted to origin/main, i.e. before
  the #709 fix)
  thread 'a_math_symbol_leaves_the_first_baseline_where_pdflatex_leaves_it' panicked
  test result: FAILED. 0 passed; 1 failed
  pdflatex oracle (pdfTeX 3.141592653, TeX Live, PyMuPDF extraction) over 174
  math symbols: pre-fix \ll off by 1.4596 pt and \gg by 2.3696 pt; post-fix
  both 0.0004 pt. No other symbol changed.
  cargo test --no-fail-fast (whole crate): 13 failures, all the known
  adapter.rs:1308 debug_assert_eq! (vendor/compiler pin, PR #696); nothing
  else red.

Next step:
- Merge after #709; this branch is stacked on it.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
…ot a glyph

What changed:
The LaTeX kernel gives neither command a character. Both are boxes built out
of `\hbox{.}` of the *text* font (`fontmath.ltx` 404-409, identical to
`plain.tex` 934-937):

    \vdots {\vbox{\baselineskip4\p@ \lineskiplimit\z@
                  \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
    \ddots {\mathinner{\mkern1mu\raise7\p@\vbox{\kern7\p@\hbox{.}}\mkern2mu
                       \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu}}

Everything there except the period and the `mu` kerns is an absolute length,
so the 6pt kern, the 4pt `\baselineskip` and the 7/4/1pt raises do not move
with the body size, and `\hbox` leaves math mode so the periods do not shrink
in a script. Both boxes come out 14pt plus the period's height tall with no
depth -- 15.05554pt at 10pt -- which is more than `\topskip`, so they push the
first baseline of the page down.

flashtex mapped both to one Latin Modern Math codepoint (U+22EE, U+22F1),
advance 2.18pt and 6.13pt, ink box 5.06pt too short (issue #717).

math-layout has no nucleus for a box the caller builds, and
`crates/render-pipeline/vendor/math-layout` is a frozen pin, so the stacks go
through the placeholder seam `mathtext.rs` already runs nested grids and
`\boxed` frames through: `FrameBoxSpec` is generalised to `BuiltBoxSpec` with
a `BuiltBody` of `Frame(MathList)` or `Dots { diagonal }`, and `built_box`
builds the dot stack out of `MathBox::vbox`/`hbox` with the text-size roman
period. `math_ellipsis_of` returns a `MathDots` so `\vdots`/`\ddots` are read
off the control word the same way `\ldots`/`\cdots` are (#467).

Measured against pdfTeX 3.141592653 (TeX Live 2026), glyph origins by PyMuPDF,
`\documentclass[10pt]{article}` `$a\vdots b$ and more text here.`, TeX pt:

                        before     after    pdflatex
    first baseline     135.2700  140.3256   140.3253
    \vdots `b` origin  156.7359  157.3336   157.3355
    \ddots `b` origin  160.6859  169.5557   169.5555

i.e. the first baseline was 5.0364 bp out and `\ddots` 8.8365 bp wide of
pdflatex; the largest residual now is 0.0019 bp. The three periods of each
stack now land within 0.0006 bp of pdflatex in both axes.

What was run:
    cargo test -p flashtex-render-pipeline --no-fail-fast   (crates/render-pipeline)
    branch: 479 passed; 13 failed
    base  : 474 passed; 13 failed        (e48ea2b, built the same way)
    all 13 failures on both sides panic at adapter.rs:1308 (the vendor/compiler
    pin, fixed by #696); 0 new failures, 5 new tests.

Next step:
None; `\vdots`/`\ddots` stay out of `math_symbol_line_height.rs`'s list on
purpose -- they legitimately move the first baseline, which
`math_dot_stacks.rs` pins separately.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
d-q222 added a commit that referenced this pull request Sep 17, 2026
… encoding

What changed:

- `mathtext.rs`: the `\hbox{.}` period `\vdots`/`\ddots` are built from now
  goes through a new `period_glyph()`, which calls `shape_run(.., key: None,
  .., text_size_pt)` the same way an ordinary text run does, instead of
  `text_glyph('.', SizeClass::Text)`. `text_glyph` is the math-alphabet route
  (`fontmath.ltx` pins math alphabets to OT1 `cmr` regardless of the
  document's text encoding, which is correct for `\mathrm`/`\mathbf`/etc.),
  but `\hbox{.}` leaves math mode entirely, so the period is ordinary text
  and must follow `\usepackage[T1]{fontenc}` like any other character in
  running text. Verified independently against `/Library/TeX/texbin/pdflatex`
  (PyMuPDF for glyph origins) before applying: at 10pt and 12pt OT1 `cmr` and
  T1 `ec` share the same native METAFONT period design, so flashtex already
  matched both; at 11pt, T1's `ecrm1095` is its own native design where OT1's
  `cmr10 at 10.95` is linearly scaled from the 10pt design, so the two
  differ by 0.059bp -- inside both project gates (0.5bp glyph, 0.1bp rule),
  but a real, measured encoding-dependence bug. Fixed at 11pt; unaffected at
  10/12pt where the two encodings' periods already coincide.

- `tests/math_dots_boxes.rs`: ported from `agent/daniel-parent/matrix-register`
  @ 34bcb8f, a branch published by a separate investigating lane (daniel-parent,
  mac-m5pro-dq222) dispatched at #750's corpus-fidelity finding F6 (two matrices
  of unequal row count in one display; a short `\vdots` row left the matrix's
  own `\vcenter` off-axis, displacing `I_3`, both `=` signs and every line below
  by half the missing height -- 102 baselines on `fixtures/real-world/math-sheet`
  page 2). That lane found #724 already fixed F6 through the same placeholder
  seam, so only the regression test (this file) and the T1/OT1 finding above
  are folded in here; the rest of 34bcb8f (a second, parallel implementation)
  is not used. Credit: daniel-parent (mac-m5pro-dq222),
  #724 (comment).

What was run:

`cargo test -p flashtex-render-pipeline --no-fail-fast`, in
`crates/render-pipeline`, `CARGO_BUILD_JOBS=4`, private target dirs, branch
and base (#724 head a033f58) built identically:

  branch  482 passed; 13 failed; 4 ignored
  base    479 passed; 13 failed; 4 ignored

Line-by-line diff of every `test <name> ... <result>` line: identical except
the 3 new `math_dots_boxes.rs` tests (all `ok`). The 13 failures are the same
named set on both sides, all panicking at `adapter.rs:1308` (the known
pre-existing `vendor/compiler` debug_assert issue, #696). HW1/HW2 unmoved.

The three cherry-picked tests, before this commit's T1 fix (i.e. on #724 as
committed): `two_matrices_of_different_row_counts_hang_from_one_axis` and
`vdots_is_three_text_periods_four_points_apart` already pass;
`ddots_descends_three_points_per_period` fails at 11pt by 0.0586bp -- the
same quantity as the T1/OT1 finding. After this commit's fix: all 3 pass at
all three sizes.

Next step: none for this task; #724 is ready for review with both findings
folded in.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent), independent Opus review of af19a349: APPROVE. It is defensive hardening now that the vendored compiler is past #517. Queued for the next merge batch; the limitation-entry follow-up is optional.

PR #696 review — render-pipeline: a box argument's leading no longer depends on the build (head af19a34)

Reviewer: opus (independent, read-only). Diff reviewed against merge base dbe3cac.

MATERIAL findings

None.

The change is correct as written: block_leadings (crates/render-pipeline/src/adapter.rs:716-722) pairs the
compiler's block_par_leading positionally only on an exact length match and otherwise returns vec![None; blocks],
which is the documented --no-default-features behaviour. The zip at the call site (adapter.rs:1344) can no longer
silently mis-pair or pad, and no debug_assertions-dependent path remains. Merges cleanly into current origin/main
(git merge-tree clean).

Non-blocking notes

  1. Premise is stale on current main. The PR text and the doc comments (adapter.rs:690-712, tests/par_leading_box_profile.rs:1-20)
    say the pinned vendor/compiler predates compiler: boxed arguments and letter \ps no longer leave phantom paragraph leadings #517 and still leaves a stray entry per \colorbox. origin/main has since been
    re-pinned (23b9058, not in this PR's base); main's vendor/compiler/src/parser/colors.rs:244 now truncates
    block_par_leading. After merge the lengths agree for boxes, so:
    • the PR fixes no live bug on main; it is hardening against a future contract drift;
    • the two integration tests in par_leading_box_profile.rs would pass on main without the adapter change, so they
      guard the layout property, not the new function. The unit test block_leadings_are_profile_independent is the only
      test of the change itself.
      Suggest: reword the comments/PR body to "defensive: a length mismatch disables par-leading" and drop the
      "until vendor is re-pinned" wording.
  2. Silent degradation replaces a (debug-only) signal. Any future compiler path that pushes a block without its
    leading, or flushes a nested paragraph without truncating (the pattern already fixed in colors.rs, tabular.rs:1534,
    parser.rs:9285), will now disable par-leading for the whole document with no diagnostic, and CI (release-only)
    would not notice. Since CI never ran the debug_assert_eq! either, this is not a regression in CI coverage, but a
    cheap release-mode guard would be better: e.g. a test that asserts block_par_leading.len() == blocks.len() over the
    existing render-pipeline fixture corpus, or push a limitations entry when the fallback fires.
  3. The unit test's exhaustive 0..6 loop's "deterministic" assertion is trivially true for a pure function; harmless.
  4. No layout change on main (lengths already agree), so no perf-bench corpus digest/baseline re-recording is needed;
    none included, which is correct.

Tests run (worktree at af19a34, debug profile, one at a time)

  • nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target cargo test -p flashtex-render-pipeline --locked --lib block_leadings
    (from crates/render-pipeline) — 1 passed, 0 failed.
  • ... --test par_leading_box_profile — 2 passed, 0 failed (Latin Modern available, tests not skipped).
  • ... --test frame_env — 1 passed, 1 ignored (pre-existing ignore), 0 failed; the debug panic from render-pipeline output differs between debug and release builds (colorbox path count 2 vs 1) #667 is gone.
  • ... --test par_leading_oracle — 9 passed, 0 failed.

VERDICT: APPROVE

@d-q222
d-q222 merged commit d361e2e into main Sep 17, 2026
21 of 22 checks passed
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
…ex#697)

What changed:
- `cargo check -p flashtex-render-pipeline --no-default-features` failed with
  7 non-exhaustive-match errors on `Nucleus::GenFraction`/`Phantom`/`Operator`/
  `SubArray`/`ExtArrow`. The vendored compiler pin exposes these 5 variants
  unconditionally, but render-pipeline's own match arms for them are gated
  behind the (now-default) `amsmath-inline` feature, so turning that feature
  off left the arms missing with no catch-all. Added feature-off catch-alls
  in `hash_math`/`shift_math` (incremental.rs) and `math_grids`/
  `math_glue_em`/`convert_math_classed` (typeset.rs) that degrade rather than
  reproduce full-feature behaviour: hash via `Debug`, skip incremental
  shift/grid tracking, treat glue as zero, and emit no atom for these nuclei.
- Fixed `kern_amount_matches`'s `compiler-package-gating`-off fallback to call
  the vendored `text_kern`'s new two-argument signature
  (`text_kern(spelling, false)`), matching only the kernel (non-amsmath)
  definition as the surrounding comment already said.
- Replaced adapter.rs's `debug_assert_eq!(leadings.len(), parsed.blocks.len())`
  with the fallback PR flash-tex#696 already documented: when the compiler's
  `block_par_leading` list doesn't match the block count, use body leading
  for every block instead of panicking. This isn't gated by any feature, so
  it also fixes 13 pre-existing failures on origin/main's default-feature
  build (all panicking at the old adapter.rs:1308 assert) with 0 new
  failures anywhere.
- Gated tests that empirically need a feature to pass, not merely ones that
  failed: amsmath_inline.rs and frac_ord_spacing.rs (whole files, use
  \dfrac/\genfrac/\binom/\substack/\operatorname), amssymb_braces.rs's
  amssymb_relations_advance_by_their_msam_msbm_widths and
  big_delimiter_packages.rs's two size-tracking tests behind
  `amsmath-inline`, math_symbols.rs's 3 mathtools-colon tests behind
  `math-class-override`, and tabular_oracle.rs (whole file) behind
  `par-leading`. Verified each by temporarily un-gating and re-running
  --no-default-features: every one fails for a real, feature-shaped reason
  (numeric mismatches or missing glyphs), not an unrelated flake.
- No `vendor/` path touched.

What was run (from crates/render-pipeline,
CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ndf-verify, CARGO_BUILD_JOBS=4):
- `cargo test --no-default-features --no-fail-fast`: 454 passed; 0 failed;
  4 ignored (0 compile errors).
- `cargo test --no-fail-fast` (default features, this branch): 482 passed;
  0 failed; 4 ignored.
- `cargo test --no-fail-fast` (default features, origin/main @ 9c5b028,
  same target-dir convention): 469 passed; 13 failed; 4 ignored — all 13
  panicking at `src/adapter.rs:1308:5`'s `debug_assert_eq!` (the stale
  vendor/compiler pin bug this branch also fixes). 469 + 13 = 482: 0 new
  failures, and the branch clears every pre-existing one.
- The `incremental_output_is_byte_identical_over_200_edits_of_a_27_page_document`
  test is genuinely slow (~330s), not hung, in both configurations.

Next step: recommend adding a CI job for
`cargo check -p flashtex-render-pipeline --no-default-features` (proposed in
the PR body, not added here) so this configuration cannot silently rot again.

Implementation-Agent: gpt-5.6-luna (Codex) via daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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