You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context
This is follow-up work from the late Copilot review on the already-merged PR #8 (which addressed the original #3 recursion risk in cross_copy_single).
Copilot posted three comments after the merge. They are all valid points that were not addressed in the original PR.
Copilot comments (all on backend/src/commands/file.rs):
Cancellation granularity (line ~224)
cross_copy_single can take a long time for a single large directory tree, but cancellation is only checked in run_cross_copy_loop/run_cross_move_loop between top-level paths. Once a deep/wide directory copy starts, a user cancellation request won’t be observed until the entire tree finishes. Consider threading cancel_flag into cross_copy_single and checking it inside the while let Some(...) loop (returning Cancelled/an error) so cross-disk copy/move remains cooperatively cancellable at a finer granularity.
BFS memory usage for wide trees (line ~220)
The new BFS work-queue enqueues (src_path, dst_path) strings for every discovered child before processing them. For very wide directory trees, this can substantially increase peak heap usage vs the prior depth-first walk (which only needed one child_dst at a time). If memory blow-up on wide trees is a concern, consider switching to an explicit DFS stack (LIFO) or a heap-backed recursion emulation that processes a child immediately while keeping only “iterator state” for pending siblings.
Test comment accuracy (line ~1112)
The test comment claims this depth “would have overflowed before”, but the historical overflow risk described in Eliminate deep recursion risk in cross-disk directory copy (cross_copy_single) #3 is at thousands of levels; ~60 levels is unlikely to reproduce the prior failure mode and may not fail under the old recursive implementation. Suggest rewording to say it’s a regression guard against reintroducing recursion (and/or increase the depth enough to actually exercise the previous limit, if feasible within test runtime).
Context
This is follow-up work from the late Copilot review on the already-merged PR #8 (which addressed the original #3 recursion risk in
cross_copy_single).Copilot posted three comments after the merge. They are all valid points that were not addressed in the original PR.
Copilot comments (all on
backend/src/commands/file.rs):Cancellation granularity (line ~224)
BFS memory usage for wide trees (line ~220)
Test comment accuracy (line ~1112)
Links
Acceptance criteria for this follow-up
Arc<AtomicBool>or similar intocross_copy_singleand check inside the loop)run_cross_*_loop, Tauri commands, progress, etc.)Out of scope
This issue was created because the original PR was merged before Copilot’s review arrived.