Skip to content

feat(torrent): use files already in place when a download asks to overwrite - #672

Merged
linroid merged 5 commits into
mainfrom
feat/torrent-adopt-files
Nov 14, 2026
Merged

linroid merged 5 commits into
mainfrom
feat/torrent-adopt-files

Conversation

@linroid

@linroid linroid commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #671 (creation); only the commits after it belong to this PR.

What

The "Storage: import existing data" row of #162, and what makes a created torrent seedable.

A torrent always saved beside an existing file or folder of its name, as name (1), so content already on disk (a torrent just created, or files another client downloaded) could never be reused.

  • Core: a request with fileConflict = OVERWRITE for a source that writes its own files gets the name Ketch chose although something has it (DownloadExecution.existingPath, OutputPathReservations.reserveExisting), unless a running download reserved the path or another unfinished task saves there. Only the request does this, never the "When a file already exists" setting, as such a source writes in place from its first piece rather than replacing the file once it completes.
  • Torrent: the v1 store already used and checked the files it found; the v2 store takes the folders and regular files in place as its own (never a symbolic link), with the support the recheck PR added. Every piece is checked before it counts, and what differs is downloaded over it.
  • Use: ketch add --overwrite pack.torrent ~/Videos/, or DownloadRequest.fileConflict in the SDK. Devices list the import capability. The server's existing rules for overwriting requests apply unchanged.

The adopted files become the task's: removing it with its files deletes them, which the docs say.

Testing

TorrentAdoptFilesTest: created v1, v2 and hybrid torrents, added over the folder they were made from, complete without a single peer and leave the files as they were; without the request a torrent still saves into pack (1). Core, torrent, server and CLI suites pass on this branch.

  • Apps: the add sheet's Options offer torrents Torrent files already there → Use them, on devices listing torrent.existingFiles. Only that switch puts OVERWRITE on a torrent's request, never the device's file conflict setting. Translated in every language.

A folder that holds another unfinished download is never taken, and a file where a v2 or hybrid torrent's folder goes fails the run saying so (v2 keeps even a single file inside a folder of its name); a v1 torrent uses a single file in place.

Snapshots

New option, so there is no before.

Light Dark

@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-14T04:56:47.384736Z 4694fdf 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.

@claude

claude Bot commented Nov 14, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@linroid
linroid force-pushed the feat/torrent-adopt-files branch from 4694fdf to df766b6 Compare November 14, 2026 04:55

@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: 4694fdf8be

ℹ️ 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".

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 2 298 files  + 5   2 326 suites  +5   57m 59s ⏱️ -1s
16 252 tests +23  15 968 ✅ +22  284 💤 +1  0 ❌ ±0 
19 775 runs  +35  19 491 ✅ +34  284 💤 +1  0 ❌ ±0 

Results for commit 7271f91. ± Comparison against base commit ff1e7b3.

♻️ This comment has been updated with latest results.

Base automatically changed from feat/torrent-create to main November 14, 2026 11:49
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