Repository navigation
compiler: boxed arguments and letter \ps no longer leave phantom paragraph leadings - #517
Conversation
What changed: - Discard block-leading metadata from temporary boxed inline parses. - Stop \ps from recording metadata without a block. - Add underline, sout, and letter fixture alignment regressions. What was run: - CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-parlead cargo test --manifest-path crates/compiler/Cargo.toml -> exit 0; all reported test-result lines passed; doc-tests passed. - CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-parlead cargo test --manifest-path crates/compiler/Cargo.toml --test par_leading -- --nocapture -> test result: ok. 11 passed; 0 failed. Next step: - Re-pin render-pipeline/vendor/compiler to this compiler fix before the render-pipeline debug gate. Implementation-Agent: codex gpt-5.6-luna (max) Commit-Executor: codex (this session) Lane-Owner: daniel-parent (mac-m5pro-dq222)
|
daniel-parent independent review (subagent) Verdict: CHANGES NEEDED Both fixes actually in this diff are correct, and both are verified independently below. But the PR's own framing ("stops firing in debug builds once 1.
The removed second call in the
The real 2. Symmetric with the existing, already-correct pattern in 3. Finding — NOT fixed by this PR: I enumerated every site that manipulates
Concrete reproduction (verified empirically — added a temporary probe test at PR head, ran it, then reverted the test file with \documentclass{article}
\begin{document}
\begin{tabular}{c}
\begin{itemize}\item x\end{itemize}
\end{tabular}
\end{document}Result at PR head ( 4. Regression check against Copied the PR's new test file ( The other 7 pre-existing tests in that file pass on 5. Full compiler test suite at PR head (
Summary: the two committed changes are both correct and necessary, and are independently verified. Recommend also closing |
…ehind What changed: - tabular_cell_inlines truncates block_par_leading after its temporary sub-parse, the third sub-parse site alongside box_inlines and argument_inlines (found by the independent review on #517). - Regression test: an itemize inside a tabular entry keeps 1 block / 1 leading. What was run: - cargo test --test par_leading: test result: ok. 12 passed; 0 failed - same test without the tabular.rs change: 1 failed (2 leadings vs 1 block) Next step: - re-pin render-pipeline/vendor/compiler past #517 (integration lane). Implementation-Agent: claude-opus-5 (daniel-parent) Commit-Executor: daniel-parent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Addressed review finding 3: |
…ixture What changed: - par_leading.rs: regression tests for the constructs that leaked phantom block_par_leading entries on main: \colorbox, \fcolorbox, and a \par inside a box argument (\colorbox, \underline), all via box_inlines. - PR #42's extended/graphics-transform-color case, verbatim: 5 blocks and 5 leadings (main gave 7 vs 5, the render-pipeline debug_assert at adapter.rs:1261; the two extras are the \colorbox and \fcolorbox args). - A guard for the argument_inlines path (\rotatebox, \scalebox, \reflectbox, \resizebox, \footnote with \par), which already truncated. - A property test: every .tex under fixtures/real-world and fixtures/divergence-probes has blocks.len() == block_par_leading.len(). - No source change: the three sub-parse sites (box_inlines, argument_inlines, tabular_cell_inlines) are the only local-vector parse_stream callers, all truncate on this branch, and all 22 blocks.push sites are paired with finish_block_dependencies. What was run: - cargo test --manifest-path crates/compiler/Cargo.toml --test par_leading test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out - same with the #517 src fix reverted: test result: FAILED. 8 passed; 10 failed (all new tests except the argument_inlines guard fail) - cargo test --manifest-path crates/compiler/Cargo.toml: exit 0, 57 test binaries, 680 passed, 0 failed, 5 ignored - Ad-hoc parse of 962 repo .tex files plus PR #42's 53 case .tex files: no count mismatch on the #517 branch. Next step: render-pipeline builds against its vendor/compiler, so the adapter assert on main clears only after a vendor re-pin past #517. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent subagent (claude-opus-5): follow-up on the Findings
Commit: 368d79e adds tests only, in
Test results
|
… in step" What changed: - Reverts 86100a7. The same two truncations (box_inlines and tabular_cell_inlines) are already open in #517 (agent/daniel-parent/parleading-assert), found after committing; this PR leaves that fix to #517 and lists the fuzz finding as covered by it. What was run: - git revert (no code of this PR's own remains in crates/compiler) Next step: none for this finding here; #517 merges and vendor re-pins. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: - adapter::list_stack_at and in_theorem_environment searched `source[from..at]` for the next \begin and the next \end again after every hit; whenever one was absent that search ran to `at`, so each call was O(begins x bytes). Both now replay one ordered begin_end_commands scan, found exactly as find_command finds them. - That scan and setlist_calls' \setlist ranges are indexed once per text for the adapt call, on the existing MacroDefsScope entry (the same (address, length) key the macro-definition index uses), since they run for every list item and every paragraph. - Fuzz findings (render-pipeline fuzz_render, "hang in render" with the compiler fixes of #577 applied): a mutated enumitem worksheet 37.5 s -> 0.29 s; page-builder enlarge-00 21.5 s -> 0.19 s; a 715-page list of 20 000 items 23.3 s -> 0.13 s; 1 000 nested itemize 23.8 s -> 0.15 s; a plain 5 000-paragraph article with a center per paragraph 8.0 s -> 1.1 s; 300 items inside 1 000 open centers 7.4 s -> 25 ms (identical PDF bytes). All release timings through fuzz_render --diagnostics. What was run: - cargo test --test fuzz_regressions -- a_long_list list_items_inside, before: FAILED. 0 passed; 2 failed (17.3 s and 18.7 s to adapt); after: test result: ok. 2 passed; 0 failed; finished in 0.27s - cargo test --no-fail-fast (render-pipeline): 368 passed, 12 failed; all 12 panic at src/adapter.rs:1261 (block_par_leading debug assert, #517) in letter_class_geometry, uline, underline_sout, xcolor_oracle; letter_class_geometry fails identically with this change stashed. Next step: the 50k rerun on the fixed branch. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…prime (#278) (#528) What changed: - The prime's box geometry already matched pdflatex (compiler #174 and math-layout #172): script size, sup shift, one superscript for f'', f'^2 joining it, f_1'/x'_a sub+sup. What was wrong was the painted glyph. The pipeline drew cmsy "30 with Latin Modern Math's cmap glyph for U+2032 (`minute`, ink 430..748/1000 em). That glyph is pre-raised for unscripted Unicode use, so at the superscript position it sat 2.7-3.1bp too high at the bottom and 1.3-1.5bp at the top. - mathfont.rs reads the face's GSUB `ssty` lookups (AlternateSubst, plus Single and Extension). mathtex.rs paints cmsy "30 with the first ssty alternate, `minute.st` (ink 96..549, cmsy's unraised design; lmsy7 is 41..559). - tests/math_primes.rs pins the pdflatex \showbox oracle (10pt and 12pt, inline and display, f'(x) f'' f''' f^{\prime} f'^2 f_1' x'_a) for placement, and lmsy7/lmsy8 AFM ink for the prime, at 0.5bp. What was run: - cargo test --test math_primes (before fix): test result: FAILED. 1 passed; 1 failed - cargo test --test math_primes (after): test result: ok. 2 passed; 0 failed - render-pipeline full suite: every failure (letter_class_geometry 5, uline 2, underline_sout 4, xcolor_oracle 1) panics at src/adapter.rs:1261, the par-leading debug_assert that open PR #517 fixes; no other failures - math-layout and compiler: see PR Next step: re-check the Mac app rendering of f'(x) once this lands. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ild profile (flash-tex#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 flash-tex#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 flash-tex#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 flash-tex#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 flash-tex#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
What
Two compiler fixes that bring
block_par_leadingback into step with the parsed blocks. The render-pipeline'sdebug_assert_eq!(leadings.len(), parsed.blocks.len())inadapter.rsstops firing in debug builds oncevendor/compileris re-pinned past this PR.\underline,\uline,\sout) and xcolor boxes: the temporarybox_inlinesparse inparser/colors.rsrestoredblock_dependenciesbut notblock_par_leading, so each boxed argument left a phantom leading. It is now truncated the same way (colors.rs:235).letterclass\ps:\pscalledfinish_block_dependencies()afterflush_paragraph, recording a block entry that was never pushed (letter fixture 14 leadings vs 13 blocks). The extra call is removed (parser.rs:2114).Counts before → after: underline family 2 vs 1 → 1 vs 1;
fixtures/real-world/letter14 vs 13 → 13 vs 13.Why
The debug assertion was reported on #2 by daniel-muse-lead-2 (credit for isolating both triggers). Release builds skip the check, but the misaligned list means a later block can get the wrong paragraph leading.
Overlap check
Checked open PRs and claims for
par_leading,box_inlines,\psand letter. There is no overlap. The claim isGH-PARLEADING-DEBUG-ASSERT. daniel-muse-lead-2's #505\marginparis told to stay out of this path.Test results
crates/compiler/tests/par_leading.rsregressions (underline,\sout,\uline, letter 13/13):11 passed; 0 failedforpar_leading.origin/main(vendor baseline, fixed only by re-pin).git diff --check: passed.Not done
vendor/compilerre-pin (integration lane) before render-pipeline debug tests go green. This PR does not touchvendor/. The adapter assertion is intentionally kept.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz