Repository navigation
compiler: diagnose \0-\9 control symbols instead of silently typesetting them - #838
Conversation
…ing them (Ross corpus finding) A real user typo (Ross corpus set7.tex:206, `$\2^9 - 1$` for `$2^9 - 1$`) compiled with zero diagnostics, silently typesetting "2 9 - 1" where pdflatex reports "! Undefined control sequence" and the student never learns their input didn't mean what they thought. Root cause: the lexer maps every backslash+non-letter to a one-character control-symbol word, correct for real commands like \%, \, and \' but also silently accepted for \0-\9, which no LaTeX layer defines. New Diagnostic::undefined_control_symbol reports it as unknown_command with a mechanical suggestion (a digit has exactly one reading, unlike a mistyped name with several close neighbours) while keeping the same rendered output, so recovery behavior is unchanged and only the missing diagnostic is added. This is the fix from a slice comparing FlashTeX's error-recovery quality against pdflatex's own on 5 real typo shapes from a real user's homework corpus; two other cases (a tie-break preference and an unbounded did-you-mean list) were reported but not fixed here, as recovery- architecture changes with broader blast radius. Tests: cargo test --locked --test recovery backslash_digit -> 1 passed. Full cargo test --locked for crates/compiler: 0 failed. Needs a crates/render-pipeline/vendor/compiler re-pin to reach users; no render-pipeline code touched. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ross-recovery, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: d-q222 <[email protected]>
|
Independent review: APPROVE. Over-triggering — the main risk for an error-recovery change — passed. The reviewer built a probe harness against the real crate and checked the legitimate constructs:
It independently confirmed in real pdflatex that both of those are legal and compile cleanly, which is exactly the false-positive risk this class of change carries. All of Test authenticity verified by revert, not taken on trust: reverting One wording nit, non-blocking. The body says rendered output is "unchanged". True relative to before-PR FlashTeX — but measured, pdflatex in Correction to the reviewer's vendor figure, since it affects planning. It reported The substantive point stands regardless: this fix touches only Base is 12 commits behind main but with no file overlap; |
Summary
set7.tex:206):$\2^9 - 1$for$2^9 - 1$compiled with zero diagnostics, silently typesetting "2 9 − 1" — the student never learns their input didn't mean what they thought. pdflatex reports! Undefined control sequencefor\2.\%,\,,\', …) but also silently accepted for\0-\9, which no LaTeX layer defines.Diagnostic::undefined_control_symbolreports the digit case asunknown_commandwith a mechanical suggestion (a digit has exactly one reading, unlike a mistyped name with close neighbours). Rendered output is unchanged — only the missing diagnostic is added.This is one fix out of a slice comparing FlashTeX's error-recovery quality against pdflatex's own on 5 real typo shapes from a real user's homework corpus (assignment context: issue #2 / Ross corpus). Two other findings from the same comparison are reported but not fixed here (broader-blast-radius recovery-architecture changes):
\cdotg→ suggests\cdotsinstead of\cdot g)Test plan
cargo test --locked --test recovery backslash_digit→ 1 passed (new test, real typo shape, checks span/suggestion/replacement identity and content survival;\%/\,verified still silent)cargo test --lockedforcrates/compiler→ 0 failedcrates/compiler/RECOVERY.mdregenerated via the repo's own generator (purely additive diff)crates/render-pipeline/vendor/compilerre-pin to reach users; norender-pipelinecode touched.🤖 Generated with Claude Code