Files
claude-code/rust/crates/rusty-claude-cli/tests/compact_output.rs
YeonGyu-Kim b4b1ba10f6 fix: route all JSON-mode abort envelopes to stdout (#819 #820 #823) (#3197)
* fix: route all JSON-mode abort envelopes to stdout (#819 #820 #823)

All handled errors in --output-format json mode now write the structured
abort envelope to stdout (rc=1) and keep stderr empty. Previously the
top-level error handler and resume_session JSON branches used eprintln!
which sent the envelope to stderr, breaking machine consumers that read
stdout for command payloads.

Surfaces fixed:
- Top-level abort handler (main.rs): export --session <missing>,
  session <subcommand>, prompt (no text), unknown subcommand fallthrough,
  flag errors, and all other run() failures
- resume_session JSON branches: session load errors, unsupported commands,
  parse errors, command execution errors

Test changes: updated 24 failing contract tests to assert JSON envelopes
on stdout. Added stderr-clean assertions where appropriate. 70 contract
tests pass (was 68; 2 additional from regression coverage).

ROADMAP: #819 (export session-not-found), #820 (interactive_only class),
#823 (missing prompt)

* style: cargo fmt on main.rs after eprintln->println fix

* fix(tests): fmt + update compact_output test for stdout abort envelope routing

* fix(tests): update resume_slash_commands stub test for stdout envelope routing
2026-05-29 13:30:35 +09:00

15 KiB