Skip to content

render-pipeline: re-pin the vendored compiler and tex-expansion to 4511166e - #829

Merged
d-q222 merged 2 commits into
mainfrom
chore/repin-vendor-compiler
Sep 17, 2026
Merged

d-q222 merged 2 commits into
mainfrom
chore/repin-vendor-compiler

Conversation

@d-q222

@d-q222 d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

The pipeline builds against frozen copies of its sibling crates. Both were at f0f86aaf, so merged work was inert in rendering. Four separate PR reviews today (#511, #514, #816, #820) flagged this as the reason a fix "doesn't reach users".

What moved

  • vendor/compiler: f0f86aaf → 4511166e (26 commits)
  • vendor/tex-expansion: f0f86aaf → 4511166e (7 commits); the pair shares one pin again

Byte-identity was verified in both directions for each: the old tree's entries match git ls-tree -r f0f86aaf apart from PIN, and diff -r --exclude=PIN against a fresh extraction of 4511166e is empty (644 and 448 files).

Now visible in rendering

Pipeline change: one call site, a diagnostic

adapter.rs in adapt (+14). #749's P::column_command warns that the compiler IR has no \@topnewpage model, so \twocolumn[<material>] "is typeset as ordinary text, brackets included". This pipeline is the renderer that has that box (split_top_material → Doc::top_material), so every banner document carried a warning describing output it does not produce. The [ now goes onto Doc::superseded, the mechanism abstract and toc::superseded_commands already use, in both branches. One diagnostic per \twocolumn[, not two.

No content is lowered lossily, nothing is stubbed, and no new unsupported_* limitation was added. No enum variant changed, so no exhaustive match moved.

Gates

  • cargo test --release --no-fail-fast on crates/render-pipeline: 631 passed, 0 failed, 2 ignored. twocolumn_banner went 4/13 → 13/13; it was failing on the diagnostic assertion alone, with every measured baseline still within 0.5bp of pdflatex.
  • Perf digest gate: --baseline … --check --require-same-host exits 0 with empty digest_mismatches across all fourteen cases. No digest moved, so no baseline was re-recorded.
  • The two remaining #[ignore]s are unrelated to any pin (a pipeline-side todo!(), and a slow 107-page test).

Docs

VENDORING.md: both rows rewritten with the new SHA, what each makes visible, and the previous pin kept in the historical chain; the intro list collapses the pair to one entry; the stale pdf entry is corrected to match its own row.

🤖 Generated with Claude Code

`vendor/compiler` was pinned at `f0f86aaf`, 26 `crates/compiler` commits
behind `main`, so merged compiler work was inert in the renderer. Re-pinned
to `main` (`4511166e`) with `git archive`, `PIN` updated, byte-identity
verified both ways: the old tree's 641 path/mode/blob entries match
`f0f86aaf:crates/compiler` apart from `PIN` (no local patch was dropped), and
`diff -r --exclude=PIN` against a fresh re-extraction is empty over 644 files.

`vendor/tex-expansion` moves with it, from `f0f86aaf` to the same SHA, 7
`crates/tex-expansion` commits. That half is **not** needed to compile -- the
new compiler type-checks against the old expansion engine -- but `cee66115`
memoizes `Lexer::rest_of_line_blank`, whose rescan of a long run of spaces is
a fuzz-found hang, and #700/#727 add `\newtheorem` to the engine outright (the
old copy has no `newtheorem` at all), so a colliding name is rejected with
LaTeX's own error, group-scoped, without disabling the working declaration. A
hang reachable from the renderer is worth more than a minimal diff. Verified
the same two ways over 448 files. No other vendored crate is touched.

Visible now: #509 relsize, #571 starred `\setlist*`, #721 preamble lengths
and `marginpar`, #791/#798 `\intertext` display math, `\pod`, `\allowbreak`,
and #700/#727 whole rather than half. Measured through the render path:
`\newtheorem{section}{Section}` in an `article` preamble now reports
`LaTeX Error: Command \section already defined.` and the document's own
`\section` still sets. No `parser::Block`/`parser::Inline` variant moved, so
no exhaustive match in the pipeline changed and both swaps built clean.

