fix(sdks/python-cli): preserve structured JSON errors for unreadable and directory paths in from-segments - #13355
Conversation
…and directory paths in from-segments Catch directory and file read errors before loading transcript segments in conversation from-segments, emitting a UsageError so JSON error contracts are preserved. Resolves BasedHardware#13013 Co-authored-by: aceletapp <326262726+aceletapp@users.noreply.github.com>
|
Thanks @CreamPle — clean, focused fix that fully resolves the structured-error gap from #13013. sdks/python-cli/omi_cli/commands/conversation.py
sdks/python-cli/tests/test_conversation.py
On the red required checks (Windows ACL / Python 3.12, Linux / Python 3.10, Linux / Python 3.12): all three fail on Nice first contribution. Leaving for human maintainer review and merge once the pre-existing CI failure is sorted. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Bug fix (crash on directory/unreadable path in conversation from-segments), closes #13013, small scoped diff with tests. Not merging: hard-floor CI gate (Linux/Windows Python matrix red, pre-existing/unrelated main-branch failure).
Summary
Fixes
omi conversation from-segmentscrashing with unhandledunexpected error: ...when passed a directory or an unreadable file.segments_file.is_dir()and emits a structuredUsageErrorbefore attempting file reads.OSError(such asPermissionError) on reading the file and routes it toUsageError.--jsonmode with stableexit_code = 1.Resolves #13013
Changes
sdks/python-cli/omi_cli/commands/conversation.py: Validate file vs directory and catchOSErrorinfrom_segments.sdks/python-cli/tests/test_conversation.py: Add unit tests asserting JSON error output when targeting a directory or unreadable file.Verification
sdks/python-cli/tests/test_conversation.pypass (13/13).ruff check.git diff --check HEAD(clean).Failure-Class: none