huskies: merge 517_story_remove_filesystem_shadow_fallback_paths_from_lifecycle_rs_finish_the_migration_to_crdt_only

This commit is contained in:
dave
2026-04-10 12:56:16 +00:00
parent fe405e81c6
commit 31388da609
12 changed files with 171 additions and 170 deletions
+5 -5
View File
@@ -194,11 +194,11 @@ mod tests {
"confirmation should include new stage: {output}"
);
// Verify the file was actually moved.
let new_path = tmp
.path()
.join(".huskies/work/2_current/42_story_some_feature.md");
assert!(new_path.exists(), "story file should be in 2_current/");
// Verify the story is still accessible in the content store after the move.
assert!(
crate::db::read_content("42_story_some_feature").is_some(),
"story should be in the content store after move"
);
}
#[test]
+9
View File
@@ -15,4 +15,13 @@ pub(crate) fn write_story_file(root: &Path, stage: &str, filename: &str, content
let dir = root.join(".huskies/work").join(stage);
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(dir.join(filename), content).unwrap();
// Seed the in-memory content store so lifecycle functions that read from
// the content store (instead of the filesystem) see this entry. Use
// write_content (not write_item_with_content) to avoid writing to the
// CRDT — tests must not initialise the global CRDT OnceLock because that
// would pollute every subsequent test in the same process.
let story_id = filename.trim_end_matches(".md");
crate::db::ensure_content_store();
crate::db::write_content(story_id, content);
}
+14 -20
View File
@@ -1104,7 +1104,10 @@ mod tests {
let current = root.join(".huskies/work/2_current");
fs::create_dir_all(&backlog).unwrap();
fs::create_dir_all(&current).unwrap();
fs::write(backlog.join("421_story_foo.md"), "---\nname: Foo\n---\n").unwrap();
let content = "---\nname: Foo\n---\n";
fs::write(backlog.join("421_story_foo.md"), content).unwrap();
crate::db::ensure_content_store();
crate::db::write_content("421_story_foo", content);
// Add a past timer so take_due returns it immediately.
let store = TimerStore::load(root.join("timers.json"));
@@ -1121,14 +1124,10 @@ mod tests {
.expect("move_story_to_current should succeed for backlog story");
}
// Story must now be in 2_current/, not in 1_backlog/.
// Story must still be accessible in the content store after the move.
assert!(
current.join("421_story_foo.md").exists(),
"story should be in 2_current/ after timer fires"
);
assert!(
!backlog.join("421_story_foo.md").exists(),
"story should no longer be in 1_backlog/ after timer fires"
crate::db::read_content("421_story_foo").is_some(),
"story should be in the content store after timer fires"
);
// Timer was consumed.
assert!(store.list().is_empty(), "fired timer should be removed from store");
@@ -1149,15 +1148,10 @@ mod tests {
let current = root.join(".huskies/work/2_current");
fs::create_dir_all(&backlog).unwrap();
fs::create_dir_all(&current).unwrap();
// Use a unique high-numbered story ID (9905) that is unlikely to be in
// the global content store from a parallel test. Write ONLY to the
// filesystem so that move_story_to_current uses the filesystem path,
// which actually moves the file on disk.
fs::write(
backlog.join("9905_story_foo.md"),
"---\nname: Foo\n---\n",
)
.unwrap();
let content = "---\nname: Foo\n---\n";
fs::write(backlog.join("9905_story_foo.md"), content).unwrap();
crate::db::ensure_content_store();
crate::db::write_content("9905_story_foo", content);
let store = Arc::new(TimerStore::load(root.join("timers.json")));
let past = Utc::now() - Duration::seconds(5);
@@ -1174,10 +1168,10 @@ mod tests {
store.list().is_empty(),
"past-due timer must be consumed after tick_once"
);
// Story should have been moved to current.
// Story should still be accessible in the content store after the move.
assert!(
current.join("9905_story_foo.md").exists(),
"story should be in 2_current/ after tick fires"
crate::db::read_content("9905_story_foo").is_some(),
"story should be in the content store after tick fires"
);
}
}