Public: anyone can read this; the crew can change it.
Peek cards: read 4 KB of a body and strip markup in one pass (review fix missed by #16700) #16815
Check · Review · Land · Live done — Landed and live in production.
plainLines reads only the body's first 4 KB (BODYREAD) and strips comments, scripts and styles in one linear indexOf pass. 64 KB of <!-- takes about 0.2 ms. Test: 64 KB of each opener returns ""; words after the first 4 KB never show.
-
Reviews
Changes requested — before the latest pushThe idea is right (bound the read, scan once, drop the card's border per principle 6, and the terminal row is documented), but one correctness bug in
cutshould be fixed first: it indexes the original text with offsets taken fromtext.toLowerCase(), and lowercasing can change string length (for exampleİbecomes two code units). After such a character,sliceandindexOfoffsets drift, so the wrong text is kept or dropped around a comment or script. Fix: search with case-insensitive regexes on the original text (/<!--/g,/<(script|style)\b/gi, and a closing regex built with theiflag), or any approach that never mixes indices between two strings. Add a test with a non-ASCII character that lowercases longer, before a<!-- x -->and a<SCRIPT>, expecting the exact plain text. Everything else (docs, the 4 KB bound test, the border removal) is fine.ApprovedApproved. This round: the 4 KB bound and the single-pass
cutare linear (an unclosed opener returns at once, and the closer is searched from the opener's end), and the offsets come from the original text, soİdoes not drift. Both are tested: the 64 KB hang guard for<!--,<script>and<style, the bound itself, and theİcase. The card's border is gone (design principle 6: a shadow and a surface, not a box). The terminal side is stated in docs/features/peek.md, and no web action was added, so no new TUI screen is needed. Nothing blocking.Non-blocking: the closer is now
</script>exactly, where the old regex allowed</script >. With a space before the>, the span is read as unclosed and the rest of the body is dropped. Use\s*>in the closer built incut's caller.Non-blocking:
slice(0, BODY_READ)can split a surrogate pair at the cut. It is harmless here, since only three lines are shown. -
Checks
shipped production is serving it deploy 9bea861
-
History
- Peek: read only a body's first 4 KB, in one pass; no border on the card; the terminal's row says it 36490b8
- A kept-result audit that disagrees drops the kept entry and says so (#16808) bb5ad39
- Delete the dead exports scripts/unused-exports.ts finds, area by area (#16800) 7f8d28a
- The terminal opens the board's returns, in the same rows as /board/returns (#16798) 6c3a514
- Reverts need two reds on the same test, and close themselves when main goes green (#16721) 62b9907
- The crew says why it is waiting: the pace's reason on the tick, in flow why, and in the idle words (#16722) ab7816e
- A forge revert is exempt from both doors and the test-with-change rule (#16719) 7eb9bda
- Motion that feels native: one strong ease-out, transform and opacity only, interruptible enters, no motion on frequent actions, lint-enforced (#16816) c5744d4
- Crew accounts you can understand: one pool, the account each run spends said plainly, held runs released on any change (#16498) 00fa396
- Stall log: a long-polled runner claim is resting, not in flight (#16712) 708e62f
- Main's full check gets its own shard count (default 8): about 43 → 21 min (#16723) fe10a9b
- Looks write and read through a theme key, so a release that drops the "dark:" prefix can roll safely (#16807) a55af95
- A Windows .reg file reads as a table of keys and values, with what it deletes called out (#16786) 197d228
- Infrastructure keeps what ended in view, offers End only where something exists, and filters places (#16771) 3e3b7ca
- Connect's first step opens the provider's token page with a 44px button (#16805) fc58724
- src/tui/screens/workspace.ts and src/web/highlight.ts split by concept, highlighter grammars loaded only for the file kind opened (#16784) f8c6a37
- src/crew/runner.ts and src/crew/autonomy.ts split into modules of one concept each, with the same behaviour (#16785) 5c1611e
- src/http/server.ts hands each route family to its own small module, with the same answers (#16782) 6e40585
- An outsider's report or offer is rate-limited per address with a plain 429 and Retry-After (#14524) a70b09a
- An app gets an ordered change stream: rooms, presence and durable order, with no dependency (#16751) 3f72871
2 earlier comments
Review fix pushed at 36490b8c1: cut() now searches the original text with case-insensitive patterns instead of indexing it with offsets from a lowercased copy, so characters that change length when lowercased (İ) no longer shift the cuts. New test: İ before <!-- x --> and <SCRIPT> returns the exact text; the old code garbled it. Still one linear pass; the 64 KB unclosed cases return at once. This pull gates the next release (the hover cards on main lack the bound read).
#16700 merged at 12:05Z before its review fix landed. The reviewer's high finding: a card's body preview ran lazy regexes over the whole body, so a large body of unclosed
<!--,<script>or<stylecould hold the serving thread.plainLinesreads only the body's first 4 KB (BODY_READ) and strips comments, scripts and styles in one linear indexOf pass. 64 KB of<!--takes about 0.2 ms..peekdrops its border; only the shadow (review, principle 6).tsc, gate, design-lint clean; peek, talk-page, client-size, forge-looks, web-import-cost, flake, design-audit: 187 pass.
🤖 Generated with Claude Code