huskies: merge 1222 bug show fails with "content unavailable" on done/archived stories — content should never be evicted

This commit is contained in:
Huskies Agent
2026-07-18 19:56:30 +00:00
parent 2b0e8e6f10
commit a6cce683f5
4 changed files with 373 additions and 40 deletions
+42
View File
@@ -382,6 +382,48 @@ mod tests {
assert_eq!(depends_on[1], 200);
}
/// Story 1222 regression: `show` must return full content for a story
/// after it reaches Done and again after it reaches Archived — the
/// terminal-stage content purge must never evict the story body, only
/// its ephemeral bookkeeping keys.
#[tokio::test]
async fn tool_show_returns_content_after_done_and_after_archived() {
let tmp = tempdir().unwrap();
crate::crdt_state::init_for_test();
crate::db::ensure_content_store();
let story_id = "1222_story_done_archived_test";
let story_content = "# Story\n\n## Acceptance Criteria\n\n- [ ] Ship it\n";
crate::db::write_item_with_content(
story_id,
"5_done",
story_content,
crate::db::ItemMeta::named("Done Archived Test"),
);
// Simulate the terminal-transition purge that fires when a story
// reaches Done (story 996 GC subscriber / sweep).
crate::db::gc::purge_ephemeral_content_keys_for_story(story_id);
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
let result = tool_show(&json!({"story_id": story_id}), &ctx)
.await
.expect("show must succeed for a Done story, not return content unavailable");
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
assert_eq!(parsed["story_id"], story_id);
assert_eq!(parsed["front_matter"]["name"], "Done Archived Test");
// Move to Archived and purge again — content must still be readable.
crate::db::move_item_stage(story_id, "6_archived", None);
crate::db::gc::purge_ephemeral_content_keys_for_story(story_id);
let result = tool_show(&json!({"story_id": story_id}), &ctx)
.await
.expect("show must succeed for an Archived story, not return content unavailable");
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
assert_eq!(parsed["story_id"], story_id);
}
#[tokio::test]
async fn tool_show_returns_story_data() {
let tmp = tempdir().unwrap();