YeonGyu-Kim eb4b1ebc9b fix(#249): Add kind+hint to resumed-session slash error JSON envelopes
## What Was Broken (ROADMAP #249)

Two Err arms in the resumed-session slash command dispatcher were emitting
JSON envelopes WITHOUT the `kind` and `hint` fields that the typed-error
contract requires:

- main.rs:~2747 (parse_command_token failure path)
- main.rs:~2783 (run_resume_command failure path)

Adjacent code paths (e.g., the Ok(None) error branch at main.rs:2658) were
already threading classify_error_kind + split_error_hint through. These two
arms skipped the helpers, so claws routing on error class couldn't
distinguish parse failures from other error classes for resumed-session
slash command operations.

This is an ARM-LEVEL LEAK pattern: the contract exists, the helpers exist,
but two specific arms didn't call them. Cycle #38 identified this pattern
("Contract + helpers exist; the remaining work is finding every code path
that didn't call the helpers").

## What This Fix Does

Thread classify_error_kind + split_error_hint through both arms:

```rust
Err(error) => {
    if output_format == CliOutputFormat::Json {
        let full_message = error.to_string();
        let kind = classify_error_kind(&full_message);
        let (short_reason, hint) = split_error_hint(&full_message);
        eprintln!(
            "{}",
            serde_json::json!({
                "type": "error",
                "error": short_reason,
                "kind": kind,
                "hint": hint,
                "command": raw_command,
            })
        );
    } else { ... }
    std::process::exit(2);
}
```

This matches the envelope shape used elsewhere in the same function
(main.rs:2658) and satisfies the typed-error contract.

## Tests Added

resumed_slash_error_envelope_includes_kind_and_hint_249 — regression guard
in crates/rusty-claude-cli/src/main.rs that:
- Documents the contract: both arms must carry kind and hint
- Verifies classify_error_kind returns a non-empty class name
- Verifies split_error_hint returns a non-empty short_reason
- Provides an explicit comment documenting the structural contract
  (integration test would require real session file setup; this
  unit-level test verifies the building blocks work correctly)

## Test Results

- All 181 tests pass (180 original + 1 new #249 regression test)
- cargo build succeeds with no warnings
- No regressions in existing tests

## Template

This fix follows the exact pattern of the Ok(None) error branch at
main.rs:2658 which was added for #77. The #247 classifier sweep (cycle
#33-#36) and #248 sweep (cycle #41) also use this pattern. Each fix
extends the typed-error contract to a previously-missed arm.

Part of the classifier/dispatcher sweep cluster:
- #247 (closed): prompt-related parse errors
- #248 (review-ready): verb-qualified unknown-option errors
- #249 (this): resumed slash-command Err arms
- #130 (still open): filesystem errno strings (classifier part)
- #251 (filed): dispatch-order on session-management verbs
2026-04-23 00:34:03 +09:00
..