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:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user