Skip to content

feat(watchsync): expand provider plugin contract - #13

Merged
Quick104 merged 5 commits into
mainfrom
codex/watch-sync-provider-v2
Aug 6, 2026
Merged

feat(watchsync): expand provider plugin contract#13
Quick104 merged 5 commits into
mainfrom
codex/watch-sync-provider-v2

Conversation

@Quick104

@Quick104 Quick104 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The released watch_sync_provider.v1 contract only covers API-key or authorization-code setup, watched-state exchange, and completed playback. That is not enough to extract the existing Trakt, Simkl, and MDBList providers or implement a self-hosted Floppy provider without provider-specific host code.

Approach

  • Add device-code authorization while keeping authorization-code and API-key flows.
  • Add favorites, watchlists, ordered watchlists, unwatched removal, and live start/pause/stop operations.
  • Add typed watched, progress, favorite, and watchlist remote-state traversal.
  • Carry full host-owned credentials, provider configuration, and provider-native item keys.
  • Define page/cursor, authoritative credential replacement, failure, and at-least-once event semantics explicitly.
  • Extend manifest validation for the new capability flags.

The additions are protobuf-wire compatible with v0.12 plugins. New fields default to disabled, so hosts expose only operations a plugin actually advertises.

Validation

  • GOWORK=off go test ./...
  • Generated protobuf and gRPC bindings are committed.
  • Manifest validation tests cover all new flags and invalid ordered-watchlist declarations.

Part of Silo-Server/silo-server#475.

Release note

The server and first Floppy plugin should consume this through a v0.13.0 SDK release after merge.

AI use disclosure

OpenAI Codex was used to inspect the existing contract, implement the protobuf and validator changes, and run the recorded tests. The maintainer is responsible for the submitted design and changes.

Summary by CodeRabbit

  • New Features
    • Added device-code authorization with verification, polling, expiration, and status details.
    • Expanded watch synchronization for favorites, watchlists, ordering, playback scrobbling, and provider-specific item identifiers.
    • Added richer remote-state tracking, list positions, tombstones, and event ordering.
    • Added optional separate device-authorization services.
  • Documentation
    • Clarified authorization state, idempotent event processing, configuration and secret handling, pagination, snapshots, and watchlist behavior.
  • Validation
    • Added checks for consistent synchronization capabilities and watchlist ordering configuration.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6bf1ba7a-1c28-44ba-82c8-ad27400e91ef

📥 Commits

Reviewing files that changed from the base of the PR and between c33f66c and 206f05f.

⛔ 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 (7)
  • README.md
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
  • pkg/pluginsdk/runtime/capability_servers_compat_test.go
  • pkg/pluginsdk/runtime/runtime.go
  • pkg/pluginsdk/runtime/serve_manifest.go
  • pkg/pluginsdk/runtime/watch_sync_provider_test.go
  • proto/silo/plugin/v1/watch_sync_provider.proto
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/pluginsdk/runtime/watch_sync_provider_test.go
  • README.md
  • proto/silo/plugin/v1/watch_sync_provider.proto

📝 Walkthrough

Walkthrough

The watch-sync protocol now supports device authorization, favorite, watchlist, and scrobbling operations, filtered remote-state families, list ordering, provider item keys, runtime service registration, and expanded SDK validation and serialization tests.

Changes

Watch-sync protocol expansion

Layer / File(s) Summary
Device authorization contracts
proto/silo/plugin/v1/watch_sync_provider.proto, pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
The protocol adds device-authorization start and poll RPCs. Responses carry authorization state, timing data, credentials, account data, and faults. Round-trip tests cover start, pending, and presence-preserving responses.
Remote-state and event contracts
proto/silo/plugin/v1/watch_sync_provider.proto, pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
Events support list positions and provider item keys. Remote-state requests support state-family filters. Records include list metadata, removals, favorite state, and watchlist state. Tests cover timestamps, tombstones, and explicit zero-value presence.
Runtime service registration
pkg/pluginsdk/runtime/runtime.go, pkg/pluginsdk/runtime/serve_manifest.go, pkg/pluginsdk/runtime/watch_sync_provider_test.go, pkg/pluginsdk/runtime/capability_servers_compat_test.go
The runtime accepts and registers the optional device-authorization service. The SDK client exposes its typed client. Tests verify both services and preserve the released CapabilityServers shape.
Capability validation and SDK coverage
pkg/pluginsdk/manifest/*, pkg/pluginsdk/convert/watch_sync_provider_test.go, pkg/pluginproto/silo/plugin/v1/watch_sync_provider_compat_test.go, README.md
Manifest validation recognizes additional operations and requires watchlist import for watchlist ordering. Conversion and compatibility tests cover device-code authentication and the provider interface. Documentation defines authorization state, event handling, polling persistence, configuration secret behavior, and remote-state semantics.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant WatchSyncDeviceAuthorizationService
  participant User
  participant WatchSyncProvider
  Host->>WatchSyncDeviceAuthorizationService: Start device authorization
  WatchSyncDeviceAuthorizationService-->>Host: User code, verification URL, and polling metadata
  Host->>User: Present authorization data
  Host->>WatchSyncDeviceAuthorizationService: Poll authorization state
  WatchSyncDeviceAuthorizationService-->>Host: Pending state or credentials
  Host->>WatchSyncProvider: Apply watch-sync events
  WatchSyncProvider-->>Host: Updated synchronization result
Loading

Possibly related PRs

Suggested reviewers: fluxis

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.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 describes the main change: expanding the WatchSync provider plugin contract.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/watch-sync-provider-v2

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: 2

🧹 Nitpick comments (1)
pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go (1)

72-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the exact values of all new round-trip fields.

  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go#L72-L75: Assert VerificationUrl, VerificationUrlComplete, and ProviderState after unmarshalling.
  • pkg/pluginsdk/convert/watch_sync_provider_test.go#L35-L37: Assert that AuthMethods[0] is WATCH_SYNC_AUTH_METHOD_DEVICE_CODE.
🤖 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 `@pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go` around lines 72 -
75, Strengthen the round-trip assertions in
pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go:72-75 by validating
the exact VerificationUrl, VerificationUrlComplete, and ProviderState values
after unmarshalling, alongside the existing fields. In
pkg/pluginsdk/convert/watch_sync_provider_test.go:35-37, assert that
AuthMethods[0] equals WATCH_SYNC_AUTH_METHOD_DEVICE_CODE.
🤖 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 `@proto/silo/plugin/v1/watch_sync_provider.proto`:
- Around line 19-20: Rename the request and response message declarations used
by StartDeviceAuthorization and PollDeviceAuthorization to
WatchSyncProviderStartDeviceAuthorizationRequest/Response and
WatchSyncProviderPollDeviceAuthorizationRequest/Response, update all RPC and
code references to the new names, and regenerate the protobuf bindings.
- Around line 283-285: Change list_position to an optional int32 field in the
proto definition to preserve the distinction between an omitted value and
explicit zero, then regenerate the corresponding bindings. Add or update tests
to verify presence detection for both absent and zero-valued list_position.

---

Nitpick comments:
In `@pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go`:
- Around line 72-75: Strengthen the round-trip assertions in
pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go:72-75 by validating
the exact VerificationUrl, VerificationUrlComplete, and ProviderState values
after unmarshalling, alongside the existing fields. In
pkg/pluginsdk/convert/watch_sync_provider_test.go:35-37, assert that
AuthMethods[0] equals WATCH_SYNC_AUTH_METHOD_DEVICE_CODE.
🪄 Autofix

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: 6f8e2c97-8774-479d-a9d4-cc845ce78c41

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb5165 and 3b705d7.

⛔ Files ignored due to path filters (2)
  • 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 (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

Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated
Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b705d7e88

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread proto/silo/plugin/v1/watch_sync_provider.proto
Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated
Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated
Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated

@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/pluginproto/silo/plugin/v1/watch_sync_provider_test.go`:
- Around line 119-121: Update the test around WatchSyncEvent to exercise the
omitted wire path: marshal an empty WatchSyncEvent, unmarshal the bytes into a
new WatchSyncEvent, and assert the resulting ListPosition is nil. Retain the
existing direct struct assertion only if useful, and use the test’s existing
protobuf error-handling conventions.
🪄 Autofix

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: f89db974-bf19-4355-afb3-2ff0fadb6afb

📥 Commits

Reviewing files that changed from the base of the PR and between 3b705d7 and 8aa005a.

⛔ Files ignored due to path filters (2)
  • 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 (7)
  • README.md
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_compat_test.go
  • pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go
  • pkg/pluginsdk/convert/watch_sync_provider_test.go
  • pkg/pluginsdk/runtime/runtime.go
  • pkg/pluginsdk/runtime/watch_sync_provider_test.go
  • proto/silo/plugin/v1/watch_sync_provider.proto
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/pluginsdk/convert/watch_sync_provider_test.go

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

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

🧹 Nitpick comments (1)
pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go (1)

124-141: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Exercise the Watchlist tombstone path too.

This test covers only Favorite. The contract permits tombstones without Media in both Favorite and Watchlist. A regression in the Watchlist wire path would pass this test. Run the same marshal/unmarshal assertions for both fields, preferably with table-driven cases.

🤖 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 `@pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go` around lines 124
- 141, Extend TestWatchSyncListTombstoneDoesNotRequireMedia to cover both
Favorite and Watchlist tombstones, preferably with table-driven cases. For each
field, marshal and unmarshal a WatchSyncRemoteState containing a Removed
tombstone without Media, then assert proto equality, nil Media, and the
tombstone’s Removed value.
🤖 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.

Nitpick comments:
In `@pkg/pluginproto/silo/plugin/v1/watch_sync_provider_test.go`:
- Around line 124-141: Extend TestWatchSyncListTombstoneDoesNotRequireMedia to
cover both Favorite and Watchlist tombstones, preferably with table-driven
cases. For each field, marshal and unmarshal a WatchSyncRemoteState containing a
Removed tombstone without Media, then assert proto equality, nil Media, and the
tombstone’s Removed value.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dce1af35-e341-4f7a-9c0f-0cdc57854438

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa005a and c33f66c.

⛔ Files ignored due to path filters (2)
  • 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 (3)
  • README.md
  • pkg/pluginproto/silo/plugin/v1/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)
  • README.md
  • proto/silo/plugin/v1/watch_sync_provider.proto

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c33f66caa5

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread proto/silo/plugin/v1/watch_sync_provider.proto

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4b0770d73

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated
Comment thread pkg/pluginsdk/runtime/runtime.go Outdated
Comment thread proto/silo/plugin/v1/watch_sync_provider.proto Outdated
@Quick104

Quick104 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Final review fixes are at 206f05f:

  • WatchSyncProviderServer and the released 12-field CapabilityServers layout remain source-compatible; device authorization now uses additive plugin-set / ServeManifestWithOptions registration, with a compile-time unkeyed-literal guard.
  • provider_state is presence-aware on the wire, so omission retains state and explicit empty clears it; SDK and host tests cover both cases.
  • pending state/timing updates are explicitly limited to the same user challenge, whose user code and verification URLs must remain valid through expiry.

go test -race ./..., go vet ./..., CI, and CodeRabbit pass at this head. buf lint continues to report only the repository's pre-existing service/RPC naming debt. The final SDK was also built into a disposable device-code plugin and exercised through the real PR #475 host across non-empty rotation, explicit-empty clearing, authorization, account lookup, and encrypted credential persistence.

@Quick104
Quick104 merged commit 13d7ccc into main Aug 6, 2026
2 checks passed
@Quick104
Quick104 deleted the codex/watch-sync-provider-v2 branch August 6, 2026 12:37
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.

1 participant