Skip to content

integration: compiler + pdf + v2 queue (#579, #640, #440, #621, #358) - #658

Merged
GoKubar merged 51 commits into
mainfrom
agent/kabir-claude/integration-q3
Sep 15, 2026
Merged

GoKubar merged 51 commits into
mainfrom
agent/kabir-claude/integration-q3

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Integration branch for the five READY PRs that were each conflicting with main on the compiler hub files. Built the way the other integration branches were: one git merge --no-ff per PR (commits and authorship preserved), resolved once, verified once.

What it carries

PR Title
#579 compiler: handle_line 1.4x faster on large documents
#640 compiler: stop dropping six amsfonts symbols on a false premise (salvage of #212)
#440 compiler: accept kernel preamble declarations, warn on DocumentMetadata keys
#621 pdf: TikZ tiling patterns on the exact route (stacked on #533)
#358 render-pipeline: opt-in display-list-v2-diagnostics capability on the v2 wire

Conflicts, and how each was resolved

Three combination bugs the merge exposed

None of these is visible in any single PR — they only exist once the branches meet, which is the argument for merging them as one change:

  1. 8f82add2 — compiler: handle_line 1.4x faster on large documents — no placed-item copies, borrowed session output, pages serialised once (stacked on #535) #579's new borrowed fast path in parse_stream_body called control_symbol_kern with 3 arguments; compiler: punctuation after a style group survives macro expansion (GH-MACRO-BODY-COMMA) #576 gave it 5 (maps_to_invocation, definition). Build error.
  2. 3e393e71 — compiler: handle_line 1.4x faster on large documents — no placed-item copies, borrowed session output, pages serialised once (stacked on #535) #579's fast path matched Word tokens before the tabbing arm that integration: comment environment and tabbing (#553, #551) #642 added to main, so \=/\>/\< were typeset as text: crates/compiler/tests/tabbing.rs went from 11 passing to 6 passing / 5 failing, with tab stops 0 instead of 2. The fast path now carries the slow path's guard.
  3. d972b38b — render-pipeline: opt-in display-list-v2-diagnostics capability carries suggestion on the v2 wire #358 adds a diagnostics field to v1::Capabilities; main's crates/perf-bench (FT-070: engine performance harness, committed baseline and a >5% regression gate #206, landed today) builds that struct literally, so the engine performance job failed at Build with E0063. This is exactly the failure mode the verification order guards against — a target that does not compile prints no test result: line.

Verification, in the mandated order

  1. cargo test --release --no-run per crate, separately and first: compiler, render-pipeline, pdf, math-layout, tex-expansion — 0 errors each. cargo check on crates/perf-bench also clean.
  2. Full suites with FLASHTEX_FONT_DIRS / FLASHTEX_LM_DIR / FLASHTEX_TFM_DIRS pointed at apps/mac/Fonts: compiler 902, render-pipeline 464, pdf 120, math-layout 74, tex-expansion 92 passed. 203 test binaries, 0 failures. (compiler 888 -> 902 and render-pipeline 454 -> 464 are the new tests these PRs bring; pdf 119 -> 120 likewise.)
  3. cargo build --release --locked: compiler, render-pipeline, pdf, flashtex-cli all clean, so CI's --locked step has nothing to regenerate.
  4. Generated artefacts regenerated, never hand-merged; sync-supported-latex.sh --check byte-identical.

Merging this closes #579, #640, #440, #621 and #358.

d-q222 and others added 30 commits September 14, 2026 00:42
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]>
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]>
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]>
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]>
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]>
…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
…s and set diagnostics: false in flashtex-render's Wire

Conflict in crates/render-pipeline/src/bin/flashtex-render.rs: main (#344) made
--v2 honour --images; this branch added the Wire.diagnostics field. Resolved
as Wire { images: self.images, device_color, diagnostics: false }.
lib 97/0, compiler_diagnostic_forward 2/0, display_list_delta 3/0, cli_e2e 4/0.

Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…mentMetadata 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]>
…ment

Conflict in crates/render-pipeline/src/display.rs: one hunk, the
Diagnostic.suggestion doc-comment. Kept HEAD's capability-gated wording
(serialised on display-list-v2 only when Wire.diagnostics is set). Took
main's #354 from_compiler (exact compiler code, in-memory suggestion) as
the auto-merged base; Wire.diagnostics / diagnostic_json_wire /
write_diagnostics gating came through from this branch.

