refactor: rename soft-delete marker from .deleted to .closed

Internal rename: DELETE_MARKER -> CLOSE_MARKER, DeleteMarker ->
CloseMarker, is_deleted -> is_closed. The batch UUID is dropped;
undo now groups cases by their exact closed_at timestamp, which
bulk-close writes identically across its selection while per-case
close writes a unique stamp.

Behavior unchanged. No migration (project is pre-production);
legacy .deleted files in tmpdata were removed manually.
This commit is contained in:
2026-04-21 10:36:55 +02:00
parent a8389a89db
commit 9410d6daaa
13 changed files with 131 additions and 145 deletions
+6 -5
View File
@@ -46,7 +46,7 @@ pub async fn enqueue_pending_for_user(
let mut pending: Vec<std::path::PathBuf> = Vec::new();
while let Ok(Some(case_entry)) = cases.next_entry().await {
let case_dir = case_entry.path();
if !case_dir.is_dir() || crate::paths::is_deleted(&case_dir).await {
if !case_dir.is_dir() || crate::paths::is_closed(&case_dir).await {
continue;
}
let Ok(mut files) = tokio::fs::read_dir(&case_dir).await else {
@@ -128,7 +128,7 @@ pub(crate) async fn cases_needing_oneliner_in(user_root: &Path) -> Vec<PathBuf>
};
while let Ok(Some(case_entry)) = cases.next_entry().await {
let case_dir = case_entry.path();
if !case_dir.is_dir() || paths::is_deleted(&case_dir).await {
if !case_dir.is_dir() || paths::is_closed(&case_dir).await {
continue;
}
let (state, _) = paths::read_oneliner_state(&case_dir).await;
@@ -308,15 +308,16 @@ mod tests {
}
#[tokio::test]
async fn cases_needing_oneliner_skips_deleted_cases() {
async fn cases_needing_oneliner_skips_closed_cases() {
let data = tempdir().unwrap();
let case = data.path().join("user").join("case1");
tokio::fs::create_dir_all(&case).await.unwrap();
tokio::fs::write(case.join("2026-04-16T10-00-00Z.transcript.txt"), "content")
.await
.unwrap();
// Empty JSON object is a valid delete marker (see paths::is_deleted).
tokio::fs::write(case.join(".deleted"), "{}").await.unwrap();
// Empty JSON object is treated as a valid close marker
// (see paths::is_closed — existence of the file is enough).
tokio::fs::write(case.join(".closed"), "{}").await.unwrap();
assert!(cases_needing_oneliner(data.path()).await.is_empty());
}