huskies: merge 888

This commit is contained in:
dave
2026-05-12 15:43:02 +00:00
parent d04facd24f
commit 3891de685c
3 changed files with 147 additions and 6 deletions
+43
View File
@@ -272,6 +272,49 @@ mod tests {
);
}
/// AC4 regression (chat path): set [1,2,3] → clear → replace [4,5].
/// Verifies each write is reflected in CRDT and that replace does not append.
#[test]
fn depends_set_clear_replace_regression() {
let tmp = tempfile::TempDir::new().unwrap();
crate::crdt_state::init_for_test();
write_story_file(
tmp.path(),
"1_backlog",
"9920_story_scr.md",
"---\nname: SCR\n---\n",
);
// Set to [1, 2, 3].
let out = depends_cmd_with_root(tmp.path(), "9920 1 2 3").unwrap();
assert!(out.contains("1"), "response should mention dep 1: {out}");
let view = crate::crdt_state::read_item("9920_story_scr").expect("CRDT must have story");
assert_eq!(
view.depends_on,
Some(vec![1, 2, 3]),
"CRDT should hold [1,2,3]: {view:?}"
);
// Clear.
let out = depends_cmd_with_root(tmp.path(), "9920").unwrap();
assert!(out.contains("Cleared"), "clear should confirm: {out}");
let view = crate::crdt_state::read_item("9920_story_scr").expect("CRDT must have story");
assert_eq!(
view.depends_on, None,
"CRDT should be None after clear: {view:?}"
);
// Replace with [4, 5] — must not append to old list.
let out = depends_cmd_with_root(tmp.path(), "9920 4 5").unwrap();
assert!(out.contains("4"), "response should mention dep 4: {out}");
let view = crate::crdt_state::read_item("9920_story_scr").expect("CRDT must have story");
assert_eq!(
view.depends_on,
Some(vec![4, 5]),
"CRDT should hold exactly [4,5] after replace: {view:?}"
);
}
#[test]
fn depends_finds_story_in_any_stage() {
let tmp = tempfile::TempDir::new().unwrap();