fix(cli): render clean error messages instead of raw tonic::Status #336

Merged
KofTwentyTwo merged 1 commits from story/ws-f1-clean-cli-errors into dev 2026-07-31 18:30:14 +00:00
KofTwentyTwo commented 2026-07-31 18:29:30 +00:00 (Migrated from github.com)

Summary

  • The CLI (crates/nuncio-cli/src/runner.rs) rendered raw tonic::Status on ~28 error paths, dumping internal gRPC framing (status: <Code>, message: "...", details: [], metadata: MetadataMap { ... }) into user-facing CLI output.
  • Added HeadlessRunner::clean_status_message(&tonic::Status) -> String, which uses status.message() (the server-provided text) and falls back to a short "<Code> error" form only when the message is empty.
  • Replaced every site that formatted a tonic::Status via {status} with Self::clean_status_message(&status), including the one map_err closure returning an owned String and the query_daemon_status RPC-call error path.
  • Left the "daemon unreachable" transport-error handling untouched (that's a tonic::transport::Error, not a Status, and its honest message is already clean) and left non-Status error paths (nuncio_core::UpdateEngine, file I/O, IMAP/SMTP connection-test report fields) untouched — out of scope for this story.
  • Typed-error hints from a future ErrorInfo proto extension are explicitly out of scope (tracked separately as issue #332); this story is message-extraction only.

Test plan

  • Added mail_rpc_error_renders_clean_message_not_raw_status_dump: boots a stub nuncio.v1.Mail gRPC server whose ListFolders always returns tonic::Status::internal("mailbox index is corrupt"), then asserts the CLI's folder list output:
    • contains the clean message "mailbox index is corrupt"
    • does NOT contain "metadata:", "MetadataMap", or "status:" (the raw-dump markers)
  • Full local gate, run as three separate commands:
    • cargo fmt --all -- --check — clean
    • cargo check-all (clippy --all-targets --workspace -D warnings) — 0 warnings
    • cargo test-all — 123 unit tests + all integration/E2E suites, 0 failed, 0 ignored

Refs #321

## Summary - The CLI (`crates/nuncio-cli/src/runner.rs`) rendered raw `tonic::Status` on ~28 error paths, dumping internal gRPC framing (`status: <Code>, message: "...", details: [], metadata: MetadataMap { ... }`) into user-facing CLI output. - Added `HeadlessRunner::clean_status_message(&tonic::Status) -> String`, which uses `status.message()` (the server-provided text) and falls back to a short `"<Code> error"` form only when the message is empty. - Replaced every site that formatted a `tonic::Status` via `{status}` with `Self::clean_status_message(&status)`, including the one `map_err` closure returning an owned `String` and the `query_daemon_status` RPC-call error path. - Left the "daemon unreachable" transport-error handling untouched (that's a `tonic::transport::Error`, not a `Status`, and its honest message is already clean) and left non-`Status` error paths (`nuncio_core::UpdateEngine`, file I/O, IMAP/SMTP connection-test report fields) untouched — out of scope for this story. - Typed-error hints from a future `ErrorInfo` proto extension are explicitly out of scope (tracked separately as issue #332); this story is message-extraction only. ## Test plan - Added `mail_rpc_error_renders_clean_message_not_raw_status_dump`: boots a stub `nuncio.v1.Mail` gRPC server whose `ListFolders` always returns `tonic::Status::internal("mailbox index is corrupt")`, then asserts the CLI's `folder list` output: - contains the clean message `"mailbox index is corrupt"` - does NOT contain `"metadata:"`, `"MetadataMap"`, or `"status:"` (the raw-dump markers) - Full local gate, run as three separate commands: - `cargo fmt --all -- --check` — clean - `cargo check-all` (clippy `--all-targets --workspace -D warnings`) — 0 warnings - `cargo test-all` — 123 unit tests + all integration/E2E suites, **0 failed, 0 ignored** Refs #321
Sign in to join this conversation.