Skip to content

feat: add watch_sync_provider.v1 capability - #10

Merged
Quick104 merged 5 commits into
Silo-Server:mainfrom
crowquillx:feat/watch-sync-provider
Jul 24, 2026
Merged

Quick104 merged 5 commits into
Silo-Server:mainfrom
crowquillx:feat/watch-sync-provider

Conversation

@crowquillx

@crowquillx crowquillx commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a typed watch_sync_provider.v1 gRPC capability
  • define host-owned OAuth/API-key credential exchange, rich desired-state watch events, typed retry outcomes, and remote-state reconciliation
  • register the capability in runtime/client scaffolding and capability discovery
  • round-trip typed descriptor metadata through persisted capability records
  • validate watch-sync manifests and add authoring/security documentation

The contract keeps encrypted credentials, OAuth state, durable delivery, retries, and reconciliation host-owned. Plugins receive secret material only for individual RPC calls and are explicitly required not to persist or log it.

Why

I was working on adding a plugin for AniList sync and noticed that the existing event_consumer.v1 path cannot reliably sync playback completion: it has no completion event, per-profile encrypted credentials, durable event IDs, retry/replay, or rich media identity. Adding those concerns to the generic event-consumer path would duplicate infrastructure Silo already has for built-in watch providers.

This capability provides the narrow plugin boundary needed to adapt external trackers to Silo's existing watchsync pipeline, keeping encryption, connection ownership, retries, scrobble sessions, and reconciliation host-owned. The contract is provider-neutral rather than AniList-specific so other watch-tracking plugins can use the same integration.

A corresponding server adapter has been implemented and tested on a branch in the contributor's fork to validate the SDK contract against the existing watchsync interfaces. If this SDK capability is merged and released, that server work can be updated to the tagged SDK version and proposed separately for review; it is not part of this PR.

Validation

  • go test -race ./...
  • go vet ./...
  • generated protobufs committed

AI use disclosure

AI assistance was used for repository research and Go/protobuf syntax suggestions. The implementation, API contract, generated code, tests, and review fixes were manually reviewed and validated by the contributor.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added support for watch_sync_provider.v1, including authorization/credential exchange, account retrieval, applying ordered watch events, and listing remote watch state.
    • Extended the plugin runtime with a Watch Sync Provider server/client capability.
  • Bug Fixes

    • N/A
  • Validation & SDK Updates

    • Added strict manifest and capability metadata validation for watch sync provider descriptors (auth methods, media types, batch sizing, IDs, and namespaces).
    • Improved capability conversion to and from the new watch sync provider descriptor.
  • Documentation

    • Documented the watch sync provider contract, semantics, fault handling, and remote-state pagination.
  • Tests

    • Added round-trip and registration tests for the new watch sync provider APIs.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Quick104, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

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).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ec0a1118-afdc-48e7-b992-269dea6a055d

📥 Commits

Reviewing files that changed from the base of the PR and between b82a1ce and cfabc3d.

⛔ Files ignored due to path filters (1)
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (3)
  • README.md
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
  • proto/silo/plugin/v1/watch_sync_provider.proto
📝 Walkthrough

Walkthrough

Adds the watch_sync_provider.v1 capability, its protobuf service and data contracts, descriptor conversion and manifest validation, runtime gRPC registration, tests, and documentation.

Changes

Watch sync provider capability

