Skip to content

compiler: structured diagnostics — optional labels, notes and help with a replacement edit; real help on the top messages (#277 parts 1+3) - #346

Closed
d-q222 wants to merge 13 commits into
mainfrom
agent/daniel-parent/structured-diagnostics
Closed

d-q222 wants to merge 13 commits into
mainfrom
agent/daniel-parent/structured-diagnostics

Conversation

@d-q222

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

Copy link
Copy Markdown
Contributor

#277 parts (1) and (3), claim GH-277-compiler, assigned by the Commander on #2 at 06:38Z. Implemented by a Cursor worker (Grok 4.6 high) and reviewed by daniel-parent in two passes (review notes on #277).

Stacked on #305 (daniel-vpclaude: \maketitle without \author, unsupported text commands), merged in at e9dd0117 so the help text lands on #305's messages. Until #305 merges, this diff includes #305's commits.

Proposal (additive)

protocol/proposals/runtime-v1-structured-diagnostics.md adds optional fields to each runtime-v1 diagnostic, each omitted when empty and never null:

  • labels[{source:{path,start_byte,end_byte}, text, primary}]
  • notes[string]
  • help{message, replacement?{source:{path,start_byte,end_byte}, text}}

replacement carries its own source because a fix can target a different document than the diagnostic, such as an included file. Frozen contracts and schemas are not edited. Existing consumers see byte-identical JSON.

Compiler

  • Diagnostic fields: labels, notes and help with builders (with_label, with_note, with_help, with_optional_help, with_replacement). shift_diagnostics remaps label and replacement spans on incremental edits.
  • Help on the high-frequency messages:
    • an unsupported command names the package, or says to wrap it in math;
    • a typo gets "did you mean";
    • recognised-but-unimplemented packages;
    • missing $, } or ];
    • a script marker outside math;
    • \frac or \sqrt outside math;
    • an undefined \ref names the nearest existing label: "a label near exists; did you mean \ref{near}?";
    • an included file not found lists the paths tried;
    • an unimplemented environment names its package;
    • a known text command used in math mode;
    • a missing \author or \title.
  • Help that only restated the message was removed.
  • One mechanical fix end to end: \alpah gets help.message "did you mean \alpha?" with replacement on the exact command span. The existing suggestion field is unchanged. mac: Problems panel reads structured diagnostics — code grouping, notes/help rows, Fix… from help.replacement (#277 part 4) #345's Mac Fix… applies this shape.

Review outcomes

  • Whitespace churn: crates/compiler/src went from 526+/186− (422+/82− ignoring whitespace) to 537+/61− (536+/60−).
  • recovery.rs: message strings are unchanged.

Tests (CARGO_TARGET_DIR isolated)

  • --lib: ok. 305 passed; 0 failed
  • --test diagnostic_codes: ok. 8 passed; 0 failed, including JSON with/without the new fields, replacement shape, and \alpah
  • --test recovery: ok. 5 passed; 0 failed; 1 ignored
  • --test supported_latex: ok. 8 passed
  • --test maketitle: ok. 14 passed
  • The incremental test covers label and replacement spans shifting with an edit before them; an overlapping edit returns None.
  • Full crate suite: robustness::deeply_nested_input_does_not_blow_the_stack overflows the stack in a debug build. It fails the same way on main: the worker ran a control on f9bab2a7, and daniel-parent re-ran it on 8f83ab5c. Not caused by this PR.

Not in this PR

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

d-q222 and others added 12 commits September 13, 2026 21:45
…xt commands stop blaming math mode

GH#244, both parts.

A. latex.ltx defines `\def\@author{\@latex@warning@no@line{No \noexpand\author
given}}`, so a missing \author is a warning and the title block is still set.
This compiler refused to produce any block and raised an error instead.
- A missing \author now gives the warning "No \author given" and the title
  block, with no author line.
- `\author{}`, or only blank \and slots, is an author that is given but
  empty. pdfLaTeX sets it silently, so there is no diagnostic.
The issue asked for a warning in the \author{} case; the pdflatex oracle
says there is none.

pdflatex 1.40.29 oracle, `\the\pagetotal` after \maketitle:
  \author{A}  116.86673pt, no warning
  \author{}   115.33337pt, no warning
  no \author  116.86673pt, "LaTeX Warning: No \author given."
The v1 layout still advances the author line in both empty cases. The 1.53 pt
that pdfLaTeX gives back for \author{} is recorded, not modelled.

B. Parser::unsupported is the text-mode fallback, but every message it
emitted ended with "; unrestricted TeX math mode is not implemented". The
message is now "\X is not supported by this compiler version".
tests/acceptance.rs' "math ... reported" assertion was satisfied only by that
misleading suffix on \tikz ($x^2$ has been implemented for a long time); it now
asserts that nothing mentions math mode.

Regenerated with their own ignored generators: RECOVERY.md and
UNSUPPORTED.md. UNSUPPORTED.md also picks up an \includegraphics message that
had changed earlier without a regen.

Product path (parser.rs applied to render-pipeline/vendor/compiler locally,
then reverted): fixtures/real-world/math-sheet goes from 1 error to 0 errors,
7 warnings, 2 pages (the reference has 2). HW1 stays at 3 pages / 0 errors / 7
warnings and HW2 at 3 / 0 / 8.

Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan)
Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback)
Co-authored-by: d-q222 <[email protected]>

Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ
Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan)
Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback)
Co-authored-by: d-q222 <[email protected]>

Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ
Add protocol/proposals/runtime-v1-structured-diagnostics.md only. Optional
labels (runtime-v1 source spans + text + primary), notes[], and help
{message, replacement?: {start_byte,end_byte,text}} on each diagnostic.
message stays one line without recovery; omitted fields keep JSON
byte-identical. Frozen contracts and schema are untouched.

Ran: none (docs-only checkpoint). Next: merge origin/agent/daniel-vpclaude/maketitle-no-author if it still touches Parser::unsupported, then Diagnostic fields, then the first ~20 helps.

Open questions: render-pipeline from_compiler does not forward these fields (or code); CLI #303 and the Mac pipeline path need a later re-pin, out of this lane.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
PR #305 (agent/daniel-vpclaude/maketitle-no-author @ 2c09f78) changes
Parser::unsupported message text and maketitle-without-author. Merge it
before rewriting those diagnostics with help, as the issue coordination
requires.

Control on unmodified compiler (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 299 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test diagnostic_codes: test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test recovery: test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- --test supported_latex: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Skipped deeply_nested_input_does_not_blow_the_stack (not in these targets).

Next: Diagnostic optional labels/notes/help fields and JSON omit-when-empty.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Compiler Diagnostic gains labels, notes, and help (empty by default).
JSON emits them only when set; unset diagnostics stay byte-identical.
Incremental mapping shifts label and replacement spans. Merged #305 first
so Parser::unsupported text is the post-maketitle wording.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test diagnostic_codes: test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test recovery: test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- --test supported_latex: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: rewrite the first ~20 highest-frequency messages with a real help.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Attach optional help (and a primary label where it captions the span)
without changing message text. Unsupported commands name package or math
mode; packages/environments say what to do; missing $ / } / ] and script
markers / \frac get wrap-or-close advice; undefined \ref offers the nearest
\label by edit distance; missing includes name the paths tried. Built on
the #305 Parser::unsupported wording. No recovery.rs message strings
changed.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test diagnostic_codes: test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test recovery: test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- --test supported_latex: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test maketitle: test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: none in this lane unless daniel-parent asks; pipeline/CLI/Mac still need a re-pin and part (4).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Restore original `push(Diagnostic::...)` line shape and hang `.with_help`
/ `.with_label` on the next line, instead of re-indenting the constructor
arguments by four spaces. Restore the `rejected entry_path` struct literal
to its original indent (only the three new fields added).