Ran: git fetch origin && git merge origin/main. Tests not yet run.

Next: add a negotiated-case integration test next to #354's
"v2 omits suggestion" test; run render-pipeline lib + diagnostic/delta
tests; confirm remaining diff vs origin/main is only the capability.

Open questions: none on the conflict. document-runtime allowlist is out
of scope (#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]>
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]>
…gestion

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]>
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]>
…nt 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]>
Merge origin/main (Mac editor folding/indent/print, cleveref/includeonly,
kernel inventory tests). No conflicts with the v2 diagnostics capability
work. Re-ran the lane gates after the merge.

Ran (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-diagfwd):
- cargo test --manifest-path crates/render-pipeline/Cargo.toml --lib
  test result: ok. 126 passed; 0 failed; 2 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.037s OK

Next: push the lane branch.

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]>
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]>
…etadata

- 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
# Conflicts:
#	apps/mac/Sources/FlashTeXMac/Resources/supported-latex.json
#	crates/compiler/src/parser.rs
#	crates/compiler/supported/coverage.md
#	crates/compiler/supported/supported-latex.json
#	docs/user/compiler.md
…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]>
…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]>
…d/kernel-text-symbols

Generated artefacts (supported-latex.json x2, coverage.md,
docs/user/compiler.md) regenerated with
crates/compiler/scripts/render_supported_latex.sh and
apps/mac/scripts/sync-supported-latex.sh, not hand-merged; supported.rs
merged clean, keeping both sides' rows.

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]>
…on 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]>
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
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
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
…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
#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
…Z 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
GoKubar and others added 9 commits September 15, 2026 18:12
…pability carries suggestion on the v2 wire
…'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
…rol 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
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
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

CI: everything green except engine performance, and it fails on the output-identity gate, not on timings — the same situation as #649.

OUTPUT CHANGED — byte-identical output is a hard gate, so this fails regardless of timings:
  hw2/{cold.reply, export.pdf, warm.*×8}, inline-math/{cold.reply, export.pdf, warm.*×2},
  math-sheet/{cold.reply, export.pdf, warm.*×4}
FAIL: output changed in 20 place(s)

Every one of the 20 is a math fixture (hw2, inline-math, math-sheet), which is what #640 is for: it stops dropping \angle, \hbar, \sqsubset, \sqsupset and \mho, so documents using them render glyphs where they previously rendered nothing. A changed digest there is the fix working, not a regression. #621's /Pattern resources move export.pdf for the same reason.

The timing deltas in that report are not enforced — the runner is an EPYC 7763 and the baseline crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json was recorded on the Ryzen reference host, so the harness reports them and declines to fail on them.

As on #649, the resolution is a deliberate re-record of the baseline on the reference host at merge time (./target/release/flashtex-perf-bench --out baselines/linux-x86_64-ryzen7-7800x3d.json), not a code change. I have not done it — it redefines the gate for every later PR and should be your call. Happy to record it on this host on request.

Local verification of the merge is unchanged: 203 test binaries, 0 failures (compiler 902, render-pipeline 464, pdf 120, math-layout 74, tex-expansion 92), --no-run clean first, --locked clean.

@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up that settles the perf question: main itself now fails the same gate. The perf run on main at ec3cb67 (#295, "render: paint the \not slash across the relation") ends with the identical OUTPUT CHANGED — byte-identical output is a hard gate / FAIL: output changed in 20 place(s).

So the committed baseline crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json is simply stale relative to main: it was recorded before today's rendering changes landed, and every PR that touches layout now trips it, whether or not it is at fault. This is a repo-wide condition introduced when #206/#232 landed the gate today, not a defect in this branch.

That makes re-recording the baseline a main-level maintenance task rather than something any one PR should carry. Recommend doing it once on the reference host against current main, then re-running these PRs.

GoKubar and others added 2 commits September 15, 2026 18:54
#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
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Re-refreshed onto main after #654/#294/#295/#296 landed. #294's page window collided with #358's diagnostics wire in four places — none of which either branch can see on its own, which is the case for merging them together:

Re-verified on 382ba24, in order:

  1. cargo test --release --no-run per crate, separately: compiler / render-pipeline / pdf / math-layout / tex-expansion — 0 errors each; cargo check on perf-bench clean.
  2. Full suites: compiler 903, render-pipeline 475, pdf 120, math-layout 74, tex-expansion 92. 204 test binaries, 0 failures.
  3. cargo build --release --locked: all four clean.
  4. Generated inventory regenerated; sync-supported-latex.sh --check byte-identical.

GoKubar and others added 3 commits September 15, 2026 19:16
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
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (through 79c83aa7 #649, then 35ead1c2 #665) and re-verified from step 1 rather than assuming the rebase was mechanical — which was the right call, because it exposed a third instance of the same combination bug.

The new bug: #579's fast path swallows an \obeylines newline

#593 landed on main inside #649 while #658 was open. It 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.

crates/compiler/tests/obeylines.rs: 7 passing → 2 passing / 5 failing (each_source_line_breaks_like_a_forced_break, broken_lines_land_on_their_own_output_lines, surrounding_spaces_are_not_preserved, the_effect_ends_at_the_environments_end, the_effect_ends_where_the_group_ends).

Fix (30a0a947): 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, where the newline is read from the token's own source bytes. Cost is one bool test outside \obeylines regions.

That is now three slow-path arms #579's fast path had shadowed — control_symbol_kern's post-#576 signature, #642's tabbing arm, and now #593's \obeylines arm — each invisible on either branch alone. Worth remembering when #579-style fast paths are reviewed: the guard list has to be re-checked against main every time main adds an arm above it.

Verification after the rebase, in the mandated order

  1. cargo test --release --no-run, per crate and separately: compiler, render-pipeline, pdf, math-layout, tex-expansion — 0 errors each; cargo check on perf-bench — 0 errors.
  2. Full suites with the font env: compiler 910, render-pipeline 478, pdf 122, math-layout 74, tex-expansion 92. 208 test binaries, 0 failures.
  3. cargo build --release --locked: compiler, render-pipeline, pdf, flashtex-cli all clean.
  4. Generated inventory regenerated with render_supported_latex.sh, never hand-merged; sync-supported-latex.sh --check byte-identical.

The only merge conflict from the rebase itself was docs/user/compiler.md (generated). #665 landed mid-verification and is merged in; its diff is entirely under apps/mac/, so it does not disturb the Rust results above.

@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Merge-order note: this PR's only failing check is engine performance, and it is failing against the old baseline — it will pass once #668 lands, with no change needed here.

The proof is in the digests it names. Its first reported failure is:

cv/cold.reply: output changed (7532e44c18b7c6e3 -> dce5d2d969154237)

and dce5d2d969154237 is precisely the value #668 records for cv/cold.reply. Same for the rest of the list — these are #649's already-merged list-geometry changes, which the committed baseline predates. #668's own CI run of engine performance is green, on main, with no OUTPUT CHANGED.

Suggested order: merge #668 first, then re-run this PR's checks (or merge it — the digest set it trips is entirely main's own, none of it originates in this branch). Everything else here is green, and the local verification after the rebase was 208 test binaries / 0 failures with --no-run run first and separately.

@GoKubar
GoKubar merged commit 83285e3 into main Sep 15, 2026
20 of 22 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/integration-q3 branch September 16, 2026 04:17
GoKubar added a commit that referenced this pull request Sep 16, 2026
…unbreaks main) (#693)

`tests/label_page_seed.rs:36` constructs `Wire { images, device_color }`, but
`Wire` grew a third field:

    error[E0063]: missing field `diagnostics` in initializer of `Wire`

A combination break, not either change being wrong. #652 (label-page seeding)
added this test against a two-field `Wire`; #358 added `Wire.diagnostics` and
landed separately inside integration PR #658. Each was green on its own branch
and neither CI run saw the other.

This is the same failure mode as #664 and #638: a Rust test target that fails to
compile emits no `test result:` line, so summing those lines reads the crate as
green while 482 tests never run. Caught by running `cargo test --no-run` as a
separate first step before trusting any pass count -- worth keeping in the
release checklist, since this was found while verifying main for the 0.1.6 tag.

Verified in `--release` (per #667, debug is not a valid oracle for this crate):
render-pipeline 482 passed, 0 failed, with `--no-run` clean first.

Implementation-Agent: Claude Opus 5 (orchestrator-astra, linux-primary)
Commit-Executor: Claude Opus 5 via Claude Code

Co-authored-by: Claude Opus 5 <[email protected]>
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