Skip to content

fix(watchsync): skip a list's removals after its import fails - #4295

Merged
Quick104 merged 3 commits into
mainfrom
fix/watchsync-skip-removals-after-failed-import
Nov 15, 2026
Merged

Quick104 merged 3 commits into
mainfrom
fix/watchsync-skip-removals-after-failed-import

Conversation

@Quick104

@Quick104 Quick104 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Not reproduced live. Producing the bug needs a real provider and an injected mid-import failure. The defect is shown in the source. A new focused test drives SyncConnection twice: 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, and go mod tidy -diff pass. make test-go passes on a macOS host except metadata/nfo, playback, scanner, and subtitles/subsync. None of them imports watchsync, and they fail there on case-variant file names and permission checks. metadata/nfo fails the same way on the base. CI runs them on Linux.
  • make lint-changed reports 0 issues. make verify-local-paths, make verify-size-ratchet, and make verify-bidi pass.
  • Web and generated contracts are untouched.

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

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code, /silo skill
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: gpt-6.1-sol found the defect in a plan-round attack on fix(watchsync): keep a removed watchlist title off when the library gains or loses it #4284, and claude-opus-5-5 confirmed it from source. This fix skipped the plan round because the change is mechanical: a few lines where the root cause sits, proven by a test that fails on the base. A low-level code review of the diff found nothing, and the simplify pass made no changes. A background adversarial review (gpt-6.1-sol, reviewed 28d3f7c) found nothing to fix.

🤖 Generated with Claude Code

Note

Skip pending removals for a list after its import fails in watchsync

A 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.executeSyncRun in service.go, which tracks each list's import error and gates removals accordingly.

  • Adds a regression test TestSyncConnectionSkipsListRemovalsAfterFailedImport in service_test.go covering a failed first sync and a successful retry that preserves a re-added favorite.
  • Updates the watch provider plugins docs in watch-provider-plugins.md to describe this behavior.
  • Behavioral Change: removals are no longer sent for lists whose import errored in the same run; removals still run when the import succeeds or is not run.

Macroscope summarized 8d663b5.

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>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 15, 2026
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93564f11-0a62-415c-a774-76a1fa86b4d0
Commits

Reviewing files that changed from the base of the PR and between dfda77d and 8d663b5.

Files selected for processing: 3

  • docs/architecture/watch-provider-plugins.md
  • internal/watchsync/service.go
  • internal/watchsync/service_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-kody

silo-kody Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 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-15T05:38:08.935431Z 8d663b5 New commits
🔒 Security Review ✅ Completed 2026-11-15T05:40:03.308661Z 8d663b5 New commits
ℹ️ 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.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code impact: data-loss User data deleted, corrupted, or unrecoverable priority: P0 Fix/merge first: data-loss, security, or widespread breakage labels Nov 15, 2026
@Quick104
Quick104 merged commit 423b5a8 into main Nov 15, 2026
17 checks passed
@Quick104
Quick104 deleted the fix/watchsync-skip-removals-after-failed-import branch November 15, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code impact: data-loss User data deleted, corrupted, or unrecoverable priority: P0 Fix/merge first: data-loss, security, or widespread breakage size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant