Repository navigation
[fix] Preserve leading whitespace when completing JSON - #22
bensynapse wants to merge 1 commit into
Conversation
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 Summary
New parameterized tests cover leading whitespace across Walkthrough
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The whitespace-offset change appears mergeable; the inspected complete and partial input paths preserve the leading prefix, with no concrete regression identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
I run Live Tennis API.
Leading whitespace changes the slice returned by the slow completion path. For example,
loads(' 123')returns12, andloads(' true')raisesJSONDecodeError.Add the trimmed prefix length to the completion offset before slicing the original input. This preserves the original prefix for complete values and partially completed strings, literals and containers.
The 144 new parametrized cases cover both completion paths and partial-value restrictions. With the original source, 120 tests fail. With this fix,
pdm testpasses all 154 examples plus the Hypothesis and performance suites on Python 3.8.20 and 3.14.7.pdm run pyright ./src/passes on both versions. Black and isort checks pass, anduv buildproduces the wheel and source distribution after the CI compatibility override.