huskies: merge 671_refactor_migrate_pipeline_state_consumers_from_string_comparisons_to_typed_pipelinestage_enum

This commit is contained in:
dave
2026-04-27 16:35:25 +00:00
parent 39a9766d7d
commit 4a0f57478c
15 changed files with 161 additions and 103 deletions
+13 -13
View File
@@ -21,16 +21,16 @@ impl AgentPool {
}
}
/// Return the active pipeline stage directory name for `story_id`, or `None` if the
/// story is not in any active stage (`2_current/`, `3_qa/`, `4_merge/`).
/// Return the active pipeline stage for `story_id`, or `None` if the story is not
/// in any active stage (`2_current/`, `3_qa/`, `4_merge/`).
pub(super) fn find_active_story_stage(
_project_root: &Path,
story_id: &str,
) -> Option<&'static str> {
) -> Option<crate::pipeline_state::Stage> {
if let Ok(Some(item)) = crate::pipeline_state::read_typed(story_id)
&& item.stage.is_active()
{
return Some(item.stage.dir_name());
return Some(item.stage);
}
None
}
@@ -44,10 +44,10 @@ mod tests {
crate::db::ensure_content_store();
crate::db::write_item_with_content("10_story_test", "2_current", "---\nname: Test\n---\n");
let tmp = tempfile::tempdir().unwrap();
assert_eq!(
assert!(matches!(
find_active_story_stage(tmp.path(), "10_story_test"),
Some("2_current")
);
Some(crate::pipeline_state::Stage::Coding)
));
}
#[test]
@@ -55,10 +55,10 @@ mod tests {
crate::db::ensure_content_store();
crate::db::write_item_with_content("11_story_test", "3_qa", "---\nname: Test\n---\n");
let tmp = tempfile::tempdir().unwrap();
assert_eq!(
assert!(matches!(
find_active_story_stage(tmp.path(), "11_story_test"),
Some("3_qa")
);
Some(crate::pipeline_state::Stage::Qa)
));
}
#[test]
@@ -66,10 +66,10 @@ mod tests {
crate::db::ensure_content_store();
crate::db::write_item_with_content("12_story_test", "4_merge", "---\nname: Test\n---\n");
let tmp = tempfile::tempdir().unwrap();
assert_eq!(
assert!(matches!(
find_active_story_stage(tmp.path(), "12_story_test"),
Some("4_merge")
);
Some(crate::pipeline_state::Stage::Merge { .. })
));
}
#[test]