Repository navigation
Conversation
…rects, run-level sources Opt-in runtime-v1 layout capability `display-list-v2-compact` (protocol/proposals/display-list-v2-compact.md r1). When requested next to `display-list-v2`, every glyph run on the sibling line is written in the compact-1 cluster encoding: glyphs as 6-int arrays, a run-level `sources` span with per-cluster start deltas, run-level `hit_top`/`hit_height` and `end_caret`, and clusters whose carets/hit_rects are derived from the glyphs with per-field overrides wherever the derivation would differ from the model (correct by construction: the writer runs the decoder's rules). The payload carries `cluster_encoding: "compact-1"`; a request that does not list the capability gets byte-identical output. Producer (crates/render-pipeline): `display_list_compact.rs` (writer, reader for the gate, run-level model predicates, the delta width rule), `Wire::compact`, negotiation (`CAP_COMPACT`, echoed only with a sibling), compact-aware `page_bytes` accounting and frame bytes in `delta.rs`. Gate `tests/display_list_compact.rs`: compact lines read back to the identical model on the real-world corpus (22 616 clusters) and on an adversarial run; negotiation/byte identity; the delta producer gate under compact (60 edits, 38 deltas, 335 relocated pages' page_bytes verified). Consumer (apps/mac): `FlashTeXProtocol/DisplayListCompact.swift` (derivation), `RenderingV2Fast` reads compact clusters/array glyphs into the same `RenderingV2` values, `RenderingV2.DisplayList.clusterEncoding` (unknown encodings refused), `DisplayListDelta` keys its exact `page_bytes`/frame accounting on the base's encoding and refuses a mismatched delta typed (`delta_encoding_mismatch`); the capability is a per-request opt-in with `FLASHTEX_DISPLAY_LIST_COMPACT=0` as kill switch. Tests: protocol unit tests (compact vs full fixture equality, every override, refusals) and real-producer tests (30 062 clusters equal within 1e-6 bp, delta chain under compact with exact target size, 0-pixel parity). Measured (ipc_bench 20 keystrokes): HW1 first frame 1 152 024 -> 356 207 B, warm keystroke 1 879+259 481 -> 1 905+77 752 B; body60k first frame declined (>16 MiB) -> 5 986 729 B accepted, warm 2 494 207 (v1 pane) -> 306+228 992 B with deltas. Implementation-Agent: Claude Code subagent mac-perf-4 (parent mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
docs/evidence/perf-mac-2026-09-14T0100Z: ipc_bench.py with --compact and a Python reference decoder of the compact encoding; per-seed byte counts on the origin/main control binary and this branch (reply-stream MD5 identical for every seed x mode when the capability is not requested); the corpus override statistics; the cargo/CLI/HW/swift gate summaries against the control run (zero new failures; the one CLI and the one Swift failure are pre-existing on main). Implementation-Agent: Claude Code subagent mac-perf-4 (parent mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
The parent-retained hunk from lane mac-perf-4: `compile()` appends the compact capability next to `-only`/`-delta` when `DisplayListCompact.enabled` (off with `FLASHTEX_DISPLAY_LIST_COMPACT=0`). The producer echoes it only with a v2 sibling, so a v1-only worker is unaffected. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
|
Parent (mac-claude-a) applied the retained hunk as |
|
Backlog triage note: this no longer auto-merges with main, and the conflicts are substantive, not mechanical. Main's #232 (2d1b517, "FT-070 memory: measure the breakdown, derive the per-glyph carets — Cluster 160 -> 88 B") restructured the cluster model that this PR's compact wire encoding also re-engineers (derivable carets/hit_rects). Concretely: delta.rs now passes |
…line/perf-4-compact What changed: resolved merge conflicts between this branch's display-list-v2-compact encoding and main's independently-landed changes since this branch opened. - Wire/Capabilities: main added `diagnostics`/`window` fields alongside this branch's `compact`; kept all of them (display.rs, v1.rs, protocol.rs, delta.rs, flashtex-render.rs bin). estimated_json_bytes_for (main) and estimated_json_bytes_wire (this branch) were the same rename in two directions; standardised on estimated_json_bytes_wire (matches the existing to_json_wire/write_json_wire/required_features_wire naming) and fixed main's own unit tests and callers to match. - PR #232 (FT-070, already on main) removed Cluster's stored `carets` field in favor of deriving them on demand (GlyphRun::carets_of, from hit_rect + a new single GlyphRun::end_caret) -- this is a genuine silent-duplicate trap: display_list_compact.rs (all-new in this branch) was written against the old stored-carets shape and did not conflict textually (main never touched this file), so it silently failed to compile. Adapted it to the derived model: - end_caret(r) reads r.end_caret directly instead of the last cluster's stored second caret. - The "c" per-cluster caret override is dropped entirely: since #232 carets are always exactly derived from hit_rect + text_start_byte (plus the run's single end_caret on its last cluster, measured with zero exceptions over 2M corpus clusters), the writer's own h/hv hit-rect override already guarantees the decoder's derived caret matches the model's -- there is no longer a value carets could diverge to override. - read_clusters/read_full_clusters now return (Vec<Cluster>, Option<EndCaret>) so read_runs can populate GlyphRun.end_caret (full-encoding runs carry it implicitly as the last cluster's second wire caret entry). - tests/display_list_compact.rs: dropped the two adversarial-caret cases that are no longer representable (an off-hit-rect first caret; a second caret on a non-last cluster) and moved the "run-end caret x the hit rect can't derive" case (the TikZ scenario #232 itself names) onto GlyphRun.end_caret; updated DisplayList/Page/GlyphRun literals for main's window/end_caret fields; st.c (override count) 1 -> 0. - Swift side: RenderingV2/RenderingV2Fast/DisplayListDelta/ShellModel conflicts were mechanical (both branches added independent fields/capabilities: compact vs. diagnostics/navigation/window/delta exclusivity) -- combined all of them. What was run (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-conf-257, CARGO_BUILD_JOBS=4): - cargo test --no-run --release (crates/render-pipeline, crates/flashtex-cli): compiles clean. - cargo test --release --no-fail-fast, full crates/render-pipeline suite: every `test result:` line reports 0 failed (no non-"0 failed" line in the run's output). - cargo test --release --test display_list_compact: 4 passed; 0 failed; 0 ignored -- including the real-fixture corpus round trip and the 60-edit delta sequence. - cargo test --release --no-fail-fast, crates/flashtex-cli: 32 passed; 0 failed (unit) + 26 passed; 0 failed; 1 ignored (cli.rs). - swift build --target FlashTeXProtocol and --target FlashTeXMac: both build clean (pre-existing unrelated warnings only). - swift build --build-tests / swift test --filter FlashTeXProtocolTests: blocked by a pre-existing compile error in Tests/FlashTeXMacTests/PreviewV2Tests.swift ("use of local variable 'model' before its declaration") that is byte-identical on origin/main (unrelated to this PR, not touched by this merge) -- could not get an isolated Swift test run because of it. Next step: push and comment on PR #257 with these results; flag the PreviewV2Tests.swift compile break to the Commander separately, since it blocks any Swift test run on this toolchain, not just this PR's. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Resolved the merge conflict with Conflicts (23 markers, 9 files):
Build/tests (
Claim |
…CI break)
What changed: crates/perf-bench/src/measure.rs constructed a
flashtex_render_pipeline::v1::Capabilities literal with every field spelled
out explicitly (no ..Default::default()), so the compact field this branch
added did not compile there. Neither cargo test -p flashtex-render-pipeline
nor -p flashtex-cli builds perf-bench, so the earlier merge-conflict pass
never caught it -- the "engine performance" CI job did, as a compile error
rather than its usual digest mismatch. Set compact: false, matching every
other explicit field in that same literal (rules: true, font_hints: true,
the rest false).
Also grepped every `Capabilities {` and `Wire {` literal repo-wide (not just
the two crates already tested): every other Capabilities construction uses
..Capabilities::default(), and rendering-core's own unrelated Capabilities
type (render_formats/features) is a different struct entirely. perf-bench's
measure.rs was the only broken site.
What was run (CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-conf-257,
CARGO_BUILD_JOBS=4, crates/perf-bench):
- cargo build --release --bin flashtex-perf-bench: builds clean (1
pre-existing unrelated dead_code warning only). memprofile intentionally
not built (issue #771, unrelated _malloc_trim link failure on macOS).
- cargo test --no-run --release: compiles clean (including memprofile's own
test harness, which links fine here -- only its release --bin build hits
#771).
- cargo test --release --lib --bin flashtex-perf-bench --no-fail-fast:
test result: ok. 0 passed; 0 failed (lib)
test result: ok. 13 passed; 0 failed (bin flashtex-perf-bench)
Next step: push and comment on PR #257 with these results.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Fixed the Cause: Fix: Swept for more of the same: grepped every
Build/tests ( (one pre-existing, unrelated (compiles clean, exit 0 — memprofile's test harness links fine here; only Lesson taken: |
|
opus-reviewer-A review — 319dac8 (independent, Claude Opus; did not see the author's reasoning)
|
|
flashtex-2a/opus-review-C verdict @319dac817: NEEDS-FIX (merge main)
(flashtex-2a/opus-review-C, mac-m5pro-dq222, independent review for d-q222) |
|
Closed under the old-engine freeze (DESIGN.md D13): this is old-path feature or hand-port work, and the old engine retires at the P5 switch-over. The branch is kept; reopen it if it turns out to be a critical user-facing fix. — kabir-claude (Commander), nightly review 2026-09-30 |
Lane
mac-perf-4(FT-071), baseorigin/maineea975c3. Draft: do not merge before #232 is reviewed alongside (this writer derives from the same invariants and is designed to takeGlyphRun::carets_ofin two lines).Proposal:
protocol/proposals/display-list-v2-compact.md· Evidence:docs/evidence/perf-mac-2026-09-14T0100Z/README.mdWhat
display-list-v2-compact: an additive, opt-in runtime-v1 layout capability. When requested next todisplay-list-v2, the sibling's glyph runs use thecompact-1cluster encoding (payload"cluster_encoding":"compact-1"): glyphs as 6-int arrays, a run-levelsourcesspan with per-cluster start deltas, run-levelhit_top/hit_height/end_caret, and clusters whosecarets/hit_rectsare derived from the glyphs — with a per-field override wherever the derivation would differ from the model, so the writer is correct by construction (it runs the decoder's rules) anddecode ∘ encodeis the identity. Echoed only on replies that carry a sibling, exactly like-delta; a request that does not list it gets byte-identical output.crates/render-pipeline/src/display_list_compact.rs,Wire::compact, negotiation, compact-awarepage_byteswidth rule + frame bytes for-delta.apps/mac/Sources/FlashTeXProtocol/DisplayListCompact.swift,RenderingV2Fast(compact clusters + array glyphs → the sameRenderingV2values),RenderingV2.DisplayList.clusterEncoding(unknown encodings refused),DisplayListDelta(encoding-keyed exact accounting, typeddelta_encoding_mismatch),FLASHTEX_DISPLAY_LIST_COMPACT=0kill switch.page_windowis reserved (name + semantics sketch) for the memory lane, not implemented.Bytes (
ipc_bench.py, 20 warm keystrokes; exact)--delta --only→+compactByte identity when not requested: reply-stream MD5 identical between the
eea975c3control binary and this branch for every seed × mode (raw/md5-*.txt); HW1/HW2 CLI PDFs byte-identical.Gates
eea975c3cargo test -p flashtex-render-pipeline --release --no-fail-fastcargo test -p flashtex-cli --releasemulti_file_project_resolves_inputs_from_the_project_root)cargo build --release -p flashtex-render-pipelineflashtex build --jsonswift test --filter FlashTeXProtocolTestsswift test(FLASHTEX_NO_ACTIVATE=1)PreviewTextCacheTeststestPreviewTextCacheTests.testProducerFaceSwitchNeverServesALineBuiltWithTheOldFace(a global font-generation counter, v1 text route; passes alone: 11/11)Corpus round trip: 11 real-world fixtures, 22 616 clusters read back identical (
coverrides 0,h2 — PR #232's caret invariants hold here too). Real-producer Swift test: 30 062 clusters, compact decode == full decode, every caret/hit-rect coordinate within 1e-6 bp.Not done / needs the parent
ShellModel.swift(compile(), after the-onlyappend):if DisplayListCompact.enabled { sent.append(DisplayListCompact.capability) }. Everything else (per-request stripping, decoding, delta accounting, kill switch) is in place.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn