Repository navigation
fix: handle invalid compare inputs - #290
Conversation
|
👋 Hi @raghulajithn — thank you so much for your first contribution to HFlow! A maintainer will review your pull request as soon as possible. In the meantime:
💡 Tip: one open pull request per contributor at a time. Issues with an assignee are taken; everything else is fair game. We are excited to have you here and appreciate your help making the project better! 🙌 |
kstonekuan
left a comment
There was a problem hiding this comment.
LGTM.
Validated on 8840f0d: gate clean, root suite 1,244 passed 6 skipped, example suite 23 passed. Observed:
compare /tmp/nope.json -> exit=2, 2 lines, "No such file or directory: /tmp/nope.json"
compare /tmp/bad.json -> exit=2, 2 lines, "invalid JSON in /tmp/bad.json: Expecting value..."
Wrapping the JSONDecodeError earns its keep even though it is already a ValueError and would have been caught anyway: the raw one does not name the file, so a multi-file compare would tell you something was malformed without saying which.
Moved compare back outside the shared try and exactly your two refusal tests go red, other 21 stay green.
Merging.
Summary
Fixes the
comparecommand so missing or malformed summary files are reported as CLI errors instead of escaping as unhandled tracebacks.Why
The
comparecommand previously allowed errors from missing or malformed summary files to escape as unhandled tracebacks.The exception handling is intentionally placed around the match statement rather than inside the compare arm. This keeps the error handling at the CLI boundary and ensures that the same handling applies consistently to all current subcommands and future subcommands without duplicating the error handling logic.
Validation
Ran all of the following validations successfully:
Closes #260
Checklist
uv run ruff check --fix,uv run ruff format, anduv run ty check.