One pipeline change, in `adapter::adapt`: #749's review commit made the
compiler warn on the `[` of `\twocolumn[<material>]` that its own IR has no
`\@topnewpage` model, while leaving the tokens for a renderer that does. This
pipeline is that renderer, so the warning described output it does not
produce and `tests/twocolumn_banner.rs` dropped to 4/13 on the diagnostic
assertion alone, every measured baseline still within 0.5 bp of pdflatex. The
bracket now goes onto `Doc::superseded` both when the material is boxed (the
warning is false here) and when it is not (the typed `twocolumn_top_material`
limitation says it more precisely, and one diagnostic per `\twocolumn[` beats
two).

`cargo test --release --no-fail-fast` on `crates/render-pipeline`: 631 passed,
0 failed, 2 ignored, after each half of the swap. Both `#[ignore]`s stay --
one is the pipeline's own `scan \input'd preambles` `todo!()`, re-checked with
`--ignored` under this pin, the other is ignored for being slow. No perf-bench
digest moved after either half (`--check --require-same-host` exits 0 with no
`digest_mismatches`), so the baseline is untouched.

`VENDORING.md`: both rows rewritten, and the intro's stale `pdf` SHA
corrected to `a9ec24a9` to match that directory's `PIN`.

Implementation-Agent: Claude Opus 5 (daniel-parent subagent)
Commit-Executor: daniel-parent (Claude Opus 5)
Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… case supersedes too)

Implementation-Agent: daniel-parent (Claude Opus 5)
Commit-Executor: daniel-parent (Claude Opus 5)
Co-authored-by: Claude Opus 5 <[email protected]>
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 7bf609f6, APPROVE, no material findings. The reviewer verified rather than accepted every claim: byte-identity in both directions and at the git-tree level (modes and blob SHAs, 644 and 448 entries), the pre-image proved clean so no local patch was silently dropped, and the perf gate cross-checked against the JSON because a missing digest is only a warning — 215/215 digests matched over 26 cases, 0 missing. No test file changed, so the banner suite going 4/13 → 13/13 cannot come from relaxed assertions.

The one code note, a stale comment saying the unboxed case keeps the warning, is fixed in 82ff4f53. Merging now.

PR #829 — re-pin vendored compiler + tex-expansion to 4511166e

Independent read-only review. Head 7bf609f6531c68a6f157cd460e20f650ca25b4ae
(one commit on top of origin/main), reviewed in a detached worktree at
~/flashtex-wt/review-829. Nothing posted, committed or pushed.

MATERIAL findings

None.

Every claim I was asked to verify held up against the repository, including
the two I initially read as failing (see notes 5 and 6 — both were my
misreading, and I record the disproof so the next reviewer does not repeat it).

What was verified, and how

1. Byte-identity of both vendored directories — PASS

diff -r --exclude=PIN against a fresh git archive extraction of
4511166e is empty for both directories.

Because diff -r compares neither file modes nor symlink-vs-regular, I also
compared the git trees, which carry mode, type and blob SHA:

diff <(git ls-tree -r 4511166e:crates/compiler       | grep -v $'\tPIN$') \
     <(git ls-tree -r HEAD:crates/render-pipeline/vendor/compiler | grep -v $'\tPIN$')
  • vendor/compiler: 644 entries, identical apart from PIN.
  • vendor/tex-expansion: 448 entries, identical apart from PIN.

Both PIN files hold the full 40-character SHA
4511166e34909b8d943a178616ecfd4deb0a7478, and 4511166e is an ancestor of
origin/main (git merge-base --is-ancestor exits 0), so the pin is behind
main, never ahead of it, as VENDORING.md's intro requires.

No other vendor directory changed. The complete file list touched by this
commit is:

  • crates/render-pipeline/vendor/compiler/** (15 files incl. PIN)
  • crates/render-pipeline/vendor/tex-expansion/** (5 files incl. PIN)
  • crates/render-pipeline/vendor/VENDORING.md
  • crates/render-pipeline/src/adapter.rs

No Cargo.toml or Cargo.lock anywhere in the tree changed, so the re-pin
introduces no dependency movement and --locked is meaningful.

I additionally verified the outgoing side, which is what would actually
hide a hand-edit: the pre-image (HEAD~1) vendored directories are
themselves byte-identical to f0f86aaf (641 and 448 tree entries, mode and
blob SHA, PIN excluded). So no local patch existed in the old snapshot that
this swap could have silently dropped. This matches the numbers VENDORING.md
states (641 old / 644 new, 448 / 448).

2. The adapter change — CORRECT

crates/render-pipeline/src/adapter.rs, +14 lines, no deletions, two
superseded.push call sites. Both branches are right, and the
"exactly one diagnostic" property holds in every case I could construct.

Is the compiler's warning genuinely wrong for this renderer?
vendor/compiler/src/parser.rs:3725 column_command warns, on the [ of
\twocolumn[, that its IR has no \@topnewpage model and the material "is
typeset as ordinary text instead, brackets included". It deliberately leaves
the bracket tokens in place so a renderer that does have the box can cut
them back out. adapter.rs:2348 split_top_material is that cut. When it
returns Some, the material really was boxed and the warning describes output
this pipeline does not produce, so suppressing it is correct.

Could it hide a genuine "material not boxed" case? No.
split_top_material (adapter.rs:2499) is conservative in every branch that
could lose material — it returns None, leaving blocks untouched, when:

  • any material block ends at or before the [ (hi <= open) — the command
    was not the page's first material, so \@topnewpage never ran;
  • a non-Paragraph block straddles a bracket;
  • a block up to the ] has no range in this document (block_range(..)?,
    i.e. \input inside the argument);
  • split_parts cannot cut a paragraph's parts exactly;
  • anything other than Paragraph/Rule/Picture ended up in the box
    (adapter.rs:2590), which is the guard against Context::box_blocks dropping
    page-level material with a warning of its own.

The only blocks skipped by is_material (adapter.rs:2484) are Chrome,
ClearPage and NoBreakFalse — page-style commands and \clearpage, which
contribute nothing to the vertical list and may legitimately stand on either
side of the box. So Some(_) really does mean "boxed exactly", and the
suppression cannot mask an unboxed case.

The \twocolumn[] case returns Some(Vec::new()) and still supersedes. That
is right: the brackets are removed from the column text, so the compiler's
"brackets included" warning would be describing output that is not produced.

Exactly one diagnostic per \twocolumn[ — confirmed for all four shapes:

case compiler warning pipeline limitation total
boxed (split_top_material → Some) superseded none 0 (correct: output matches LaTeX)
not boxed (boxed != Some(open)) superseded at open twocolumn_top_material at (end, end) 1
one-column geometry (two_column false) superseded twocolumn_top_material 1
no bracket per \@ifnextchar never emitted none 0

The last row is the one that could have gone wrong, and does not. The two
sides agree on what counts as a bracket: columns::optional_bracket
(columns.rs:195) allows spaces, tabs, \r and at most one \n, returning
None on a blank line; the compiler's peek_bracket_span uses skip_spaces
(parser.rs:10393), which skips only Space and Comment tokens and therefore
stops at the \par a blank line produces. Neither warns. Test
a_blank_line_before_the_bracket_is_plain_text_not_a_warning
(tests/twocolumn_banner.rs:326) pins this.

The one divergence I found is safe: \twocolumn %c\n[X]. The compiler skips
the Comment token and warns; optional_bracket hits % and returns None,
so the pipeline neither boxes nor supersedes. The material really is set as
ordinary text there, so the surviving compiler warning is accurate, and the
count is still one.

Is Doc::superseded the right mechanism? Yes. It is the same Vec<Span>
that abstractenv::apply (abstractenv.rs:321/336/366), listings::apply
(listings.rs:886/888) and the size_envs pass (adapter.rs:2274) already push
into, consumed by one retain at lib.rs:302-308. toc::superseded_commands
is a different path (the is_superseded closure at lib.rs:265, applied
before that retain) — the PR body lumps the two together, but the doc comment
on Doc::superseded (adapter.rs:824-827) already describes them that way, so
this is house style rather than an error.

Document-id and byte correctness. Both pushes use DocumentId(entry)
(the first via the local document binding, adapter.rs:2347) and
source = texts[entry] (adapter.rs, top of adapt_cached), so the byte
offsets and the document id refer to the same text. Both open values come
from the same columns::optional_bracket computation — branch A through
ColumnMode::top_material (columns.rs:465), branch B directly
(adapter.rs:2372) — so they cannot disagree on which byte is the [.

3. Claimed behaviour changes — both spot-checks PASS

Lexer hang fix — present in the new copy, absent from f0f86aaf.
vendor/tex-expansion/src/lexer.rs replaces

fn rest_of_line_blank(&self) -> bool {
    self.src.as_bytes()[self.pos..].iter().take_while(|&&b| b != b'\n' && b != b'\r').all(|&b| b == b' ')
}

with a memoized &mut self version carrying blank_probe: Option<(usize, usize, bool)>.
The pre-image is byte-identical to f0f86aaf:crates/tex-expansion, so the fix
is genuinely absent there.

I checked the memoization for correctness, since it is an engine change that
now reaches users, and it is sound in all three stored shapes:

  • (pos, i, false) where i is the first non-space: every byte in pos..i
    is a space, so any probe from pos..=i correctly answers false
    (including pos == i, where the byte itself is non-space).
  • (pos, i, true) where i is the \n/\r: any probe from pos..=i
    answers true; at pos == i the original take_while is empty and
    all() is vacuously true, so the two agree.
  • (pos, len, true) at end of buffer: same reasoning.

Staleness is impossible: src is an immutable Rc<str>, and pos only
moves forward (every assignment in the file is += or = self.src.len()),
so a probe on the next line has pos > floor and rescans. Lexer::resume
sets blank_probe: None. Scanned ranges across rescans are disjoint, so the
claimed O(line length) bound holds.

\newtheorem is genuinely new — in the expansion engine. This is the
claim I first read as false, and it is not; the detail matters enough to
record:

  • f0f86aaf:crates/tex-expansion contains no newtheorem at all
    (git grep -i newtheorem exits 1).
  • 4511166e:crates/tex-expansion/src/expand.rs adds
    ("newtheorem", Primitive::NewTheorem) (line 341), do_newtheorem
    (line 3141) and the collision error
    LaTeX Error: Command \<name> already defined. (lines 2509, 3202), plus
    six new tests in tests/expand_tests.rs:741-801.

So \newtheorem{section}{Section} reporting Command \section already defined.
is a real new behaviour reaching the render path, and "stops being half-landed"
is exactly right: the compiler half had landed, the expansion half had not.

Note for future verifiers: the compiler half was not half-landed and did
not move. f0f86aaf:crates/compiler already had full \newtheorem support
(parser.rs, supported.rs, theorems.rs, vocabulary.rs,
tests/amsthm.rs), and across the two pins P::new_theorem and theorems.rs
are byte-identical; tests/amsthm.rs gains 99 lines of tests and no
production change. Grepping the compiler alone makes the PR's wording look
false. It is about the expansion engine, where VENDORING.md's
tex-expansion row states it precisely.

4. Regressions — PASS

See "Tests run" below. 631/0/2, twocolumn_banner 13/13, perf gate exit 0
with zero digest movement.

One structural check worth recording: no test file anywhere in
crates/render-pipeline/tests/ was modified by this PR
(git diff --name-only
over that directory is empty), and twocolumn_banner.rs contains exactly 13
#[test] functions. So the 4/13 → 13/13 improvement cannot have come from
relaxed assertions; it is produced by the re-pin and the adapter change alone.

5. Docs — PASS

Only the compiler and tex-expansion rows changed; no row was added or
removed, and every other row is byte-identical.

  • compiler: 4511166e (was f0f86aaf) — SHA matches PIN and the tree.
    "26 crates/compiler commits" matches git rev-list --count f0f86aaf..4511166e -- crates/compiler = 26.
    641/644 entry counts match my own measurements.
  • tex-expansion: 4511166e (was f0f86aaf) — "7 crates/tex-expansion commits"
    matches git rev-list --count = 7. 448/448 matches.
  • Previous pins are preserved verbatim: each new row contains its entire
    predecessor row body under "Previously f0f86aaf on main, whose row still
    read as follows", verified by exact substring containment of the HEAD~1
    row text. The historical chain back to 8a8a22b4 and c95977d6 is intact.
  • The intro's stale pdf bffd168a → a9ec24a9 correction is right: the
    pdf row itself already read a9ec24a9 before this PR and is unchanged.

Non-blocking notes

  1. adapter.rs:2356-2357 — the comment contradicts the code it points at.
    "The unboxed case below keeps it and adds twocolumn_top_material." The
    unboxed case does not keep the compiler's warning: adapter.rs:2388
    supersedes it there too, which is the whole point of the second hunk (and
    its own comment says so — "this typed limitation replaces it"). Suggest
    "The unboxed case below replaces it with twocolumn_top_material." A
    future reader trusting this comment would believe two diagnostics survive
    the unboxed path.

  2. PR body: "all fourteen cases" understates the gate. The harness
    compared 26 cases and 215 digests. The gate is stronger than advertised,
    but the number should be corrected so a later reviewer diffing case counts
    does not think coverage shrank.

  3. PR body: "the intro list collapses the pair to one entry." The intro
    already listed compiler/tex-expansion as a single entry before this
    PR; only the SHA inside it changed. Harmless, but it is not a change.

  4. Doc::superseded matches on start byte and path only (lib.rs:302-308:
    r.start_byte == s.start && paths.get(s.document.0) == Some(&*r.path)),
    with no message or end-byte check, and it drops a diagnostic if any of its
    source ranges matches. So any unrelated compiler diagnostic whose span
    starts on the same [ byte in the entry file would also be suppressed.
    I could not construct a realistic case — peek_bracket_span returns the
    span of the [-initial word token, and diagnostics on ordinary word text
    are rare — and this imprecision is pre-existing and identical for
    abstract, listings and size_envs, so it is not introduced here.
    Recorded only because it is the mechanism's weakest point and this PR adds
    two more users of it. A message-aware match would be strictly tighter.

  5. Reviewer trap, recorded for the next pass: grepping newtheorem against
    f0f86aaf:crates/compiler makes the PR's \newtheorem bullet look false.
    The claim is about crates/tex-expansion. See section 3.

Tests run

All on this worktree, release profile, shared target dir
~/flashtex-wt/review-target, one cargo invocation at a time.

  1. cd crates/render-pipeline && nice -n 15 env CARGO_BUILD_JOBS=3 CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target cargo test --release --locked --no-fail-fast
    → exit 0. 631 passed, 0 failed, 2 ignored across 29 binaries, matching
    the PR exactly. The two ignored are unrelated to any pin:
    adapter::tests::preamble_scan_does_not_see_input_files (pipeline-side
    todo!() at adapter.rs:7602) and
    incremental_output_is_byte_identical_over_30_edits_of_a_107_page_document
    (marked slow).
    twocolumn_banner: 13 passed, 0 failed, 0 ignored.

  2. cd crates/perf-bench && cargo build --release --locked, then
    flashtex-perf-bench --baseline baselines/linux-x86_64-ryzen7-7800x3d.json --check --require-same-host
    → exit 0, OK: 549 metrics compared, no regression.

    I did not take that at face value, because report.rs:581 makes a missing
    digest a warning rather than a failure, so an all-missing run would pass
    vacuously. Cross-checking the emitted JSON against the committed baseline
    directly:

    215 baseline digests over 26 cases — 215 matched, 0 missing, 0 mismatched,
    unmeasured: []. Digest comparison at report.rs:577-582 is unconditional
    on host, and gate_failed (report.rs:620-626) fails on any digest
    mismatch regardless of require_same_host, so this is a real gate. No
    digest moved; no baseline was re-recorded, correctly.

    Timing deltas are not evidence here and the harness says so itself: the host
    fingerprint differs (linux/x86_64 Ryzen 7 7800X3D → macos/aarch64 Apple M5
    Pro) and peak 1-minute load was 1.4 for the baseline versus 5.1 for this
    run. --require-same-host is what makes that non-fatal. The mem.*
    "metric missing from this run" warnings are memory metrics unavailable on
    this platform, not digests.

Verdict rationale

The substance of this PR — the part that is trust-critical — is exactly what
it claims: both vendored trees are unmodified git archive output at
4511166e, verified at the tree level (path, mode, blob SHA), in both
directions, with the pre-image proven clean so no local patch could have been
dropped. The adapter change is 14 additive lines, correct in both branches,
using the established mechanism, and it cannot mask an unboxed case. Tests and
the digest gate are green on measurements I reproduced rather than accepted.

The four non-blocking notes are one stale code comment and three wording
imprecisions in the PR description; none changes behaviour and none should
hold the merge.

VERDICT: APPROVE

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