Skip to content

fix: correct dependency resolution for nested actions and deletions (… - #790

Open
theAnuragMishra wants to merge 1 commit into
stevearc:masterfrom
theAnuragMishra:move-before-delete
Open

theAnuragMishra wants to merge 1 commit into
stevearc:masterfrom
theAnuragMishra:move-before-delete

Conversation

@theAnuragMishra

Copy link
Copy Markdown

Closes #780 .

Fixes an issue where deleting a parent directory while moving or copying descendant items out of it caused the deletion to execute first, deleting the items before they could be moved.

  • Fix Trie:_dfs using ipairs over container.children (a string-keyed map), which prevented discovering nested descendants in dependency checks (accum_children_of), and ensure filter is forwarded.
  • Normalize trailing slashes in Trie:_url_to_path_pieces so paths with and without a trailing slash resolve to the same trie node.
  • Safely check for missing parent containers in accum_first_parents_of.
  • Defer independent deletes after non-destructive operations (create, move, copy, change) while preserving explicit dependencies (such as deleting a destination before moving/copying into it).
  • Add copy checks to delete dependencies so reading from a path to copy it completes before deleting that path.

Note: I wrote this PR with AI assistance but have fully verified the changes myself, ran tests and also manually tested a lot of variations of moves and deletes in bulk including one specified in #780 .

…tevearc#780)

Fixes an issue where deleting a parent directory while moving or copying descendant items out of it caused the deletion to execute first, deleting the items before they could be moved.

- Fix Trie:_dfs using ipairs over container.children (a string-keyed map), which prevented discovering nested descendants in dependency checks (accum_children_of), and ensure filter is forwarded.
- Normalize trailing slashes in Trie:_url_to_path_pieces so paths with and without a trailing slash resolve to the same trie node.
- Safely check for missing parent containers in accum_first_parents_of.
- Defer independent deletes after non-destructive operations (create, move, copy, change) while preserving explicit dependencies (such as deleting a destination before moving/copying into it).
- Add copy checks to delete dependencies so reading from a path to copy it completes before deleting that path.
@github-actions
github-actions Bot requested a review from stevearc October 14, 2026 23:07
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.

bug: delete occurs before move/copy

1 participant