Repository navigation
[CTX-1610] fix(render): close the font index follow-ups - #2736
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7198b05 to
4c5a322
Compare
… claims - font_index/README/lib.rs: the cold build's bounded reader reads only the name/OS-2/post tables; a file it cannot name falls back to fontdb's loader, which reads the whole file. The outline/layout/variation exclusion is scoped to the bounded path. - writer_stops_before: document the sorted-(path, face_index) precondition and guard it with a debug_assert. - measure-startup.sh: default 50 runs, fail when the cold launch leaves no index (warm samples would silently be cold-index), note the >=100-sample p99 bar, and point at the real PB-1 anchor (pb-1-cold-startup-time); the same stale anchor in tools/perf/startup is fixed too. - font_index tests: byte-cap end-to-end no-rewrite case near 32 MiB with a synthetic cached body, mirroring the face-count cap test.
…tral reconcile() gated the byte-capped fast path on the appended faces sorting after every retained face. Path's order is component-based, so on Windows a drive-prefixed temp path (Component::Prefix) orders before a root-relative one (Component::RootDir) and the same capped host rewrote its cache. The byte budget is a total bound, so the decision now depends only on it: a line it cannot fit would have to displace a retained face, and skipping the write keeps the cache stable while the displaced face is reparsed like any other overflow path. Adds a regression test that drives the sorts-before branch directly, which also reproduces the Windows failure on Linux.
4c5a322 to
78e3491
Compare
Xuepoo
left a comment
There was a problem hiding this comment.
PR-2736 REVIEWER VERDICT: APPROVE
Attribution: independent reviewer subagent (Bitty blitz guard tick, 2026-10-27). Verification performed on a scratch clone of head 7198b05; verdict follows.
Verified:
discovered.generic.sanitize()runs pre-reconcile; stale-cache warm-start equality restored; no cap regression (font_index.rs:501).- Truncated-cache read-only detection mirrors
serialize_indexcap logic exactly (font_index.rs:827-846);cached_body_lenexact. O_NONBLOCKconstants correct for Linux/macOS; post-openfstatis the authoritative swap-race rejection; FIFO-swap regression test present.- Targeted runs:
cargo check -p bitty-terminal -p bitty-runtimeclean;cargo test -p bitty-render --lib= 396 passed / 0 failed (incl. 11 new tests). - No let-chains, no hardcoded host/env values, English artifacts.
- CI on head: pending at review time (7 pass / 7 pending / 0 fail); merge gated on full green.
Non-blocking findings (P2, follow-ups):
writer_stops_beforesorts-append edge: mid-prefix append fitting under cap can leave an oversized-batch sibling never persisted (documented accepted trade; suggestion: comment only).- Legacy v1 index residue removed only on
changed && write ok— cosmetic staleness path.
Head sha at verdict: 7198b05fa420fcb6368d814241b0d2c9140fab42. Rebase/head note: if head moves, CI+approval re-gate.
Priority: P2 | Area: render | Labels: fix,P2,area:render | Milestone: v0.1.0 | RFC: OQ-090 | Task: CTX-1610
Summary
Closes the font-index follow-ups from the shaped-default review (#2733). No correctness change for the shipped path; this is churn, robustness, coverage, and measurement.
Churn
reconcilekeepschanged = falsewhen every cached face survives, the extras sort past the retained key, and the writer's face/byte caps would discard them. Detection uses the cached body length (exact writer mirror), so a capped cache is read-only. 16,385-face case: 185.7 ms reparse/start remains, but the 29.8 ms + 1.98 MB rewrite is gone.BITTY_FONT_INDEX=0is the uncapped escape hatch.Robustness
O_NONBLOCKopen (OpenOptionsExt, per-platform ABI constants, no new crate) → authoritativefstatbefore reading. The FIFO-swapped-after-metadata case is tested and cannot block. Windows keeps the plain-open +fstatpath; Unix targets without the flag are documented.font-index-v1is removed best-effort after the first successful v2 write.name/OS/2/post, and unnameable files fall back to fontdb's whole-file loader.Measurement
scripts/measure-startup.sh: N launches (default 50), nearest-rank p50/p99/mean/max, isolated XDG/HOME tree, warm-index assertion,--coldwindow, refusesBITTY_FONT_INDEX=0, not CI-gating. Current debug build: cold 792 ms first launch, warm p50 39 ms / p99 62 ms (50 samples).just doc-checkstays green.Tests
bitty-render464 (46 font-index module),bitty-runtime --lib1315, terminal bin 1327 serial, text-stack/shaped suites green; fmt, clippy-D warnings, Windows cross-check, shellcheck/shfmt, markdownlint,just doc-checkall clean.New: generic-warm no-rewrite, 16,385-face cap read-only, byte-cap e2e, device/socket rejection, FIFO-after-metadata, TTC mtime reparse, v1 ignore/remove/reject, symlink dedupe, writer caps.
Closes #2733.