fix(eval-list): reject malformed --limit values with exit 1#1762
fix(eval-list): reject malformed --limit values with exit 1#1762NikhileshNanduri wants to merge 1 commit into
Conversation
…#1683) parseInt("1abc") silently returned 1 (partial parse), and parseInt("nope") returned NaN causing slice(0, NaN) to show zero rows while the footer still reported the full count. Both are confusing silent failures. Fix: use Number.parseInt + Number.isSafeInteger + string round-trip check. Add 6 regression tests in test/eval-list-limit.test.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Collision flag: this overlaps with #1684, which is already open against the same issue (#1683) with the same fix. Both PRs target One difference worth noting: this PR also bumps |
Summary
--limit 1abcsilently showed 1 row (parseInt partial-parse)--limit nopesilently showed 0 rows (NaN slice) while footer still reported full countRoot cause
parseInt("1abc", 10)returns1— JavaScript accepts trailing non-numeric characters.parseInt("nope", 10)returnsNaN, andarr.slice(0, NaN)returns an empty array. Neither case produced any error output.Fix
Replaced
parseInt(raw, 10)with:The string round-trip check (
String(parsed) !== raw) catches1abc,1.5, and other mixed inputs.Closes #1683.
Test plan
bun test test/eval-list-limit.test.ts— 6 tests passbun test— full free suite passes🤖 Generated with Claude Code