Skip to content

cli: one-line messages for expected errors (curate/doctor/stale) - #18

Merged
kstonekuan merged 5 commits into
Hebbian-Robotics:mainfrom
ayam04:fix/cli-one-line-errors
Aug 19, 2026
Merged

kstonekuan merged 5 commits into
Hebbian-Robotics:mainfrom
ayam04:fix/cli-one-line-errors

Conversation

@ayam04

@ayam04 ayam04 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #3

Expected, user-recoverable errors in curate, doctor, and stale now print a one-line <command>: <message> on stderr and return exit code 2, instead of leaking a full Python traceback.

  • Extracts _command_curate and _command_doctor so main() is pure dispatch (per the issue's companion cleanup)
  • Applies the same except (ValueError, FileNotFoundError) pattern _command_deploy already used
  • _command_stale now wraps the stale_episodes call the same way

Tests:

  • test_cli_doctor_missing_file_prints_one_line: exit 2, doctor: on stderr, no traceback
  • test_cli_curate_bad_catalog_prints_one_line: exit 2, curate: on stderr, no traceback

Validation: uv run pytest tests/test_doctor.py tests/test_catalog_curation.py tests/test_runtime_cli.py -q (37 passed).

ayam04 added 3 commits August 19, 2026 17:25
curate and doctor previously let ValueError/FileNotFoundError bubble up
as full tracebacks, reading as crashes rather than user feedback. Extract
_command_curate and _command_doctor so main() is pure dispatch, and
apply the same except -> one-line stderr -> return 2 pattern that
_command_deploy already uses.

Closes Hebbian-Robotics#3
@ayam04

ayam04 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review and for the clear guidance on the good-first-issue pool. Totally understand the one-PR-at-a-time policy — makes sense to keep starter issues available.

Happy to iterate on #18 until it's merged, and I'll bring one of the others back (or open new ones) once this one lands. Appreciate the help getting started here!

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ayam04! Validated locally: quality gate and full test suite pass. This matches the issue spec exactly, including the optional _command_curate/_command_doctor extraction, and the capsys regression tests are just what we wanted. I pushed one tiny commit to your branch applying ruff format to a long line in the new curate test. Merging.

@kstonekuan
kstonekuan merged commit 913f053 into Hebbian-Robotics:main Aug 19, 2026
kstonekuan pushed a commit that referenced this pull request Aug 19, 2026
fetch_uri raised FileNotFoundError(local_file) with the path as the single
argument, so str() of the exception was just the bare path and the CLI
printed 'doctor: /tmp/nope.mcap' with no 'no such file' hint after #18
turned tracebacks into one-line messages.

Raise with errno.ENOENT, os.strerror(errno.ENOENT), and the path as the
filename only, so it formats as:
  [Errno 2] No such file or directory: '/tmp/nope.mcap'

Closes #26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: expected errors print full tracebacks instead of one-line messages

2 participants