fix: replace O(n²) string concatenation in readLines with array buffering #252
+32
−14
Claude / Claude Code Review
completed
Apr 14, 2026 in 9m 8s
Code review found 1 important issue
Found 4 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | js/src/utils.ts:34-38 |
Missing TextDecoder flush on stream end drops trailing multi-byte characters |
Annotations
Check failure on line 38 in js/src/utils.ts
claude / Claude Code Review
Missing TextDecoder flush on stream end drops trailing multi-byte characters
The new code never flushes the TextDecoder before breaking on stream end, silently dropping any incomplete multi-byte UTF-8 sequences (e.g. a 4-byte emoji split across the final chunk). Fix: add `const trailing = decoder.decode(); if (trailing) pending.push(trailing)` before the `pending.length` check in the `done` branch.
Loading