Repository navigation
fix(watchsync): skip a list's removals after its import fails - #4295
Conversation
A favorites or watchlist import that failed partway still let the same list's removal phase run. The import is what drops a pending local removal when the provider lists the title again after it, so a removal it never reached went out and took the provider's newer add off. Removals now wait for a run whose import completes; lists with import off still send them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 6 minutes. View limit details
|
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…movals-after-failed-import
…movals-after-failed-import
Problem
Related issue: N/A
Validation tasks: none
Other clients: N/A (no client-visible change)
With removal sync on, a favorites or watchlist import that fails partway through a sync run could delete a title the provider had just re-added. The title then ended up on neither the provider nor Silo.
The import decides which pending local removals are stale. When the provider lists a title again with a date after the local removal, the import treats it as a new add and drops the waiting removal. The removal phase for the same list ran right after the import, even when the import had failed. An error on an earlier row (a store write, a matcher error, or one supersede write among several) stopped the import before it reached the newer listing. The removal phase then sent the stale removal, which took the provider's newer add off, and the local add never happened.
Found in review of #4284.
Approach
When a list's import was attempted and failed, the run now skips that list's removal phase. The removals stay pending and go out in the next run whose import completes. That run sees the newer listing and drops any removal it supersedes. Lists with import turned off still send removals as before. The other list kind and the export phase are unaffected.
If an import keeps failing, that list's removals wait until it succeeds. Each of those runs already ends as failed and reports the import error.
The architecture doc's list sync rules now state this.
Validation
SyncConnectiontwice: the first run's import fails on an earlier row, and the retry succeeds. On the base, the first run sends the stale removal (removals sent after failed import = [movie-1], want none). With the fix, neither run sends it, and the retry adds the title back locally.go test ./internal/watchsync/...,go build ./...,go vet,gofmt, andgo mod tidy -diffpass.make test-gopasses on a macOS host exceptmetadata/nfo,playback,scanner, andsubtitles/subsync. None of them importswatchsync, and they fail there on case-variant file names and permission checks.metadata/nfofails the same way on the base. CI runs them on Linux.make lint-changedreports 0 issues.make verify-local-paths,make verify-size-ratchet, andmake verify-bidipass.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/watchsync-skip-removals-after-failed-import/
Risks
An import that keeps failing now holds that list's pending removals until the import succeeds. Before, those removals went out anyway, at the risk above.
Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Skip pending removals for a list after its import fails in
watchsyncA sync run now skips pending removals for a list whose import failed. The import may not have reached a newer listing that supersedes the pending removal, so sending it could remove a favorite the provider re-added. The change is in
Service.executeSyncRunin service.go, which tracks each list's import error and gates removals accordingly.TestSyncConnectionSkipsListRemovalsAfterFailedImportin service_test.go covering a failed first sync and a successful retry that preserves a re-added favorite.Macroscope summarized 8d663b5.