Layer / File(s) Summary
Define watch-sync provider capability contract
proto/silo/plugin/v1/watch_sync_provider.proto, proto/silo/plugin/v1/common.proto, pkg/pluginsdk/capability/capability.go, README.md
Defines authentication, credential, account, event, fault, apply, remote-state, and RPC contracts; registers the capability type and documents host/plugin responsibilities.
Convert and validate capability metadata
pkg/pluginsdk/convert/..., pkg/pluginsdk/manifest/...
Converts watch-sync descriptors through capability metadata and validates descriptor presence, identifiers, operations, batching, media types, and namespaces.
Register and access the gRPC capability
pkg/pluginsdk/runtime/...
Adds the watch-sync provider server field and client accessor, conditionally registers the gRPC service, and tests service registration.
Verify typed protobuf behavior
pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
Verifies remote-state timestamp round-tripping and typed rate-limit retry data in protobuf messages.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant GRPCPlugin
  participant WatchSyncProvider
  Host->>GRPCPlugin: Register WatchSyncProvider service
  Host->>WatchSyncProvider: ApplyEvents ordered desired-state events
  WatchSyncProvider-->>Host: Return apply results and updated credentials
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding the watch_sync_provider.v1 capability.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/pluginsdk/manifest/manifest.go`:
- Around line 137-172: Update validateWatchSyncCapability to reject
WATCH_SYNC_AUTH_METHOD_UNSPECIFIED entries after confirming auth methods are
present, and require supported_media_types to be non-empty before validating
each value as movie or episode. Preserve the existing validation errors and
checks for valid configurations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bec2cf59-6e85-40ca-8081-90df491a5139

📥 Commits

Reviewing files that changed from the base of the PR and between 5c50b8f and 9b8f3a3.

⛔ Files ignored due to path filters (3)
  • pkg/pluginproto/silo/plugin/v1/common.pb.go is excluded by !**/*.pb.go
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider.pb.go is excluded by !**/*.pb.go
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_grpc.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (10)
  • README.md
  • pkg/pluginsdk/capability/capability.go
  • pkg/pluginsdk/convert/convert.go
  • pkg/pluginsdk/convert/watch_sync_provider_test.go
  • pkg/pluginsdk/manifest/manifest.go
  • pkg/pluginsdk/manifest/watch_sync_provider_test.go
  • pkg/pluginsdk/runtime/runtime.go
  • pkg/pluginsdk/runtime/watch_sync_provider_test.go
  • proto/silo/plugin/v1/common.proto
  • proto/silo/plugin/v1/watch_sync_provider.proto

Comment thread pkg/pluginsdk/manifest/manifest.go
Quick104
Quick104 previously approved these changes Jul 24, 2026

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated the final provider-neutral contract, generated protobufs, manifest conversion/validation, full race tests, vet, and disposable host-adapter integration proof.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
proto/silo/plugin/v1/watch_sync_provider.proto (1)

155-163: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Define how credential updates interact with response faults.

updated_credentials may be returned alongside fault, but the contract only defines discarding results/pages—not whether credential updates are persisted, rejected, or discarded. Different implementations could lose token rotation or apply credentials from a failed operation. Specify and validate one deterministic rule across credential, apply, and remote-state responses.

Also applies to: 224-230, 270-285

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@proto/silo/plugin/v1/watch_sync_provider.proto` around lines 155 - 163,
Define a single deterministic policy for handling updated credentials when a
response also contains a fault, and document it in the WatchSync response
contracts. Apply the same policy consistently to WatchSyncCredentialResponse and
the related credential, apply, and remote-state response messages, then update
validation or implementations to enforce it so credentials are never ambiguously
persisted or discarded.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 150-155: Update the README pagination description to say the host
“commits each successful page” instead of “commits every page,” preserving the
surrounding behavior and terminology.

---

Outside diff comments:
In `@proto/silo/plugin/v1/watch_sync_provider.proto`:
- Around line 155-163: Define a single deterministic policy for handling updated
credentials when a response also contains a fault, and document it in the
WatchSync response contracts. Apply the same policy consistently to
WatchSyncCredentialResponse and the related credential, apply, and remote-state
response messages, then update validation or implementations to enforce it so
credentials are never ambiguously persisted or discarded.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5abbf985-ec06-4bfe-97db-b53817c30b48

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8f3a3 and b82a1ce.

⛔ Files ignored due to path filters (1)
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (6)
  • README.md
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
  • pkg/pluginsdk/convert/watch_sync_provider_test.go
  • pkg/pluginsdk/manifest/manifest.go
  • pkg/pluginsdk/manifest/watch_sync_provider_test.go
  • proto/silo/plugin/v1/watch_sync_provider.proto
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/pluginsdk/convert/watch_sync_provider_test.go
  • pkg/pluginsdk/manifest/manifest.go

Comment thread pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go Outdated
Comment thread README.md Outdated

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at cfabc3d after resolving all CodeRabbit feedback. Verified deterministic credential/fault commit ordering, protobuf regeneration, go test -race ./..., go vet ./..., focused host-adapter proof, and clean autoreview.

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.

2 participants