This should fix the issue in Parser.scan()#66
Conversation
📝 WalkthroughWalkthroughThe parser's UTF-8 decoding now catches UTFException and only posts a Key.graph event on successful decode. Unit tests were added/updated to assert that invalid UTF-8 sequences produce no events and that valid multi-byte sequences followed by extra input yield the expected events. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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 |
…usly verify the UTF-8 error handling logic.
|
AARGH. I forgot again to squash the sausage factory. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
==========================
==========================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
UTF-8 decoding in Parser.scan() is problematic. It uses decode(cast(string) accum, index) which involves an unsafe cast (violating immutability) and may fail to compile or run correctly if std.utf.decode expects a ref string. Furthermore, UTFException thrown by decode is not caught, which could crash the parser on invalid UTF-8 input.
I've also added tiny unittest for it.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.