Skip to content

feat(torrent): move a torrent's files to another folder - #678

Merged
linroid merged 3 commits into
mainfrom
feat/torrent-relocate
Nov 14, 2026
Merged

linroid merged 3 commits into
mainfrom
feat/torrent-relocate

Conversation

@linroid

@linroid linroid commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Stacked on #677.

What

  • TorrentController.relocate(taskId, directory), capability relocate, REST PUT /api/torrents/{id}/location (answers the snapshot) and the remote client. The files keep their name inside the new folder.
  • A downloading or queued task is paused for the move and resumed after it; a completed one stops seeding, is checked at its new place and seeds again if it was meant to; a paused one is checked when it next starts.
  • SourceHost.relocate (core) runs under the task's control lock with no execution active. It refuses a relative folder, the folder the task is in, a folder inside its files, a name that is taken and another unfinished task's output, and saves the new output path and source state in one record write.
  • The torrent source renames the tree, or between volumes copies it and deletes the original; a copy that fails is removed again and the files stay where they were. The bookkeeping beside the old place is deleted, and the next run checks the files where they are and takes them as the task's own.
  • v1 stores can now take files in place as their own (TorrentPieceStore(adoptExisting)), as v2 stores already could, so removing a moved task with its files deletes them. This also applies to a v1 task added to use files already on disk.
  • The server lets a caller move only into folders it may save to (DestinationGuard.checkMove, 403 path_rejected).

Limits

  • No control in the apps yet: SDK and REST only. The app UI follows as its own PR.
  • A torrent's upload and download totals start again after a move, as its checkpoint is rebuilt by the check.
  • Pieces a v1 task kept for skipped files are downloaded again if those files are chosen later.
  • A move between volumes holds the request for as long as the copy takes, with no progress.

Tests

TorrentSeedingControlTest (a completed v1 task, a completed v2 task and a running download are moved, checked and owned at the new place; refusals), TorrentMoveTest (rename, copy between volumes, a failed copy, a taken name), TorrentRoutesTest (the route and its folder check). The torrent, core, server and remote JVM suites and the iOS compiles pass locally; the first full run ended in a build failure I could not attribute to a test or a compile error, and passed when run again.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T10:11:34.755235Z ce50c21 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce50c21317

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@linroid
linroid force-pushed the feat/torrent-edit-trackers branch from 9337277 to b8ec0a0 Compare November 14, 2026 11:50
@linroid
linroid force-pushed the feat/torrent-relocate branch from 2d66986 to c29faee Compare November 14, 2026 11:50
@linroid
linroid force-pushed the feat/torrent-edit-trackers branch from b8ec0a0 to fa4be47 Compare November 14, 2026 13:12
@linroid
linroid force-pushed the feat/torrent-relocate branch from c29faee to 6289321 Compare November 14, 2026 13:12
@linroid
linroid force-pushed the feat/torrent-edit-trackers branch from fa4be47 to 239e581 Compare November 14, 2026 13:48
@linroid
linroid force-pushed the feat/torrent-relocate branch from 6289321 to c816270 Compare November 14, 2026 13:48
Base automatically changed from feat/torrent-edit-trackers to main November 14, 2026 13:50
@linroid
linroid force-pushed the feat/torrent-relocate branch from c816270 to aa9fd47 Compare November 14, 2026 13:51
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 320 files  + 5   2 348 suites  +5   59m 58s ⏱️ +8s
16 359 tests +26  16 072 ✅ +26  287 💤 ±0  0 ❌ ±0 
19 940 runs  +42  19 653 ✅ +42  287 💤 ±0  0 ❌ ±0 

Results for commit fc27c8c. ± Comparison against base commit 23c8cac.

@linroid
linroid merged commit 8b20dcf into main Nov 14, 2026
14 checks passed
@linroid
linroid deleted the feat/torrent-relocate branch November 14, 2026 14:29
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