Skip to content

Let download repair accept a library switched from hardlink to copy - #90

Open
TheMightyTRex wants to merge 1 commit into
logabell:mainfrom
TheMightyTRex:contrib/repair-hardlink-to-copy
Open

TheMightyTRex wants to merge 1 commit into
logabell:mainfrom
TheMightyTRex:contrib/repair-hardlink-to-copy

Conversation

@TheMightyTRex

Copy link
Copy Markdown

Problem

When a library's import method is changed from hardlink to copy (for example because hardlinks do not work for those folders), downloads that were already submitted and are held for connection repair cannot be repaired. The repair stops with "The library destination changed; this repair cannot move an existing import", although the library location has not moved.

Connection repair compared the whole frozen destination with the current one, including the import mode, so any mode change was treated as a moved destination.

Change

services/app/domain/download_repairs.py gains same_destination, which compares the destination without the mode and accepts the mode when it is unchanged or is now copy. The repair proposal uses it in place of the exact comparison.

Copying moves nothing for a download that has not been imported yet, and copy works where hardlinks do not. Every other destination change, and a switch from copy to hardlink, still stops the repair as before.

Testing

  • New unit test tests/unit/test_download_repair_destination.py: switching to copy and a new backend credential generation keep the destination; copy to hardlink, a different root or a different backend do not.
  • tests/integration/test_download_repairs.py: the existing resume test is now also run with a library switched from hardlink to copy, and the held transfer resumes.
  • tests/unit/test_download_repair_destination.py, tests/integration/test_download_repairs.py and tests/integration/test_download_attempts.py: 61 passed.
  • ruff check and ruff format --check pass.

🤖 Generated with Claude Code

After an administrator changed a library's import method from hardlink to
copy, held downloads could not be repaired: connection repair compared the
whole frozen destination with the current one, so the changed mode failed
with "The library destination changed; this repair cannot move an existing
import", although the library location had not moved.

Repair now compares the destination without the mode and accepts the mode
when it is unchanged or is now copy. Copying moves nothing for a download
that has not been imported yet. Any other destination change, or a switch
from copy to hardlink, still needs a new selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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