A batch of confirmed low-severity correctness/perf nits from the review, each a 1-2 line fix, grouped into ONE ticket (a TODO checkbox per item) to avoid ticket sprawl. Every cited file:line is verified below. The cheap ones land together; any item that grows past a couple of lines splits out into its own ticket. Repro where the bug is observable (the CR-in-line matcher, the oversized-line split, the empty-dir/dead-branch cases). Method: Issues.
view/bro.js:67 io.mmap(path,"r").data() — the file mmap handle is never
closed/unmapped (classify.js:125 already fled io.mmap for this leak).view/bro.js:88-91 buildDirHunk calls utf8.Encode(text) 3× per entry on
the GROWING text → re-encodes the whole buffer each iteration, O(n^2).views/diff/diff.js:259-261 prefixingSink blind .split().join() rewrite
of --- a//+++ b//diff: — matches those substrings anywhere in a chunk.core/loop.js:139-148 _hunkSink.feed 40-iteration retry cap + a substring
("" + e).includes("full") error match (fragile error classification).shared/store.js:358-367 readRecord retries on ANY caught error (comment
says NOROOM) doubling cap to ~1GB before rethrow — a non-NOROOM error
burns 24 grows.shared/store.js:277 locate: if (fileIdx < 0) return true; — an unknown
(keeper-less) file_id is silently dropped, the scan continues.shared/pkt.js:30 if (total > 0xffff) throw — accepts total===0xffff,
but 0xffff is the RESERVED pkt-line flush marker; should reject >=.shared/classify.js:122-139 wtEqBase reg-file path uses the lstat st.size
from an EARLIER stat to size the read; a racing truncation → short read,
stale-ok.core/job.js:57,85,107 c._read | 0 / startOff | 0 / c.after | 0 — the
| 0 truncates the ULOG offset to 32-bit signed; a >2GB queue wraps.views/spot/match.js:77 splitLinesBytes line range {lo, hi:i} excludes
\n but KEEPS a trailing \r — a CRLF source matches with the CR in-line.views/tree/tree.js:115-120 commitOrTree derefs tree/commit but
returns null for a tag — an annotated tag is never dereferenced.views/blob/blob.js:122 if (sha === null) throw "BLOBFAIL" is DEAD —
resolveHexAny returns undefined (store.js:344), never null, so an
ambiguous prefix throws BLOBNONE, not BLOBFAIL.views/blob/blob.js:161-167 a single line longer than CAP (1 MiB) has no
\n in [off,end), the back-scan hits off, if(nl>off) is false → the
line is SPLIT mid-content rather than kept whole.includes("full"), NOROOM retry)
swap to a typed/NOROOM-specific check if the binding exposes one.job.js | 0 → Number()/BigInt-safe offset; verify the done-row format.view/bro.js:67 close/unmap the file mmap after .data() (or fd-read
like classify.js:125).view/bro.js:88-91 build the dir hunk with byte-length accumulation, not
a per-entry full utf8.Encode.diff.js:259-261 anchor the prefix rewrite to line starts, not blind
substring replace.loop.js:139-148 classify the grow error precisely (not includes
"full"); revisit the 40-retry cap.store.js:358-367 readRecord retry-grow only on NOROOM, rethrow other
errors immediately.store.js:277 locate — surface or log a keeper-less file_id rather than
silently dropping it.pkt.js:30 reject total >= 0xffff (0xffff is the reserved marker).classify.js:122-139 re-lstat (or fstat the open fd) for the size used to
read; guard the short read.job.js | 0 offsets: MOOT — core/job.js deleted with the work queue (JSQUE-020 928aaad5).match.js splitLinesBytes — strip a trailing \r from the line range (now ~:73-81).tree.js commitOrTree deref an annotated tag to its commit/tree (now :146-151, returns null for tag).blob.js dead BLOBFAIL: RE-EVAL — resolveHexOrFull now returns k.resolveHexAny(hex)||null
(blob.js:69-72), so sha===null at :134 is REACHABLE, not dead; the original premise changed.blob.js oversized line split (now :174-179) — keep an oversized (>CAP, no-\n) line whole.view/bro.js:499;
dir-hunk O(n²) bro.js:511-525; diff prefixingSink views/diff/diff.js:364-374; loop
includes("full")+40-retry core/loop.js:80-83; store readRecord retry-any shared/store.js:359-368;
store locate fileIdx<0 :278,:330; pkt >0xffff shared/pkt.js:30; classify stale st.size
shared/classify.js:124-139 (switched mmap→fd read, race remains). Two changed: job.js item moot,
blob.js dead-BLOBFAIL now reachable.