huskies: merge 1034

This commit is contained in:
dave
2026-05-14 14:02:21 +00:00
parent 8625b9a7fc
commit 8faf19f3ab
11 changed files with 362 additions and 246 deletions
+22 -19
View File
@@ -11,17 +11,8 @@ use super::CommandContext;
#[allow(clippy::string_slice)] // commit_hash is hex (ASCII), min(8) always within bounds
pub(super) fn handle_overview(ctx: &CommandContext) -> Option<String> {
let num_str = ctx.args.trim();
if num_str.is_empty() {
return Some(format!(
"Usage: `{} overview <number>`\n\nShows the implementation summary for a story.",
ctx.services.bot_name
));
}
if !num_str.chars().all(|c| c.is_ascii_digit()) {
return Some(format!(
"Invalid story number: `{num_str}`. Usage: `{} overview <number>`",
ctx.services.bot_name
));
if num_str.is_empty() || !num_str.chars().all(|c| c.is_ascii_digit()) {
return None;
}
let commit_hash = match find_story_merge_commit(ctx.effective_root(), num_str) {
@@ -232,22 +223,34 @@ mod tests {
}
#[test]
fn overview_command_no_args_returns_usage() {
fn overview_command_no_args_routes_to_timmy() {
let tmp = tempfile::TempDir::new().unwrap();
let output = overview_cmd_with_root(tmp.path(), "").unwrap();
let result = overview_cmd_with_root(tmp.path(), "");
assert!(
output.contains("Usage"),
"no args should show usage hint: {output}"
result.is_none(),
"no args should route to LLM (None): {result:?}"
);
}
#[test]
fn overview_command_non_numeric_arg_returns_error() {
fn overview_command_non_numeric_arg_routes_to_timmy() {
let tmp = tempfile::TempDir::new().unwrap();
let output = overview_cmd_with_root(tmp.path(), "abc").unwrap();
let result = overview_cmd_with_root(tmp.path(), "of the auth refactor");
assert!(
output.contains("Invalid"),
"non-numeric arg should return error: {output}"
result.is_none(),
"natural-language args should route to LLM (None): {result:?}"
);
}
#[test]
fn overview_command_well_formed_runs_handler() {
let repo_root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap_or(std::path::Path::new("."));
let result = overview_cmd_with_root(repo_root, "99999");
assert!(
result.is_some(),
"well-formed numeric arg should run the command handler: {result:?}"
);
}