Repository navigation
fix: batch trash operations and prevent re-upload races - #11
Merged
LukeGus merged 3 commits intoOct 22, 2026
Merged
Conversation
Add a batch trash endpoint with per-path results and bounded concurrency. Trash files in batches, keeping rows dimmed until each batch is confirmed. Wait for in-flight deletes before uploads, drops, and paste operations. Skip selected children when their parent folder is also selected. Trashed 1,000 files in 10.13s with no failures on one remote host. TypeScript checks pass; all 256 Vitest tests pass. Real UI not tested. Copy, move, and rename can still target names being deleted; cancel cannot stop in-flight requests, and permanent delete remains per-item.
Block rename, create, drag-move, and undo while deletes are in flight, and exclude dimmed rows from Ctrl+A. Add server cancellation so queued delete items stop, and offer permanent deletion only for items the server reports as failed. Batch permanent deletes through /deleteItems with per-call nonce status markers. Use rm -f for files and rm -rf only for listed directories; retry with sudo only paths reported as permission denied, and refuse roots and paths containing a . or .. segment. Hold the delete barrier through permanent-delete and sudo prompts. Add route and permanent-delete unit tests.
|
AI review | Looks safe to merge Implements batched trash and permanent delete operations with concurrency limits, cancellation support, and a frontend delete barrier to prevent re-upload races. Path validation, nonce-based shell output parsing, and comprehensive tests are included. No security, rule, or quality issues found. Reviewed 69d9031. AI can be wrong, a maintainer still decides. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bulk delete previously sent one request per file and removed rows before the server confirmed the trash operation. This could make a re-upload under the same name get trashed too. This PR sends deletes in bounded batches, keeps rows dimmed until each batch is confirmed, and makes everything that could reuse a path wait for in-flight deletes. On the measured remote host, 1,000 files were trashed in 10.13 seconds with no failures; the earlier per-item rate (about 0.46 s per file) extrapolates to about 460 seconds for the same workload.
Permanent delete and sudo retries are batched too, and Cancel now stops queued items on the server.
Overview
Bulk trash and permanent delete are faster and no longer remove rows before the server confirms them, which closes the re-upload race.
POST /deleteItemsbatch endpoint (trash, or permanent withpermanent: true) andPOST /deleteItems/cancelChanges Made
POST /deleteItems: up to 500 deduplicated paths per request, per-path results, 16 concurrent moves, trash purge after the response, session ownership check./deleteItemis unchanged.POST /deleteItems/cancel; queued items then stop starting and report "Cancelled". State is in memory only (10-minute TTL, keyed by user, session and operation)./deleteItemswithpermanent: true:sh -cscripts, with per-path status lines carrying a per-call random nonce so file names or error text cannot forge a result.rm -ffor files;rm -rfonly for paths the client lists as directories.rmreported as: Permission denied(checked underLC_ALL=C), and not after Cancel./, drive roots, and any path with a.or..segment.Verification
tscand Prettier are clean. 272 Vitest tests pass in 48 files, including new/deleteItemsroute tests (validation, session checks, dedupe, permanent mode, cancel) andremovePermanentlytests (batching, nonce, sudo scope, cancel, root refusal)./was refused.Known limitations
SUCCESS.Related Issues
None
Screenshots / Demos
Before Demo:
2026-10-20.23-28-08.mp4
After Demo:
2026-10-20.23-29-19.mp4
Checklist
CHANGELOG.md(if the repo has one)CONTRIBUTING.md