huskies: merge 1034
This commit is contained in:
@@ -495,6 +495,84 @@ pub(crate) mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
// -- malformed-args routing (story 1034) -----------------------------------
|
||||
|
||||
#[test]
|
||||
fn malformed_unblock_args_route_to_timmy() {
|
||||
// "unblock to fix the blocking issue" — verb recognised, args look like
|
||||
// natural language rather than a numeric story ID. Must return None so
|
||||
// the message is forwarded to the LLM instead of showing a usage error.
|
||||
let result = try_cmd_addressed(
|
||||
"Timmy",
|
||||
"@timmy:homeserver.local",
|
||||
"@timmy unblock to fix the blocking issue",
|
||||
);
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"unblock with natural-language args must route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_start_args_route_to_timmy_via_registry() {
|
||||
// "start to get the cheese grater working" — the registry entry for
|
||||
// start always returns None (handled async), so even bad args produce None.
|
||||
let result = try_cmd_addressed(
|
||||
"Timmy",
|
||||
"@timmy:homeserver.local",
|
||||
"@timmy start to get the cheese grater working",
|
||||
);
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"start with natural-language args must route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_show_args_route_to_timmy() {
|
||||
let result = try_cmd_addressed(
|
||||
"Timmy",
|
||||
"@timmy:homeserver.local",
|
||||
"@timmy show me the login bug",
|
||||
);
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"show with natural-language args must route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_freeze_args_route_to_timmy() {
|
||||
let result = try_cmd_addressed(
|
||||
"Timmy",
|
||||
"@timmy:homeserver.local",
|
||||
"@timmy freeze the pipeline until Friday",
|
||||
);
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"freeze with natural-language args must route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn well_formed_unblock_runs_handler() {
|
||||
// Numeric story ID → command handler runs (story not found, but Some is returned).
|
||||
let result = try_cmd_addressed("Timmy", "@timmy:homeserver.local", "@timmy unblock 1010");
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"well-formed unblock command should run the handler: {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn well_formed_show_runs_handler() {
|
||||
let result = try_cmd_addressed("Timmy", "@timmy:homeserver.local", "@timmy show 984");
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"well-formed show command should run the handler: {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
// -- commands registry --------------------------------------------------
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user