Repository navigation
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Part of #376. Amends the draft in PR #377 per review: - Scope the post-cutover hard gate to the protocol version only; manifest revisions become monotone-compatible within protocol 1 (clients hide definitions newer than the connected server), so additive settings no longer require four-platform lockstep releases. Acknowledge the store-auto-update vs operator-upgrade window. - Add the Jellyfin compatibility surface section: jellycompat is exempt from the handshake, DisplayPreferences seed repoints to the canonical resolver, and its blobs move off the legacy user_settings store before that table is dropped. - Correct the foreign-key claim: delete behavior is application- enforced (SQLite store has no FKs; Postgres has none on library/series/device columns) and covered by the conformance suite. - Soften migration failure semantics: recognized-but-unnormalizable values are quarantined to the rejects table; hard abort is reserved for structural failures. Define per-user SQLite migration atomicity. - Specify account-scope authorization (child profiles cannot mutate), last-write-wins concurrency, outbox hold behavior on 426, RFC 8785 canonical JSON for the manifest digest, delivery of settings-changed events over the existing internal/events hub, and note the silo-apple baseline branch. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Applied the design-review findings in 9314df1 (review pass verified every claim against silo-server, silo-apple, and silo-android code plus the jellycompat surface — all drift claims held): Design changes
Corrections & hardening
PR body updated to match (core decision 3, review focus). |
Revises the cross-platform settings contract design after review against the current server, web, and policy implementations. The contract model itself — server-owned manifest, typed values, per-definition resolution order, generated bindings, durable client outbox — is unchanged. What changes is how it ships and what it reconciles with. Rollout. The hard `426 Upgrade Required` gate is withdrawn. It sat on the whole first-party authenticated chain, so a settings-version mismatch made the entire app unusable, and app-store auto-update against self-hosted servers guarantees that window happens. It was also version sniffing, which docs/architecture/ v1-scope.md rules against in favor of capability endpoints, and it contradicted the coexistence approach the playback protocol v3 plan chose for a larger cross-platform change. Detection now uses the manifest endpoint; older clients fall back to the legacy string API through a projection over the canonical resolver instead of being blocked. Staging. The design is split into three independently shippable stages: A binds the manifest to existing storage (additive, fixes all of #376's P1s, no data moves), B consolidates storage behind an unchanged API, C retires the legacy surface. Nothing requires a lockstep four-repository release, which also removes the incentive to route around the contract via unregistered local.* keys. Policy seam. internal/policy already resolves max_playback_quality and metadata language restrictions over the same controls this contract resolves preferences for. Adds `constrained_by`, permitted-value reporting, and the rule that a restriction filters what a preference does rather than validating what it is, so a capped profile never renders a choice playback will refuse. Also: revision-tagged enum members, scopes, and bounds so widening stays safe where the previous blanket immutability rule was both too strict (scope widening) and too weak (defaults and enum widening were already mutable); appearance and date/time moved from account to profile scope, since account scope was an artifact of pre-profile storage and let any non-child profile restyle the household; account writes narrowed to the primary profile; a read path section with a batched context endpoint, index requirements, and a no-regression gate on stage B; degraded settings mode instead of account lockout on a quarantined per-user SQLite database; a separate user_settings event channel; an idempotency sweeper; jellycompat seeding pinned to profile scope; and clearer device-scope UX copy. Related to #376. Still design-only; no runtime behavior changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Reverts the staged A/B/C rollout from the previous commit. Phasing required a compatibility projection of the old string API over the new resolver, plus manifest bindings to the very tables the migration replaces — both written only to be deleted, and a meaningful fraction of the permanent code in this subsystem. The project is pre-1.0, v1 scope is unlocked, and data volumes are small, so one clean switchover costs less than the scaffolding needed to avoid it. Server, bundled web, Apple, and Android now update together, and mixed version operation is an explicit non-goal. No client fallback either. A new client against a pre-contract server shows server-upgrade-required rather than degrading to local defaults; there is no legacy write path. The 426 middleware gate stays withdrawn, on narrower grounds than before. It is not about giving mismatched clients grace — it is that deleting the routes already produces the break, so the gate is strictly more code in four repos for the same outcome, and it permanently couples every endpoint in the product to one subsystem's versioning for a one-time event. Route removal has no such tail. An old client gets 404 on removed routes; that is what "update both" means. Kept from the staging pass, since it costs nothing: the migration does not DROP superseded columns. It stops reading them and leaves them for a trivial follow-up migration one release later, which turns recovery from "restore the backup and the prior binary" into "revert the binary". Nothing reads them and no client can reach them, so this is an operator affordance, not a compatibility path. Also adds a phase that ships the #376 P1 fixes ahead of the contract — the Apple audio-language no-op, Android's key/clamp/default drift, the durable outboxes, and web cache owner-tagging are all independent of the manifest and should not wait on the migration. Notes the release-ordering hazard found while checking this: silo-android publishes plain versions straight to Play Store while silo-server has no versioned releases at all, only Docker latest, so operators have no version number to reason about. Unchanged from the prior revision: the policy seam and constrained_by, the widening-vs-narrowing compatibility rules and revision-tagged sub-elements, appearance and date/time at profile scope, the read path section, degraded settings mode on a quarantined user database, the separate user_settings event channel, the idempotency sweeper, jellycompat seeding at profile scope, and the device-scope UX copy. Those are orthogonal to rollout. Related to #376. Still design-only; no runtime behavior changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Coordinated server/client updates are expected during beta, so the pre-release gate no longer frames the Play Store / Docker latest ordering as a hazard. Keeps the actionable part: release notes name the server build to pull alongside the client versions, since image tags do not carry that pairing. Related to #376. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Summary
Design-only draft for standardizing user settings across the server, bundled web client, Apple clients, and Android clients.
This turns the findings in #376 into a typed, decision-complete contract covering ownership, value types, persistence scopes, resolution order, storage, API shape, client synchronization, UX language, migration, and release gates.
No runtime behavior changes in this PR.
Core decisions for review
local.<client>.*implementation, diagnostics, or experimental knobs may bypass the server contract; they must never reach the API or normal production Settings UI.internal/policystays authoritative for restrictions. Definitions declareconstrained_by, the effective response reports the permitted value alongside the user's stored preference, and a restriction filters what a preference does rather than validating what it is.user_settingsstore.Changed in the latest revision
The
426upgrade gate is withdrawn — but the coordinated cutover it was meant to enforce is not. Removing the legacy routes already produces the break: an old client gets404and its settings screens fail, which is what "update both" means. Adding a version header to every request plus a check in the authenticated middleware is strictly more code, in four repositories, for the same user-visible outcome — and it permanently couples every endpoint in the product to one subsystem's versioning for a one-time event. Route removal has no such tail.Preferences versus restrictions is new.
internal/policyalready resolvesmax_playback_qualityand metadata-language restrictions over the same controls this contract resolves preferences for. Without an explicit seam, a child profile capped at 720p gets an effective value of2160p, renders 4K as selectable, and playback silently disagrees. Addsconstrained_by,requested_value/permitted_valuesreporting, and the rule that mutations exceeding a restriction are stored, not rejected — a stored 4K preference should take effect the day the cap lifts, not be destroyed by it.Compatibility rules split widening from narrowing. Blanket definition immutability was simultaneously too strict (scope widening is backward-safe) and too weak (defaults and enum widening were already permitted, which broke the safety argument).
introduced_inis now a manifest revision, and enum members, scopes, and widened bounds carry their own so a newer client never offers a choice an older server will reject.Appearance and date/time move from account to profile scope. Account scope was an artifact of pre-profile
user_settingsstorage; under the old rules a household shared one theme and text size, and any non-child profile could restyle everyone else permanently. Account writes now require the primary profile.A read path section: batched context-resolution endpoint (
profile_seriesresolution is per-item, so a season view would otherwise issue one request per episode), index requirements, session-snapshot rule, and a no-regression benchmark against the specialized tables being replaced.Also: degraded settings mode instead of account lockout when a per-user SQLite database is quarantined; a separate
user_settingsevent channel rather than overloading the admin-only one; an idempotency sweeper; advisoryplatforms; and clearer device-scope UX copy ("This device, for this profile").Finally, a phase that ships the #376 P1 fixes ahead of the contract — the Apple audio-language no-op, Android's key/clamp/default drift, the durable outboxes, and web cache owner-tagging are all independent of the manifest and shouldn't wait on the migration.
Review focus
constrained_bythe right seam between this contract andinternal/policy, particularly the rule that mutations exceeding a restriction are stored rather than rejected?Verification
internal/api/handlers/settings.go,web/src/lib/settingsManifest.ts,internal/policy,internal/events,internal/jellycompat/handlers_displayprefs.go,internal/userdb,internal/userstore/pgstore, anddocs/architecture/v1-scope.md. Confirmed: the unknown-key extension bag (keyUsesUserScopeaccepts any unregistered key), the web manifest's 18 definitions with zero user-scope entries against ~24 server keys, thesettingsevent channel being admin-granted with no publishers, and v1 scope reading NOT LOCKED — which is why the removal needs no amendment if it lands before lock.make verify-local-pathspasses.Related to #376. This PR intentionally does not close the implementation issue.
AI-use disclosure
The original design and its revisions were drafted with AI assistance (Claude Opus 5) under maintainer direction. All claims about current behavior were verified against the cited source files; the rollout model, policy seam, and scope assignments were reviewed and decided by the maintainer.