Repository navigation
Commit 2dc20bf
LASK
fix(jsonl): broaden CSI final-byte range; correct cleanProtocolLine JSDoc
Both addresses Copilot inline review on PR #311.
1. The CSI regex previously matched final bytes only in `[a-zA-Z]`, which
misses valid CSI sequences that end on a non-letter. The most relevant
missing case in this codebase is `\x1b[200~` / `\x1b[201~` —
bracketed-paste content markers — which a TTY-attached subprocess
emits *around* pasted content, not just the on/off `\x1b[?2004h` /
`\x1b[?2004l` toggles. With the old regex, a JSON record sandwiched
between `200~` and `201~` would survive `replace`, then fail the
first-char `{`/`[` guard, then be silently dropped — the worst kind of
regression for this fix's stated goal.
Broaden to the ECMA-48 CSI grammar: parameter bytes in 0x30..0x3F,
optional intermediate bytes in 0x20..0x2F, final byte in 0x40..0x7E.
Adds a regression test for `\x1b[200~{...}\x1b[201~` and the boundary
finals `@` (0x40) and `` ` `` (0x60).
2. The JSDoc declared `@param {string} rawLine` even though the function
explicitly handles non-string input by short-circuiting to `null`
(and a unit test asserts that). Update to `@param {unknown}` so
editors and tsc-via-checkJs don't mislead callers into thinking they
must type-narrow first.1 parent 5b94144 commit 2dc20bf
2 files changed
Lines changed: 27 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | | - | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
46 | 55 | | |
47 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
38 | 52 | | |
39 | 53 | | |
40 | 54 | | |
| |||
0 commit comments