huskies: merge 530_story_eliminate_filesystem_markdown_shadows_entirely_crdt_db_is_the_only_story_store

This commit is contained in:
dave
2026-04-10 14:56:13 +00:00
parent 1dd675796b
commit 11d19d8902
26 changed files with 966 additions and 1668 deletions
@@ -2,23 +2,9 @@
use std::path::Path;
/// Read story contents from DB content store first, fall back to filesystem.
fn read_story_contents(project_root: &Path, story_id: &str) -> Option<String> {
// Primary: in-memory content store (backed by SQLite).
if let Some(c) = crate::db::read_content(story_id) {
return Some(c);
}
// Fallback: scan filesystem stages.
for stage in &["1_backlog", "2_current", "3_qa", "4_merge", "5_done", "6_archived"] {
let path = project_root
.join(".huskies/work")
.join(stage)
.join(format!("{story_id}.md"));
if let Ok(c) = std::fs::read_to_string(&path) {
return Some(c);
}
}
None
/// Read story contents from the DB content store (CRDT-backed).
fn read_story_contents(_project_root: &Path, story_id: &str) -> Option<String> {
crate::db::read_content(story_id)
}
/// Read the optional `agent:` field from the front matter of a story file.
@@ -125,14 +111,12 @@ mod tests {
#[test]
fn has_review_hold_returns_true_when_set() {
let tmp = tempfile::tempdir().unwrap();
let qa_dir = tmp.path().join(".huskies/work/3_qa");
std::fs::create_dir_all(&qa_dir).unwrap();
let spike_path = qa_dir.join("10_spike_research.md");
std::fs::write(
&spike_path,
crate::db::ensure_content_store();
crate::db::write_item_with_content(
"10_spike_research",
"3_qa",
"---\nname: Research spike\nreview_hold: true\n---\n# Spike\n",
)
.unwrap();
);
assert!(has_review_hold(tmp.path(), "3_qa", "10_spike_research"));
}