Skip to content

Keep same-named folders the manager did not copy (#107) - #114

Merged
uyujkk merged 2 commits into
mainfrom
claude/fix-copy-ownership
Nov 9, 2026
Merged

uyujkk merged 2 commits into
mainfrom
claude/fix-copy-ownership

Conversation

@uyujkk

@uyujkk uyujkk commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Fixes #107.

Summary

In copy mode, restoring a combination preset recognised a deployed Mod by folder name alone, so an unrelated folder with the same name could be planned for removal. The manager now records the copies it makes and only removes what it owns.

  • Ownership record: each copy the manager deploys is recorded in its own settings (beta-shell.json): repository, source Mod, target path and file list. Nothing is written into Mod folders.
  • Old copies without a record (option A, strict, chosen by the maintainer): a folder is claimed automatically only when its file list and every file size match the repository Mod; the claim is then recorded. An edited copy is not claimed.
  • Unknown same-name folders:
    • The restore preview lists them as external folders. They are never removed or installed over; a restore that would need to replace one is blocked until it's handled.
    • The preview explains that if this is a copy you deployed earlier and then edited, you can take it over, and offers a "Take over" button. Once taken over, it counts as the Mod's deployment.
  • External junctions: treated as external, neither owned nor removed.
  • A recorded copy stays owned after it's edited; removing a copy removes its record.
  • Normal restores keep the existing transaction backup and rollback.

Note for later: renaming a character (#108) doesn't update these records yet. That's a small follow-up once both PRs are in main.

Test plan

  • scripts\test-all.ps1 after merging main: Release build 0 warnings; Core line coverage 94.0%, branch 88.1%
  • UI tests 34/34 on the same build. Reproduce_CopyPresetRemovesUnrelatedSameNamedFolder now checks that the unrelated folder survives the restore.
  • 14 new Core tests:
    • Ledger_*: claiming an identical old copy, refusing an edited one or one with an extra or missing file, records for another source, and forgetting a removed copy.
    • Plan_*: keeping an unrelated folder out of the removal, never installing over an external folder, external junctions, removing a recorded copy.
    • Preview_* and Capture_*: showing and keeping external folders, blocking the restore, taking over, choosing between two sources with the same name.
  • Code-style check
  • Only disposable synthetic data was used

🤖 Generated with Claude Code

uyujkk and others added 2 commits November 9, 2026 12:12
Copy-mode deployments are recorded in beta-shell.json (CopyDeployments),
never as files inside Mod folders. A same-named folder in the loader
folder counts as a Mod's copy only when it was recorded or, for copies
made before the records existed, when its file list and every file size
equal the repository Mod (strict choice A). Anything else is an external
folder: the preset preview lists it, keeps it out of the removal plan and
offers to take it over; a single toggle asks before removing one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@uyujkk
uyujkk merged commit 42d94ee into main Nov 9, 2026
4 checks passed
@uyujkk
uyujkk deleted the claude/fix-copy-ownership branch November 16, 2026 15: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.

复制模式恢复组合会移除无归属记录的同名目录 / Verify ownership of copied Mods before preset removal

1 participant