Skip to content

FT-070: a negotiated page window — the fix for a 500 KB document that has no reply - #294

Merged
GoKubar merged 26 commits into
mainfrom
engine/ft-070-page-window
Sep 15, 2026
Merged

GoKubar merged 26 commits into
mainfrom
engine/ft-070-page-window

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

FT-070's structural half, and the fix for a document that has no reply at all.

r2 turns the capability on. r1 specified the wire shape and deliberately did
not negotiate it, because one of the closures §3 requires whole was not yet
whole. That is fixed, the name is accepted, and the product claim is now
demonstrated rather than argued: the 500 KB corpus document that returns
status: failed today comes back with a painted window.

Rebased onto main three times during this lane as it moved — 9bd4b025, then
8f83ab5c (the tables/footnotes chains and the vendor re-pin), then 06007472
(#343's single page builder). Verified at each.

1. Two problems, one mechanism

A 500 KB document cannot be previewed today. 385 pages serialise to a
152 106 263-byte display_list against a 16 MiB line limit, so handle_line
declines it without serialising; the v1 compile_result that would carry the
pages instead is 20 339 674 bytes; the request ends status: failed.
Not slow — failed.

Neither existing sibling capability fixes it, for structural reasons: -delta
needs the full DisplayList from render_cached before it can diff anything,
so it shrinks the wire after the producer has already built and failed to fit
the whole document; -only empties the v1 pages only when a sibling is
present, and here the sibling is the line that was declined.

And #232's arithmetic forecloses the memory route separately: 100 MB over
1507 pages is ~68 KB a page, less than one page of glyph data at any
representation that keeps per-glyph carets and source ranges.

Both roads end at the same mechanism — the producer must build less.

2. The fix, through the actual worker

flashtex-render over JSON Lines, the synthetic-500kb corpus case, the real
16 MiB limit, zero font-failure diagnostics in every run. Byte-identical across
all three merges of main:

request reply
["display-list-v2"] — what the Mac app sends today status: failed, one line, no pages: "compile_result would be 20 339 674 bytes for 385 pages, over the 16 777 216-byte reply limit"
+ -only + -window, {first_page: 1, page_count: 16} status: recovered, two lines, sibling 5 937 794 B, 385 pages / 16 resident / 369 elided, window: {1, 16, 385}
+ -only + -window, {300, 16} as above, sibling 6 369 270 B, painted at page 300
+ -only + -window, {1, 64} narrowed to {13, 40} and served, 15 211 146 B
+ -only + -window, no display_list_window status: failed — the capability without a position is an unwindowed reply (§4), and the name is absent from the echo

cli_e2e::a_document_over_the_reply_limit_has_a_reply_when_a_window_is_negotiated
is that table as a test: the same three refusals put into the same ratio through
FLASHTEX_MAX_REPLY_BYTES, because the failure is a ratio between the reply and
the limit rather than an absolute size, so it costs seconds instead of minutes of
debug-build layout. Nothing in it is hard-coded to a page size — the limit comes
from a measured window, and the whole-document size is read back out of the
producer's own refusal.

3. What r2 changed, and why the name is on

  • required_features is whole-document. r1 derived it from the resident
    pages. A document whose only rule sat on page 300 would have announced no
    rule to a consumer windowed on page 1 — the same failure as a smaller font
    closure, and the one §3 and §5.6 forbid. assemble_windowed now harvests a
    DocumentFeatures in the same pass that harvests the faces and the
    diagnostics, over every block including the ones whose only pages are elided,
    plus the items no block owns (float images, the \pagecolor rule, the
    document default colour written into every paint after placement). An
    unwindowed list still scans its own items, so every line on the wire today
    is byte-for-byte unchanged by the harvest existing.
  • status is window-independent (§4.1). v1::fallback asked "did the
    compile produce anything paintable" of the pages it built, which on a windowed
    payload are the window's; it now asks the same whole-document harvest.
  • An over-limit window is narrowed and served, not declined (§8).
    MAX_WINDOW_PAGES bounds what a viewer shows, not bytes, so a consumer may
    legitimately ask for 64 pages of a document whose pages are 426 KB each.
    Declining that is the status: failed this exists to remove, so the producer
    measures the pages it built, re-derives the window through the already-present
    PageWindow::fitting, and serves that. The echoed window is the authority
    on what was served, so a narrowing is not a diagnostic.
  • Negotiation follows -only's pattern exactly. Accepted only next to
    display-list-v2; echoed only on a reply that actually carries a window;
    -delta declined when a window is asked for (§7: a delta binds a digest for
    every page and a windowed producer has none for a page it never materialised);
    a degenerate window is not an error but an unwindowed reply with the name
    absent from the echo (§8).

4. What this implements (from r1)

  • Page.items: Vec<Item> → Page.content: PageContent (Resident(..) /
    Elided). Deliberately a breaking change rather than a resident: bool beside
    a retained items: the failure mode being designed against is a consumer that
    reads items without checking, and there is now no silent path.
  • render_windowed(..., window: Option<PageWindow>); render and
    render_cached keep their signatures and pass None.
  • typeset::assemble_windowed streams blocks into the window's pages instead of
    holding every AssembledBlock until a second page loop.
  • RenderCache::retain_assembled scopes the glyph-level cache to the window, so
    a viewer scrolling a long document does not re-accumulate every page it
    passed. blocks and adapted stay whole-document by design — they are what
    makes re-materialising a page cheap.
  • pdf::write_pdf/write_pdf_exact refuse a windowed list (a PDF never
    silently omits a page); v1::fallback skips an elided page; delta takes no
    snapshot from a windowed list and emits no delta against one.
  • On the wire an elided page carries its frame, "resident": false and no
    items key at all
    — absent, not [], so a consumer that ignored the flag
    fails to decode rather than painting a blank page. A resident page gains no
    marker, which is what keeps every existing digest identical.

Not implemented, and named as such: §5.5's retained PageRecipe. Each
windowed render re-runs layout. Serving a scroll without re-layout is the point
of retaining it, and is the next revision. A window and a delta are also
mutually exclusive (§7).

5. Output identity

The §9 gate is equality, not a digest, because the risk this design carries
is a producer sending a correct-looking smaller closure; a digest would only
prove a consumer rebuilt what it was sent.

Run against the real 500 KB case rather than a 20-page stand-in: for windows
at pages 1, 185, 300 and 378, every resident page object is byte-identical to
that page in the unwindowed 152 MB render, all 385 page frames match, and
documents, fonts, diagnostics and required_features are byte-identical.
tests/page_window.rs keeps the in-process version over every window position of
a 20-page document, forwards and backwards through one shared cache.

page_window::a_window_announces_a_feature_that_only_an_elided_page_uses is the
new closure gate. Reverting the harvest turns it red with ["glyph_run", "rgba-srgb", "cluster-actualtext"] against ["glyph_run", "rule", "rgba-srgb", "cluster-actualtext"], which is the point of it.

6. Memory

memprofile --window 1:16 against an unwindowed control on the same code path
(--render-only, so the window is not credited with the v1 payload and JSON line
the protocol path also builds):

500 KB / 385 pp 2 MB / 1507 pp
unwindowed window 16 unwindowed window 16
VmRSS 748.8 541.9 2919.6 2037.0
live 363.2 238.1 1442.9 922.2
walked 234.7 109.2 941.1 418.6
— display list 61.7 2.5 247.5 2.5
— render cache 173.1 106.8 693.6 416.1

The 500 KB column is r1's; the 2 MB column is re-measured at this SHA, against
r1's 2912.3 → 2035.8 and 1440.7 → 920.0 — 0.2% apart after three merges of
main, with the display-list and render-cache rows identical to the digit.
Reproducing the control is the point of re-running it. The display list falls to
the window's own size and stops scaling with the document: 2.5 MiB at 385
pages and at 1507.

r2 can also measure the protocol path windowed, because the capability is
negotiated: 2 MB, VmRSS 2889.0 → 2048.5, live 1440.8 → 920.1; 500 KB,
VmRSS 751.3 → 540.3, live 363.3 → 238.2.

That row exists because of a harness fix worth flagging to other lanes:
memprofile's own request() emitted a JSON-RPC 2.0 envelope, which
protocol::handle_line answers missing_protocol_version, so its default-mode
warm keystrokes had been rendering nothing. The window's numbers were never
affected
— they were measured --render-only on both sides, which builds no
request — and crates/perf-bench proper builds a correct request
(measure.rs:204), so the digests and timing gates were never affected either.

At 2 MB the window still leaves 2037 MiB — 20x the 100 MB target, and the
proposal says so. What stays resident is RenderCache.blocks plus the font,
expander and compiler caches: whole-document by design here.

7. Collision with #283

Both replace Page.items. #294 first, #283 rebased onto it and re-measured,
and the reason is an asymmetry that is measured rather than argued:

The savings are also not additive: a 16-page window's whole display list is
2.5 MiB, so there is at most 2.5 MiB of page-side duplication left for #283 to
remove from a windowed render. #283's 244 MiB should be read as what it is —
a saving for every unwindowed render, which is every render in the product
today and every short document forever — rather than added to the window's.

8. Gates

gate result
amsmath corpus 59/59 within 0.5 bp
HW1 / HW2 3 pages each, 0 errors, 0 overfull, 0 font-failure diagnostics
cargo test -p flashtex-render-pipeline --no-fail-fast 236 passed, 0 failed, 1 ignored
§9 equality on the 500 KB case, 4 window positions pass — resident pages, frames and every closure byte-identical
corpus digests vs a same-base control, same directory 190 digests over 26 cases, 0 differing, unmeasured: [] both

The digest gate was run at 8f83ab5c (branch ac3f1404) against a control
built and run in the same directory from the same merge of main with this lane's
changes reverted. Between that SHA and this one the lane added two
comment-only commits, the two accessor fixups #343's new oracles needed, and
proposal text; the suite, amsmath, HW and the equality gate were all re-run at
this SHA.

9. What still has to happen before a user sees this

The producer half needs no co-signer: no reply on any route is windowed, because
no consumer names the capability. What is gated is the consumer — apps/mac
must not add display-list-v2-window to setLiveV2's capability list until the
v2 pane paints an elided page as a placeholder rather than as nothing, since a
blank page is indistinguishable from a page that is genuinely empty. That is the
confusion PageContent::Elided prevents on the producer side and the consumer
must not reintroduce. crates/rendering-core and the forwarding crates sign the
same shape; the Commander signs the -window/-delta exclusivity and the
docs/contracts/runtime-v1* amendment. The co-signer table in the proposal now
carries a status column saying exactly who owes what.

The other thing for the integrator: this branch still carries #206 (harness) and
#232 (memory/carets), both open. Merging this merges all three.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

claude and others added 10 commits September 13, 2026 16:10
There was no way to tell whether an engine change made the compiler faster.
The numbers that existed came from `examples/stages.rs` and `perf_bench.rs`:
macOS-only metadata, one sample per cell, no memory figure, no machine-readable
output, and no way to fail a build on a regression. This adds a harness whose
output can be argued with.

`crates/perf-bench` measures the product path -- the same
`protocol::handle_line` the `flashtex-render` worker serves -- over the ten
committed real-world fixtures and four generated documents (500 KB, 2 MB,
math-heavy, TikZ-heavy; generators committed, not blobs). Per case it reports
cold timings with a per-phase split, warm single-keystroke timings, PDF export,
peak and steady RSS, and an output digest. `--baseline ... --check` turns the
same run into a CI gate.

Three rules the harness enforces on itself, because breaking any of them
produces numbers that look fine and mean nothing:

* No measurement without fonts. Latin Modern and the pinned 12 pt TFM set must
  load and no render may substitute a face or a metric, or the case produces no
  timing at all -- a substituted metric is a different workload, not a slower
  one. The font set is built with `FontSet::with_dirs`, which probes nothing,
  so this box's TeX Live cannot supply the metrics by accident. The line is
  drawn at the configuration, not the document: a character with no glyph, or a
  class command the compiler does not model, is deterministic and identical
  every run, so the case is measured and the degradation is recorded next to
  the number.
* Cold means cold. Every repetition runs in a child process of its own, so the
  expander's thread-local cache, the font set's memoised faces and the
  allocator all start empty, and peak RSS belongs to one document.
* Medians, with the spread shown. Nothing comes from one sample; every metric
  carries n, p25/p75, p95 and MAD, and the table prints the run's own noise
  estimate per case.

The gate is built to survive a shared machine. A metric counts as regressed
only when it exceeds both the tolerance and that metric's own measured spread
in the baseline, and the comparison warns and stops enforcing timings when the
host, build profile, font configuration or peak load differ. Output identity
does not depend on the machine -- the fonts come from the repository -- so a
changed digest fails everywhere and unconditionally.

Baseline, at main 8465bbd on a Ryzen 7 7800X3D: cold HW1 meets its 10 ms
target; warm keystroke is 153x over budget at 500 KB and 132x at 2 MB, HW1 PDF
export is 5.6x over, and steady memory at 2 MB is 49x over. Full numbers,
method and three findings are in docs/evidence/perf-ft070-2026-09-13.

The clearest of those findings: typesetting a 2 MB document costs 42.7 s with
the document sources attached and 1.04 s without. Two per-formula code paths in
render-pipeline's typeset ask a question about the preamble and answer it by
searching the entire document, so a document that does not contain the searched
string pays a full scan per formula. That crate is another lane's, so this lane
has measured and reported it rather than touching it.

Gates unchanged (this adds a crate and edits no existing crate's source):
amsmath 59/59, HW1/HW2 3 pages with 0 errors and 0 overfull, render-pipeline
170 passed / 0 failed, compiler 395 passed / 0 failed, perf-bench 13 passed.

Implementation-Agent: Claude Opus 5 (FT-070 perf lane, linux-primary)
Commit-Executor: Claude Opus 5 (direct agent Git execution, per the AGENTS.md
  Cursor-limit fallback in force on this machine)
Co-authored-by: GoKubar <[email protected]>
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
The memory work measures with this harness, so the lane branches from main
with the harness merged in rather than duplicating the crate.

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

`typeset::assemble` grew `page_color`/`default_color` and `v1::Capabilities`
grew `device_color`/`delta`/`v2_only` after the harness was written. Pass
`None`/`None` and spread the default so the measured path is still the one the
committed baselines were recorded against.

Reported on PR #206.

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

`Cluster` carried a `Carets { first: Caret, last: Option<Caret> }` — 72 of
its 160 bytes — and a text run emits one cluster per glyph, so a 1507-page
document held 1.48 million caret pairs. They were never independent data:

  carets.first == Caret { text_byte: text_start_byte,
                          x:  hit_rect.x,
                          top: hit_rect.top,
                          height: hit_rect.height }

at all three construction sites (text runs, math, TikZ node text), and
`place_item`/`shift_x` moved the rect and both carets by the same offset,
so placement preserved it too. Audited over the twelve corpus cases —
1 991 552 clusters — the start caret was byte-identical to the derived one
in every single one, the end caret never sat on a cluster other than its
run's last, and its top/height always equalled that cluster's hit rect.

So `Cluster` keeps the rect and derives both carets, and the one thing that
is genuinely not derivable — the end caret's `x` (the TikZ path clamps the
hit rect's width to one tick but not the caret) and its text byte — moves to
the run as `GlyphRun::end_caret`, one per run instead of 40 bytes per glyph.
`Cluster`: 160 -> 88 bytes.

This also makes an invariant structural that `join_runs` used to maintain by
hand: it cleared the joined-over cluster's trailing caret so that only a
run's last cluster carried one. With the caret on the run there is nowhere
for a mid-run one to live.

Output is unchanged and that is the point of the change: both JSON emitters
and the delta digest now call `GlyphRun::carets_of`, which reconstructs the
same `Carets` value. `delta::changed_items` compares `end_caret` once per run
in place of `carets` per cluster — the same comparison, since the rest of the
caret is the cluster bytes and hit rect it already compares.

Measured on synthetic-2mb (1507 pages, 1.48M clusters), the perf harness
reports identical digests for all three scenarios (cold.reply
b0d5e89b71ab0200, warm.type-display-eq 4ec7e38a83002099,
warm.type-paragraph 484f07ea71d1b181) and steady RSS 5107 -> 4897 MiB.

FT-070. Reported on PR #206.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
FT-070's memory gap was a single number with no attribution. This adds the
instrument, so the breakdown is measured rather than argued about.

`render_pipeline::memsize` walks an already-built display list and render
cache and charges allocated bytes (capacity, not length — that is what the
allocator holds) to named lines, counting each shared `Rc` once so the two
totals can be added. It is read-only and touches no render path.

`memprofile <case>` renders a corpus case through the product path, runs the
warm keystrokes the harness runs, and reports VmRSS, live bytes from a
counting global allocator, and the walked breakdown, so the three gaps are
separated: live-minus-walked is what the walk cannot reach (font, expander
and compiler caches), RSS-minus-live is allocator retention, and a
`malloc_trim(0)` probe splits that last one into trimmable and fragmented.

It is a second binary because the counting allocator must not be linked into
the timing binary, and `main.rs` keeps its own module declarations: every
committed baseline was recorded by it exactly as it stands.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Two tests constructed or read `Cluster.carets` directly. The JSON
round-trip test now sets the run's `end_caret` — which also makes it check
that both writers agree about *which* cluster shows the end caret, not just
about its value — and the joined-fragment test reads `GlyphRun::carets_of`,
so it still asserts the property it was written for: a caret never falls
outside its own cluster's byte range.

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

FT-070's structural half. #232 established that 100 MB over 1507 pages is
~68 KB a page -- less than one page of glyph data at any representation that
keeps per-glyph carets and source ranges -- so the target cannot be reached by
representation and the document has to stop being resident.

`protocol/proposals/display-list-v2-window.md` is the proposal; this is its
producer-side prototype. The wire capability is specified and NOT negotiated:
`v1.rs` does not accept the name, no consumer sends it, and an unwindowed
render -- every render on every route today -- is byte-for-byte unchanged.

Where the window belongs. `-only` and `-delta` are serialisation levers: they
choose what of an already-built `DisplayList` reaches the consumer, so a
`-window` built at that boundary would cut wire bytes and leave resident memory
exactly where it is. The window therefore takes effect at `typeset::assemble`,
the first point where per-page glyph data exists, and is declared at the
protocol boundary because whether a reply covers the whole document is a
contract fact, not something a consumer should infer.

Layout still runs over the whole document -- page breaking, `\pageref`, floats
and contents lists are global and a window over them would change output. Only
assembly is windowed.

The completeness hazard, and what it forced. The font closure and the
`math_resource_profile` / `math_glyph_unmapped` diagnostics are derived during
assembly over every block, so a window that assembled only its own blocks would
emit a quietly smaller closure and fewer diagnostics. `assemble_windowed`
therefore still visits every block in the same order and harvests before it
drops: what the window changes is retention, not the traversal. An assembled
block reaching no resident page is dropped and never cached.

`Page.items: Vec<Item>` becomes `Page.content: PageContent` (`Resident(..)` or
`Elided`). Deliberately a breaking change rather than a `resident: bool` beside
a retained `items`: the failure mode being designed against is a consumer that
reads `items` without checking, and there is now no silent path. `pdf::write_pdf`
refuses a windowed list, `v1::fallback` skips an elided page, and `delta` takes
no snapshot from one and emits no delta against one (a window and a delta are
mutually exclusive in r1, since the delta's `list_digest` binds a digest for
every page).

On the wire an elided page carries its frame, `"resident": false` and no
`items` key at all -- absent, not `[]`, so a consumer that ignored the flag
fails to decode rather than painting a blank page. A resident page gains no
marker, which is what keeps every existing digest identical.

`tests/page_window.rs` is the acceptance gate, and it is equality rather than a
digest: over every window position of a 20-page document, each resident page
must serialise byte-identically to that page in the unwindowed render, and the
documents, fonts, diagnostics and required features must match the complete
compile's. A digest would only prove a consumer rebuilt what it was sent; the
risk here is a producer sending a correct-looking smaller closure.

Measured with `memprofile --window 1:16` against an unwindowed control on the
same code path (`--render-only`), 2 MB / 1507 pages: live 1440.7 -> 920.0 MiB,
VmRSS 2912.3 -> 2035.8, display list 247.5 -> 2.5. 500 KB / 385 pages: live
363.2 -> 238.1, VmRSS 748.8 -> 541.9. The display list stops scaling with the
document, which is the property this is for. What remains is
`RenderCache.blocks`, whole-document by design because it is what makes
re-materialising a page cheap -- and 2036 MiB is still 20x the 100 MB target.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ays bounded

Without this the window is only a first-render win. `RenderCache.assembled` is
append-only -- its sole bound is "clear everything at 50 000 entries" -- so a
viewer scrolling a long document accumulates the glyph-level assembly of every
page it has passed, and the resident set climbs back to the whole document
while the window keeps claiming to be 16 pages.

A windowed render now ends by retaining exactly the blocks its resident pages
used. `blocks` and `adapted` are deliberately untouched: they are the
whole-document layout records that make re-materialising a page cheap, and they
are the cache lines the measurements show remaining (160.2 MiB of
`BuiltBlock.items` and 73.1 MiB of `ClusterRec` at 2 MB). Bounding those is
#232's follow-up 3, not this.

An unwindowed render never calls `retain_assembled`, and now also treats every
block as wanted whether or not a page placed it -- so a complete compile's cache
behaviour is byte-for-byte and entry-for-entry what it was before the window
existed, rather than merely equivalent in output.

Also: `flashtex-cli`'s `has_content` reads through `Page::items()`, and the
proposal now states per section what r1 implements against what it specifies.
The gap worth naming is §5.5: the page recipe is NOT retained across requests,
so r1 re-runs layout for every window. Serving a scroll without re-layout is
the point of retaining it and is r2; the memory this change measures does not
depend on it, which is why it is separated rather than bundled in unmeasured.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…y budget

The window lane was written against FT-070's 100 MB target. PR #273 measured
something more urgent with the same cause: a 500 KB document has **no reply at
all** today. Its `display_list` sibling would be 164 MB against a 16 MiB line
limit, so `handle_line` declines it without serialising; the v1 `compile_result`
that would carry the pages instead is 20 339 909 bytes for those 385 pages, also
over; the request ends `status: failed`.

Neither existing sibling capability fixes that, and the reasons are structural.
`-delta` needs the full `DisplayList` from `render_cached` before it can diff
anything, so it shrinks the wire after the producer has already built and failed
to fit the whole document. `-only` empties the v1 `pages` only when a sibling is
present, and here the sibling is the 164 MB line that was declined. The window is
the only one of the three that makes the producer build less, which is what a
size limit actually requires.

So `MAX_WINDOW_PAGES` was 512, which is indefensible: at the measured ~426 KB a
page that is 218 MB. It is now 64, derived from the arithmetic -- a 16 MiB line
carries ~39 pages of that document and the runtime's 8 MiB framed default ~19,
both more than a viewer shows and both finite where 1507 pages is not.

`PageWindow::fitting(centre, pages, bytes_per_page, limit)` is the widest window
a given limit can carry. It takes a measured `bytes_per_page` rather than a
constant, because page size varies by an order of magnitude between a title page
and a dense one and a constant here would be a guess presented as a bound; the
caller supplies the previous reply's `page_bytes` or its own estimate. A page too
large for even one to fit still yields a one-page window -- refusing is the
protocol's job, not the window's. Nothing calls it until the capability is
negotiated.

The consequence worth recording is a composition result: `-window` and `-only`
are each useless alone at this scale and sufficient together. The v1 payload
fails on its own at 385 pages (20.3 MB) and the v2 sibling fails on its own
(164 MB), so a consumer that wants large documents to work sends
`display-list-v2`, `-only` and `-window` together. That is the first hard reason
in this protocol to require two capabilities rather than choose between them.

Proposal gains §1.0 for the failure, §1.1 for the memory argument it started
from, and the §7 composition rule. `tests/page_window.rs` gains
`a_window_is_sized_by_the_reply_limit`, which pins the arithmetic against #273's
measured page size rather than against a number invented here.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar and others added 12 commits September 14, 2026 01:36
… and the page's items accessor

Three semantic conflicts between this lane and main's `\lVert`/`\rVert` and
extensible-delimiter work. The textual merge was clean; none of them is.

`typeset.rs`'s stacked-assembly cluster (main's extensible delimiter, one
cluster holding the whole Latin Modern Math assembly) set `Cluster.carets`
explicitly. #232 removed that field: the carets are derived from
`text_start_byte` and `hit_rect` (`Cluster::first_caret`), and the run-level
`end_caret` supplies `last` for the final cluster only. The literal it wrote --
`first { text_byte: start, x: g.x, top, height: hh }`, `last: None` -- is
exactly what the accessor derives from the `hit_rect { x: g.x, top, width,
height: hh }` it sits beside, and the run is built with `end_caret: None`, so
dropping the field is value-preserving rather than a behaviour change.

`tests/big_delimiter_packages.rs` and `tests/extensible_delimiters.rs` are new
on main and read `&page.items`, which this lane made a method returning
`Option<&Vec<Item>>`. Both are unwindowed renders, so they take
`resident_items()` -- the accessor that panics on an elided page rather than
reading it as empty -- like the other 20 tests this lane converted.

Builds: `cargo build --tests` clean in render-pipeline, flashtex-cli and
perf-bench.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
… reply

r1 specified the wire capability and deliberately did not negotiate it, because
one of the closures §3 requires whole was not yet whole. This closes that gap
and turns the name on, which is what makes the lane's product claim testable
rather than argued: the document that returns `status: failed` today now
returns a painted window.

The gap. `required_features` is derived by classifying items, and it was
derived from `resident_page_items()` -- the window's items, not the document's.
A document whose only rule sits on page 300 would have announced no `rule` to a
consumer windowed on page 1, which is the same failure as a smaller font
closure: a consumer negotiating a feature set it cannot paint the rest of the
document with. §5.6 already named the rule ("computed during the streaming
pass, over every block, not over `pages`"); r1 had not implemented it, and
`display.rs` said so in a comment. `assemble_windowed` now harvests
`DocumentFeatures` in the same pass that harvests the faces and the
diagnostics, from every block including the ones whose only pages are elided,
plus the page-level items the block loop cannot see (float images, the
`\pagecolor` rule, the document default colour). An unwindowed list still
*scans* its own items, so every line on the wire today is byte-for-byte what it
was; only a windowed list reads the harvest.

`status` too. `v1::fallback` derived `has_content` from the pages it built, and
a windowed payload holds only the resident ones, so a window over blank pages
of a document carrying an error could have reported `failed` where the
unwindowed reply says `recovered`. §4.1 says the window does not change
`status`, so the question is now asked of the same whole-document harvest.

Negotiation follows `-only`'s pattern exactly. `CAP_WINDOW` is accepted only
next to `display-list-v2`, `payload.display_list_window` says where the viewer
is, and the name is echoed only on a reply that actually carries a window --
the way `-only` is echoed only when the pages were really elided. Per §7 the
window declines `-delta`: a delta binds a digest for every page and a windowed
producer has none for a page it never materialised. Per §8 a degenerate window
is not an error; the reply is unwindowed and the echo omits the name.

One behaviour beyond r1, and it is the one that makes the capability worth
having: a window the reply limit still cannot carry is narrowed and served
rather than declined. `MAX_WINDOW_PAGES` bounds what a viewer shows, not bytes,
so a consumer can legitimately ask for 64 pages of a document whose pages are
426 KB each. Declining that is the `status: failed` this exists to fix, so the
producer measures the pages it just built, re-derives the window through the
already-present `PageWindow::fitting`, and serves that; the echoed `window` is
the authority on what was served, so the narrowing needs no diagnostic (§8).

Measured, against the real `synthetic-500kb` corpus case, 385 pages, through
the actual `flashtex-render` worker over JSON Lines:

  today's consumer   status failed -- "compile_result would be 20 339 674 bytes
                     for 385 pages, over the 16 777 216-byte reply limit"
  window 1:16        status recovered, 2 lines, sibling 5 937 794 B,
                     385 pages / 16 resident / 369 elided
  window 300:16      status recovered, sibling 6 369 270 B
  window 1:64        narrowed to 13:40 and served, 15 211 146 B

and the §9 equality gate applied to that document rather than to a 20-page
stand-in: for windows at 1, 185, 300 and 378, every resident page object is
byte-identical to that page in the unwindowed 152 MB render, all 385 page
frames match, and `documents`, `fonts`, `diagnostics` and `required_features`
are byte-identical. Zero font-failure diagnostics in every run.

Tests. `cli_e2e` gains the product bug itself as a regression test: the same
three refusals reproduced through `FLASHTEX_MAX_REPLY_BYTES` (the failure is a
ratio, not an absolute size), with the limit derived from a measured window and
the whole-document size read back out of the producer's own refusal, so nothing
is hard-coded to a page size. `page_window` gains the closure test: a document
whose only rule is on a late page, windowed on page 1, must still announce
`rule` -- and it asserts the resident page carries no rule, so the feature can
only have come from the harvest. Reverting the harvest turns that test red with
`["glyph_run", "rgba-srgb", "cluster-actualtext"]` against
`["glyph_run", "rule", "rgba-srgb", "cluster-actualtext"]`, which is the point.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…w on the protocol path

`memprofile`'s `request()` built a JSON-RPC 2.0 envelope -- `jsonrpc`, `method`,
`params` -- and `protocol::handle_line` requires runtime-v1's
`protocol_version` / `type` / `payload`. Every warm keystroke on the default
(protocol) path was therefore answered `missing_protocol_version` and rendered
nothing, so a default run's warm phase was measuring an empty cache rather than
a populated one.

The window's published numbers are unaffected: they were measured
`--render-only` on both sides, which never builds a request. `crates/perf-bench`
proper builds a correct request (`measure.rs:204`), so the digests and the
timing gates are unaffected too. What was wrong was memprofile's own default
mode, and only its warm phase.

With that fixed, `--window` no longer has to imply `--render-only`: the
capability is negotiated, so a windowed run can drive the same protocol path
the product does, `display_list_window` and all. The comparison rule is
unchanged and now stated as "compare like with like" rather than "windowed
means render-only".

Measured at this commit, release, this machine, zero font diagnostics:

  synthetic-2mb, --render-only    VmRSS 2912.6 -> 2035.9   live 1440.8 -> 920.1
  synthetic-2mb, protocol         VmRSS 2889.0 -> 2048.5   live 1440.8 -> 920.1
  synthetic-500kb, protocol       VmRSS  751.3 ->  540.3   live  363.3 -> 238.2

The `--render-only` pair reproduces the r1 table (2912.3 -> 2035.8, 1440.7 ->
920.0) to within 0.1 MiB after the rebase onto current main and the
negotiation, which is the point of re-running it. The display list is 2.5 MiB
at 385 pages and at 1507, unchanged.

The proposal goes to r2: the capability is negotiated, `required_features` is
whole-document, `status` is window-independent, and an over-limit window is
narrowed and served rather than declined.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…still has to sign

The §9 gate list gains the two tests r2 adds and the equality run against the
real 500 KB case rather than a 20-page stand-in. §1.0 gains the measured
replies -- the failure and the four windows -- so the section that argues the
bug also shows the fix. The measured table notes that the r1 numbers reproduce
after the rebase, adds the protocol-path pair the harness fix made measurable,
and records the harness fix itself rather than quietly benefiting from it.

The co-signer table gains a column. The producer row is signed; the three
consumer rows and the Commander row are unchanged in substance but are now
explicitly gating the *consumer*, because that is what negotiation changes:
no reply on any route is windowed today, and `apps/mac` must not add the name
to its capability list until the pane paints an elided page as a placeholder
rather than as nothing.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
`-only` and `-window` are echoed only on a reply that actually carries a
sibling line. The over-limit `compile_result` path filtered `display-list-v2`
out of the echo but left those two in, so a reply that sent nothing could still
have claimed the pages were elided for a sibling, or that a window was served.
Reachable only when a windowed or `-only` v1 payload is itself over the limit,
which is why it went unnoticed; wrong either way.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
# Conflicts:
#	crates/render-pipeline/tests/tabular_oracle.rs
…window's

Two stale notes left over from r1. `resident_page_items` said deriving a
document-wide feature set from it was unreconciled r2 work and the reason the
capability was producer-internal; the harvest reconciled it, and the doc now
says what the accessor is for instead -- what a list carries, never what the
document needs. `negotiate`'s note said "in r1" about the -window/-delta
exclusion, which outlived r1.

Comments only. The binaries used for the digest and memory runs at this SHA
predate these two edits and are unaffected by them.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
The harvest visits every block, including one placed on no page, so it can
announce a feature nothing paints. That is the safe direction -- a consumer
told to support `rule` when no rule is drawn loses nothing, while a consumer
not told is the failure the harvest exists to prevent -- and the §9 equality
gate pins the harvest against the unwindowed scan for every document it
covers, so an over-announcement surfaces as a windowed reply differing from
the unwindowed one rather than passing quietly. Worth saying where the next
reader will be standing when a gate fails.

Comment only.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ough the accessor

`tests/footnotes_oracle.rs` and `tests/float_notes_oracle.rs` arrived on main
with the single page builder (#343) and read `&page.items`, which this lane
made a method returning `Option<&Vec<Item>>`. Both are unwindowed renders, so
they take `resident_items()` -- the accessor that panics on an elided page
rather than reading it as empty -- like the other 23 tests this lane converted.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
The memory table stays r1's and now says so, with the r2 re-run of the 2 MB
pair beside it: 2919.5 -> 2037.0 MiB VmRSS and 1442.9 -> 922.2 live against
r1's 2912.3 -> 2035.8 and 1440.7 -> 920.0, with the display-list and
render-cache rows identical to the digit. Reproducing the control after two
merges of main is the point of re-running it.

The digest gate gets its result: 190 digests over 26 cases, 0 differing,
against a control built and run in the same directory from the same merge of
main with this lane's changes reverted.

Implementation-Agent: claude-opus-5 (engine lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar GoKubar changed the title FT-070: a bounded resident page window (and the fix for a 500 KB document that has no reply) FT-070: a negotiated page window — the fix for a 500 KB document that has no reply Sep 14, 2026
GoKubar added a commit that referenced this pull request Sep 14, 2026
…olders

The consumer half of `display-list-v2-window` (protocol/proposals/display-list-v2-window.md,
producer PR #294). The producer's `apps/mac` co-signer row gates the capability
on exactly this: the pane must paint an elided page as a placeholder before the
shell may send the name, because today it would paint nothing there and a blank
page is indistinguishable from a page that is genuinely empty — the confusion
`PageContent::Elided` exists to prevent on the producer side and which the
consumer must not reintroduce. This commit does the painting; the name is not
sent yet.

**The wire shape, fail-closed.** `RenderingV2.Page` gains `PageContent`, mirroring
the producer's enum so that "this page was not built" is not representable as
"this page is empty". `items` present = resident; `items` absent with
`"resident": false` = elided; `items` absent with no flag = a DECODE ERROR. That
last rule is the whole reason §4 makes `items` absent rather than `[]`: a
consumer that never learned about windows gets a refusal instead of a blank page.
Both readers enforce it — `Codable` and `RenderingV2Fast` — and `DisplayList`
gains `window`. A resident page still encodes with no `resident` key and an
unwindowed list emits no `window`, so every line on the wire today is byte-for-byte
unchanged.

`validate` gains the residency/window agreement check (an elided page with no
window, a hole inside the window, a resident page outside it, a mismatched
`document_page_count` are all refusals) and skips item checks on elided pages
while still requiring their page number and a positive frame. The
`used ⊆ declared` direction of the feature check is already what §3's
whole-document `required_features` needs, and a test pins that.

**The paint.** An elided page keeps its real frame, so the scroll column and page
navigation land exactly where they would have, and `PageV2View` draws it as a
dashed, tinted placeholder labelled "Page N / not loaded yet" — never a white
rectangle, never an error. It is not rasterized, has no hover and no tap target,
and carries its own accessibility label.

**What refuses.** `Export PDF (v2)`, `Export Exact PDF` and the v1 `Export PDF`
all refuse a windowed frame naming how many pages are missing (§4.1: a windowed
reply is never the source of a PDF; and §5.6: `v1::fallback` skips elided pages,
so the v1 payload is a subset). A windowed frame is never installed as a
`display-list-v2-delta` base (§7: the two are exclusive). Caret follow walks
resident pages only, and ⌘⇧J says the caret is outside the loaded window rather
than "inside no preview item" — a different claim.

Implementation-Agent: claude-opus-5 (mac lane, linux-primary NixOS)
Commit-Executor: claude-opus-5 (direct git; Cursor usage limit in effect)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Resolutions:
- typeset.rs: the streaming assembly keeps harvesting math_glyph_unmapped
  in the block loop; main's two new BoxRec variants (Leader, Underline)
  join its span finder. The exact-caret hunk keeps the derived-carets
  Cluster and adopts main's provenance_of.
- display.rs: union — DocumentFeatures (this branch) plus main's
  diagnostic wire caps.
- The \dotfill run from #548 is converted to the derived-caret pattern
  (end_caret on the run), wire-identical through carets_of.
- perf-bench: main's post-#206 canon (recalibrated baseline, product
  assemble signature); the lib/memprofile targets stay.
- main's new tests/examples that read the removed Page.items field now
  use resident_items(); V1 payload accesses are untouched.

Implementation-Agent: fable-ft070
Commit-Executor: fable-ft070 (direct; Cursor usage limit)
Capabilities gained `window` on this branch; the harness's fixed set
keeps it off — the timing and digest gates measure the unwindowed
product path, which this branch keeps byte-identical.

Implementation-Agent: fable-ft070
Commit-Executor: fable-ft070 (direct; Cursor usage limit)
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Merged current main (b980a89, 208 commits of drift — the fourth merge of this lane) and re-verified the whole §5/§8/§9 story at the new SHA. Still a draft; the #367 gate stands — no consumer advertises the capability, and nothing under apps/mac changed.

Resolutions of note (details in the merge commit message):

Verification on the merged tree (reference host):

  • Full render-pipeline suite with repo fonts: 462 passed, 0 failed (101 targets). flashtex-cli 58/58, vector-graphics 65/65, perf-bench 13/13, all --locked.
  • §9 equality, real 500 KB case (now 387 pages on current main): windows at 1, 185, 300, 378 — every resident page identical to the 146 MB unwindowed reference, all 387 frames match, required_features/fonts closures identical, elided pages carry frame + resident: false and no items key.
  • The table, at the real ratio: plain caps → status: failed, 0 pages, sized refusal; + -only + -window {1,16} → status: recovered, 6 605 599 B sibling, 387 frames / 16 resident; {1,64} over the limit → narrowed to {24,19} and served; capability without a position → unwindowed reply, name absent from the echo.
  • Digest gate: 0 output changes over the 13-case PR set against the committed baseline — the unwindowed line is still byte-for-byte main's.

One honest flag: the same gate run reports (not enforces) synthetic-500kb timing rows up on this branch — parse +34%, v1 +30%, warm v1 ~+15% — but the host was under desktop load and its own calibration drifted, so attribution needs an interleaved main-vs-branch A/B before anyone reads those as this branch's cost. Worth doing before undraft; the digest gate is the one that is clean and load-independent.

Note for the PR body: at current main the 500 KB corpus document's v1 line is 13.9 MB — under the 16 MiB limit, so it now degrades to recovered rather than failed at the real limit. The honest demonstration of the ceiling is the 398-page/17.3 MB document (or any document past ~16 MiB of v1), which still ends failed without the window. The mechanism, not the specific corpus case, is the fix.

…ntegration queue)

- protocol.rs: #651's size-first envelope refusal kept whole; this
  branch's contribution grafted in — the refusal's capability echo also
  filters -only and -window, since nothing sibling-shaped was accepted.
- memsize.rs / memprofile.rs: this branch's window-aware versions are
  supersets of the #232 versions main landed; kept ours.
- typeset.rs: comment-only (derived-carets note on the math assembly).

Implementation-Agent: fable-ft070
Commit-Executor: fable-ft070 (direct; Cursor usage limit)
@GoKubar
GoKubar marked this pull request as ready for review September 15, 2026 22:14
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Undrafted, with the measured cost of the mechanism stated honestly. Re-merged current main (56c0a29 — #651's size-first envelope refusal kept whole, this branch's -only/-window echo filtering grafted into its refusal arm; #232's landed carets content absorbed cleanly since this branch already carried it).

Performance, measured properly (interleaved A/B/A, 3 pairs at stock + 2 pairs at codegen-units=1, both trees at the same main, reference host — the method that separated #232's false regression from real cost):

synthetic-500kb (385 pp) stock gm CU=1 gm
warm keystroke (all four scenarios) +20–22% +17–18%
cold render (cached product path) +1.3% −0.9%
first render +3.5% —
cold.phase.v1 +57% (9.4→14.6 ms) +52%
cold.phase.parse +37% (21.9→30 ms) +37%
steady RSS −15.6% —

math-heavy: warm +9–11%, v1 +33–40%, cold ~0%. All output digests identical to main in every pair.

The mechanism of the cost is measured, not guessed: whole-run perf stat on the 500 KB case shows +0.96% instructions but +14.9% cycles — IPC 1.74→1.53 — with +21.6% LLC misses and +31% dTLB misses (L1d and branch misses unchanged). The streaming assembly frees each AssembledBlock as its pages leave scope instead of holding all of them to the end; that early-drop is exactly what buys the −15.6% steady RSS, and the churned heap it leaves behind is what later phases (and even the byte-identical vendored parser, running on the reshaped heap after warmup) pay for in locality. It is a real, attributable trade: memory ceiling down 15%, warm-edit latency up ~18% on a 500 KB document (296→350 ms), ~10% at 150 KB, ~0% cold.

Two notes for the record:

  • This is the trade the lane exists to make: the document class this serves currently returns zero pages. A follow-up lane can chase the locality (allocation-order shaping, arena reuse for AssembledBlock, or §5.5's PageRecipe which removes the re-layout entirely) without blocking the fix.
  • The committed perf gate is digest-hard and timing-soft on foreign runners; on the reference host the >5% timing rule would flag the warm rows against the current baseline — the acceptance decision should say so explicitly, and the post-merge baseline re-record (already policy for the codegen-units follow-up) will fold the accepted trade in.

Verification at 56c0a29: full render-pipeline suite 464 passed / 0 failed (101 targets, repo fonts, --locked); the reply-limit table replayed end-to-end (plain → failed/0 pages; -window {1,16} → recovered, 387 frames / 16 resident, correct echo; capability without a position → unwindowed failed, name absent); §9 equality previously verified at 4 window positions and unchanged by this merge's protocol-only conflicts.

@GoKubar
GoKubar merged commit 7e6ed07 into main Sep 15, 2026
21 of 22 checks passed
GoKubar added a commit that referenced this pull request Sep 15, 2026
GoKubar added a commit that referenced this pull request Sep 15, 2026
GoKubar added a commit that referenced this pull request Sep 15, 2026
#294 replaced Page's items field with PageContent plus an items()
accessor; tests/math_symbols.rs still took the field, so the test
target failed to compile (E0615) and its 18 tests silently did not run.
Broken on main itself as well -- fixed there in #664.

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 15, 2026
GoKubar added a commit that referenced this pull request Sep 15, 2026
#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 added a commit that referenced this pull request Sep 15, 2026
…essor (unbreaks main) (#664)

#294 replaced Page's `items` field with `PageContent` plus an
`items()` accessor, but tests/math_symbols.rs still took the field, so
`cargo test --no-run` on crates/render-pipeline has failed on main
since c8e002d:

    error[E0615]: attempted to take value of method `items` on type
    `flashtex_render_pipeline::display::Page`

A target that fails to compile prints no `test result:` line, so the
render-pipeline suite reads green while 18 tests are not running at all.

Read the items through the accessor and flatten the `Option`: a
resident page yields its items, an elided one yields none.

cargo test --release --test math_symbols: 18 passed, 0 failed.


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
… (#649)

* render-pipeline: long arrows are pdfTeX joins; heading spaces after \normalfont are medium

What changed:
- The six long arrows (and so \implies, \iff, \impliedby) are built as
  LaTeX builds them: one relation holding the two cmr/cmsy pieces with
  \joinrel's -3mu between them. They were Latin Modern Math's single
  U+27F5..U+27FA glyphs, 1.457em wide against pdfTeX's 1.611em. On HW1
  Problem 4(b) that shifted the centred display by +0.84/-0.84bp.
- In a directly written heading title, a space with \normalfont words on
  both sides uses the medium font's \fontdimen2 (3.91571pt at \large),
  not the head's bold 4.4989pt. On HW1 "Bonus Problem [1 bonus point]",
  "[1" was 1.15bp left of pdfTeX's position.
- New tests/long_arrows.rs pins pdfTeX's x-to-y distance for all nine
  commands. heading_macros.rs pins the Bonus heading's positions and
  checks the bold/medium spaces around {\normalfont B}. math_symbols.rs
  now expects the composed pieces instead of the fallback glyph.

What was run:
- cargo test --test long_arrows: test result: ok. 1 passed; 0 failed
- cargo test --test heading_macros: test result: ok. 5 passed; 0 failed
- cargo test --test math_symbols: test result: ok. 12 passed; 0 failed
- HW1 glyph diff against pdflatex (TeX Live 2026): lines over 0.5bp went
  from 6 to 2. The 2 left are math-mode TFM kerns (r+comma). 3 pages and
  4 diagnostics, both unchanged.

Next step: math-mode Ord kerns (tex.web §752) in crates/math-layout, then a
vendor re-pin by the integration lane.

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

* compiler: implement \obeylines as group-scoped forced line breaks (#588)

Each source newline lowers to the existing \\-primitive (Inline::LineBreak), scoped like the centering/ragged declarations; blank lines still end the paragraph and surrounding spaces are not preserved. Adds crates/compiler/tests/obeylines.rs and regenerates the supported-LaTeX inventory. Nothing under crates/render-pipeline/ touched.

Implementation-Agent: muse-spark-1.3-contributor

* render-pipeline: build \longmapsto from pieces like the other long arrows (GH-LONGMAPSTO-PIECES)

U+27FC explodes in symbol_atoms to the flag (U+2223, this compiler's \mid
glyph) backed up by its own advance (cmsy10 slot "6A is 5.00002mu, so -5mu
nets ~1e-5pt) plus the usual relbar + joinrel + rightarrow join, matching
pdfTeX's \mapstochar\longrightarrow: the x-to-y span is 29.9832pt,
bit-for-bit the \longrightarrow width. long_arrow_pieces/long_arrow now
take (glyph, kern-before-mu) lists so the 3-piece arrow shares the 2-piece
path. The new long_arrows.rs case spells U+27FC literally until
vendor/compiler is re-pinned past PR #603's ("longmapsto", U+27FC) row.

Implementation-Agent: muse-spark-1.3-contributor

* render-pipeline: align list labels with pdflatex

What changed:
- Preserve list-symbol weight and glyph identity from the compiler.
- Use Latin Modern font dimensions for list margins and honor left-extending label boxes.
- Add pdflatex-pinned itemize, enumerate, and description origin probes.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-itemlabel CARGO_BUILD_JOBS=4 cargo build --bin flashtex-render
- Focused render-pipeline list oracle tests
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-itemlabel CARGO_BUILD_JOBS=4 cargo test --lib

Next step:
- Parent lane can review and integrate this commit.

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

* pdf: add marked ActualText groups

What changed:
- Added typed exact-route marked-content operators with UTF-16BE ActualText encoding.
- Added optional v2 glyph_run actual_text grouping across font and BT/ET switches.
- Documented the field and added syntax, byte-identity, and PyMuPDF tests.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-actualtext CARGO_BUILD_JOBS=4 cargo test --manifest-path crates/pdf/Cargo.toml --lib --tests
- git diff --cached --check

Next step:
- render-pipeline can populate actual_text after the vendor/pdf re-pin.

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

* render-pipeline: enumitem labelsep, itemindent, widest and register leftmargin follow \enit@calcleft

What changed:
- Read enumitem `labelsep=`, `itemindent=` and `widest=` per list level
  (itemize/enumerate). With `leftmargin=*` the margin is
  `\labelwidth + \labelsep - \itemindent` (new `ListMargin::WidestSep`);
  otherwise `labelsep` moves only the label and `itemindent` the first
  line and its label. `\labelsep` is inherited by nested lists.
- `leftmargin=\len` resolves a preamble `\setlength` or `\settowidth`
  register (new `ListMargin::TextWidth`).
- `ListGeom` gains `labelsep_pt` and `itemindent_pt` at the end.
- New pdflatex-pinned oracle `tests/enumitem_item_text.rs` (10/11/12pt).
- The enumitem-worksheet +1.17bp item-text shift from the #609 sweep is
  already gone on #611's head (it was `\leftmargin<i>` in a 12pt em rather
  than lmr12's 11.74994pt quad); rows a-c pin it.

What was run:
- cargo test --release --test enumitem_item_text: test result: ok. 1 passed; 0 failed
- Without the src change the same test fails on 37 rows (e.g. K12e text: 101.265 vs pdflatex 112.981).

Next step:
- Full render-pipeline release suite, then PR stacked on #611.

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

* render-pipeline: itemize TS1 symbols take tcrm's widths without lmodern

What changed:
- Without lmodern (OT1 or T1 body text), \textbullet, \textasteriskcentered
  and \textperiodcentered are TS1 tcrm, whose widths are the cmsy designs
  (0.499878/0.499878/0.27771 at 10pt), not ts1-lmr's 0.7778em bullet and
  period. Label boxes now take the tcrm advance (transcribed tcrm CHARWD at
  all 14 EC sizes, fonts::tcrm_symbol_width). The bullet and centred period
  are drawn with Latin Modern Math's U+2022/U+00B7, which are cmsy's glyphs
  (ink matches pdflatex's SFRM1000 to 0.03bp); the asterisk keeps LM Roman.
- leftmargin=* on itemize measures the class labels as \labelitemi..iv set
  them: the tcrm widths, and \labelitemii's en dash in bold (was regular,
  0.75pt short even with lmodern).
- Class \leftmargin<i> under T1 cmr use OT1 cmr's em (the class sets them
  before fontenc), fixing a 0.15bp shift at 11pt.
- New oracle tests/itemize_ts1_symbols.rs (OT1/T1/lmodern x 10/11/12pt,
  levels 1-4, default and leftmargin=*); enumitem_item_text now gates the
  K..j bullet x.

What was run:
- cargo test --release --no-fail-fast (render-pipeline): 82 binaries, 378 passed, 0 failed, 3 ignored
- itemize_ts1_symbols: test result: ok. 1 passed; 0 failed (78 mismatches before the src change)
- enumitem_item_text, enumitem_keys_oracle, itemize_label_offset, list_items, description_env, description_display: all ok

Next step: Times documents' TS1 symbols and class em are unmeasured.

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

* integration fix: math_symbols reads Page::items through #294's accessor

#294 replaced Page's items field with PageContent plus an items()
accessor; tests/math_symbols.rs still took the field, so the test
target failed to compile (E0615) and its 18 tests silently did not run.
Broken on main itself as well -- fixed there in #664.

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: Claude Opus 5 <[email protected]>
GoKubar added a commit that referenced this pull request Sep 15, 2026
…indow (#665)

#294 (merged, `7e6ed07f`) negotiates `display-list-v2-window` and serves a
bounded resident page window, which is what gives a long document a reply at
all. No in-tree consumer sent it. This is that consumer, as a pure addition:
nothing is removed, no v1 code is touched, and an unwindowed reply stays
byte-for-byte what it is today.

Protocol (FlashTeXProtocol):
* `CompileRequest.displayListWindow` -> `display_list_window {first_page,
  page_count}`, omitted from the wire when nil.
* `RenderingV2.Window` for the reply's top-level `window` object, and
  `Page.resident`. Per proposal §4 the flag is asymmetric: an elided page
  carries `"resident": false` and NO `items` key, a resident page carries
  neither marker — which is what keeps every unwindowed line's bytes, and so
  every `dl2-canon-1` page digest, unchanged.
* Both decoders (fast reader and JSONDecoder) read it and refuse the same
  malformed shapes; `validate` checks the window range against the document
  and that residency matches the window exactly, and refuses a non-resident
  page that has no window object to belong to.

Consumer (V2PageWindow.swift):
* The window is engaged ON DEMAND, never by default — an unwindowed reply is
  complete (delta base, export authority) and a windowed one is an incomplete
  view (§4.1). It engages only after the producer says the unwindowed reply
  cannot exist: the over-the-reply-limit `status: failed`, or a
  `display_list_declined` diagnostic. The same buffers are then re-requested
  under a window at the viewer, a new id at the same revision.
* Once engaged, the pane's scroll anchor drives it: leaving the served
  window's comfortable interior (margin 4 of 16 pages, with document edges
  exempt) re-requests anchored at the viewer. A positioned request that comes
  back without the echoed capability disengages, so a producer that cannot
  window is never asked again on every scroll.
* §7 composition: `-window` rides with `-only` and suppresses `-delta` (r1
  makes them mutually exclusive — a windowed producer cannot digest pages it
  has not materialised), and a windowed frame is never installed as a delta
  base.
* §4.1 exclusions: a windowed frame refuses both PDF exports and the parity
  evidence hook rather than writing blank pages as evidence.
* Elided pages paint a geometry-only placeholder, so the document keeps its
  full scroll extent (scrolling toward one is what fetches it) with no bitmap,
  hover or navigation machinery.

Verified against the MERGED producer, not a hand-written approximation:
`flashtex-render` built from this tree answers a `{first_page: 3,
page_count: 4}` request over a 30-page document with `status: ok`, zero v1
pages (`-only`), a 12-page-shaped sibling whose elided entries carry exactly
`{number, width, height, resident: false}` and whose resident entries carry no
`resident` key at all. `display-list-v2-window.json` is one such reply
committed verbatim, and `testRealProducerWindowedLineDecodesAndPaints` decodes
it on both decoder paths.

Tests: V2WindowTests (wire shape both decoders, the refusals, the controller's
engage/re-anchor/disengage state machine, failure classification, the real
producer's bytes, and the two §4.1 exclusions) plus a live pair through
fake_worker_v2.py's new `%v2window` directive — an over-limit failure engaging
the window, the 40-page/16-resident frame, a scroll that moves it to a clamped
{25, 16}, and a producer without the capability disengaging instead of
looping.

Mac gate on an idle machine: 1355 tests, 0 failures, 12 skipped.

Implementation-Agent: claude-fable-5 (mac window-consumer lane)
Commit-Executor: claude-fable-5 direct Git (observed Cursor usage limit)
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 engine/ft-070-page-window branch September 16, 2026 04:17
d-q222 added a commit that referenced this pull request Sep 16, 2026
…e consumer

What changed:
main took #358's producer in via the integration commit 83285e3
("integration: compiler + pdf + v2 queue (#579, #640, #440, #621, #358)"),
so every Rust/protocol/docs/python file this branch carried is now already
on main byte-for-byte. `git diff MERGE_HEAD -- crates/ protocol/ docs/ tests/
tools/` is down to the one producer-side piece main does NOT have:
crates/document-runtime/src/lib.rs's capability allowlist.

Conflicts and how they were resolved:
- crates/render-pipeline/src/delta.rs, src/display.rs: took main. The branch's
  test helpers predate FT-070 (#294), which added `window` and
  `document_features` to DisplayList and turned `Page` into `Page::resident`.
  main's copies of `diag_list` / `header_only_diag_list` are the same tests
  with the new struct shape, and they pin the same Appendix A vectors
  (c4e7c712… on, e554935e… off).
- apps/mac/Sources/FlashTeXMac/DisplayListDelta.swift: both sides changed
  `installed(from:pageBytes:lineBytes:)`. Kept main's windowed-frame guard and
  its doc comment, and re-applied this branch's `diagnosticsCapability:` flag,
  which is what gates `suggestion` into the header digest.

Kept from this branch (nothing main provides):
- crates/document-runtime allowlist: `display-list-v2-diagnostics` accepted
  only alongside `display-list-v2`, with the pairing/unknown-cap tests.
- the whole Mac consumer: RenderingV2/RenderingV2Fast decode the optional
  `suggestion` (and tolerate labels/notes/help, which the proposal defines and
  main's producer documents as not yet on the wire), ShellModel.producerDiagnostics
  maps the live v2 frame through `asRuntimeV1` when compile_result.diagnostics
  is empty, and the delta digest hashes `suggestion` only when the capability
  was negotiated.

Also dropped a stray blank line the branch had added to EditorDiagnostics.swift.

What was run:
- CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-merge363 CARGO_BUILD_JOBS=4
  cargo test --manifest-path crates/document-runtime/Cargo.toml
    lib:              test result: ok. 18 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out
    chunks:           test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    display_sibling:  test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    session:          test result: ok. 19 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
- apps/mac: swift build -> Build complete! (19.60 sec)
- apps/mac: swift test --filter 'RenderingV2|PreviewV2|EditorDiagnostics|ProblemsPanel|DisplayListDelta|V2Image'
    Executed 98 tests, with 12 tests skipped and 0 failures (0 unexpected) in 8.688 seconds

Next step:
push fast-forward to the PR branch and let CI run the full mac suite.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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