fix(session): finish interrupted deletion without removing shared recovery [skip ci]

Allow retry after a deletion tombstone while retaining the legacy single-slot checkpoint, which older binaries can write outside the per-session lock. The existing lifecycle case now checks its bytes remain intact and the retired checkpoint stays hidden.

Refs #7095 (CW-7553). On frozen 896e781fbb plus 29 inventoried dirty paths, 33 existing checkpoint, deletion, retention and late-usage cases passed; rustfmt and diff check passed. This does not reproduce the original Deepin report or qualify older concurrent binaries.
This commit is contained in:
CodeWhale Bot committed 2026-10-29 15:35:14 -07:00
1 parent 896e781fbb
commit 16d42ab17d
2 files changed
+6 -2

No files matched your search

+2 -1
View File
@@ -4355,7 +4355,8 @@ impl SessionManager {
}
let owns_legacy_checkpoint =
matches!(&legacy_origin, Ok(Some(origin)) if origin == id.trim());
if matches!(removal, SessionRemoval::Explicit) && owns_legacy_checkpoint {
if matches!(removal, SessionRemoval::Explicit) && owns_legacy_checkpoint && !already_deleted
{
return Err(io::Error::other(
"this session has a shared legacy checkpoint; remove that checkpoint separately before deleting the session",
));
@@ -859,6 +859,8 @@
.as_bytes(),
)
.expect("legacy checkpoint before deletion");
let legacy = manager.checkpoints_dir().join(LEGACY_CHECKPOINT_FILE);
let legacy_before = fs::read(&legacy).expect("legacy bytes");
let (ledger, _) = manager
.ensure_late_usage_paths("interrupted-delete")
.expect("paths");
@@ -891,7 +893,8 @@
.delete_session("interrupted-delete")
.expect("finish deletion");
assert!(manager.list_sessions().expect("list").is_empty());
assert!(manager.list_checkpoints().expect("checkpoints").is_empty());
assert_eq!(fs::read(&legacy).expect("legacy preserved"), legacy_before);
assert!(manager.load_legacy_checkpoint().expect("legacy read").is_none());
}
#[test]