Skip to content

Auto-repair historical provider-anchored version merges after scan #459

Closed

Description

@Quick104

Summary

Provider-anchored content-group keys prevent newly scanned folders with different structured provider IDs from merging. However, a library first scanned before that fix can retain stale media_files.content_id ownership: the next scan updates the group key but deliberately preserves the already-matched item link.

This leaves the historical root attached to the wrong matched series until an administrator uses Split Versions.

Reproduction

Executed against the current scanner with two same-title series carrying different TVDB tags:

  1. Start with one tagged root historically attached to the other matched series.
  2. Rescan the tagged subtree.
  3. Observe that the file rows receive the correct provider-anchored group key, but retain the wrong matched content_id.

Expected behavior

After a completed scan, Silo should automatically repair this deterministic contradiction when all of the following hold:

  • every active file in the observed root shares one provider-anchored identity;
  • the root is a proper subset of the current source item;
  • exactly one existing matched same-type item owns the anchored provider ID;
  • no path-scoped identity override applies.

The repair must be transactional, preserve file-attributable user state, avoid moving episode-level state when another active file still uses the source episode, update scanner root/group claims, and converge to a no-op on the next scan.

AI Disclosure

  • Tool(s): Codex
  • Model(s): gpt-5.6-sol
  • Involvement: fully AI-generated
  • Adversarial review: identified and fixed claim rollback, episode membership/relink, pagination and atomic-group, concurrency, and exact-path edge cases; the final rerun reported no remaining findings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions