fix+test(#749): compact interactive-only hint now non-null; extend compact JSON test for hint contract

This commit is contained in:
YeonGyu-Kim
2026-05-26 19:38:09 +09:00
parent 3975f2b3ab
commit 2dfb7af66e
3 changed files with 14 additions and 1 deletions

View File

@@ -1422,7 +1422,8 @@ fn bare_slash_command_guidance(command_name: &str) -> Option<String> {
}
fn compact_interactive_only_error() -> String {
"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."
// #749: newline before remediation so split_error_hint populates hint field
"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."
.to_string()
}

View File

@@ -283,6 +283,16 @@ fn compact_subcommand_json_help_fails_fast_when_stdin_closed() {
.contains("claw compact"),
"message should name compact: {parsed}"
);
// #749: hint must be non-empty (was null before fix — same class as #738/#745/#746)
let hint = parsed["hint"].as_str().unwrap_or("");
assert!(
!hint.is_empty(),
"compact interactive-only JSON must have non-empty hint (#749); got: {parsed}"
);
assert!(
hint.contains("/compact") || hint.contains("--resume"),
"hint should mention /compact or --resume: {hint}"
);
fs::remove_dir_all(&workspace).expect("workspace cleanup should succeed");
}