view/diff.js:190:pn copies the record's text (hd.text.slice()) but aliases its
spans (toks = hd.toks), while the file header (diff.js:21:pn-22) promises every
emitted record is copied out before the next path folds into the one _hd
scratch container (diff.js:23:pn-28). If hd.toks ever points into the reused
scratch, every earlier hunk's spans observe the last fold. Found in the
2026-08-21 review; whether tok.parse always allocates fresh arrays is the
first thing to verify.
Verify the aliasing on a multi-file diff (repro: earlier hunk's toks mutate
after a later fold). Either copy toks alongside text, or prove freshness
by construction and say so where the header makes the promise.