Skip to content

fix(events): deliver administrator default changes to every viewer - #2754

Merged
Quick104 merged 1 commit into
mainfrom
fix/issue-2748-admin-default-events
Oct 20, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/issue-2748-admin-default-events

Conversation

@Quick104

@Quick104 Quick104 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2748
Related issue: N/A
Validation tasks: none. #2718 listed #1180 C1 and #1181 C1 (not yet run); this change keeps the profile isolation those cases cover. #2365 listed #1228 C1, which this change does not reach.

When an administrator changes a server-wide default (title art, or the Next Up defaults), connected clients are supposed to get a user_settings.changed event with scope: "default" so viewers inheriting the default re-read their settings. On main that event reaches no one, on either events socket.

#2365 publishes the event with no account and no profile, because it is meant for every viewer. #2718, merged a minute later, made user_settings delivery require the connection's own account, so an event with no account is now dropped everywhere. Each passed CI alone. On main, TestAdminDefaultChangeReachesEveryViewer fails, and so does the Go test job on any pull request's merge ref.

Approach

The administrator-default event is now marked for every viewer explicitly. The events socket delivers a user_settings event to every connection only when it carries that marker and names no account and no profile. Every other settings, state, and notification event goes through #2718's account and profile checks unchanged, so a personal event that loses its account by mistake still reaches no one.

The marker is an internal field on the event envelope. It travels over the event bus between nodes and is not part of any client frame, so clients see no contract change. This fixes all three administrator defaults (title art and both Next Up settings), which share one publisher. No other publisher on the personal channels sends events without an account.

Treating any user_settings event without an account as a broadcast would also work and needs no new field. I didn't do that because it turns a publisher bug that forgets the account into a broadcast, which is the case #2718 pinned as rejected.

docs/realtime-api.md and docs/settings-api.md now describe the every-viewer event.

Validation

  • Reproduced on main (dd3f7a6): TestAdminDefaultChangeReachesEveryViewer times out waiting for the event. It passes with this change.
  • That test now publishes from a second node's hub over an in-memory event bus, so it also proves the marker survives serialization between nodes. Setting the field's JSON tag to - makes it fail again.
  • New table cases check that the marker delivers only when the event names no account and no profile, does nothing on user_state or notifications, and still respects AdminOnly and missing claims. The v2 socket isolation test now also expects the default change on bound and unbound sockets, alongside the existing rejections. A remote-playback handoff receives it too. Removing the filter change fails all four tests.
  • go build ./..., gofmt, go vet, make lint-changed, make lint-router-recovery, and go test ./... pass. No web files changed.
  • Not checked on a running server. The tests open real v1 and v2 websocket connections through the production handlers.

Evidence

No screen changes; clients re-read settings again when an administrator changes a default. The page holds the test runs before and after.

Evidence: https://evidence.siloserver.org/r/silo-server/admin-default-events/

Risks

In a cluster, the event reaches every viewer only once every node runs this change. Until then, nodes without it drop the event, as all nodes do today. Personal-event isolation does not depend on the rollout.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code
  • Tool(s): Claude Code agent, Codex CLI (codex exec, read-only), gh, Go toolchain
  • Model(s): claude-opus-5-5 (implementation), gpt-6.1-sol (plan review)
  • Involvement: Fully AI-generated; a maintainer has not verified it yet
  • Adversarial review: gpt-6.1-sol reviewed the plan before implementation and agreed with it. It asked for a cross-node test of the marker and a fix to a contradicting sentence in the realtime docs; both are in. A background adversarial review with gpt-6.1-sol (reviewed 1ff8199) found nothing to fix.

🤖 Generated with Claude Code

#2718 limited user_settings delivery to the connection's own account,
which also dropped the administrator-default event #2365 publishes with
no account. Mark that event for every viewer explicitly and let only an
envelope with the marker and no account or profile through, so personal
settings events keep their isolation.

Closes #2748

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 20, 2026
@silo-kody

