huskies: merge 770

This commit is contained in:
dave
2026-04-28 15:31:29 +00:00
parent 1946709681
commit f63464852b
13 changed files with 212 additions and 266 deletions
-52
View File
@@ -42,58 +42,6 @@ fn story_is_archived_true_when_file_in_6_archived() {
assert!(svc::is_archived(&root, "79_story_foo"));
}
#[tokio::test]
async fn list_agents_excludes_archived_stories() {
let tmp = TempDir::new().unwrap();
let root = make_work_dirs(&tmp);
// Place an archived story file in 6_archived
std::fs::write(
root.join(".huskies/work/6_archived/79_story_archived.md"),
"---\nname: archived story\n---\n",
)
.unwrap();
let ctx = AppContext::new_test(root);
// Inject an agent for the archived story (completed) and one for an active story
ctx.services
.agents
.inject_test_agent("79_story_archived", "coder-1", AgentStatus::Completed);
ctx.services
.agents
.inject_test_agent("80_story_active", "coder-1", AgentStatus::Running);
let api = AgentsApi { ctx: Arc::new(ctx) };
let result = api.list_agents().await.unwrap().0;
// Archived story's agent should not appear
assert!(
!result.iter().any(|a| a.story_id == "79_story_archived"),
"archived story agent should be excluded from list_agents"
);
// Active story's agent should still appear
assert!(
result.iter().any(|a| a.story_id == "80_story_active"),
"active story agent should be included in list_agents"
);
}
#[tokio::test]
async fn list_agents_includes_all_when_no_project_root() {
// When no project root is configured, all agents are returned (safe default).
let tmp = TempDir::new().unwrap();
let ctx = AppContext::new_test(tmp.path().to_path_buf());
// Clear the project_root so get_project_root returns Err
*ctx.state.project_root.lock().unwrap() = None;
ctx.services
.agents
.inject_test_agent("42_story_whatever", "coder-1", AgentStatus::Completed);
let api = AgentsApi { ctx: Arc::new(ctx) };
let result = api.list_agents().await.unwrap().0;
assert!(result.iter().any(|a| a.story_id == "42_story_whatever"));
}
fn make_project_toml(root: &path::Path, content: &str) {
let sk_dir = root.join(".huskies");
std::fs::create_dir_all(&sk_dir).unwrap();