Skip to content

[PB-6531]: extract name collision move actions out of the container - #2146

Merged
terrerox merged 30 commits into
masterfrom
refactor/extract-name-collision-move-actions
Oct 8, 2026
Merged

terrerox merged 30 commits into
masterfrom
refactor/extract-name-collision-move-actions

Conversation

@terrerox

Copy link
Copy Markdown
Contributor

Description

First of a stack that ends in #2039 (skip option) and #2129 (merge folders on skip). Pure refactor, no behaviour change.

The name-collision container held every side effect inline. This moves the move-collision handling (keep both with a unique name, replace by trashing the existing item) into nameCollision.actions.ts behind resolveMoveCollision, which takes the items plus a small context (dispatch, workspace, upload limit, versioning flag) instead of closing over component state. Upload collisions stay in the container for now and move in the next PR.

Unit tests cover both move resolutions.

Related Issues

Related Pull Requests

  • Next: refactor/extract-name-collision-upload-actions

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: 1598ef4
Status: ✅  Deploy successful!
Preview URL: https://0f552e67.drive-web.pages.dev
Branch Preview URL: https://refactor-extract-name-collis-twf5.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
Comment thread src/app/drive/components/NameCollisionDialog/nameCollision.actions.test.ts Outdated
@terrerox
terrerox requested a review from CandelR September 15, 2026 02:56
CandelR
CandelR previously approved these changes Sep 16, 2026
@terrerox
terrerox force-pushed the refactor/extract-name-collision-move-actions branch 2 times, most recently from b30a5cd to 7d4f851 Compare September 30, 2026 02:25
@terrerox
terrerox dismissed CandelR’s stale review October 2, 2026 11:55

The merge-base changed after approval.

@terrerox
terrerox force-pushed the refactor/extract-name-collision-move-actions branch 2 times, most recently from 7fff079 to 7311fe3 Compare October 7, 2026 01:03
Move the keep/replace handling for moved items into nameCollision.actions
behind resolveMoveCollision, with unit tests. No behaviour change.
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.
Move the keep/replace handling for uploaded files and folders, including
versioned replacement, into nameCollision.actions. resolveCollision now
covers both move and upload collisions, so the container only reads
store state and delegates. No behaviour change.
Covers single and multiple duplicates, per-item and apply-to-all skipping,
non-conflicting files still uploading, and Replace trashing the matching
file, with auth, bootstrap and Drive endpoints mocked so the specs run
without a backend. Queued uploads are asserted through the task panel
because Playwright cannot intercept the bridge in Firefox.
Adds a Skip option to the name-collision dialog, next to Replace and Keep
both, for both upload and move collisions. Duplicates are resolved one at
a time, and a new "Apply this action to all duplicates" checkbox handles
them all at once, closing the dialog immediately and running the work in
the background.

The renameModal i18n block is renamed to alreadyExistsModal (the dialog
does not rename anything), the description text is operation-neutral and
the apply-to-all label toggles the checkbox.
Skipping a colliding folder upload now keeps the existing folder and uploads only
the files and subfolders that do not exist yet, merging colliding subfolders
recursively so the folder structure is preserved.
Covers keep both for files and folders, replacing a folder, merging a
skipped folder into the existing one, replace, keep both and skip for
moved files, and versioned replace. The Drive mock now tracks folders,
folder creation, moves and a versioning flag; moves are driven by
dispatching the HTML5 drag events on the row's drop zone.
@terrerox
terrerox force-pushed the refactor/extract-name-collision-move-actions branch from 7311fe3 to 6f45d60 Compare October 7, 2026 13:25
@terrerox
terrerox removed this pull request from stack #2151 October 7, 2026 13:28
terrerox and others added 13 commits October 7, 2026 10:04
…restore-e2e

[PB-6531]: e2e coverage for same-name restore collisions
…atch

[PB-6531]: resolve same-name items within a move collision batch
…ge-on-skip

[PB-6531]: merge folder uploads into the existing folder on skip
[PB-6531]: e2e coverage for the skip option in name collisions
…collision

[PB-6531]feat/skip item option in name collision
…d-batching

[PB-6531]: match name collisions by name and type and batch their resolution
…n-upload-actions

[PB-6531]: extract name collision upload actions out of the container
larryrider
larryrider previously approved these changes Oct 8, 2026

@larryrider larryrider left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check and/or fix SonarCloud issues before merge

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@terrerox
terrerox requested a review from larryrider October 8, 2026 14:57
@terrerox
terrerox merged commit 7ac6f8b into master Oct 8, 2026
10 of 11 checks passed
@terrerox
terrerox deleted the refactor/extract-name-collision-move-actions branch October 8, 2026 15:24
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.

3 participants