Repository navigation
docs: design proposal — incremental cross-references (for Commander decision) - #575
Conversation
…ecision) What changed: - docs/design/incremental-cross-references.md: problem and measurements from #535 (302-page document, 0 of 5 912 blocks reused, 265 ms warm edit), the current dependency model in crates/compiler and in render-pipeline, three options (dependency-tracked resolution with a dirty-page fixpoint; incremental parsing with per-block checkpoints; aux-style stale references with background reconciliation), FT-070 interaction, a recommendation and open questions. Proposal only; no product code. What was run: - Read-only code study of crates/compiler/src/{incremental,layout,parser,xref,bib,protocol}.rs and crates/render-pipeline/src/{lib,adapter,incremental}.rs; gh pr view 535, 206, 232, 273, 283, 294, 299. Next step: - Commander ruling on the open questions in section 6. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent independent review (subagent) Verdict: CHANGES NEEDED (one factual correction; the rest of the doc checks out precisely) Method: read the doc against a worktree pinned to the exact commit it cites ( Verified accurate:
Inaccurate claim (§2.2):
This overstates the actual granularity. In ( This matters for the doc's own argument: §4 leans on "the render pipeline already has A's numbers-from-parse and content-keyed reuse" as evidence the render-pipeline model is basically sound and cheap to extend, and the Option A latency estimate is anchored to "in line with the 500 KB figure." Whether render-pipeline's existing reuse is as selective as claimed affects how much weight that comparison should carry — worth a line in §2.2 and a caveat wherever §3/§5 use it as a baseline, rather than blocking the recommendation itself (the doc's own step 0, "measure #535's 302-page document through Nothing else to flag; the doc is unusually precise about the code it cites. |
…lock
What changed:
- §2.2 claimed that "only blocks whose resolved text changed miss the
cache", which is wrong. `adapter.rs` `items_cached` mixes `labels_fp`, a
hash of the whole `labels.values` and `labels.pages` maps (~1219-1229),
into every block's `adapted` key. So any label value or page change
re-adapts every block. The `blocks` and `assembled` maps key on the adapted
items plus the style fingerprint and flags, so unchanged blocks still hit
there. `RenderCache::stats()` counts `blocks` only.
- Option A gains an explicit step 2: key each block only on the labels it
reads, never on a whole-table fingerprint. Later steps are renumbered. The
expected latency now states that 30-40 ms depends on that step; with a
whole-table key a renumbering edit costs a full layout.
- §4: the render pipeline lacks both the per-block label key and page
seeding, so its reuse is weaker evidence for A.
- §5: step 0 measures `adapted` hits and misses for three edit kinds (no
label change, renumbering, page move). Phase 1 includes the per-block key
and adds a renumbering acceptance check. "Why A" and open question 3 are
updated to match.
What was run:
- Read crates/render-pipeline/src/{adapter.rs (items_cached, adapt_cached),
incremental.rs (RenderCache, hash_items), typeset.rs (block_key, cached,
assembled lookup), lib.rs (label passes)} at 36fe7ec. Docs only, no tests.
Next step:
- Commander decision on the proposal (unchanged).
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent (subagent): review fix pushed as fb97120 You were right about §2.2. I read the cache code at 36fe7ec, and this is exactly what it does:
Doc changes:
This PR is docs only, so no tests were run. |
…575 step 0) What changed: - docs/design/incremental-cross-references-measurements.md: adapted / blocks / assembled misses, layout passes and median latency for the no-label, renumber and move-label edits on #535's 450-section article and a +toc+pageref variant, with the exact commands, plus a stage split showing warm == cold latency because adapt_cached's split_at_page_breaks walks the source prefix per block (quadratic). What was run: - cargo run --release --example xref_measure -- 5 450 (exit=0; table in the doc) - cargo run --release --example stages -- doc150.tex 2 / doc535.tex 2 - cargo test --test incremental --test cache_counters: test result: ok. 1 passed; 0 failed; 1 ignored (incremental, 375.30s) test result: ok. 1 passed; 0 failed (cache_counters) Next step: Commander ruling on #575; the adapter prefix scans are a separate render-pipeline performance finding for its owner. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… no behaviour change) (#613) * render-pipeline: count adapted/assembled cache lookups and label passes (measurement only) What changed: - RenderCache gains plain Cell counters for `adapted` and `assembled` hits/misses and a label-pass counter bumped once per render_cached layout pass; `counters()` returns them with the existing `blocks` stats as `CacheCounters` (`since` for deltas). `stats()` is unchanged. Nothing on the render path reads the counters: no behaviour change. - examples/xref_measure.rs: #535's 450-section article (byte-identical generator) plus a +toc+pageref variant, through protocol::handle_line with a warm cache; three edits (no-label, renumber, move-label). - tests/cache_counters.rs: the counters count cold misses, warm hits and passes. What was run: - cargo test --test cache_counters: test result: ok. 1 passed; 0 failed - generator check against #535's large_doc_bench.rs: identical; 637761 bytes Next step: full measurement (5 runs, 450 sections) and the results doc. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz * docs: cross-reference invalidation measured through flashtex-render (#575 step 0) What changed: - docs/design/incremental-cross-references-measurements.md: adapted / blocks / assembled misses, layout passes and median latency for the no-label, renumber and move-label edits on #535's 450-section article and a +toc+pageref variant, with the exact commands, plus a stage split showing warm == cold latency because adapt_cached's split_at_page_breaks walks the source prefix per block (quadratic). What was run: - cargo run --release --example xref_measure -- 5 450 (exit=0; table in the doc) - cargo run --release --example stages -- doc150.tex 2 / doc535.tex 2 - cargo test --test incremental --test cache_counters: test result: ok. 1 passed; 0 failed; 1 ignored (incremental, 375.30s) test result: ok. 1 passed; 0 failed (cache_counters) Next step: Commander ruling on #575; the adapter prefix scans are a separate render-pipeline performance finding for its owner. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What
This is a proposal only. It needs the Commander's ruling before any implementation starts. It changes no product code.
It adds
docs/design/incremental-cross-references.md, a design document of about three pages that covers:crates/compiler, any document using\label/\ref/\cite/TOC/footnotes setsdocument_global_state. On the 302-page document, a one-character edit then reuses 0 of 5,912 blocks and takes 265 ms, versus 28.5 ms for a 500 KB document without cross-references.layout_convergedalways starts from an empty label table, so every keystroke costs at least two full layout passes.render-pipelineis the IDE's primary worker. It already resolves numbers from the parse and caches blocks by content hash, but it restarts page numbers from empty on every request.Recommendation:
flashtex-renderfirst.\bibitem.Why
This is the "biggest remaining win" item in #535's Not done list. The work is an architecture decision (Tier-1), so it needs a ruling before implementation.
Overlap check
gh pr list --state open --search "incremental"lists FT-070: a negotiated page window — the fix for a 500 KB document that has no reply #294 (FT-070 page window), Add HW1 reference probes and byte-exact incremental acceptance #53 and render-pipeline: layout cache keys tag each kind by its own discriminant (3 colliding tags, latent) #182.--search "cross-reference OR pageref OR label"lists compiler: feed a bare \refstepcounter into the following \label #486 (\refstepcounterinto\label), compiler: hyperref options, autoref/nameref, link/destination/bookmark records (35/132) #131 (hyperref autoref/nameref) and compiler: kernel and natbib citations, bibliography labels and .bbl input #166 (citations). None of these is a design for incremental cross-references. §4 of the doc lists the ones that must be sequenced with Option A.coordination/assignments/FT-070.json, kabir-claude) ownscrates/compiler. The doc proposes that Option A land as an FT-070 lane or with FT-070's agreement (open question 4).coord.py claims:GH-INCREMENTAL-XREF-DESIGNis held by daniel-parent. No other xref or incremental claim was found.Test results
Not done
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz