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
+11 -3
View File
@@ -588,6 +588,10 @@ pub(crate) async fn run_reconcile_pass(
// Content-GC: purge content-store entries for terminal/tombstoned stories.
crate::db::gc::sweep_zombie_content_on_startup();
// Content backfill: restore story bodies wiped by the pre-1222 buggy
// terminal-transition purge from the durable SQLite shadow column.
crate::db::gc::backfill_evicted_story_content().await;
// Worktree create: ensure every Coding story has a worktree.
crate::agents::pool::worktree_lifecycle::reconcile_worktree_create(root, agents.port()).await;
@@ -749,12 +753,16 @@ mod tests {
"run_reconcile_pass must not broadcast through the transition channel (no Lagged)"
);
// ── Assert: zombie content purged for all 200 Abandoned stories ────
// ── Assert: story content is RETAINED for all 200 Abandoned stories ──
// Story 1222: content must never be evicted on a pipeline transition
// (Done/Archived/Abandoned/etc.) — only genuinely deleted/tombstoned
// stories get their body purged. These stories are still live in the
// CRDT (merely Abandoned), so their content-store entry must survive.
for i in 0..200u32 {
let id = format!("1066_abandoned_{i:04}");
assert!(
crate::db::read_content(ContentKey::Story(&id)).is_none(),
"zombie content must be purged for abandoned story {id}"
crate::db::read_content(ContentKey::Story(&id)).is_some(),
"story content must be retained for abandoned story {id} (story 1222)"
);
}
}