Repository navigation
Conversation
… display conversion
`display::Diagnostic::from_compiler` rewrote every compiler diagnostic's
`code` to the literal `"compiler"`, discarding the category the compiler had
already computed. Consequences, in order of severity:
- `docs/contracts/runtime-v1.md` enumerates six legal `code` values
(`unknown_command`, `unsupported_feature`, `syntax_error`,
`export_limitation`, `fidelity_note`, `recovered_input`) and instructs
consumers to "classify by `code`, not by `message` wording". The display
producer emitted a seventh value, outside that enumeration, for every
compiler diagnostic -- so every consumer was forced into exactly the
message-substring matching the contract forbids. This is a conformance fix,
not a new wire field: `code` already exists and is already serialised
(`v1.rs:310`, `display.rs:1153`), and the compiler already carries
`Option<DiagnosticCode>` and serialises it correctly on its own route.
- Any assertion keyed on a specific code could never match a compiler
diagnostic. `amsmath_inline.rs`'s `assert_no_limitation_or_unsupported`
filters `code == "math_limitation" || code.starts_with("unsupported")`,
which a compiler `unsupported_feature` would have matched -- so that gate
was structurally incapable of failing on compiler output.
The compiler's code is now preserved verbatim; `"compiler"` remains only as
the fallback for a diagnostic the compiler itself left uncoded (`code: None`),
keeping the field non-empty. The `Severity` match is made exhaustive so a
future compiler variant fails to compile rather than silently becoming a
warning.
`Origin::{Pipeline, Compiler}` is added to `display::Diagnostic`, NOT
serialised. `code` cannot double as an origin marker once it carries real
categories, and one test depended on it doing so -- see below.
## The fixtures the restored gate exposed
`tests/amsmath_inline.rs`'s `doc()` helper wrote a bare
`\documentclass{article}` preamble, so nine of its eleven fixtures were
documents real LaTeX rejects outright. Verified with pdflatex (TeX Live 2025)
as an oracle, never in the product path:
\binom \dfrac \tfrac \substack \operatorname \operatorname* \genfrac
-> "! Undefined control sequence"
smallmatrix -> "! LaTeX Error: Environment smallmatrix undefined"
dcases -> "! LaTeX Error: Environment dcases undefined"
(still undefined with amsmath alone -- it is mathtools')
\bigl/\bigr, \phantom -> kernel commands, compile bare
An engine whose contract is matching pdflatex cannot claim a construct
"typesets cleanly" from a document pdflatex refuses to typeset at all. The
helper now loads `amsmath`, and the `dcases` fixture `mathtools`.
Declaring the package makes the compiler emit its own preamble warning
("packages amsmath are recognised but not implemented", spanning the
`\usepackage` line). That is about package machinery, not about whether
`\binom` set correctly, so the assertion is now scoped to diagnostics whose
source range overlaps the body. A construct-level `unsupported_feature` still
fails, and the predicate additionally catches `unknown_command` and
`syntax_error`, which do not share the `unsupported` prefix and are exactly
how an unrecognised construct arrives.
Negative control, run before and after, to prove the gate is no longer
vacuous (all three were invisible as `"compiler"` before):
$\binom{n}{k}$ -> [] (clean)
$\binom{n}{k}\notarealcommandxyz$ -> unknown_command
$\binom{n}$ -> syntax_error ("\binom requires an argument")
preamble package warnings -> not flagged (correctly out of body scope)
## tikz_pipeline.rs
`assert!(d.code != "compiler")` was the only gate on `lib.rs`'s `in_picture`
suppression -- its real predicate is "no diagnostic here came from the
compiler", which worked only because `from_compiler` stamped that literal on
everything. With codes preserved, a leaked `\draw` arrives as
`unsupported_feature` (all of `\draw`/`\node`/`\fill` are in the compiler's
known vocabulary) and the old form would pass silently, going dark on exactly
the regression it exists to catch. It now asserts `origin == Origin::Pipeline`,
which is stable under any future code-vocabulary change.
Same file: it was the last test in the suite still using the raw
`latin_modern_available()` probe instead of `common::lm_available()`, so it
skipped silently on a fontless run. That is very likely why the stale
assertion went unnoticed locally -- CI sets `FLASHTEX_FONT_DIRS`, local runs
did not.
## Gates
- amsmath oracle corpus: 59/59 within 0.5 bp, 0 font-FAILURE diagnostics.
Unaffected by design -- `oracle.py` selects on `severity == "error"`, which
was never flattened.
- HW1: 3 pages, 0 errors, 0 overfull, 0 font failures. HW2: same.
- Real-world corpus (10 fixtures): 0 font-FAILURE diagnostics total; page
counts and statuses unchanged.
- `crates/render-pipeline` suite: 205 passed / 0 failed, vs a same-base
control of 203 passed / 2 failed. The two control failures
(`font_family_fixtures_match_pdflatex`, `footnotes_against_pdflatex`) are
flaky under full-suite parallelism on a loaded box: both pass in isolation
on the control tree AND on this branch. Not attributable to this change in
either direction. This change adds no failures.
No vendor file is touched: `vendor/compiler` already carries `code`.
Implementation-Agent: claude-opus-5 (engine lane, linux-primary)
Commit-Executor: claude-opus-5 direct git (Cursor usage limit fallback)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Co-authored-by: GoKubar <[email protected]>
This was referenced Sep 15, 2026
Contributor
Author
|
Closing as superseded — the work is already on Replacement: 906ac8f "forward the compiler's diagnostic code... (#277) (#354)" Closed by the integration lane while clearing a 219-PR backlog (112 of them drafts). If this is wrong, reopen it and tell me — I would rather be corrected than leave stale work buried. — orchestrator-astra (Commander) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
render-pipeline: preserve the compiler's diagnostic codes through the display conversion
display::Diagnostic::from_compilerrewrote every compiler diagnostic'scodeto the literal"compiler", discarding the category the compiler hadalready computed. Consequences, in order of severity:
docs/contracts/runtime-v1.mdenumerates six legalcodevalues(
unknown_command,unsupported_feature,syntax_error,export_limitation,fidelity_note,recovered_input) and instructsconsumers to "classify by
code, not bymessagewording". The displayproducer emitted a seventh value, outside that enumeration, for every
compiler diagnostic -- so every consumer was forced into exactly the
message-substring matching the contract forbids. This is a conformance fix,
not a new wire field:
codealready exists and is already serialised(
v1.rs:310,display.rs:1153), and the compiler already carriesOption<DiagnosticCode>and serialises it correctly on its own route.diagnostic.
amsmath_inline.rs'sassert_no_limitation_or_unsupportedfilters
code == "math_limitation" || code.starts_with("unsupported"),which a compiler
unsupported_featurewould have matched -- so that gatewas structurally incapable of failing on compiler output.
The compiler's code is now preserved verbatim;
"compiler"remains only asthe fallback for a diagnostic the compiler itself left uncoded (
code: None),keeping the field non-empty. The
Severitymatch is made exhaustive so afuture compiler variant fails to compile rather than silently becoming a
warning.
Origin::{Pipeline, Compiler}is added todisplay::Diagnostic, NOTserialised.
codecannot double as an origin marker once it carries realcategories, and one test depended on it doing so -- see below.
The fixtures the restored gate exposed
tests/amsmath_inline.rs'sdoc()helper wrote a bare\documentclass{article}preamble, so nine of its eleven fixtures weredocuments real LaTeX rejects outright. Verified with pdflatex (TeX Live 2025)
as an oracle, never in the product path:
An engine whose contract is matching pdflatex cannot claim a construct
"typesets cleanly" from a document pdflatex refuses to typeset at all. The
helper now loads
amsmath, and thedcasesfixturemathtools.Declaring the package makes the compiler emit its own preamble warning
("packages amsmath are recognised but not implemented", spanning the
\usepackageline). That is about package machinery, not about whether\binomset correctly, so the assertion is now scoped to diagnostics whosesource range overlaps the body. A construct-level
unsupported_featurestillfails, and the predicate additionally catches
unknown_commandandsyntax_error, which do not share theunsupportedprefix and are exactlyhow an unrecognised construct arrives.
Negative control, run before and after, to prove the gate is no longer
vacuous (all three were invisible as
"compiler"before):tikz_pipeline.rs
assert!(d.code != "compiler")was the only gate onlib.rs'sin_picturesuppression -- its real predicate is "no diagnostic here came from the
compiler", which worked only because
from_compilerstamped that literal oneverything. With codes preserved, a leaked
\drawarrives asunsupported_feature(all of\draw/\node/\fillare in the compiler'sknown vocabulary) and the old form would pass silently, going dark on exactly
the regression it exists to catch. It now asserts
origin == Origin::Pipeline,which is stable under any future code-vocabulary change.
Same file: it was the last test in the suite still using the raw
latin_modern_available()probe instead ofcommon::lm_available(), so itskipped silently on a fontless run. That is very likely why the stale
assertion went unnoticed locally -- CI sets
FLASHTEX_FONT_DIRS, local runsdid not.
Gates
Unaffected by design --
oracle.pyselects onseverity == "error", whichwas never flattened.
counts and statuses unchanged.
crates/render-pipelinesuite: 205 passed / 0 failed, vs a same-basecontrol of 203 passed / 2 failed. The two control failures
(
font_family_fixtures_match_pdflatex,footnotes_against_pdflatex) areflaky under full-suite parallelism on a loaded box: both pass in isolation
on the control tree AND on this branch. Not attributable to this change in
either direction. This change adds no failures.
No vendor file is touched:
vendor/compileralready carriescode.Implementation-Agent: claude-opus-5 (engine lane, linux-primary)
Commit-Executor: claude-opus-5 direct git (Cursor usage limit fallback)
Co-Authored-By: Claude Opus 5 [email protected]
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Co-authored-by: GoKubar [email protected]