Repository navigation
render-pipeline: fix --no-default-features build (#697) - #733
Conversation
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 #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
…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
left a comment
There was a problem hiding this comment.
Independent verification — VERIFIED (one non-blocking finding)
Fetched refs/review/pr-733 = 6961a72e, own worktree, CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-vr3-733, CARGO_BUILD_JOBS=4. Base is the merge-base dbe3cac8.
1. --no-default-features — 454 / 0
$ cd crates/render-pipeline
$ cargo test --no-default-features --no-fail-fast
$ grep -E "^test result" ... | awk '{p+=$4;f+=$6;i+=$8} END {...}'
NO-DEFAULT-FEATURES: passed=454 failed=0 ignored=4 over 105 targets
$ grep -cE "^error" 733-nodefault.log
0
$ grep -c "^ Running tests/" 733-nodefault.log
101
454 passed, 0 failed, no compile error, 101 integration-test binaries built and run. Exact.
2. Default configuration unchanged
Two ways, because the claim deserves more than the diff's shape.
By construction. Every arm this PR adds is under #[cfg(not(feature = "…"))] where the named feature is in default, and the one changed line — text_kern(spelling) → text_kern(spelling, false) at src/adapter.rs:6736 — sits inside #[cfg(not(feature = "compiler-package-gating"))], also default-on. So with default features nothing this PR adds is compiled at all. The remaining hunk in that function is a doc comment.
By running it. The six test files this PR touches, default features, branch against base, per-test-name:
$ cargo test --no-fail-fast --test big_delimiter_packages --test math_symbols \
--test tabular_oracle --test amsmath_inline --test frac_ord_spacing --test amssymb_braces
base default: passed=40 failed=0 ignored=1
branch default: passed=40 failed=0 ignored=1
$ diff 733-def-base.txt 733-def-branch.txt
IDENTICAL
Identical test-name-by-test-name, not merely identical totals. The #![cfg(feature = "…")] file gates are all on default-on features, so nothing drops out of the default run.
3. "No test was gated merely to hide a failure" — the claim worth testing
I picked the gates myself and un-gated them in a scratch worktree. I chose big_delimiter_packages.rs:99 deliberately: a test named without_amsmath_big_does_not_move_with_the_body_size, gated on amsmath-inline, is the one gate in this diff that reads inverted, and is where I would expect a convenient gate to hide. I added tabular_oracle.rs's whole-file par-leading gate as a third, since a file-level gate hides the most.
All three still compile with default features off — so #[cfg] is not load-bearing for compilation here — and all three fail for a reason shaped like the missing feature:
tests/big_delimiter_packages.rs:99 — amsmath-inline:
---- without_amsmath_big_does_not_move_with_the_body_size stdout ----
panicked at tests/big_delimiter_packages.rs:107:5:
assertion `left == right` failed: 11pt without amsmath must match 10pt
left: (40, "9.9626")
right: (40, "10.9091")
10.9091 is amsmath's \big@size tracking the 11 pt body. Without the feature the pipeline cannot tell amsmath is absent and applies amsmath's rule anyway — precisely the regression the test's own doc comment describes, and precisely what the feature carries. Feature-shaped. Note also that the sibling with_amsmath_big_tracks_the_body_size is not gated and passes both ways, which is the correct asymmetry: the amsmath-loaded path doesn't need the detection.
tests/math_symbols.rs:407 — math-class-override:
---- unraised_colons_match_pdflatex stdout ----
panicked at tests/math_symbols.rs:397:9:
colon glyph 2 `b`: x=16.7027bp, pdflatex 14.7049
A ~2 bp horizontal error on the glyph after a colon: the colon's math class, which is exactly what math-class-override overrides. The other 15 tests in the file still pass. Feature-shaped, and narrowly so.
tests/tabular_oracle.rs:19 (whole file) — par-leading:
---- tabular_fixtures_match_pdflatex stdout ----
panicked at tests/tabular_oracle.rs:189:5:
25 mismatches over 128 fixtures:
127-size-env-paragraphs p1: no glyph at word "Group" (72.000, 138.750)
... (all 25 in the same fixture)
25 of 128 fixtures' worth of mismatches, every one in 127-size-env-paragraphs — paragraph leading inside a size environment, which is what par-leading is. If the file-level gate were hiding unrelated breakage the mismatches would be scattered across fixtures; they are in exactly one, and it is the one the feature names.
Three for three. On this sample the claim holds, and it holds for the gate I most suspected.
Finding (non-blocking)
Compile-time #[cfg] makes these tests disappear silently rather than report as skipped. Under --no-default-features the 454 is not comparable to the default-feature total, and nothing in the run says what is not being measured — a reader sees a green 454/0 with no hint that tabular_oracle's entire 128-fixture corpus was never built.
Since all three gates I un-gated compile fine without their feature, #[cfg] is stronger than necessary for them. #[cfg_attr(not(feature = "…"), ignore = "needs feature …")] would keep them visible in the output, which is the idiom this crate already uses elsewhere — e.g. math_symbols.rs prints coloneqq_decomposes_like_mathtools ... ignored, needs re-pin past #529. That turns "silently absent" into a named ignored line and makes a future gate-to-hide-a-failure visible at a glance.
I'd apply it to tabular_oracle.rs:19, big_delimiter_packages.rs:99,130 and math_symbols.rs:407,429,470 only. amsmath_inline.rs:9 and frac_ord_spacing.rs:17 I did not test for compilation without the feature, and given the feature's stated purpose (the compiler's Nucleus variants) #[cfg] is plausibly required there — don't change those on my say-so.
Not a blocker: nothing here is wrong, and the PR's own claim about the gates reproduces.
— independently verified by daniel-parent's review lane
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
|
Verification-round fix: the 28 tests gated behind Checked each one before converting, not assumed: every file uses only
None had to be left as Deliberately not touched: Test counts, both configurations ( Both configurations now compile the identical 486 test items — only the Also added a line to the PR body making explicit that 454 One more note since it affects how these numbers get read later: those 13 Pushed as |
…o-default-features What changed: resolved two merge conflicts (incremental.rs hash_math/ shift_math, typeset.rs convert_math_classed/math_grids/math_glue_em/ math_approximations) between this branch's --no-default-features catch-all arms (#697) and main's independently-landed compiler-node-surface arms (#711, TextRun/SideSet/Lap). Both sets of arms are kept; the catch-all wildcard is placed last so it only fires for variants neither feature's arms cover. adapter.rs's kern_amount_matches auto-merged cleanly (no conflict) and was verified unchanged/correct. What was run: cargo test --no-run --release (both default and --no-default-features) compiles clean; cargo test --release --no-fail-fast in both configurations: every `test result:` line reports 0 failed (no non-"0 failed" line in either run). Next step: push and comment on PR #733 with these results. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Resolved the merge conflict with Conflicts:
Resolution: kept both sides — main's Build/tests (
This confirms the fix: Claim |
What
Fixes #697:
cargo check -p flashtex-render-pipeline --no-default-featuresdidnot build:
(7 such errors, in
hash_math/shift_math/math_grids/math_glue_em/convert_math_classed, plus atext_kernargument-count mismatch.)The vendored
flashtex-compilerpin exposesNucleus::GenFraction/Phantom/Operator/SubArray/ExtArrowunconditionally, but render-pipeline's ownmatch arms for them are gated behind the (now-default)
amsmath-inlinefeature. Turning that feature off left the arms missing with no catch-all, so
the match wasn't exhaustive.
Fix, in
crates/render-pipeline:hash_math/shift_math(
src/incremental.rs) andmath_grids/math_glue_em/convert_math_classed(src/typeset.rs). Each degrades rather thanreproduces
amsmath-inlinebehaviour:hash_mathhashes viaDebug(still distinguishes content, just not through the structured path),
shift_math/math_grids/math_approximationsskip these nuclei,math_glue_emtreats them as zero-width, andconvert_math_classedemitsno atom for them. Nothing here silently reimplements the full-feature path.
kern_amount_matches'scompiler-package-gating-off fallback tocall the vendored
text_kern's current two-argument signature(
text_kern(spelling, false)), matching only the kernel (non-amsmath)constant, as the adjacent comment already said.
amsmath_inline.rs,frac_ord_spacing.rs,amssymb_braces.rs,big_delimiter_packages.rs,math_symbols.rs(behindamsmath-inlineormath-class-override) and all oftabular_oracle.rs(behind
par-leading). Each was checked, not assumed: I temporarilyun-gated every one and re-ran
--no-default-featuresmyself beforeaccepting the gate. All fail for a real, feature-shaped reason — e.g.
big_delimiter_heights_match_pdflatex_at_all_article_sizespanicsgot 9.96264bp, want 12.00011pt, andtabular_oracle's corpus shows 25/128fixture mismatches (a
\small/\largeparagraph's words land on the wrongbaseline) — never a bare "it failed, so gate it."
vendor/path is touched anywhere in this diff.An earlier version of this branch also replaced
adapter.rs'sdebug_assert_eq!(leadings.len(), parsed.blocks.len())with a length-checkfallback (that line panics on 13 tests today, unrelated to feature flags —
see Overlap check). It's been dropped: #696 already owns that fix, with a
more thorough root cause and its own tests, so this PR no longer touches
adapter.rs'sdebug_assert_eq!at all and is scoped to exactly what #697needs.
Why
--no-default-featuresis a real fallback configuration (documented perCargo.toml's own feature comments — each default feature has an off path
meant to build against an older vendor pin), so it needs to actually compile
for the fallback to mean anything.
Overlap check
GH-697-NO-DEFAULT-FEATURESheld bydaniel-parentthroughout(
python3 scripts/coord.py claims).gh pr list --search "no-default-features"/"render-pipeline": foundPR render-pipeline: a box argument's leading no longer depends on the build profile (#667) #696 (
agent/daniel-parent/debug-release-diverge, opened2026-09-16T05:34:50Z, before this claim) touching the exact same
debug_assert_eq!atadapter.rs:1308for the exact same 13 tests(
frame_env,letter_class_geometry,uline,underline_sout,xcolor_oracle), root-caused to the pinned vendor'sbox_inlinesnottruncating
block_par_leadingafter a\colorbox/\fcolorboxargument.My first commit on this branch independently reinvented a shallower version
of the same fix; I dropped it (second commit) once the overlap surfaced, so
this PR carries none of that change and won't conflict with render-pipeline: a box argument's leading no longer depends on the build profile (#667) #696 landing.
agent/daniel-parent/repin-evidence, opened2026-09-16T06:02:19Z), which touches the same
hash_math/shift_math/math_grids/math_glue_em/convert_math_classedmatch statements to adda different, off-by-default feature (
compiler-node-surface) forNucleus::TextRun/SideSet/Lapand newBlock/Inlinevariants aheadof a future vendor re-pin. That PR independently confirms this branch's
13-failures/
adapter.rs:1308finding (its own measured baseline: "469passed; 13 failed — the same 13 names"). It doesn't touch
amsmath-inlineor
--no-default-featuresat all, so there's no semantic conflict, only alikely textual one in these match blocks at merge time — flagging for
whoever integrates both.
Test results
All runs from
crates/render-pipeline, withCARGO_TARGET_DIR=/Users/dqi26/flashtex/target-ndf-verifyandCARGO_BUILD_JOBS=4(full totals, not fragments):This branch,
--no-default-features --no-fail-fast:(builds and runs cleanly — 0 compile errors; this is the headline fix)
This branch, default features,
--no-fail-fast:origin/main@9c5b028d, default features,--no-fail-fast, sametarget-dir convention (fresh worktree, its own target dir):
Both sets of 13 failures panic identically at
src/adapter.rs:1308:5'sdebug_assert_eq!, across the same 5 test files(
frame_env/letter_class_geometry/uline/underline_sout/xcolor_oracle) — left untouched here for #696 to fix, as above.Comparison: 469 == 469, 13 == 13 — 0 new failures, byte-identical to base
in the default configuration; the only change is that
--no-default-featuresnow compiles and passes at all.
One test,
incremental_output_is_byte_identical_over_200_edits_of_a_27_page_document,is genuinely slow (~330s) in both configurations — not hung, just slow;
cargo test's own 60s slow-test notice fires partway through.454 and 469 are different test sets, not one suite's pass rate moving.
Before the follow-up below,
--no-default-featurescompiled 458 test itemstotal (454 passed + 0 failed + 4 ignored) while default features compiled
486 (469 passed + 13 failed + 4 ignored): 28 fewer items, not 28 more
passes, because every test gated behind
amsmath-inline,math-class-overrideorpar-leadingwas entirely absent from the--no-default-featuresbinary rather than skipped. 454/458 and 469/486should not be read as the same denominator.
Follow-up (verification round): those 28 tests used to disappear from
--no-default-featuresinstead of reporting as ignored, which is exactlythe discrepancy above — a smaller, different test set that still prints a
plausible-looking "N passed" total. Converted every one (11 in
amsmath_inline.rs, 1 infrac_ord_spacing.rs, 1 inamssymb_braces.rs,2 in
big_delimiter_packages.rs, 3 inmath_symbols.rs, 9 inpar_leading_oracle.rs, 1 intabular_oracle.rs) from#[cfg(feature = "...")]to#[cfg_attr(not(feature = "..."), ignore = "requires the ... feature")],checking each one first: all use only render-pipeline's ordinary public API
(
FontSet,render(),positioned_math_glyphs, ...), never a symbol thatexists only under its feature, so all 28 compile and run (as ignored)
without their feature — none had to be left as
#[cfg]. Re-measured, bothconfigurations now compile the same 486 test items:
Unchanged: the pass/fail numbers and the 13
adapter.rs:1308failures (seeNot done). Changed:
--no-default-features's ignored count, 4 → 32 (28previously-invisible tests are now visible and correctly marked ignored).
Not touched:
math_spacers.rs'sglue_inside_a_fence_pair_is_set/glue_inside_a_fence_pair_stays_a_typed_limitationpair — two distinctlynamed tests that already assert the two mutually exclusive expected
behaviors (one per configuration), so neither is a silent gap.
Also worth restating given two lanes misread this today: the 13
adapter.rs:1308failures aredebug_assert_eq!s, so they vanish under--release— a green release run is not evidence they are fixed or absent.Not done
adapter.rs:1308failures — render-pipeline: a box argument's leading no longer depends on the build profile (#667) #696 owns that (see Overlapcheck).
cargo check -p flashtex-render-pipeline --no-default-featuresstepalongside the existing default-feature CI check, so this configuration
cannot silently rot again — recommending that as a follow-up for whoever
owns
.github/workflows/, rather than changing CI policy unilaterally here.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz