Repository navigation
Release 0.2.2: a wrong content guess is UnknownFormat, not a misleading parse error - #50
Conversation
…ng parse error
Found while running anomalyx against real datasets: feeding an Apache error_log
(lines start with '[') produced 'failed to parse json input' — the JSON parser's
cheap leading-[/{ sniff claimed it, then the parse failed and surfaced JSON's
internal error, pointing the user at the wrong problem.
Fix: ParserRegistry::normalize now tracks how the parser was resolved. A parse
failure under a weak (TEXT/FALLBACK) content sniff means the guess was wrong, so
it reports AxError::UnknownFormat — 'I don't recognize this' rather than 'your
JSON is broken'. A format identified confidently (by file extension, or a
MAGIC/STRONG signature) still surfaces a genuine malformed-file parse error
unchanged. resolve() is unchanged; resolve_detail() is the new internal helper.
Tests pin all three paths (weak-sniff fail -> UnknownFormat; extension fail ->
Parse; STRONG-sniff fail -> Parse) and the < STRONG boundary. Bumps 0.2.1 ->
0.2.2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors the parser registry to classify JSON content sniffing errors more accurately. When content detection yields a weak confidence score and parsing fails, the error now reports ChangesJSON Parser Error Classification
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Found while running
anomalyxagainst real datasets (an Apacheerror_log): aplain-text line that merely starts with
[got claimed by the JSON parser'scheap leading-
[/{sniff, and when the JSON parse then failed the user sawfailed to parse json input— pointing them at the wrong problem.Fix
ParserRegistry::normalizenow tracks how the parser was resolved:TEXT/FALLBACK) content sniff → the guesswas wrong →
AxError::UnknownFormat("I don't recognize this").MAGIC/STRONGsignature — still surfaces a genuine malformed-file parse error unchanged
(a broken
.jsonor a truncated Parquet still says so).resolve()is unchanged;resolve_detail()is the new internal helper.Tests pin all three paths (weak-sniff→UnknownFormat, extension→Parse,
STRONG-sniff→Parse) and the
< STRONGboundary. Mutation gate on the changedfile: 0 surviving mutants. Bumps
0.2.1→0.2.2.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Chores