Skip to content

fix(trash): trash a gone folder whole, files in chunks of 50 - #8

Merged
jshvn merged 1 commit into
mainfrom
josh/trash-folders
Sep 15, 2026
Merged

jshvn merged 1 commit into
mainfrom
josh/trash-folders

Conversation

@jshvn

@jshvn jshvn commented Sep 15, 2026

Copy link
Copy Markdown
Member

Problem

Runs 39, 40 and 41 (github 34956677315, 34962546482, 34988879529) all died in trash on the same folder: one filesystem trash call with 232 paths for .../CS35L/Assignments/1/1/ccle/processed/. The CLI resolves paths one after another at about two seconds each (133 paths took 261 s in the state's commands table), so the call cannot beat the 300 s command_timeout_seconds, and _mutation never retries. The report phase pushes state even on failure, so every later run resumed at the identical folder and died the same way.

Beyond that folder, 24 of the 4,124 remaining folders hold over 200 files and /Media/iPhone 2016/ holds 4,570. File-by-file trashing needs roughly 20 hours of CLI time across many chained runs.

Change

  • A folder the mirror holds nothing live under is trashed whole. _units finds the topmost directories with no live mirror_objects row beneath them and issues one filesystem trash on the folder node; every deleted row under it is recorded TRASHED and dropped. Against the current state this covers 36,722 of the 36,723 remaining files in 34 calls. Reconcile already trashes stray folders the same way.
  • A folder still holding live files gets its deleted files trashed by name in chunks of 50 paths (TRASH_CHUNK), each chunk's rows recorded and dropped as the call returns, so a call that dies loses at most one chunk of bookkeeping.
  • Folder units run first, then file units; budget, checkpoints and chaining are unchanged. Outputs gain subtrees.

Test plan

  • task test: 156 passed, including two new cases: a gone tree goes in one call while a mixed folder trashes by name; chunked calls settle each chunk before the next and a failing call leaves the rest for the next run
  • task lint, task check (render unchanged)
  • Merge, dispatch sync, watch the trash phase log for folder N of ~35 lines with subtrees counts and task status mirrored files fall toward the inventory count

@jshvn
jshvn merged commit f3c4657 into main Sep 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant