Skip to content

Commit 2dfb7af

Browse files
committed
fix+test(#749): compact interactive-only hint now non-null; extend compact JSON test for hint contract
1 parent 3975f2b commit 2dfb7af

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

ROADMAP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7663,3 +7663,5 @@ Original filing (2026-04-18): the session emitted `SessionStart hook (completed)
76637663
747. **ROADMAP #745 has no regression test: `claw issue/pr/commit --output-format json hint` could silently regress to null** — confirmed by gaebal-gajae on `3c5459a33`. Same pattern as #737, #742, #744. Fix: add `bare_slash_command_hint_745` test iterating `issue`, `pr`, `commit` and asserting `error_kind:"interactive_only"` + non-empty `hint` field. Source: gaebal-gajae dogfood on `3c5459a33`, fixed on `18e7744e`, 2026-05-26.
76647664

76657665
748. **`claw mcp bogussubcmd --output-format json` returned `error_kind: null` when an unknown subcommand was passed — `render_mcp_usage_json(Some("bogus"))` set `status:"error"` but left `error_kind` absent — while `agents bogussubcmd` emits `error_kind:"unknown_agents_subcommand"`** — dogfooded 2026-05-26 on `04eb661e`. Fix: add `error_kind: "unknown_mcp_action"` to `render_mcp_usage_json` when `unexpected.is_some()`; remains `null` for the `help` path (`unexpected: null`). Source: Jobdori dogfood on `04eb661e`, 2026-05-26.
7666+
7667+
749. **`claw compact --output-format json` returned `hint: null` — `compact_interactive_only_error()` returned a single-line string with no `\n` between short error and remediation text, so `split_error_hint` couldn't populate the hint field** — identified by gaebal-gajae on `04eb661e`. Same class as #738 / #745 / #746. Fix: add `\n` before the remediation text in `compact_interactive_only_error`. Regression guard: extended `compact_subcommand_json_help_fails_fast_when_stdin_closed` to also assert `hint` is non-empty and mentions `/compact` or `--resume`. Source: gaebal-gajae dogfood on `04eb661e`, 2026-05-26.

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,8 @@ fn bare_slash_command_guidance(command_name: &str) -> Option<String> {
14221422
}
14231423

14241424
fn compact_interactive_only_error() -> String {
1425-
"interactive_only: `claw compact` is an interactive/session command. Start `claw` and run `/compact`, or use `claw --resume SESSION.jsonl /compact` to compact an existing session."
1425+
// #749: newline before remediation so split_error_hint populates hint field
1426+
"interactive_only: `claw compact` is an interactive/session command.\nStart `claw` and run `/compact`, or use `claw --resume SESSION.jsonl /compact` to compact an existing session."
14261427
.to_string()
14271428
}
14281429

rust/crates/rusty-claude-cli/tests/compact_output.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ fn compact_subcommand_json_help_fails_fast_when_stdin_closed() {
283283
.contains("claw compact"),
284284
"message should name compact: {parsed}"
285285
);
286+
// #749: hint must be non-empty (was null before fix — same class as #738/#745/#746)
287+
let hint = parsed["hint"].as_str().unwrap_or("");
288+
assert!(
289+
!hint.is_empty(),
290+
"compact interactive-only JSON must have non-empty hint (#749); got: {parsed}"
291+
);
292+
assert!(
293+
hint.contains("/compact") || hint.contains("--resume"),
294+
"hint should mention /compact or --resume: {hint}"
295+
);
286296

287297
fs::remove_dir_all(&workspace).expect("workspace cleanup should succeed");
288298
}

0 commit comments

Comments
 (0)