crates/compiler/src vs merge-base origin/main:
- git diff: 347 insertions(+), 59 deletions(-)
- git diff -w: 346 insertions(+), 58 deletions(-)
Previously 526+/186- vs 422+/82-. Remaining 1-line gap is expansion.rs
include-not-found, which changed skip() to Diagnostic::error (not whitespace).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: emit help.replacement as {source, text} via source_json.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
Replacement uses the same source object as labels[].source (path,
start_byte, end_byte) plus text, so it can target a different document
than the diagnostic (e.g. an included file). Proposal records why; the
JSON test asserts the new shape.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib diagnostics:: : test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 297 filtered out

Next: drop help that restates the message; real help or none.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
`\foo is not supported in math mode` no longer gets `\foo is not
implemented in math mode`. Known text commands get a mode hint (`\foo is
a text command; use it outside math or inside \text{...}`); otherwise no
help. command_help/environment_help now return Option: package or
did-you-mean or spelling hints stay; generic "recognised but
unimplemented" restatements are omitted.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib vocabulary:: : test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 297 filtered out
- --test diagnostic_codes: test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: undefined \ref wording should point at \ref{near}, not \label{near}.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
The user must change the \ref key. When a nearby label exists, help is
"a label `near` exists; did you mean \ref{near}?". The no-near fallback
is unchanged.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --test diagnostic_codes undefined_ref: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out

Next: unknown_command did-you-mean help.replacement on the command span.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
…nd span

`\alpah` keeps suggestion `\alpha` and now also help "did you mean \alpha?"
with replacement {source, text:"\alpha"} covering the exact command span.
with_optional_help does not overwrite that replacement. JSON test covers
the protocol compile_result object.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --lib diagnostics:: : test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 298 filtered out
- --test diagnostic_codes: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: incremental test that label and help.replacement spans shift.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
shift_diagnostics maps label and replacement when an edit is before the
span, and returns None (invalidate) when the edit overlaps. Session
edits of `\alpah` keep both spans on the command bytes and match a clean
build; parser diagnostics still force today's full recompile.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --lib incremental::tests::shift_diagnostics: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out
- --lib incremental::tests::edit_before_a_labelled: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out
- --lib incremental::tests::edit_inside_a_labelled: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out

Next: full compiler gates (--lib, diagnostic_codes, recovery, supported_latex, maketitle, then cargo test -p compiler).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
d-q222 added a commit that referenced this pull request Sep 14, 2026
CAP_DIAGNOSTICS and Wire.diagnostics / Capabilities.diagnostics, negotiated
only with display-list-v2. Writers still emit the frozen four-key diagnostic,
so capability-on output is byte-identical to capability-off and a suggestion
change does not change the delta header digest.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib
  diagnostics_capability_gates_suggestion -- suggestion_change_is_hashed --
  negotiation_accepts_only_known
Result: test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 89 filtered out
- negotiation_accepts_only_known_requested_capabilities: ok
- diagnostics_capability_gates_suggestion_on_the_wire: left == right (no suggestion key)
- suggestion_change_is_hashed_and_deltaed_only_when_serialised: header_digest equal with cap on

Next: emit suggestion from write_diagnostics / diagnostic_json when the cap
is on and the value is Some; hash it only then.

Open questions: none. labels/notes/help still wait for #346 re-pin.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
d-q222 added a commit that referenced this pull request Sep 14, 2026
write_diagnostics and diagnostic_json_wire add suggestion after sources
when Wire.diagnostics is set and the value is Some (BTreeMap order; never
null). Deltas use the same writer. header_digest hashes suggestion only
then, so a suggestion-only change produces a delta. Frozen writers stay
four-key. No labels/notes/help slots (vendor compiler has none until #346).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- --lib diagnostics_capability_gates_suggestion -- suggestion_change_is_hashed
  -- write_json_matches: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 89 filtered out
- --lib writer_matches_value_tree -- from_compiler_forwards --
  negotiation_accepts: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 89 filtered out
- --test compiler_diagnostic_forward: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: full cargo test --manifest-path crates/render-pipeline/Cargo.toml.

Open questions: none in-scope.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>
@GoKubar

GoKubar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Superseded by #389: the same commits rebased onto main after #305 (this PR's own base) was squash-merged. The single conflict was in \maketitle — main has #305's No \author given warning, this branch has the same warning with .with_help(...) appended, so #389 takes this branch's version. Closing in favour of #389.

@GoKubar GoKubar closed this Sep 14, 2026
GoKubar added a commit that referenced this pull request Sep 14, 2026
…th a replacement edit (#277 parts 1+3) (rebase of #346) (#389)

* compiler: \maketitle without \author warns like LaTeX; unsupported text commands stop blaming math mode

GH#244, both parts.

A. latex.ltx defines `\def\@author{\@latex@warning@no@line{No \noexpand\author
given}}`, so a missing \author is a warning and the title block is still set.
This compiler refused to produce any block and raised an error instead.
- A missing \author now gives the warning "No \author given" and the title
  block, with no author line.
- `\author{}`, or only blank \and slots, is an author that is given but
  empty. pdfLaTeX sets it silently, so there is no diagnostic.
The issue asked for a warning in the \author{} case; the pdflatex oracle
says there is none.

pdflatex 1.40.29 oracle, `\the\pagetotal` after \maketitle:
  \author{A}  116.86673pt, no warning
  \author{}   115.33337pt, no warning
  no \author  116.86673pt, "LaTeX Warning: No \author given."
The v1 layout still advances the author line in both empty cases. The 1.53 pt
that pdfLaTeX gives back for \author{} is recorded, not modelled.

B. Parser::unsupported is the text-mode fallback, but every message it
emitted ended with "; unrestricted TeX math mode is not implemented". The
message is now "\X is not supported by this compiler version".
tests/acceptance.rs' "math ... reported" assertion was satisfied only by that
misleading suffix on \tikz ($x^2$ has been implemented for a long time); it now
asserts that nothing mentions math mode.

Regenerated with their own ignored generators: RECOVERY.md and
UNSUPPORTED.md. UNSUPPORTED.md also picks up an \includegraphics message that
had changed earlier without a regen.

Product path (parser.rs applied to render-pipeline/vendor/compiler locally,
then reverted): fixtures/real-world/math-sheet goes from 1 error to 0 errors,
7 warnings, 2 pages (the reference has 2). HW1 stays at 3 pages / 0 errors / 7
warnings and HW2 at 3 / 0 / 8.

Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan)
Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback)
Co-authored-by: d-q222 <[email protected]>

Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ

* compiler: rustfmt the new maketitle tests

Implementation-Agent: daniel-vpclaude (Claude Code, Claude Pro plan)
Commit-Executor: daniel-vpclaude, direct git (Cursor-limit fallback)
Co-authored-by: d-q222 <[email protected]>

Claude-Session: https://claude.ai/code/session_012iWhnaQddU1UTMh6ZssGBJ

