story-kit: merge 164_bug_dev_process_readme_documents_wrong_pipeline_stages

This commit is contained in:
Dave
2026-02-24 18:21:32 +00:00
parent 5ff213b3c5
commit d62f679fed
2 changed files with 39 additions and 28 deletions

View File

@@ -67,12 +67,10 @@ struct WorktreeListEntry {
/// response so the agents panel is not cluttered with old completed items on
/// frontend startup.
pub fn story_is_archived(project_root: &path::Path, story_id: &str) -> bool {
project_root
.join(".story_kit")
.join("work")
.join("5_archived")
.join(format!("{story_id}.md"))
.exists()
let work = project_root.join(".story_kit").join("work");
let filename = format!("{story_id}.md");
work.join("5_done").join(&filename).exists()
|| work.join("6_archived").join(&filename).exists()
}
pub struct AgentsApi {
@@ -298,29 +296,39 @@ mod tests {
use crate::agents::AgentStatus;
use tempfile::TempDir;
fn make_archived_dir(tmp: &TempDir) -> path::PathBuf {
fn make_work_dirs(tmp: &TempDir) -> path::PathBuf {
let root = tmp.path().to_path_buf();
let archived = root
.join(".story_kit")
.join("work")
.join("5_archived");
std::fs::create_dir_all(&archived).unwrap();
for stage in &["5_done", "6_archived"] {
std::fs::create_dir_all(root.join(".story_kit").join("work").join(stage)).unwrap();
}
root
}
#[test]
fn story_is_archived_false_when_file_absent() {
let tmp = TempDir::new().unwrap();
let root = make_archived_dir(&tmp);
let root = make_work_dirs(&tmp);
assert!(!story_is_archived(&root, "79_story_foo"));
}
#[test]
fn story_is_archived_true_when_file_present() {
fn story_is_archived_true_when_file_in_5_done() {
let tmp = TempDir::new().unwrap();
let root = make_archived_dir(&tmp);
let root = make_work_dirs(&tmp);
std::fs::write(
root.join(".story_kit/work/5_archived/79_story_foo.md"),
root.join(".story_kit/work/5_done/79_story_foo.md"),
"---\nname: test\n---\n",
)
.unwrap();
assert!(story_is_archived(&root, "79_story_foo"));
}
#[test]
fn story_is_archived_true_when_file_in_6_archived() {
let tmp = TempDir::new().unwrap();
let root = make_work_dirs(&tmp);
std::fs::write(
root.join(".story_kit/work/6_archived/79_story_foo.md"),
"---\nname: test\n---\n",
)
.unwrap();
@@ -330,11 +338,11 @@ mod tests {
#[tokio::test]
async fn list_agents_excludes_archived_stories() {
let tmp = TempDir::new().unwrap();
let root = make_archived_dir(&tmp);
let root = make_work_dirs(&tmp);
// Place an archived story file
// Place an archived story file in 6_archived
std::fs::write(
root.join(".story_kit/work/5_archived/79_story_archived.md"),
root.join(".story_kit/work/6_archived/79_story_archived.md"),
"---\nname: archived story\n---\n",
)
.unwrap();