huskies: merge 864

This commit is contained in:
dave
2026-04-30 22:23:21 +00:00
parent 3911c24c26
commit 61cf7684de
41 changed files with 540 additions and 71 deletions
@@ -57,7 +57,12 @@ mod tests {
.unwrap();
// Place the story in 2_current/ via CRDT (the only source of truth).
crate::db::ensure_content_store();
crate::db::write_item_with_content("story-3", "2_current", "---\nname: Story 3\n---\n");
crate::db::write_item_with_content(
"story-3",
"2_current",
"---\nname: Story 3\n---\n",
crate::db::ItemMeta::named("Story 3"),
);
let pool = AgentPool::new_test(3001);
// No agents are running — coder-1 is free.
@@ -139,6 +144,11 @@ mod tests {
"9930_story_qa1",
"3_qa",
"---\nname: QA Story\nagent: coder-1\n---\n",
crate::db::ItemMeta {
name: Some("QA Story".into()),
agent: Some("coder-1".into()),
..Default::default()
},
);
let pool = AgentPool::new_test(3001);
@@ -188,6 +198,11 @@ mod tests {
"story-pref",
"2_current",
"---\nname: Coder Story\nagent: coder-1\n---\n",
crate::db::ItemMeta {
name: Some("Coder Story".into()),
agent: Some("coder-1".into()),
..Default::default()
},
);
let pool = AgentPool::new_test(3001);
@@ -235,6 +250,11 @@ mod tests {
"9931_story_noqa",
"3_qa",
"---\nname: QA Story No Agent\nagent: coder-1\n---\n",
crate::db::ItemMeta {
name: Some("QA Story No Agent".into()),
agent: Some("coder-1".into()),
..Default::default()
},
);
let pool = AgentPool::new_test(3001);
@@ -274,6 +294,7 @@ mod tests {
"9932_story_waiting",
"2_current",
"---\nname: Waiting\ndepends_on: [9999]\n---\n",
crate::db::ItemMeta::from_yaml("---\nname: Waiting\ndepends_on: [9999]\n---\n"),
);
let pool = AgentPool::new_test(3001);
@@ -307,12 +328,18 @@ mod tests {
// Seed stories via CRDT (the only source of truth).
crate::db::ensure_content_store();
// Dep 999 is now done.
crate::db::write_item_with_content("999_story_dep", "5_done", "---\nname: Dep\n---\n");
crate::db::write_item_with_content(
"999_story_dep",
"5_done",
"---\nname: Dep\n---\n",
crate::db::ItemMeta::from_yaml("---\nname: Dep\n---\n"),
);
// Story 10 depends on 999 which is done.
crate::db::write_item_with_content(
"10_story_unblocked",
"2_current",
"---\nname: Unblocked\ndepends_on: [999]\n---\n",
crate::db::ItemMeta::from_yaml("---\nname: Unblocked\ndepends_on: [999]\n---\n"),
);
let pool = AgentPool::new_test(3001);
@@ -496,6 +523,9 @@ mod tests {
"9860_story_conflict",
"4_merge",
"---\nname: Conflict\nmerge_failure: \"CONFLICT (content): server/src/lib.rs\"\n---\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Conflict\nmerge_failure: \"CONFLICT (content): server/src/lib.rs\"\n---\n",
),
);
let pool = AgentPool::new_test(3001);
@@ -530,6 +560,9 @@ mod tests {
"9861_story_nothing",
"4_merge",
"---\nname: Nothing\nmerge_failure: \"nothing to commit, working tree clean\"\n---\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Nothing\nmerge_failure: \"nothing to commit, working tree clean\"\n---\n",
),
);
let pool = AgentPool::new_test(3001);
@@ -565,6 +598,9 @@ mod tests {
"9863_story_blocked_conflict",
"4_merge",
"---\nname: Blocked conflict\nmerge_failure: \"CONFLICT (content): foo.rs\"\nblocked: true\n---\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Blocked conflict\nmerge_failure: \"CONFLICT (content): foo.rs\"\nblocked: true\n---\n",
),
);
let pool = AgentPool::new_test(3001);
@@ -599,6 +635,9 @@ mod tests {
"9862_story_attempted",
"4_merge",
"---\nname: Already tried\nmerge_failure: \"CONFLICT (content): foo.rs\"\nmergemaster_attempted: true\n---\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Already tried\nmerge_failure: \"CONFLICT (content): foo.rs\"\nmergemaster_attempted: true\n---\n",
),
);
let pool = AgentPool::new_test(3001);
+6 -1
View File
@@ -83,7 +83,12 @@ impl AgentPool {
&contents,
);
crate::db::write_content(story_id, &updated);
crate::db::write_item_with_content(story_id, "4_merge", &updated);
crate::db::write_item_with_content(
story_id,
"4_merge",
&updated,
crate::db::ItemMeta::from_yaml(&updated),
);
}
crate::crdt_state::set_mergemaster_attempted(story_id, true);
if let Err(e) = self
+19 -3
View File
@@ -168,6 +168,7 @@ mod tests {
"9970_story_archived",
"6_archived",
"---\nname: Archived\n---\n",
crate::db::ItemMeta::from_yaml("---\nname: Archived\n---\n"),
);
// Also place a stale .md file in a temp 1_backlog/ dir.
@@ -200,9 +201,24 @@ mod tests {
fn scan_stage_items_returns_sorted_story_ids() {
// Write items via the CRDT store (the primary source of truth).
crate::db::ensure_content_store();
crate::db::write_item_with_content("9942_story_foo", "2_current", "---\nname: foo\n---");
crate::db::write_item_with_content("9940_story_bar", "2_current", "---\nname: bar\n---");
crate::db::write_item_with_content("9935_story_baz", "2_current", "---\nname: baz\n---");
crate::db::write_item_with_content(
"9942_story_foo",
"2_current",
"---\nname: foo\n---",
crate::db::ItemMeta::from_yaml("---\nname: foo\n---"),
);
crate::db::write_item_with_content(
"9940_story_bar",
"2_current",
"---\nname: bar\n---",
crate::db::ItemMeta::from_yaml("---\nname: bar\n---"),
);
crate::db::write_item_with_content(
"9935_story_baz",
"2_current",
"---\nname: baz\n---",
crate::db::ItemMeta::from_yaml("---\nname: baz\n---"),
);
let tmp = tempfile::tempdir().unwrap();
let items = scan_stage_items(tmp.path(), "2_current");
@@ -188,6 +188,9 @@ mod tests {
"10_spike_research",
"3_qa",
"---\nname: Research spike\nreview_hold: true\n---\n# Spike\n",
crate::db::ItemMeta::from_yaml(
"---\nname: Research spike\nreview_hold: true\n---\n# Spike\n",
),
);
assert!(has_review_hold(tmp.path(), "3_qa", "10_spike_research"));
}