fix(cli): a bad input path is a message, not a traceback - #3
Merged
Conversation
Found while installing from PyPI into a clean environment and using it the way a stranger would. Two ordinary mistakes both produced a full stack trace: a typo'd filename raised FileNotFoundError out of turns_from_jsonl, and a file that is not newline-delimited JSON raised JSONDecodeError from inside the parser. A traceback answers neither question and tells the user the tool crashed, which is untrue. Both are now SystemExit with a message that says what was wrong and, for the JSONL case, what the file was supposed to contain. Pinned. The argparse error for a missing source and the Langfuse credentials check were already clean; these were the two paths that were not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by installing
postflightfrom PyPI into a clean venv and using it the way someone encountering it for the first time would.Two ordinary mistakes produced full stack traces:
Neither answers the question, and both tell the user the tool crashed, which is untrue. Now:
Both pinned by tests. The argparse error for a missing source and the Langfuse credentials check were already clean; these were the two paths that were not.
The rest of the fresh-install audit passed
pip listshows onlypipandpostflight)mypy --strictpasses against the public API and catches a deliberate type error in it, which is the real test ofpy.typed: a missing marker would have made mypy skip the package silentlyTurnexample, typed verbatim, produces the documentedTOOL_REFUSAL+UNVERIFIED_CLAIMpairing--coverage, and--jsonall behave, with exit 1 on a fault