* wip(#277): additive runtime-v1 proposal for diagnostic labels/notes/help

Add protocol/proposals/runtime-v1-structured-diagnostics.md only. Optional
labels (runtime-v1 source spans + text + primary), notes[], and help
{message, replacement?: {start_byte,end_byte,text}} on each diagnostic.
message stays one line without recovery; omitted fields keep JSON
byte-identical. Frozen contracts and schema are untouched.

Ran: none (docs-only checkpoint). Next: merge origin/agent/daniel-vpclaude/maketitle-no-author if it still touches Parser::unsupported, then Diagnostic fields, then the first ~20 helps.

Open questions: render-pipeline from_compiler does not forward these fields (or code); CLI #303 and the Mac pipeline path need a later re-pin, out of this lane.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): optional Diagnostic labels/notes/help, JSON omit-when-empty

Compiler Diagnostic gains labels, notes, and help (empty by default).
JSON emits them only when set; unset diagnostics stay byte-identical.
Incremental mapping shifts label and replacement spans. Merged #305 first
so Parser::unsupported text is the post-maketitle wording.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test diagnostic_codes: test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test recovery: test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- --test supported_latex: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: rewrite the first ~20 highest-frequency messages with a real help.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): real help on the highest-frequency compiler diagnostics

Attach optional help (and a primary label where it captions the span)
without changing message text. Unsupported commands name package or math
mode; packages/environments say what to do; missing $ / } / ] and script
markers / \frac get wrap-or-close advice; undefined \ref offers the nearest
\label by edit distance; missing includes name the paths tried. Built on
the #305 Parser::unsupported wording. No recovery.rs message strings
changed.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test diagnostic_codes: test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test recovery: test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- --test supported_latex: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test maketitle: test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: none in this lane unless daniel-parent asks; pipeline/CLI/Mac still need a re-pin and part (4).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): revert whitespace-only Diagnostic constructor reflow

Restore original `push(Diagnostic::...)` line shape and hang `.with_help`
/ `.with_label` on the next line, instead of re-indenting the constructor
arguments by four spaces. Restore the `rejected entry_path` struct literal
to its original indent (only the three new fields added).

crates/compiler/src vs merge-base origin/main:
- git diff: 347 insertions(+), 59 deletions(-)
- git diff -w: 346 insertions(+), 58 deletions(-)
Previously 526+/186- vs 422+/82-. Remaining 1-line gap is expansion.rs
include-not-found, which changed skip() to Diagnostic::error (not whitespace).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib: test result: ok. 300 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: emit help.replacement as {source, text} via source_json.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): emit help.replacement as {source, text} via source_json

Replacement uses the same source object as labels[].source (path,
start_byte, end_byte) plus text, so it can target a different document
than the diagnostic (e.g. an included file). Proposal records why; the
JSON test asserts the new shape.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib diagnostics:: : test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 297 filtered out

Next: drop help that restates the message; real help or none.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): drop help that restates the diagnostic message

`\foo is not supported in math mode` no longer gets `\foo is not
implemented in math mode`. Known text commands get a mode hint (`\foo is
a text command; use it outside math or inside \text{...}`); otherwise no
help. command_help/environment_help now return Option: package or
did-you-mean or spelling hints stay; generic "recognised but
unimplemented" restatements are omitted.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- cargo test --manifest-path crates/compiler/Cargo.toml --lib vocabulary:: : test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 297 filtered out
- --test diagnostic_codes: test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: undefined \ref wording should point at \ref{near}, not \label{near}.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): undefined \ref help points at \ref{near}, not \label{near}

The user must change the \ref key. When a nearby label exists, help is
"a label `near` exists; did you mean \ref{near}?". The no-near fallback
is unchanged.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --test diagnostic_codes undefined_ref: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out

Next: unknown_command did-you-mean help.replacement on the command span.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): unknown_command did-you-mean help.replacement on the command span

`\alpah` keeps suggestion `\alpha` and now also help "did you mean \alpha?"
with replacement {source, text:"\alpha"} covering the exact command span.
with_optional_help does not overwrite that replacement. JSON test covers
the protocol compile_result object.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --lib diagnostics:: : test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 298 filtered out
- --test diagnostic_codes: test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: incremental test that label and help.replacement spans shift.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): incremental test for label and help.replacement spans

shift_diagnostics maps label and replacement when an edit is before the
span, and returns None (invalidate) when the edit overlaps. Session
edits of `\alpah` keep both spans on the command bytes and match a clean
build; parser diagnostics still force today's full recompile.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-structdiag):
- --lib incremental::tests::shift_diagnostics: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out
- --lib incremental::tests::edit_before_a_labelled: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out
- --lib incremental::tests::edit_inside_a_labelled: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 304 filtered out

Next: full compiler gates (--lib, diagnostic_codes, recovery, supported_latex, maketitle, then cargo test -p compiler).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

---------

Co-authored-by: d-q222 <[email protected]>
Co-authored-by: Cursor <[email protected]>
GoKubar added a commit that referenced this pull request Sep 14, 2026
…n `par-leading` on

`vendor/compiler` is re-pinned to `faa7d484` (WIP commit df05f74); this makes
the pipeline compile against what it finds there and switches `par-leading` on.

`par-leading` was inert: #437's `Block::Paragraph::leading_pt` needs #436's
`Parsed::block_par_leading`, which the old pin did not carry. Measured end to
end from a clean checkout, not inferred from a green build: `{\small ...\par}`
in an 11pt article now sets baselines 11.955 bp apart, exactly pdflatex's
11.955 bp (`\small` = 12pt in size11.clo); the old pin gave 13.549 bp, i.e.
`\normalsize`, wrong by 1.594 bp per line.

Three moved compiler APIs, none swallowed by a wildcard arm:

* `Inline::HFill { leader }` (#320). The glue is set exactly — `\hrulefill`
  and `\dotfill` are `\leavevmode\leaders<box>\hfill\kern\z@`, so all three
  parts are emitted. Both extras are load-bearing: `\leavevmode` keeps a lone
  `\hrulefill` paragraph from being dropped along with the `\vspace` before it
  (that took `enumitem-worksheet` from 3 pages to 2), and `\kern\z@` stops
  TeX's end-of-paragraph final-glue deletion (tex.web §816) from eating a
  trailing fill. The leader box is *not* painted — this pipeline has no
  leaders outside `typeset/toc.rs`, and paragraph-layout reports no per-glue
  set width — so every occurrence is lowered with a typed `unsupported_inline`
  warning naming the command. `fixtures/divergence-probes/min-hrulefill`, which
  recorded `Date:` 198.51 bp left of pdflatex, is now 0.55 bp from the oracle.
* `Diagnostic.labels`/`.notes`/`.help` (#346/#389). display-list-v2's
  diagnostic is `additionalProperties: false` over `{code, message, severity,
  sources}`, so rather than invent wire fields, `from_compiler` folds them onto
  the fields that already mean the same thing: label spans join `sources`,
  their texts plus notes and help become `[note: …]`/`[help: …]` clauses on
  `message`, and `help.replacement` back-fills `suggestion`. One line only —
  `flashtex-render --tex` prints `severity[code] message (line:col)` per line.
* `Inline::Underline` (#328/#390). PR #329 was written for this re-pin, is
  pipeline-only and applied cleanly; its only integration gap was a `VBlock`
  literal predating `broken_penalty`.

The pin itself also starts warning `unsupported_feature` for
`\usepackage{amsmath}`, which `e44d5917` did not. That line is user-visible on
every amsmath document and claims "not implemented" about constructs this
pipeline does set — a cross-crate disagreement for the owners, not something a
re-pin settles. `tests/amsmath_inline.rs` excludes that one wording by a
documented predicate and stays strict about everything else.

Gates: render-pipeline 295 passed / 0 failed / 2 ignored (254 before);
compiler 588 / 0 / 4; amsmath 59/59; tabular 106/106; HW1 and HW2 3 pages,
0 errors, 0 font-FAILURE diagnostics; corpus page counts 22/22.

Corpus geometry (rank.py, same pdf-exact, only the producer varying), before →
after: dx 85.74% → 85.61%, dy 75.04% → 75.73%, both 68.97% → 69.11%, aligned
words 15073 → 15099, reflowed 131 → 129. 21 of 22 fixtures are bit-identical;
all movement is `enumitem-worksheet` (dy +34.14 pp, aligned 332 → 357) plus one
word in `unicode-accents`. That fixture's dx percentage falls 2.75 pp while its
absolute count rises 157 → 159: 25 more words are measured, and the new ones
sit outside 0.5 bp because the leader rule is still unpainted.

No other vendor directory needed re-pinning; the four that differ from `main`
do so by their own rows' deliberate choices, and the vendored compiler
type-checks against them.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 14, 2026
… catch the pipeline up to it (#451)

* WIP: vendor/compiler re-pinned to faa7d48 + par-leading enabled (does not compile yet)

* render-pipeline: build against the re-pinned vendor/compiler, and turn `par-leading` on

`vendor/compiler` is re-pinned to `faa7d484` (WIP commit df05f74); this makes
the pipeline compile against what it finds there and switches `par-leading` on.

`par-leading` was inert: #437's `Block::Paragraph::leading_pt` needs #436's
`Parsed::block_par_leading`, which the old pin did not carry. Measured end to
end from a clean checkout, not inferred from a green build: `{\small ...\par}`
in an 11pt article now sets baselines 11.955 bp apart, exactly pdflatex's
11.955 bp (`\small` = 12pt in size11.clo); the old pin gave 13.549 bp, i.e.
`\normalsize`, wrong by 1.594 bp per line.

Three moved compiler APIs, none swallowed by a wildcard arm:

* `Inline::HFill { leader }` (#320). The glue is set exactly — `\hrulefill`
  and `\dotfill` are `\leavevmode\leaders<box>\hfill\kern\z@`, so all three
  parts are emitted. Both extras are load-bearing: `\leavevmode` keeps a lone
  `\hrulefill` paragraph from being dropped along with the `\vspace` before it
  (that took `enumitem-worksheet` from 3 pages to 2), and `\kern\z@` stops
  TeX's end-of-paragraph final-glue deletion (tex.web §816) from eating a
  trailing fill. The leader box is *not* painted — this pipeline has no
  leaders outside `typeset/toc.rs`, and paragraph-layout reports no per-glue
  set width — so every occurrence is lowered with a typed `unsupported_inline`
  warning naming the command. `fixtures/divergence-probes/min-hrulefill`, which
  recorded `Date:` 198.51 bp left of pdflatex, is now 0.55 bp from the oracle.
* `Diagnostic.labels`/`.notes`/`.help` (#346/#389). display-list-v2's
  diagnostic is `additionalProperties: false` over `{code, message, severity,
  sources}`, so rather than invent wire fields, `from_compiler` folds them onto
  the fields that already mean the same thing: label spans join `sources`,
  their texts plus notes and help become `[note: …]`/`[help: …]` clauses on
  `message`, and `help.replacement` back-fills `suggestion`. One line only —
  `flashtex-render --tex` prints `severity[code] message (line:col)` per line.
* `Inline::Underline` (#328/#390). PR #329 was written for this re-pin, is
  pipeline-only and applied cleanly; its only integration gap was a `VBlock`
  literal predating `broken_penalty`.

The pin itself also starts warning `unsupported_feature` for
`\usepackage{amsmath}`, which `e44d5917` did not. That line is user-visible on
every amsmath document and claims "not implemented" about constructs this
pipeline does set — a cross-crate disagreement for the owners, not something a
re-pin settles. `tests/amsmath_inline.rs` excludes that one wording by a
documented predicate and stays strict about everything else.

Gates: render-pipeline 295 passed / 0 failed / 2 ignored (254 before);
compiler 588 / 0 / 4; amsmath 59/59; tabular 106/106; HW1 and HW2 3 pages,
0 errors, 0 font-FAILURE diagnostics; corpus page counts 22/22.

Corpus geometry (rank.py, same pdf-exact, only the producer varying), before →
after: dx 85.74% → 85.61%, dy 75.04% → 75.73%, both 68.97% → 69.11%, aligned
words 15073 → 15099, reflowed 131 → 129. 21 of 22 fixtures are bit-identical;
all movement is `enumitem-worksheet` (dy +34.14 pp, aligned 332 → 357) plus one
word in `unicode-accents`. That fixture's dx percentage falls 2.75 pp while its
absolute count rises 157 → 159: 25 more words are measured, and the new ones
sit outside 0.5 bp because the leader rule is still unpainted.

No other vendor directory needed re-pinning; the four that differ from `main`
do so by their own rows' deliberate choices, and the vendored compiler
type-checks against them.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* render-pipeline: an appended `[help: …]` clause must not defeat the package supersede

Regression in this branch, found in review of #451. `from_compiler` appends the
compiler's structured `help`/`notes` to `message` as ` [help: …]` clauses;
`packages::supersede_message` ends its match with

    strip_suffix(" are recognised but not implemented")

so with a clause on the end the match failed, the `else` branch returned the
message unchanged, and every superseded `\usepackage` diagnostic leaked into the
render output. Not just amsmath: every package in `implemented_by_pipeline` —
amsfonts, lmodern, microtype, geometry, graphicx, tikz — and the mixed list too,
where `packages amsmath, booktabs, …` should be trimmed to `booktabs` and was
instead shown in full, telling the reader this pipeline does not implement things
it does.

`split_clauses` now peels trailing clauses off the body before matching and
re-attaches them to whatever survives a trimmed list. It keys on the clause
*shape* — ` [<label>: <text>]` with a plain-word label, bracket-depth aware so
clause text may contain brackets and a body merely ending in `]` is not eaten —
rather than on the two labels that exist today, so a third kind appended later
needs no further fix. `preamble_command_superseded` reads the body too: `lib.rs`
calls it on the compiler's diagnostic *before* the conversion, so it was not
leaking, but it compares the whole message for equality and would the moment that
call moved.

Measured on the owner's fixtures, before → after: HW1 6 → 4 diagnostics, HW2
9 → 7, `unsupported_feature` leaks 2 → 0 in each; what remains is
`math_resource_profile`, which is informational.

This also retracts a wrong conclusion in the previous commit. I had reported the
amsmath warning as purely a consequence of the re-pin and loosened
`tests/amsmath_inline.rs` to tolerate it. The pin does newly emit it, but it never
reaches a consumer — the supersede drops it — so it was visible only because of
the bug above. That test is restored to `main`'s strict assertion and passes 11/11
on its own.

Tests: `packages` unit tests for a superseded message with a clause (each of the
eight packages), the mixed list with a clause, several clauses, clause text
holding brackets, and bodies that merely end in `]`; plus two end-to-end tests in
`compiler_diagnostic_forward` covering the real render path, which is where the
clause actually gets appended. The existing `supersede_message` tests all used
bare messages, which is why this got through.

Gates re-run: render-pipeline 303 passed / 0 failed / 2 ignored; amsmath 59/59;
tabular 106/106; HW1 and HW2 3 pages, 0 errors, 0 font-FAILURE diagnostics;
corpus page counts 22/22. Corpus geometry is unchanged by this commit (dx 85.61%,
dy 75.73%, both 69.11%, aligned 15099) — the supersede moves diagnostics, not
glyphs.

Implementation-Agent: Claude Opus 5 (lane vendor-repin-2, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

---------

Co-authored-by: Claude Opus 5 <[email protected]>
GoKubar added a commit that referenced this pull request Sep 15, 2026
…#658)

* wip(#277): reproduce from_compiler dropping code and suggestion

Add display::Diagnostic.suggestion (None at every constructor) and tests
that expect unknown_command/\alpha and unsupported_feature. from_compiler
still hardcodes code "compiler" and does not copy suggestion.

Ran: CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib from_compiler_forwards
Result: test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 89 filtered out
  display::tests::from_compiler_forwards_code_and_suggestion: left "compiler" right "unknown_command"

Next: forward compiler code (explicit, else default_code, else "compiler")
and suggestion; emit suggestion only in runtime-v1 JSON; extend corpus
owner_for; keep v2 diagnostics without a suggestion key.

Open questions: none in-scope. vendor/, apps, protocol schema untouched.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): forward compiler diagnostic code and suggestion

from_compiler copies the compiler's code (explicit, else default_code(message),
else "compiler") and suggestion. runtime-v1 JSON emits suggestion only when
set; display-list-v2 diagnostics are unchanged except the code value.
owner_for accepts the compiler code set; tikz_pipeline rejects those codes
too so a forwarded unknown_command cannot slip through as "not compiler".

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- --lib from_compiler_forwards -- writer_matches_value_tree: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 88 filtered out
- --lib write_json_matches_the_value_tree: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 89 filtered out
- --test compiler_diagnostic_forward: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- --test tikz_pipeline: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- python3 -m unittest tools.real-world-corpus.test_run: Ran 6 tests in 0.008s OK

Next: full cargo test --manifest-path crates/render-pipeline/Cargo.toml control-vs-after.

Open questions: no in-scope golden embeds "code":"compiler" for a compiler
diagnostic (vendor/pdf fixture and apps/mac display-list fixture are out of
lane). docs/user/compiler.md still shows the old example.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): propose display-list-v2-diagnostics capability

Add protocol/proposals/display-list-v2-diagnostics.md: capability accepted
only with display-list-v2; suggestion/labels/notes/help use the runtime-v1
shapes with v2 #/$defs/source; omit-when-empty; deltas carry the same keys;
without the cap bytes stay identical. Schema delta is text in the proposal
(frozen rendering-v2.schema.json untouched). labels/notes/help wait for a
vendor re-pin past #346; this lane serialises suggestion only.

Ran: none (docs-only).

Next: failing tests for negotiated vs not, compact vs JSON-tree, and a
suggestion-only delta.

Open questions: none in-scope. No vendor/, schema, apps, or contracts edits.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): reproduce v2 suggestion omitted without diagnostics cap

CAP_DIAGNOSTICS and Wire.diagnostics / Capabilities.diagnostics, negotiated
only with display-list-v2. Writers still emit the frozen four-key diagnostic,
so capability-on output is byte-identical to capability-off and a suggestion
change does not change the delta header digest.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib
  diagnostics_capability_gates_suggestion -- suggestion_change_is_hashed --
  negotiation_accepts_only_known
Result: test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 89 filtered out
- negotiation_accepts_only_known_requested_capabilities: ok
- diagnostics_capability_gates_suggestion_on_the_wire: left == right (no suggestion key)
- suggestion_change_is_hashed_and_deltaed_only_when_serialised: header_digest equal with cap on

Next: emit suggestion from write_diagnostics / diagnostic_json when the cap
is on and the value is Some; hash it only then.

Open questions: none. labels/notes/help still wait for #346 re-pin.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#277): emit v2 suggestion when display-list-v2-diagnostics is on

write_diagnostics and diagnostic_json_wire add suggestion after sources
when Wire.diagnostics is set and the value is Some (BTreeMap order; never
null). Deltas use the same writer. header_digest hashes suggestion only
then, so a suggestion-only change produces a delta. Frozen writers stay
four-key. No labels/notes/help slots (vendor compiler has none until #346).

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- --lib diagnostics_capability_gates_suggestion -- suggestion_change_is_hashed
  -- write_json_matches: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 89 filtered out
- --lib writer_matches_value_tree -- from_compiler_forwards --
  negotiation_accepts: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 89 filtered out
- --test compiler_diagnostic_forward: test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Next: full cargo test --manifest-path crates/render-pipeline/Cargo.toml.

Open questions: none in-scope.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* render-pipeline: from_compiler forwards exactly the compiler's code, no re-derived fallback

Adopts the semantics of GoKubar's duplicate #370: the compiler's constructors
already set `code` via `default_code`, and a `None` is deliberate (request
validation), so re-deriving `default_code(message)` here could label a
diagnostic the compiler's own runtime-v1 reply leaves uncoded. Now
`d.code.map_or("compiler", ...)`.

--lib from_compiler 1/0 (test updated: uncoded stays "compiler");
compiler_diagnostic_forward 2/0 (tikz still unsupported_feature, set by the
compiler's constructor); tikz_pipeline 3/0; golden_v1 1/0.

Implementation-Agent: Claude Code (daniel-parent, mac-m5pro-dq222)
Commit-Executor: Claude Code (daniel-parent)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: accept kernel preamble declarations as no-ops, warn on DocumentMetadata keys

\NeedsTeXFormat, \ProvidesClass, \ProvidesPackage and \ProvidesFile are
.cls/.sty declarations with no visible output in a document compiler,
so they're accepted silently (required group, then the optional
[info]/[date] bracket, both discarded).

\DocumentMetadata (LaTeX2e 2022+) is different: its keys (pdfstandard,
pdfversion, lang, testphase, ...) really do change real LaTeX's PDF
output, which this compiler doesn't generate that way. Before
\documentclass it's accepted with a warning naming the ignored keys;
after \documentclass it's a real error, matching real LaTeX. Reuses
the existing document_class: Option<String> field (set when
\documentclass itself is processed) for the position check -- no new
preamble-tracking mechanism needed.

Regenerates the inventory artifacts and the Mac bundled copy.

Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane kernel-text-symbols, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Muse-Lane-Head: 3dbf61de
Co-authored-by: muse-spark-1.3-contributor <[email protected]>

* wip(#358): negotiated-case protocol test next to #354's omit-suggestion

compiler_diagnostic_forward.rs: keep typo_alpah_is_unknown_command_with_alpha_suggestion_in_v1_only
(v2 omits suggestion when the cap is off). Add negotiated_v2_diagnostics_emits_suggestion
through handle_line: capability off omits suggestion; with display-list-v2 +
display-list-v2-diagnostics the sibling carries suggestion and echoes the cap;
the cap alone is rejected. Proposal status no longer says stacked on #354.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib
  test result: ok. 112 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- cargo test --manifest-path crates/render-pipeline/Cargo.toml --test compiler_diagnostic_forward --test display_list_delta
  compiler_diagnostic_forward: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
  display_list_delta: test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- python unittest tests/test_rendering_v2.py: Ran 23 tests in 0.037s OK

Next: push this lane branch.

Open questions: none. document-runtime allowlist remains #363.

Implementation-Agent: cursor-agent cursor-grok-4.6
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#358): failing tests for overflow dependents, estimate, empty suggestion

Reproduction tests for the independent review: declining display-list-v2
must also drop display-list-v2-diagnostics (FLASHTEX_MAX_REPLY_BYTES=6000);
the size estimate with diagnostics off must match a suggestion-stripped
list; Some("") must be omitted from the writer and the digest.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- cargo test --lib estimate_omits_suggestion
  test result: FAILED. 0 passed; 1 failed (784 vs 758)
- cargo test --lib empty_suggestion
  test result: FAILED. 0 passed; 2 failed
- cargo test --lib empty_suggestion_is_not_hashed
  test result: FAILED. 0 passed; 1 failed
- cargo test --test compiler_diagnostic_forward declining_display_list
  test result: FAILED. 0 passed; 1 failed
  (echoed ["display-list-v2-diagnostics"] with no sibling)

Next: drop dependents with one helper, gate the estimate on Wire,
omit empty suggestions in writer and digest, document dl2-canon-1
conditional suggestion, make the LM skip visible.

Open questions: digest scheme — document conditional suggestion under
dl2-canon-1 (images already Wire-gate the same scheme) rather than
rename to dl2-canon-1+diagnostics (Mac still only knows dl2-canon-1).

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* compiler: brace-aware DocumentMetadata keys, seen-documentclass flag

Fixes all three of daniel-parent's re-review points on #440:

1. \DocumentMetadata{testphase={phase-III,math,table}} now warns
   naming only "testphase" (a top-level key with a braced value), not
   three separate "keys" -- keys are now split on top-level commas,
   tracking brace depth character by character, instead of a plain
   comma split over the raw (brace-stripped) argument text.
2. A new seen_documentclass flag (set on any \documentclass
   invocation, even an empty one) replaces document_class.is_some()
   for the \DocumentMetadata position check, so
   \documentclass{}\DocumentMetadata{lang=en-US} is now the real
   "must come before \documentclass" error instead of a warning.
3. missing_required_argument_is_a_parse_error now asserts the exact
   message this PR's own dispatch arm produces, instead of a generic
   "command not supported" message the unmodified parser already
   emits for any unknown preamble command.

Mutation-tested for all three (revert -> new/strengthened test fails
-> restore -> passes), independently spot-checked by the reviewer for
fix 1 (disabling brace-depth tracking fails
document_metadata_nested_braces_are_a_single_key as predicted).

cargo test --test kernel_preamble_declarations: 8 passed, 0 failed.
Full cargo test in crates/compiler: 0 FAILED across all suites.

Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix440, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Co-authored-by: muse-spark-1.3-contributor <[email protected]>

* wip(#358): drop dependents on overflow; omit empty suggestion; document digest

Declining display-list-v2 now drops the whole family (images, device-color,
diagnostics, delta, only) via is_display_list_family. The size estimate
charges suggestion only when Wire.diagnostics would serialise it.
Some("") is omitted from the compact writer, JSON tree, and header_digest
through Diagnostic::wire_suggestion. Digest scheme stays dl2-canon-1:
optional negotiated fields are Wire-gated like image items, not a rename
(Mac still only accepts dl2-canon-1). LM skip in compiler_diagnostic_forward
is now an assert. Stale runtime-v1 "does not forward code/suggestion"
wording updated.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib
  test result: ok. 115 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- cargo test --test compiler_diagnostic_forward --test display_list_delta
  compiler_diagnostic_forward: test result: ok. 4 passed; 0 failed; 0 ignored
  display_list_delta: test result: ok. 3 passed; 0 failed; 0 ignored
- python unittest tests/test_rendering_v2.py: Ran 23 tests in 0.039s OK

Next: git fetch origin && git merge origin/main, re-run, push.

Open questions: none on the five review items.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* wip(#358): pin Appendix A suggestion digest; drop overflow dependents

Appendix A header_digest now hashes suggestion at the same position and
with the same encoding as delta.rs (only when display-list-v2-diagnostics
is negotiated and the value is non-empty). Pinned
c4e7c7129994d1b73c8dfe3d9b1b9a0cbf0edc49e7f9e6bc848d8c66e0126bb6 from a
hand walk of that algorithm; diagnostics-off in-memory suggestion matches
the no-suggestion digest. Overflow no longer echoes -images or
-device-color.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib --test display_list_delta --test compiler_diagnostic_forward
  lib: test result: ok. 128 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out
  compiler_diagnostic_forward: test result: ok. 5 passed; 0 failed; 0 ignored
  display_list_delta: test result: ok. 3 passed; 0 failed; 0 ignored
- /tmp/flashtex-schema-venv/bin/python -m unittest tests.test_rendering_v2
  Ran 24 tests in 0.039s OK

Next: push this checkpoint for daniel-parent re-review of the last PARTIAL.

Open questions: none.

Implementation-Agent: cursor-agent cursor-grok-4.6-high-fast
Commit-Executor: cursor-agent
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Co-authored-by: Cursor <[email protected]>

* fix440: keep text glued after ']', honour escaped commas in DocumentMetadata

- optional_bracket_argument consumes exactly up to the matching ']' at
  brace depth 0 and rewrites any trailing tail back into the token stream
  (fixes ProvidesFile{foo.cfg}[2024]VISIBLE losing VISIBLE). The helper
  predates this PR (on main since 01fb13c); all ~25 call sites benefit.
- document_metadata treats a standalone one-character Word ',', '{', '}'
  (i.e. control symbols) as escaped literals via placeholders while
  splitting top-level commas (fixes foo=hello\,world reporting 'world').
- document_metadata_after_documentclass_is_an_error now asserts this PR's
  exact ordering message, not just any error mentioning DocumentMetadata.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor

* compiler: fix two real DocumentMetadata/bracket-argument bugs, merge main

Fixes daniel-parent's third re-review of #440:

1. `optional_bracket_argument` (parser.rs): [ and ] are not lexer-special
   characters, so `[2024]VISIBLE` lexes as one Word token, and the old
   code consumed the whole token, dropping `VISIBLE`. Now scans
   token-by-token for the closing `]` at brace depth 0, and rewrites any
   unconsumed tail back into the token stream in place. Confirmed
   pre-existing beyond DocumentMetadata: ~25 call sites share this
   helper (cite, bibitem, linebreak, footnote, newtheorem, lstlisting,
   ...), all fixed at the helper. Also newly correct: a `]` inside a
   nested `{...}` group no longer closes the bracket argument early.
2. `document_metadata` (parser.rs): a control symbol like `\,`/`\{`/`\}`
   lexes as its own standalone one-character Word token, while a real
   separator character is always embedded inside a longer Word token --
   a reliable signal this fix uses to hide escaped characters behind
   private-use-area placeholders during the top-level comma/brace scan,
   restoring them afterward, so \DocumentMetadata{foo=hello\,world,
   lang=en} no longer reports "world" as a spurious key.
3. document_metadata_after_documentclass_is_an_error now asserts the
   exact ordering-error message, not any error mentioning
   DocumentMetadata.

Merged current main and regenerated all inventory artifacts via the
project scripts (not hand-merged).

Verified independently, including a mutation check on fix 2 (disabling
the escaped-comma placeholder fails document_metadata_escaped_comma_is_
not_a_separator as predicted; restoring passes):
- cargo test --test kernel_preamble_declarations: 10 passed, 0 failed.
- cargo test --test supported_latex: 8 passed, 0 failed.
- Full cargo test in crates/compiler: 0 FAILED across all suites.

Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix440v2, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Co-authored-by: muse-spark-1.3-contributor <[email protected]>

* compiler: split DocumentMetadata's plain top-level commas regardless of whitespace

A standalone Word(",") from the lexer was always treated as an escaped `\,`,
so `\DocumentMetadata{foo=bar , lang=en}` lost `lang`: a real separator comma
surrounded by spaces lexes identically to an escaped one. The lexer gives
both the same TokenKind::Word variant, so distinguish them the way
optional_bracket_argument already does one function away: an escaped
control symbol's source span is longer than its one-character text (it
includes the backslash), while a plain word's span length always equals its
text length. Applied the same check to `,`, `{`, `}`.

Added regression tests for the shared optional_bracket_argument bracket
reader across citation, footnote, \\[<length>], theorem-head and listing
option callers, proving trailing text still survives after the bracket
closes.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Co-authored-by: muse-spark-1.3-contributor <[email protected]>

* compiler: document macro-comma limit, keep only real ]-glued regression tests

Documented the accepted macro-produced-comma limitation (a comma from
expanding a user macro carries the macro invocation's span, so the
span-length check can't tell it apart from a real separator) at the
span-length check site.

Replaced the caller-regression tests added for optional_bracket_argument
with ones that actually exercise the bug this PR fixes: text glued
directly after the closing ']', not after a following required argument.
The previous \cite/\footnote tests put TEXT after a required {...}, so
they passed even on the pre-fix helper and proved nothing; verified against
the pre-fix helper directly and kept only the ]-glued cases that fail on it
(\ProvidesFile{f}[i]TEXT), since \\[<length>] and \item[<label>] already
had their own tail-rewrite predating this PR.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
Co-authored-by: muse-spark-1.3-contributor <[email protected]>

* compiler tests: pin text glued after \\[2pt] line-break length

skip_line_break_length has its own tail-rewrite for [2pt]TEXT-style
glued text, separate from optional_bracket_argument; this pins that
behavior next to the sibling ]-glued coverage.

Implementation-Agent: muse-spark-1.3-contributor

* compiler tests: pin text glued after explicit item label

item_label_argument has its own tail-rewrite for [x]TEXT-style glued
text, separate from optional_bracket_argument; this pins that behavior
next to the other explicit-label coverage in list_structure.rs.

Implementation-Agent: muse-spark-1.3-contributor

* compiler: large-document bench and fixture output-identity digests (#65)

What changed:
- src/bin/large_doc_bench.rs: deterministic ~300-page article (sections,
  labels/refs, cites + thebibliography, equation/align*, itemize/enumerate,
  tabular); median-of-N cold and one-character-edit timings through
  Session and protocol::handle_line, plus a reply digest.
- src/bin/fixture_digest.rs: per-fixture SHA-256 of the clean compile dump
  (blocks, diagnostics, pages), the protocol reply, and a warm edited
  Session output, for byte-identity checks across perf changes.

What was run:
large document: 637761 bytes, 450 sections, 5912 blocks, 302 pages, 0 diagnostics, profile=release
fixture_digest over fixtures/ and crates/compiler/tests: 273 files, two runs identical

Next step: profile and fix the top hotspots.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: memoise Core 14 shaping, index glyph tables, lend cleveref config (#65)

What changed:
- layout: shaping a Core 14 face is a pure function of (face, text); the
  width/source-bounds/missing-glyph summary layout reads is memoised per
  thread (reset past 131072 entries). Every cross-reference pass used to
  reshape every word with a fully allocated `Shaped`.
- char_table: sorted binary-search index equal to `iter().find` (first
  occurrence) for lm_math/newcm_math/amssymb advances and the export
  Symbol/WinAnsi tables; math_font walked ~440 entries per ASCII character.
- layout: inline_box (every tabular entry) lends the cleveref config to the
  detached cursor instead of building the default name table and cloning.

What was run:
fixture_digest over fixtures/ + crates/compiler/tests (273 files) and the 302-page doc: identical to origin/main 36fe7ec
cargo test (debug): 59 suites, passed=671 failed=0 ignored=5
cargo fmt --check: ok; clippy -D warnings: 20 pre-existing errors, none in touched code

Next step: interleaved A/B timings, PR.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: undo whole-crate reformatting swept into the previous commit (#65)

What changed:
- The previous commit accidentally included a local `cargo fmt` of the whole
  crate (43 unrelated files). Every file outside the perf change is restored
  to origin/main 36fe7ec; the perf edits are re-applied without reformatting.
  No behaviour change relative to the previous commit.

What was run:
git diff 36fe7ec --stat: 10 files changed, 607 insertions(+), 42 deletions(-)
fixture_digest (273 files + 302-page doc): identical to origin/main

Next step: interleaved A/B timings, PR.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* pdf: exact route rounds colours to xcolor's 5 decimals and paints TikZ path items

What changed:
- v2: `pdf_number` formats an f64 as a bounded PDF number (shortest decimal
  rounded half away from zero, no exponent, -0 -> 0); sRGB colour components
  use 5 digits (pdflatex measured: RGB{20,80,170} -> 0.07843 0.31374 0.66667
  rg). Replaces the exact-binary requirement that refused 0.8 and 0.07843.
- v2: `path_fill` / `path_stroke` items (with clips) become
  q [rg RG] [clip W n] [w M d J j] path f|f*|S Q, in pgf's pdfTeX order.
- exact: `M` (miter limit) joins the bounded operator set.

What was run:
- cargo test (crates/pdf): lib 53 passed; tests/v2 7 passed; all targets 0 failed
- cargo check --tests (crates/rendering-core): ok

Next step: re-pin crates/render-pipeline/vendor/pdf so `flashtex build` uses it.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* pdf: exact route paints alpha through pgf's /pgf@CA and /pgf@ca ExtGStates

What changed:
- exact: Op::StrokeAlpha / Op::FillAlpha, written `/pgf@CA<a> gs` and
  `/pgf@ca<a> gs`, the names and one-key dictionaries pgf's pdfTeX driver
  writes (measured with pdflatex 1.40). `gs` joins the bounded operator set
  for those names only; any other ExtGState is still refused. Validation
  refuses an alpha outside [0, 1] and `gs` during path construction. Each
  page declares the states it selects once, sorted by name, inline:
  `/ExtGState << /[email protected] << /ca 0.4 >> >>`.
- v2: a paint alpha below 1 is no longer an error. It is rounded like a
  colour component and selected right after the colour inside the item's
  `q … Q`: path_stroke sets CA, path_fill, rule and glyph_run set ca.
- Tests: exact operator stream and resources for stroke and fill alpha,
  per-page dedup, refusal of other gs names, text alpha on a glyph run.

What was run:
- cargo test (crates/pdf): test result: ok. 53 passed; 0 failed (lib),
  12 passed (tests/exact), 5 (images), 11 (navigation), 28 (render),
  3 (type1), 10 passed; 0 failed (tests/v2).
- cargo check --tests (crates/rendering-core): Finished.

Next step: build extended/tikz-clipping-patterns with a scratch copy whose
render-pipeline/vendor/pdf is this crate.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: ignored large-document timing test; bench reports first compile (#65)

What changed:
- tests/large_document_timing.rs: #[ignore] timing test sharing the bench's
  302-page generator; asserts >= 300 pages, no diagnostics, and warm edit ==
  clean compile.
- large_doc_bench prints the first compile in the process (empty memo).

What was run:
cargo test --release --test large_document_timing -- --ignored: 1 passed (302 pages)
cargo test (debug): 60 suites, passed=671 failed=0 ignored=6

Next step: A/B timings, PR.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* compiler: stop copying placed text, lend the session output, serialise pages once (#65)

What changed:
- layout: clean layout and every cross-reference pass call a new
  non-collecting render_block; only incremental reuse collects placed items.
- layout: the shaping memo hashes a word once per hit (get, not
  contains_key plus index).
- incremental: Session::compile_project_borrowed lends the retained output;
  compile_project_with clones from it as before. protocol uses the borrow.
- protocol: bound_pages serialises each page once and joins the result
  instead of serialising, cloning and serialising again.
- parser: parse_stream handles space, comment and word tokens borrowed
  before cloning the token.

What was run:
fixture_digest (273 fixtures + 302-page doc) vs #535 head 3c2b0e1: IDENTICAL
large_doc_bench reply sha256 51e4d9a9dc3f0ac0aa8cc90267fb8a73664650d2ebf246bcbb2958ad1cba9747 (same as base)
large_doc_bench 5 (load ~44): cold session 50.9 -> 40.6 ms, cold protocol 68.7 -> 46.7, edit protocol 69.9 -> 50.0

Next step: full test run, interleaved median-of-5 timings, PR stacked on #535.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* pdf: support TikZ tiling patterns

What changed:
- Add deterministic PatternType 1 tiling resources and typed /Pattern cs, scn operators to the exact PDF route.
- Generate the eight requested PGF cells with pattern color, accept the v2 path_fill pattern extension, and cover PaintType 2 RGB selection.
- Add operator, resource, parser, deterministic-output, structure-check, and Ghostscript-backed sample verification coverage.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-pattern CARGO_BUILD_JOBS=4 cargo check --manifest-path crates/pdf/Cargo.toml
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-pattern CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/pdf/Cargo.toml --lib --tests
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-pattern CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/vector-graphics/Cargo.toml --lib tikz::tests::unsupported_input_is_reported_not_dropped
- /opt/homebrew/bin/gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -r144 on /private/tmp/flashtex-pattern-sample.pdf

Next step:
- Carry pattern name/color state through vector-graphics, render-pipeline display items, and display-list JSON so the live TikZ corpus can populate the new PDF contract.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)

* compiler: stop dropping six amsfonts symbols on a false premise

gen_amssymb.py carried SKIP = {angle, hbar, mho, sqsubset, sqsupset,
rightleftharpoons}, justified as "kernel commands amsfonts only
redefines keep their kernel glyphs". That was wrong twice over (checked
against pdfTeX 3.141592653-2.6-1.40.27, TeX Live 2025):

- \mho, \sqsubset, \sqsupset are not kernel commands at all: latex.ltx
  makes them \not@base stubs and amsfonts.sty 99-101 is what provides
  them. FlashTeX diagnosed them "not supported in math mode" even with
  amssymb loaded.
- \angle, \hbar, \rightleftharpoons are kernel composites that amsfonts
  replaces with one msam/msbm glyph of different metrics (\angle
  6.37344pt -> 7.22223pt, \hbar 5.76172pt -> 5.40280pt at 10pt). With
  the package loaded, \angle/\hbar fell through to bare COMMAND_GLYPHS
  rows at Latin Modern advances matching neither pdflatex answer, and
  \rightleftharpoons was "not supported".

Removing SKIP lets the generator emit all six with the class and slot
amsfonts declares (provider Amsfonts, so \usepackage{amsfonts} alone
suffices, matching the .sty). \hbar needs a MANUAL entry: amsfonts puts
it on msbm "7E, the slot amssymb also gives \hslash, and unicode-math
names that character only as \hslash.

Since the original draft, main gained the package gate (543bde5) with
kernel-width arms for unloaded \angle/\hbar; those keep working and the
loaded case now takes the declared msam/msbm rows. \rightleftharpoons -
whose comment said "no row at all, so nothing to gate yet" - gets the
same treatment: a gated kernel arm (Rel, U+21CC, 1.000002em, the
measured 10.00002pt \mathpalette stack) so an unloaded document does
not regress to a missing-package error for a command base LaTeX2e does
define.

scripts/amssymb_api.rs.in is caught up with 84ff3c4's hand-edit of the
generated file (CharTable index instead of linear find), so
`python3 scripts/gen_amssymb.py > src/amssymb.rs` is byte-identical
again; verified before this change the generator reproduced main's
table except for that drift, and after it the diff is exactly the six
rows plus their LM advances.

Regenerated docs/user/compiler.md, supported/supported-latex.json,
supported/coverage.md and the Mac bundled copy via
scripts/render_supported_latex.sh.

Tests: tests/amssymb_skip.rs reconstructs pdfTeX's \show mathchars
("340A "045C "057E "3440 "3441 "0566) from the generated class, font
and slot, and pins the msam/msbm widths against the pdflatex \hbox
measurements. angle_and_hbar_keep_the_kernel_composite_without_amsfonts
extended to the loaded-case msam/msbm advances and to
\rightleftharpoons.

Salvaged from PR #212 (engine/amssymb-generator-skip), rebuilt against
current main (post-543bde5c package gating).

Implementation-Agent: fable-salvage
Commit-Executor: fable-salvage (direct; Cursor usage limit)

* compiler: regenerate supported-latex docs on the merged tree

docs/user/compiler.md (generated) conflicted with the #641 integration
batch; the merge took main's copy and this regenerates it via
scripts/render_supported_latex.sh on the merged tree, restoring the six
amssymb rows on top of main's new inventory (555 -> 559 math entries).
supported-latex.json and the Mac bundled copy were already correct;
sync-supported-latex.sh --check is byte-identical (704a3974fe88).
gen_amssymb.py re-verified byte-identical against src/amssymb.rs after
the merge.

Gates re-run on the merged tree: cargo test --release --no-run clean;
--lib 380 passed 0 failed; amssymb_skip 1 passed; supported_latex 8
passed; lm_math_binding 6 passed.

Implementation-Agent: fable-salvage
Commit-Executor: fable-salvage (direct; Cursor usage limit)

* integration fix: #579's borrowed fast path passes control_symbol_kern's post-#576 arguments

#579 predates #576 (kern control symbols measured by definition bytes);
its new parse_stream_body fast path called the old 3-argument form.
Pass maps_to_invocation and definition from the token entry, as the
slow path does.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* integration: regenerate supported-latex artefacts (render_supported_latex.sh; sync-supported-latex.sh)

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* integration fix: #579's fast path must not shadow main's tabbing control arm

#642 added a \\=/\\>/\\< tabbing arm to parse_stream_body's match that
runs before the control_symbol_kern arm. #579's borrowed fast path,
written before #642, matched those words first and typeset them as
text, so tabbing produced 0 tab stops instead of 2 (5 failures in
crates/compiler/tests/tabbing.rs). Mirror the slow path's guard.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* integration fix: perf-bench names #358's new diagnostics capability

main's crates/perf-bench (#206) constructs v1::Capabilities literally;
#358 adds the diagnostics field, so the bench stopped compiling (E0063)
and the engine performance job failed at Build. Pass diagnostics: false,
matching the bench's other opt-in capabilities.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* integration fix: #294's page window and #358's diagnostics wire meet

#294 replaced Page's items field with PageContent + an accessor, added
DisplayList::{window, document_features}, and added tests/page_window.rs;
#358 adds Wire::diagnostics. Neither sees the other on its own branch:

- delta.rs/display.rs test helpers built Page and DisplayList literally
  (E0560, E0063 x2) -> Page::resident(..) and the two new fields as None
- tests/page_window.rs's const WIRE misses diagnostics (E0063)
- tests/math_symbols.rs took Page::items as a field (E0615) -- broken on
  main itself, fixed separately in #664 and carried here

cargo test --release --no-run on crates/render-pipeline: 0 errors.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

* integration fix: #579's fast path must not swallow an \obeylines newline

Third instance of the same combination bug, found by re-running the full
suite after the rebase rather than assuming it was mechanical.

#593 (landed on main via #649) makes a source newline end the line under
\obeylines: the lexer folds a lone newline into TokenKind::Space, and
parse_stream_body's Space arm turns it into an Inline::LineBreak. #579's
borrowed fast path, written before #593 existed, matched Space first and
skipped it, so crates/compiler/tests/obeylines.rs went 7 passing -> 2
passing / 5 failing.

Take the fast path for a Space only when \obeylines is not in force; a
Comment is still always skipped. Under \obeylines spaces fall through to
the slow path, which is where the newline is read from the token's own
source bytes.

cargo test --release --test obeylines: 7 passed, 0 failed.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

---------

Co-authored-by: d-q222 <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: muse-spark-1.3-contributor <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
@GoKubar
GoKubar deleted the agent/daniel-parent/structured-diagnostics branch September 16, 2026 04:18
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.

2 participants