huskies: merge 961

This commit is contained in:
dave
2026-05-13 11:22:57 +00:00
parent 78b1ecdc3c
commit 8b53e20ca9
38 changed files with 327 additions and 146 deletions
+4 -1
View File
@@ -115,7 +115,10 @@ pub fn list_bug_files(_root: &Path) -> Result<Vec<(String, String)>, String> {
} else {
Some(item.name)
}
.or_else(|| crate::db::read_content(&sid).and_then(|c| extract_bug_name_from_content(&c)))
.or_else(|| {
crate::db::read_content(crate::db::ContentKey::Story(&sid))
.and_then(|c| extract_bug_name_from_content(&c))
})
.unwrap_or_else(|| sid.clone());
bugs.push((sid, name));
}
+7 -6
View File
@@ -187,7 +187,7 @@ fn create_bug_file_writes_correct_content() {
);
// Check content exists (either in DB or filesystem).
let contents = crate::db::read_content(&bug_id)
let contents = crate::db::read_content(crate::db::ContentKey::Story(&bug_id))
.or_else(|| {
let filepath = tmp
.path()
@@ -273,7 +273,8 @@ fn create_spike_file_writes_correct_content() {
"spike ID must be numeric-only, got: {spike_id}"
);
let contents = crate::db::read_content(&spike_id).expect("spike content should exist");
let contents = crate::db::read_content(crate::db::ContentKey::Story(&spike_id))
.expect("spike content should exist");
assert!(
contents.starts_with("---\ntype: spike\nname: \"Filesystem Watcher Architecture\"\n---"),
@@ -305,7 +306,7 @@ fn create_spike_file_uses_description_when_provided() {
)
.unwrap();
let contents = crate::db::read_content(&spike_id)
let contents = crate::db::read_content(crate::db::ContentKey::Story(&spike_id))
.or_else(|| {
let filepath = tmp
.path()
@@ -328,7 +329,7 @@ fn create_spike_file_uses_placeholder_when_no_description() {
)
.unwrap();
let contents = crate::db::read_content(&spike_id)
let contents = crate::db::read_content(crate::db::ContentKey::Story(&spike_id))
.or_else(|| {
let filepath = tmp
.path()
@@ -437,7 +438,7 @@ fn create_bug_file_without_depends_on_omits_field() {
)
.unwrap();
let contents = crate::db::read_content(&bug_id)
let contents = crate::db::read_content(crate::db::ContentKey::Story(&bug_id))
.or_else(|| {
let filepath = tmp
.path()
@@ -485,7 +486,7 @@ fn create_refactor_file_without_depends_on_omits_field() {
)
.unwrap();
let contents = crate::db::read_content(&refactor_id)
let contents = crate::db::read_content(crate::db::ContentKey::Story(&refactor_id))
.or_else(|| {
let filepath = tmp
.path()
+1 -1
View File
@@ -119,7 +119,7 @@ mod tests {
// Also write to the global content store so read_story_content picks up this
// content even when a previous test has left a stale entry for the same ID.
crate::db::ensure_content_store();
crate::db::write_content(story_id, content);
crate::db::write_content(crate::db::ContentKey::Story(story_id), content);
}
// --- create_story integration tests ---
@@ -280,7 +280,7 @@ mod tests {
// Also write to the global content store so read_story_content picks up this
// content even when a previous test has left a stale entry for the same ID.
crate::db::ensure_content_store();
crate::db::write_content(story_id, content);
crate::db::write_content(crate::db::ContentKey::Story(story_id), content);
}
// --- create_story integration tests ---
+1 -1
View File
@@ -67,7 +67,7 @@ mod tests {
fs::create_dir_all(&current).unwrap();
fs::write(current.join(format!("{story_id}.md")), content).unwrap();
crate::db::ensure_content_store();
crate::db::write_content(story_id, content);
crate::db::write_content(crate::db::ContentKey::Story(story_id), content);
}
#[test]
+5 -2
View File
@@ -6,7 +6,7 @@ use std::path::Path;
///
/// Returns the story content or an error if not found.
pub(crate) fn read_story_content(_project_root: &Path, story_id: &str) -> Result<String, String> {
crate::db::read_content(story_id)
crate::db::read_content(crate::db::ContentKey::Story(story_id))
.ok_or_else(|| format!("Story '{story_id}' not found in any pipeline stage."))
}
@@ -341,7 +341,10 @@ mod tests {
fn read_story_content_from_content_store() {
crate::db::ensure_content_store();
let content = "---\nname: Test\n---\n# Story\n";
crate::db::write_content("9878_story_read_test", content);
crate::db::write_content(
crate::db::ContentKey::Story("9878_story_read_test"),
content,
);
let tmp = tempfile::tempdir().unwrap();
let result = read_story_content(tmp.path(), "9878_story_read_test").unwrap();