silo-kody Bot commented Oct 20, 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 ❌

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c82582f-5831-49ad-b474-cc6db5e74e55
📥 Commits

Reviewing files that changed from the base of the PR and between ed40fa2 and 1ff8199.

📒 Files selected for processing: 9
  • docs/realtime-api.md
  • docs/settings-api.md
  • internal/api/handlers/events_ws.go
  • internal/api/handlers/events_ws_personal_test.go
  • internal/api/handlers/events_ws_remote_playback_test.go
  • internal/api/handlers/events_ws_user_settings_test.go
  • internal/api/handlers/user_settings_events.go
  • internal/events/hub.go
  • internal/events/types.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

Administrator-default user_settings events now carry an explicit all-viewers marker. Socket authorization permits these marked events for bound and unbound viewers while retaining account and profile restrictions for other events.

Changes: Administrator-default settings delivery

Layer / File(s) Summary
Add and publish the all-viewers marker
internal/events/types.go, internal/events/hub.go, internal/api/handlers/user_settings_events.go, docs/settings-api.md
Publish options and event envelopes now carry the AllViewers marker. Administrator-default settings events set it, and the settings API documentation describes delivery to every viewer.
Authorize delivery and verify viewer coverage
internal/api/handlers/events_ws.go, internal/api/handlers/events_ws_personal_test.go, internal/api/handlers/events_ws_remote_playback_test.go, internal/api/handlers/events_ws_user_settings_test.go, docs/realtime-api.md
Socket authorization permits marked, unaddressed user-settings events. Tests cover bound and unbound viewers, event restrictions, and publication between separate hubs. Realtime API documentation describes delivery scope.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: rhainland

Merge Risk: ⚪ Minimal · up to 1ff81

Administrator default changes now reach every connected viewer, while personal settings events keep their account and profile isolation. No merge-blocking risk was identified. The author did not check behavior on a running server.

Pre-merge checks: Passed 6 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 6 passed
Check name Status Explanation
Linked Issues check Passed The pull request directly addresses issue #2748 and preserves the account and profile isolation requirements described in the objectives.
Out of Scope Changes check Passed The implementation, tests, and documentation changes are focused on delivering administrator-default events to every eligible viewer.
Title check Passed The title clearly and concisely identifies the main change: delivering administrator-default events to every viewer.
Linked Issues check Passed Issue #2748 requires administrator-default user_settings.changed events to reach authenticated subscribers on both event sockets. The PR sets AllViewers: true in publishAdminDefaultEvent and pre…
Out of Scope Changes check Passed The changes stay within issue #2748. The event envelope and hub changes transport the delivery marker, the socket filter enforces its restricted use, and the publisher change fixes administrator-defau…
Description check Passed The pull request description directly explains the regression, implementation, testing, documentation updates, risks, and affected administrator-default events. It matches the changeset.
Full details: Linked Issues check

Explanation

Issue #2748 requires administrator-default user_settings.changed events to reach authenticated subscribers on both event sockets. The PR sets AllViewers: true in publishAdminDefaultEvent and preserves scope: "default" with no account or profile. The envelope serializes the marker for cross-node delivery. The reported tests cover v1 and v2 sockets, bound and unbound connections, personal-event isolation, claim checks, and cross-node propagation. The three administrator defaults use this shared publisher.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #2748. The event envelope and hub changes transport the delivery marker, the socket filter enforces its restricted use, and the publisher change fixes administrator-default delivery. The added tests and documentation verify and describe this behavior. No unrelated product behavior is identified.

Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 7 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 20, 2026
@Quick104
Quick104 merged commit d5126cc into main Oct 20, 2026
16 checks passed
@Quick104
Quick104 deleted the fix/issue-2748-admin-default-events branch October 20, 2026 13:29
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 priority: P2 Limited scope, workaround exists, or polish 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.

[bug] Administrator default changes no longer reach any events socket

1 participant