Repository navigation
fix(file): reject moving a folder together with its descendants - #20848
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to This change makes the file service reject a move that selects a folder together with one of its descendants, which prevents duplicate or failed processing. No concrete merge-blocking risk was found. Bulk moves of very large selections may do extra ancestor lookups, but this is unconfirmed and not blocking. Pre-merge checks |
|
…lt window Adds TestDeleteStructureForDocs_FindsGhostsPastResultWindow, contributed by @Xavierando in the PR thread: a windowEngine fake pages like the Elasticsearch engine (unsorted from+size requests fail past index.max_result_window, sorted requests walk past it via search_after), and a ghost row sorted past the window must still be found and deleted. Verified to fail on main without this PR's Asc("id") on the ghost scan and to pass on this branch. Also merges upstream/main (ed0fd78) to pick up office_oxide v0.1.12 and the infiniflow#20750/infiniflow#20848 changes; both affected packages pass: go test ./internal/ingestion/knowledge_compile/ ./internal/engine/elasticsearch/
…lt window Adds TestDeleteStructureForDocs_FindsGhostsPastResultWindow, contributed by @Xavierando in the PR thread: a windowEngine fake pages like the Elasticsearch engine (unsorted from+size requests fail past index.max_result_window, sorted requests walk past it via search_after), and a ghost row sorted past the window must still be found and deleted. Verified to fail on main without this PR's Asc("id") on the ghost scan and to pass on this branch. Also merges upstream/main (ed0fd78) to pick up office_oxide v0.1.12 and the infiniflow#20750/infiniflow#20848 changes; both affected packages pass: go test ./internal/ingestion/knowledge_compile/ ./internal/engine/elasticsearch/
…lt window Adds TestDeleteStructureForDocs_FindsGhostsPastResultWindow, contributed by @Xavierando in the PR thread: a windowEngine fake pages like the Elasticsearch engine (unsorted from+size requests fail past index.max_result_window, sorted requests walk past it via search_after), and a ghost row sorted past the window must still be found and deleted. Verified to fail on main without this PR's Asc("id") on the ghost scan and to pass on this branch. Also merges upstream/main (ed0fd78) to pick up office_oxide v0.1.12 and the infiniflow#20750/infiniflow#20848 changes; both affected packages pass: go test ./internal/ingestion/knowledge_compile/ ./internal/engine/elasticsearch/
Summary
FileService.MoveFilesprocessed everysrc_file_idsentry independently, butmoveEntryRecursivealready relocates and deletes an entire subtree. Selecting a folder together with one of its descendants therefore processed the descendant twice: its row was already gone, so the second pass recreated an empty duplicate folder under the destination, and for a nested file it attempted a storage move from an already-removed source.This change adds a fail-fast source-level check.
MoveFilesnow rejects any request whose selected entries contain an ancestor/descendant relationship (folder + subfolder, folder + grandchild, folder + contained file, any depth) before any storage or database mutation, returningcannot move a folder together with its descendant. The check is order-independent and reused the existing ancestry helper.