Skip to content

[PB-6531]: match name collisions by name and type and batch their resolution - #2148

Open
terrerox wants to merge 2 commits into
refactor/extract-name-collision-upload-actionsfrom
fix/name-collision-matching-and-batching
Open

terrerox wants to merge 2 commits into
refactor/extract-name-collision-upload-actionsfrom
fix/name-collision-matching-and-batching

Conversation

@terrerox

Copy link
Copy Markdown
Contributor

Description

Stacked on refactor/extract-name-collision-upload-actions. Two fixes to how name collisions are resolved, split out of #2039 so that PR only adds the Skip option.

  • Duplicated items were matched to their existing counterpart by array index, which could make Replace trash the wrong file. They are now paired by name and type (name only for folders) via findExistingItemFor in nameCollision.utils.ts, and items without a match are left out of the replace.
  • Each resolution goes through the array-based primitives (moveItemsToTrash, moveItemsThunk, the upload managers) in one call instead of one call per item, so batching, concurrency limits and per-item error handling are inherited rather than reimplemented. Versioned replacements still run one at a time because that upload bypasses the queue. The destination folder is refreshed once per group instead of once per item.

Unit tests cover the matching rules and every resolution path.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

yarn vitest run src/app/drive/components/NameCollisionDialog, plus the manual upload/move collision flows (keep both, replace, with and without versioning).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 11, 2026

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: bce942f
Status: ✅  Deploy successful!
Preview URL: https://87cd9bbc.drive-web.pages.dev
Branch Preview URL: https://fix-name-collision-matching.drive-web.pages.dev

View logs

@terrerox terrerox self-assigned this Sep 11, 2026
@terrerox
terrerox added this pull request to stack #2149 September 11, 2026 04:06
@terrerox
terrerox removed this pull request from stack #2149 September 11, 2026 05:41
@terrerox
terrerox added this pull request to stack #2151 September 11, 2026 05:44
Duplicated items were matched to their existing counterpart by array
index, which could make Replace trash the wrong file. They are now paired
by name and type (or name only for folders), and each resolution goes
through the array-based primitives (moveItemsToTrash, moveItemsThunk,
upload managers) so batching, concurrency limits and per-item error
handling are inherited instead of reimplemented per item.
…never cross-match

The duplicate checks return raw API items that carry no isFolder, so the
name matcher could never pair a moved folder with its existing folder and
could pair an uploaded folder with a file of the same name. Existing items
are now tagged when the collision groups are built, and the matcher only
pairs folders with folders and files with files.
@terrerox
terrerox force-pushed the fix/name-collision-matching-and-batching branch from 7091a30 to bce942f Compare September 15, 2026 03:33
@sonarqubecloud

Copy link
Copy Markdown

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