Skip to content

feat(mobile): create, rename, duplicate and delete files from the phone's Files browser - #51224

Merged
AmoabaKelvin merged 1 commit into
mainfrom
mobile-files-explorer-actions
Nov 28, 2026
Merged

AmoabaKelvin merged 1 commit into
mainfrom
mobile-files-explorer-actions

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

On the phone, long-pressing a file or folder in Files only let you copy its name or path. Now you can also make a new file or folder, rename, duplicate and delete, like the desktop's Files menu.

Files Added Deleted Net
Test 0 0 0 0
Prod 23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1257 $\color{#cf222e}{\Huge{\mathbf{−}}}$​80 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1177

What Changed

  • Before: the long-press sheet had Copy Name and Copy Relative Path. There was no way to make, rename, duplicate or delete anything from the phone.
  • After:
    • A file's sheet: Rename, Duplicate, Copy Name, Copy Relative Path, Delete.
    • A folder's sheet: New File, New Folder, Rename, Copy Name, Copy Relative Path, Delete.
    • The Files header gets a ⋯ menu with New File and New Folder for the top of the workspace.
    • Rename and New open a name field in the same sheet (Rename selects the name before the extension, as desktop and iOS do), as Rename does on the workspace menu. Delete asks first, with the desktop's remote-delete wording ("This permanently deletes the file. This cannot be undone."). A new file opens in the preview, as the desktop opens it in the editor. A renamed folder stays open, a deleted one is forgotten, and the folder that changed refreshes.
  • Mechanism:
    • The host already has no-clobber files.createDir, files.rename, files.copy and files.delete, but phones were only allowed files.createFile. They are now allowed on the workspace's own host (execution-host route), and the host advertises files.mobile-explorer-mutations.v1 so the phone only shows the actions where they work.
    • Every write names the host it expects (the same ownership fence the phone's note create uses), so a workspace that moved hosts refuses the write instead of it landing elsewhere.
    • The writes go through the phone's host-mutation layer. Offline, the name sheets keep the typed text. A lost reply is settled when the host is back: creates, renames and copies check whether the path exists before sending again. A delete is never sent again; if the path is still there, the phone says so.
    • Duplicate names copies the way the desktop does ("a copy.txt", "a copy 2.txt"). That rule now lives in one shared function the desktop and phone both use.

Why

The phone sheet was built copy-only, and the host's phone allowlist never included these four methods, so there was nothing for a phone to call. The host methods already refuse to overwrite and already check which host owns the workspace, so this reuses them as they are instead of adding phone-only host code. Desktop's naming and confirm rules are reused as well, so the two apps behave the same.

Delete is permanent (there is no Trash on the host side for remote callers), so the phone asks every time, using the same wording as the desktop's remote delete.

Linked Issue

Part of #31892 and #45776: the phone's Files browser can now change files. Share and Upload follow in separate PRs.

Visual Proof

iPhone simulator (Release build of this stack) paired to a headless orca serve built from this branch. Captures are from the full stack, so the Share row comes from #51225.

Before (main) After
File long-press, dark
File long-press, light
Folder long-press (dark / light) Root ⋯ menu (dark / light)
Rename New File New Folder result (docs opens) Delete confirm (dark / light)

Each action was checked on the host's disk: Duplicate made report copy.csv, Rename made summary.csv, New Folder made docs/drafts, Delete removed summary.csv, and New File made notes.md and opened its preview.

Added later: the "New" control for a panel with no header menu and for an empty workspace (it opens Upload Files / New File / New Folder at the root).

Empty workspace (dark / light) Its sheet Bot's Files tab + (dark / light) Its sheet
(screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data)

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • Host built from this branch as a headless orca serve with phone pairing: status advertises files.mobile-explorer-mutations.v1.

  • Phone checks: simulator walkthrough of each action against that host (captures in Visual Proof).

  • pnpm check:changed passes (format, lint, typecheck, localization in all 11 languages, ratchets).

  • No unit test: the change wires existing host methods to existing phone components; the duplicate naming rule keeps its previous behaviour.

Performance

None at rest: nothing runs until the user picks an action. Each action costs one ownership check (two or three small reads) and one write, then refreshes only the folder that changed. Duplicate checks copy names ten at a time with one files.pathsExist, so the usual case is one check and one copy.

Risk

The riskiest part is Delete, which permanently removes the file or folder on the host. It is behind a confirm, uses the workspace-owner fence, and is never retried after a lost reply. Older desktops and servers don't advertise the capability, so older hosts show only the copy actions, as before. A server workspace needs both the server and the relaying desktop to have it.

Level: Medium

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Windows hosts: the phone sends /-separated paths, and the host converts them as it does for every other phone file read.
  • Folder workspaces work the same way; nothing here needs git.
  • The bot panel's Files tab has no header, so it has no top-level New File/New Folder yet. Its folders' long-press sheets still have them.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The mobile file explorer adds capability-gated actions to create, rename, duplicate, and delete files and folders. Mutations use host RPC operations and update cached listings. The actions hook updates expanded paths after moves or removals. New labels and operation messages are added across the supported locales.

Merge Risk: Moderate · up to 29711

Mobile file create, rename, duplicate, and delete are now gated by a host capability and pinned to the explorer scope. Remaining concerns are that a write after a lost reply or host change may not be fully fenced, that a copy may be reported complete while unfinished, and that a renamed expanded folder can stay hidden under a collapsed parent. These should be resolved or accepted before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(mobile): create, rename, duplicate and delete files from the phone's Files browser" matches the main change. The changeset adds mobile file-explorer create, rename, duplicate, and dele…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description follows the repository template closely. It covers the ELI5, What Changed (before/after and mechanism), Why, Linked Issue (partial, see resolution), Visual Proof with before/after imag…
Full details: Title check

Explanation

The title "feat(mobile): create, rename, duplicate and delete files from the phone's Files browser" matches the main change. The changeset adds mobile file-explorer create, rename, duplicate, and delete actions, plus host method allowlisting and a capability flag. The title covers the primary change and omits the supporting shared duplicate-naming helper and capability gating, which is acceptable.

Full details: Description check

Explanation

The description follows the repository template closely. It covers the ELI5, What Changed (before/after and mechanism), Why, Linked Issue (partial, see resolution), Visual Proof with before/after images, Testing, Performance, Risk with level Medium, and Notes. The AI Disclosure section is empty, but the template says to fill it in only for non-StablyAI team members, and the author's membership is not stated. The Linked Issue section reads 'Part of #31892 and #45776' and contains no 'Fixes #' line. The template requires an actual linked issue for outside contributors, and the author's status is unknown. Several checklist items for lint, typecheck, test, and build remain unchecked, and the automated-tests checkbox is unchecked with a justification given below it. Overall the description is mostly complete.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 54ad9241-2bf7-4018-b9a0-ff2c53284371
Commits

Reviewing files that changed from the base of the PR and between 728806a and 297113f.

Files selected for processing: 14

  • mobile/src/files/explorer/MobileFileExplorerPanel.tsx
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • src/main/runtime/rpc/server/runtime-rpc-mobile-method-routing.ts
  • src/shared/file-access/files-runtime-capabilities.ts
Files skipped from review as they are similar to previous changes: 11

  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfecd9c6-3361-4aac-b774-ad022902bb45
Commits

Reviewing files that changed from the base of the PR and between 08e4629 and cd20bf2.

Files selected for processing: 21

  • mobile/src/files/explorer/MobileFileExplorerPanel.tsx
  • mobile/src/files/explorer/mobile-file-explorer-mutation-operations.ts
  • mobile/src/files/explorer/mobile-file-explorer-mutations.ts
  • mobile/src/files/explorer/mobile-file-explorer-row-actions-sheet.tsx
  • mobile/src/files/explorer/use-mobile-file-explorer-actions.tsx
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
  • mobile/src/worktree/execution-hosts/use-route-capability.ts
  • src/main/runtime/rpc/server/runtime-rpc-mobile-method-routing.ts
  • src/renderer/src/components/right-sidebar/file-explorer/mutations/useFileDuplicate.ts
  • src/shared/file-access/files-runtime-capabilities.ts
  • src/shared/file-import/import-copy-name.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@AmoabaKelvin
AmoabaKelvin force-pushed the mobile-files-explorer-actions branch from cd20bf2 to c9d1cb8 Compare November 27, 2026 23:24

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cd533e28-2c8a-4191-b63c-6d3492580a50
Commits

Reviewing files that changed from the base of the PR and between cd20bf2 and c9d1cb8.

Files selected for processing: 2

  • mobile/src/files/explorer/mobile-file-explorer-name-sheet.tsx
  • mobile/src/files/explorer/mobile-file-explorer-row-actions-sheet.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@AmoabaKelvin
AmoabaKelvin force-pushed the mobile-files-explorer-actions branch 2 times, most recently from ab12112 to 728806a Compare November 28, 2026 05:21

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da7f74c7-f344-45cf-9ecb-6bc401a41608
Commits

Reviewing files that changed from the base of the PR and between ab12112 and 728806a.

Files selected for processing: 17

  • mobile/src/files/explorer/MobileFileExplorerPanel.tsx
  • mobile/src/files/explorer/mobile-file-explorer-mutation-operations.ts
  • mobile/src/files/explorer/mobile-file-explorer-mutations.ts
  • mobile/src/files/explorer/mobile-file-explorer-name-sheet.tsx
  • mobile/src/files/explorer/mobile-file-explorer-row-actions-sheet.tsx
  • mobile/src/files/explorer/use-mobile-file-explorer-actions.tsx
  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 11

  • mobile/src/i18n/locales/de.json
  • mobile/src/i18n/locales/en.json
  • mobile/src/i18n/locales/es.json
  • mobile/src/i18n/locales/fr.json
  • mobile/src/i18n/locales/ja.json
  • mobile/src/i18n/locales/ko.json
  • mobile/src/i18n/locales/pt.json
  • mobile/src/i18n/locales/ru.json
  • mobile/src/i18n/locales/tr.json
  • mobile/src/i18n/locales/zh-Hant.json
  • mobile/src/i18n/locales/zh.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

}
return new Set(
[...expanded].flatMap((path) =>
!isPathOrDescendant(path, from) ? [path] : to === null ? [] : [to + path.slice(from.length)]

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.

Minor · Functional Correctness · Quick win

Open the destination ancestors when an expanded folder is renamed into a different folder.

A rename accepts a name that contains /, so the destination can sit under a different parent. For example, renaming an expanded old to nested/renamed gives the expansion set nested/renamed without nested. shownFolders hides a path whose ancestors are not all expanded. The renamed folder therefore stays hidden until nested is expanded, even though it is still marked open. Open the destination's ancestors when an expanded folder moves, as the create path already does. Leave the deletion path and unrelated expanded paths unchanged.

Suggested fix

-      onMoved: (from, to) => setExpanded((previous) => withFolderMoved(previous, from, to)),
+      onMoved: (from, to) =>
+        setExpanded((previous) => {
+          const moved = withFolderMoved(previous, from, to)
+          const parent = parentPathOf(to)
+          return previous.has(from) && parent ? withFolderOpen(moved, parent) : moved
+        }),

…ne's Files browser

Long-pressing a file or folder in the phone's Files browser only offered
Copy Name and Copy Relative Path. The host already had no-clobber create,
rename, copy and delete methods, but phones were never allowed to call the
last four.

The host now allows phones files.createDir, files.rename, files.copy and
files.delete on the workspace's own host and advertises
files.mobile-explorer-mutations.v1, so the phone offers the actions only
where they work. Each write names the host it expects, as the phone's note
create does. Duplicate names copies as the desktop does, now from one
shared rule. Delete is permanent and asks first.
@AmoabaKelvin
AmoabaKelvin force-pushed the mobile-files-explorer-actions branch from e41c9b8 to 9c0e658 Compare November 28, 2026 10:03
@AmoabaKelvin
AmoabaKelvin merged commit 06a2190 into main Nov 28, 2026
59 checks passed
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