Repository navigation
feat(settings): sync navigation and card customization by client family - #538
Conversation
📝 WalkthroughWalkthroughThe change implements revision-five settings with client-family-aware profiles, three navigation and card UI settings, atomic idempotent shortcut mutations, database migrations from v17 to v18, profile request-context protection in the web client, and synchronized customization UI controls. ChangesSettings contract, storage, and customization
Web client, hooks, and customization
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant InterfaceSettings
participant UICustomizationProvider
participant SettingsAPI
participant SettingsStore
InterfaceSettings->>UICustomizationProvider: load effective customization settings
UICustomizationProvider->>SettingsAPI: request capabilities and effective values
SettingsAPI->>SettingsStore: resolve profile, client-family, and device values
SettingsStore-->>SettingsAPI: return effective settings and source metadata
SettingsAPI-->>UICustomizationProvider: return customization values
UICustomizationProvider-->>InterfaceSettings: provide menu and card state
InterfaceSettings->>SettingsAPI: submit atomic shortcut or setting mutation
SettingsAPI->>SettingsStore: compare-and-set and record mutation transaction
SettingsStore-->>SettingsAPI: return revision or conflict
SettingsAPI-->>InterfaceSettings: return mutation result
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/src/pages/Recommendations.tsx (1)
178-179: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMatch the skeleton width to the configured poster size.
Line 192 now sizes recommendation cards with
posterWidthClasses.DiscoverSkeletonsat line 134 still uses the fixedw-[140px] sm:w-[160px] lg:w-[185px].If the user selects a non-standard poster size, the skeleton renders at one width and the loaded cards render at another. The page shifts layout when loading completes.
Pass the computed classes into
DiscoverSkeletons.🎨 Proposed fix
-function DiscoverSkeletons() { +function DiscoverSkeletons({ posterWidthClasses }: { posterWidthClasses: string }) { return ( <div className="space-y-10 pt-2"> {Array.from({ length: 4 }).map((_, i) => ( <div key={i} className="space-y-5"> <div className="px-4 sm:px-6 lg:px-10 xl:px-12"> <Skeleton className="h-6 w-48 rounded" /> </div> <div className="flex gap-4 overflow-hidden px-4 sm:px-6 lg:gap-5 lg:px-10 xl:px-12"> {Array.from({ length: 12 }).map((_, j) => ( - <div key={j} className="w-[140px] shrink-0 sm:w-[160px] lg:w-[185px]"> + <div key={j} className={`shrink-0 ${posterWidthClasses}`}>Then update the call site:
{isLoading ? ( - <DiscoverSkeletons /> + <DiscoverSkeletons posterWidthClasses={posterWidthClasses} /> ) : isError ? (🤖 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 `@web/src/pages/Recommendations.tsx` around lines 178 - 179, Update the DiscoverSkeletons call in Recommendations to pass the computed posterWidthClasses, and modify DiscoverSkeletons to accept and apply those classes instead of its fixed width classes. Ensure loading skeletons use the same configured poster width as the loaded recommendation cards.
🧹 Nitpick comments (15)
internal/api/handlers/settings_values_test.go (1)
1496-1518: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAssert the three capability flags in the response.
docs/settings-api.mdstates that a revision-5 client requiressupports_atomic_shortcuts,supports_batched_effective, andsupports_idempotent_writes, and that any missing flag fails closed. The test pins scopes and client families exactly but does not cover those flags. If one is dropped or renamed, every revision-5 client silently disables customization and this test still passes.♻️ Proposed addition
var body struct { APIVersion int `json:"api_version"` Revision int `json:"revision"` Scopes []string `json:"scopes"` ClientFamilies []string `json:"client_families"` + BatchedEffective bool `json:"supports_batched_effective"` + IdempotentWrites bool `json:"supports_idempotent_writes"` + AtomicShortcuts bool `json:"supports_atomic_shortcuts"` }if !slices.Equal(body.ClientFamilies, wantFamilies) { t.Errorf("reported client families %v, want %v", body.ClientFamilies, wantFamilies) } + if !body.BatchedEffective || !body.IdempotentWrites || !body.AtomicShortcuts { + t.Errorf("capability flags = batched %v idempotent %v atomic %v, want all true", + body.BatchedEffective, body.IdempotentWrites, body.AtomicShortcuts) + }🤖 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 `@internal/api/handlers/settings_values_test.go` around lines 1496 - 1518, Extend the response body assertions in the settings values test to include supports_atomic_shortcuts, supports_batched_effective, and supports_idempotent_writes. Decode these fields using their response names and assert each is enabled, alongside the existing APIVersion, Revision, Scopes, and ClientFamilies checks.web/src/lib/settingsConformance.json (1)
6-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a case that proves
profile_clientoutranksprofile.The case name states that
profile_clientsits between device and profile. The fixture always includes aprofile_devicerow, so the expectation only proves thatprofile_devicewins. A resolver that rankedprofile_clientbelowprofilewould still pass this case. Add a second case with the same stored rows minus theprofile_devicerow and expect theprofile_clientvalue.♻️ Proposed additional case
{ "name": "profile_client_beats_profile_without_a_device_row", "description": "Without an exact-device override, the client-family value wins over the cross-family profile fallback.", "keys": ["ui.card_presentation"], "context": { "profile_id": "p1", "client_family": "tv", "device_id": "living-room" }, "stored": [ { "key": "ui.card_presentation", "scope": "profile", "profile_id": "p1", "value": { "poster_size": "standard", "caption": "title" } }, { "key": "ui.card_presentation", "scope": "profile_client", "profile_id": "p1", "client_family": "tv", "value": { "poster_size": "large", "caption": "artwork" } } ], "expected": [ { "key": "ui.card_presentation", "value": { "poster_size": "large", "caption": "artwork" }, "source": "profile_client" } ] }🤖 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 `@web/src/lib/settingsConformance.json` around lines 6 - 40, Add a second conformance case alongside the existing profile_client scenario, using the same profile and client context but omitting the profile_device stored row. Expect the profile_client value and source, so the fixture explicitly verifies profile_client outranks the profile fallback.internal/userdb/setting_mutation_tx.go (1)
90-126: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHonor the per-call context in the writer methods.
Four of the five writer methods discard the
context.Contextparameter with_.CompareAndSetSettingValueat lines 105-112 forwards it. The delegated helpers reach the database through the non-context executor methods, which bind the capturede.ctxfrom the enclosing transaction. A caller that passes a narrower context toGetSettingValue,UpsertSettingValue,GetSettingMutation, orPutSettingMutationgets no effect from it.The outer context already bounds the transaction, so behavior is correct today. Forwarding the parameter through the
*Contextexecutor methods, which the interface now provides, would make the five methods consistent and prevent a future caller from relying on a deadline that is ignored.🤖 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 `@internal/userdb/setting_mutation_tx.go` around lines 90 - 126, Update all five methods on sqliteSettingMutationWriter to honor their per-call context: replace the discarded context parameters in GetSettingValue, UpsertSettingValue, GetSettingMutation, and PutSettingMutation, and delegate through the corresponding context-aware executor methods, matching CompareAndSetSettingValue. Preserve each method’s existing arguments and return behavior.internal/userdb/schema.go (1)
438-489: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftDerive the rebuild DDL from one shared definition.
The table definition and the index set now exist in two places:
settingContractSchemaat lines 299-340 and this rebuild block. The two must stay semantically identical, because a fresh database takes the first path and an upgraded database takes the second. Any future column, CHECK, or index added to only one place produces two different table shapes depending on the install age, and no test would catch it.Two related points:
user_setting_values_profile_client_uqis created only inensureSettingValuesClientFamily, not insettingContractSchemanext to the other five unique indexes. A reader ofsettingContractSchemasees no uniqueness guarantee for theprofile_clientscope. Move that index intosettingContractSchemaso all six live together, and let thecount > 0branch rely on theIF NOT EXISTSform already executed bydb.Exec(Schema).- Extract the column list and CHECK constraints into a single constant that both the
CREATE TABLE user_setting_valuesstatement and the rebuild statement interpolate, so drift becomes impossible.🤖 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 `@internal/userdb/schema.go` around lines 438 - 489, Make settingContractSchema and the rebuild DDL share one table-definition constant containing all columns and CHECK constraints, and interpolate it in both CREATE TABLE statements. Move user_setting_values_profile_client_uq into settingContractSchema alongside the other unique indexes, removing its separate creation from ensureSettingValuesClientFamily while preserving IF NOT EXISTS behavior for existing databases.internal/userstore/pgstore/setting_values.go (1)
112-122: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAlign the indentation inside the SQL literal.
Lines 112 to 122 gained one extra indentation level relative to lines 103 to 111 in the same raw string.
gofmtdoes not reformat raw string contents, so the misalignment persists in the source and in any logged query text.♻️ Proposed fix
profile_id = ANY($3::text[]) - AND ( - scope = 'profile' - OR (scope = 'profile_client' AND client_family = $4) - OR (scope = 'profile_device' AND device_id = $5) - OR (scope = 'profile_library' AND library_id = ANY($6::int[])) - OR (scope = 'profile_series' AND series_id = ANY($7::text[])) - ) - ) - ) + AND ( + scope = 'profile' + OR (scope = 'profile_client' AND client_family = $4) + OR (scope = 'profile_device' AND device_id = $5) + OR (scope = 'profile_library' AND library_id = ANY($6::int[])) + OR (scope = 'profile_series' AND series_id = ANY($7::text[])) + ) + ) + )🤖 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 `@internal/userstore/pgstore/setting_values.go` around lines 112 - 122, Align the SQL lines in the raw query literal within the setting-values query so the lines containing the scope conditions and ORDER BY match the indentation used by the preceding SQL lines. Preserve the SQL text and behavior; change only the inconsistent source indentation.web/src/lib/uiCustomization.ts (1)
115-117: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTrim
section_idandcollection_idlike labels.
isTargetIdaccepts a padded id such as" recent "because it only tests the trimmed length.parseMenuItemthen stores the raw value, whilelabelis stored trimmed. The padded id becomes a distinctmenuItemKey, so it will not match the same target written by another client or by the server-canonical document.Trim the id at parse time for consistency with
label.♻️ Proposed fix
return isPositiveInteger(value.library_id) && isTargetId(value.section_id) && isLabel(value.label) ? { type: "section", library_id: value.library_id, - section_id: value.section_id, + section_id: value.section_id.trim(), label: value.label.trim(), } : null;return { type: "collection", - collection_id: value.collection_id, + collection_id: value.collection_id.trim(), label: value.label.trim(), ...(value.library_id === undefined ? {} : { library_id: value.library_id }), };Also applies to: 138-165
🤖 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 `@web/src/lib/uiCustomization.ts` around lines 115 - 117, Update parseMenuItem to trim section_id and collection_id before storing or using them in menuItemKey, matching the existing label normalization. Keep isTargetId focused on validation, and ensure padded IDs such as " recent " are represented canonically as "recent".internal/userstore/settingvalues.go (1)
156-171: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueEmbed
SettingValueCompareAndSetterinSettingMutationWriter.
SettingMutationWriterrepeats theCompareAndSetSettingValuesignature declared at lines 147 to 154. Embedding keeps the two declarations from drifting if the signature changes.♻️ Proposed fix
type SettingMutationWriter interface { + SettingValueCompareAndSetter + GetSettingValue(ctx context.Context, id SettingIdentity) (*SettingValue, error) UpsertSettingValue(ctx context.Context, id SettingIdentity, value json.RawMessage) (*SettingValue, error) - CompareAndSetSettingValue( - ctx context.Context, - id SettingIdentity, - value json.RawMessage, - expectedRevision int64, - ) (*SettingValue, error) GetSettingMutation(ctx context.Context, mutationID string) (*SettingMutationRecord, error) PutSettingMutation(ctx context.Context, record SettingMutationRecord) (SettingMutationRecord, bool, error) }🤖 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 `@internal/userstore/settingvalues.go` around lines 156 - 171, Embed SettingValueCompareAndSetter in the SettingMutationWriter interface and remove its duplicate CompareAndSetSettingValue declaration, preserving the other transaction-scoped methods unchanged.migrations/sql/20260803191207_add_profile_client_settings_scope.sql (1)
10-28: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoffConsider the lock duration on
user_setting_values.Lines 10 to 24 add three
CHECKconstraints in validating mode, and line 26 creates a unique index withoutCONCURRENTLY. Both take anACCESS EXCLUSIVElock and scan the table. On a small table this completes quickly, and the seedingINSERTin the same transaction requires the index to already exist, soCONCURRENTLYis not usable here.If
user_setting_valuesis already large in any deployment, split the work: add theCHECKconstraints asNOT VALID, thenVALIDATE CONSTRAINTin a later migration.🤖 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 `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql` around lines 10 - 28, Reduce lock duration for large user_setting_values deployments by adding the new CHECK constraints in NOT VALID form and moving their validation to a later migration with VALIDATE CONSTRAINT. Keep the unique index creation and migration ordering compatible with the seeding INSERT, since the index must exist before seeding and cannot be created concurrently in this transaction.Source: Linters/SAST tools
web/src/contexts/UICustomizationProvider.tsx (1)
41-66: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the two source values for consistency with the three extracted values.
Lines 33-39 extract
primaryMenuValue,shortcutsValue, andcardPresentationValuefromquery.data. Lines 45 and 49 instead readquery.data?.[...]?.sourceinline, soquery.datamust stay in the dependency array.Because
query.datais a dependency, the three extracted variables cannot narrow the memo any further. Extracting the two source values applies the same pattern to all five reads and lets the memo depend on the five values instead of the whole query result.This is a consistency change. Current behavior is correct, because React Query keeps a stable
datareference when the data does not change.♻️ Proposed refactor
const cardPresentationValue = isSupported ? query.data?.[SETTING_KEYS.UI_CARD_PRESENTATION]?.value : undefined; + const cardPresentationSource = isSupported + ? (query.data?.[SETTING_KEYS.UI_CARD_PRESENTATION]?.source ?? "default") + : "default"; + const primaryMenuSource = isSupported + ? (query.data?.[SETTING_KEYS.NAV_PRIMARY_MENU]?.source ?? "default") + : "default"; const value = useMemo<UICustomizationValue>( () => ({ cardPresentation: parseCardPresentation(cardPresentationValue), - cardPresentationSource: isSupported - ? (query.data?.[SETTING_KEYS.UI_CARD_PRESENTATION]?.source ?? "default") - : "default", + cardPresentationSource, primaryMenu: parsePrimaryMenu(primaryMenuValue), - primaryMenuSource: isSupported - ? (query.data?.[SETTING_KEYS.NAV_PRIMARY_MENU]?.source ?? "default") - : "default", + primaryMenuSource, shortcuts: parseShortcuts(shortcutsValue), isSupported, supportsAtomicShortcuts, isLoading: capabilitiesQuery.isLoading || (isSupported && query.isLoading), }), [ capabilitiesQuery.isLoading, + cardPresentationSource, cardPresentationValue, isSupported, + primaryMenuSource, primaryMenuValue, - query.data, query.isLoading, shortcutsValue, supportsAtomicShortcuts, ], );🤖 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 `@web/src/contexts/UICustomizationProvider.tsx` around lines 41 - 66, Extract the primary-menu and card-presentation source values alongside primaryMenuValue, shortcutsValue, and cardPresentationValue from query.data in UICustomizationProvider. Use those source variables in the memoized value instead of inline query.data lookups, and replace query.data in the useMemo dependency list with the two extracted source values while preserving the existing default and isSupported behavior.web/src/api/client.test.ts (1)
321-334: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a case that changes only the profile ID.
Both current cases change the PIN token.
isCapturedProfileAuthorityActivereturns false through thegetProfileToken() === snapshot.profileTokencomparison in both cases. ThegetProfileId() === snapshot.profileIdcomparison is never the deciding condition. If that comparison were removed, both cases would still pass.Add a third case that keeps the PIN token and changes only the profile ID.
🧪 Proposed additional case
{ authorityChange: "active PIN", changeAuthority: () => setProfileToken("pin-new"), expectedToken: "pin-new", }, + { + authorityChange: "active profile identity alone", + changeAuthority: () => setProfileId("profile-new"), + expectedToken: "pin-old", + },🤖 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 `@web/src/api/client.test.ts` around lines 321 - 334, Add a third test case to the isCapturedProfileAuthorityActive parameterized cases that changes only the profile ID, leaves the existing profile token unchanged, and expects the authority to be inactive. Keep the existing active-profile and active-PIN cases unchanged so the profile-ID comparison is independently exercised.web/src/pages/catalogSearchParams.ts (1)
179-183: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThe
sameCatalogDestinationfallthrough is neither documented nor tested. The function returns false at line 202 for every source outsidesection,library_collection, anduser_collection, so it is not reflexive forquery,favorites,watchlist,history, orperson. The name suggests a general destination comparison, and nothing records or verifies the restriction. Current callers inweb/src/components/AppSidebar.tsxpass only sections and collections, so behavior is correct today.
web/src/pages/catalogSearchParams.ts#L179-L183: extend the doc comment to state that onlysection,library_collection, anduser_collectionhave a stable destination identity, and that every other source returns false even for identical arguments.web/src/pages/catalogSearchParams.test.ts#L139-L158: add a test that assertssameCatalogDestinationreturns false for two identicalquerystates and for two identicalfavoritesstates.🤖 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 `@web/src/pages/catalogSearchParams.ts` around lines 179 - 183, The sameCatalogDestination documentation must state that stable destination identity is limited to section, library_collection, and user_collection, while all other sources return false even for identical arguments. In web/src/pages/catalogSearchParams.ts lines 179-183, update the doc comment accordingly; in web/src/pages/catalogSearchParams.test.ts lines 139-158, add assertions that identical query states and identical favorites states return false.web/src/hooks/queries/sidebarPins.ts (1)
316-334: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueMemoize
overlayQueryKeyto stop dependency churn.
sidebarPinsOverlayQueryKey()returns a new array on every render.readCachedValuelistsoverlayQueryKeyas a dependency, soreadCachedValueandisPinnedget a new identity on every render. Wrap the key inuseMemo.♻️ Proposed refactor
- const overlayQueryKey = sidebarPinsOverlayQueryKey(); + const overlayQueryKey = useMemo(() => sidebarPinsOverlayQueryKey(), []);🤖 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 `@web/src/hooks/queries/sidebarPins.ts` around lines 316 - 334, Memoize the result of sidebarPinsOverlayQueryKey() with useMemo so overlayQueryKey remains stable across renders, then keep readCachedValue’s dependency on that memoized key to prevent unnecessary recreation of readCachedValue and isPinned.web/src/hooks/queries/sidebarPins.integration.test.tsx (1)
81-110: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the real capability predicates in this mock.
The mock reimplements
settingsCapabilitiesSupportKeyandsettingsCapabilitiesSupportAtomicShortcutswith hard-codedapi_version === 1andrevision >= 5. Both functions are pure and depend only on the generated contract. If the contract raisesSETTINGS_API_VERSIONor theintroducedInrevision ofnav.shortcuts, this test keeps passing while production fails closed. Import the actual module and override only the hooks.♻️ Proposed refactor
-vi.mock("./settingValues", () => ({ +vi.mock("./settingValues", async () => { + const actual = await vi.importActual<typeof import("./settingValues")>("./settingValues"); + return { + ...actual, effectiveSettingsQueryKey: ({ keys }: { keys?: readonly string[] }) => [ "settings", "values", "effective", "profile-1", keys?.join(",") ?? "*", ], useEffectiveSettings: () => ({ /* unchanged */ }), useSettingsCapabilities: () => ({ data: mocks.capabilities, isLoading: false }), useSetNavigationShortcutPresence: () => ({ mutateAsync: mocks.mutateAsync }), -})); + }; +});🤖 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 `@web/src/hooks/queries/sidebarPins.integration.test.tsx` around lines 81 - 110, Replace the hard-coded settings capability implementations in the mock with the real settings capability predicate module, overriding only the required hooks while preserving the existing mock behavior. Reuse the production `settingsCapabilitiesSupportKey` and `settingsCapabilitiesSupportAtomicShortcuts` symbols so contract version and revision changes are reflected in this test.web/src/hooks/queries/settingValues.ts (1)
300-304: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueMemoize the returned object to keep the caller's callback identity stable.
useSetNavigationShortcutPresencereturns a new object on every render.useToggleSidebarPinlistssetShortcutPresencein the dependency array oftogglePin(seeweb/src/hooks/queries/sidebarPins.tsline 415), sotogglePingets a new identity on every render of that hook. Components that receivetogglePinas a prop re-render each time. Wrap the return value inuseMemo.♻️ Proposed refactor
- // This deliberately is not a TanStack mutation. Mutation variables remain - // in the mutation cache after settlement; the PIN token should live only in - // the in-memory serialized queue/request closure that needs it. - return { mutateAsync }; + // This deliberately is not a TanStack mutation. Mutation variables remain + // in the mutation cache after settlement; the PIN token should live only in + // the in-memory serialized queue/request closure that needs it. + return useMemo(() => ({ mutateAsync }), [mutateAsync]);🤖 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 `@web/src/hooks/queries/settingValues.ts` around lines 300 - 304, Memoize the object returned by useSetNavigationShortcutPresence so its identity remains stable across renders; wrap the mutateAsync-containing return value in useMemo with the appropriate mutateAsync dependency, preserving the existing callback behavior.web/src/pages/settings/InterfaceSettings.tsx (1)
124-124: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueCentralize the menu limit.
The schema, parser, and UI currently use the same value,
64. Export one shared client constant fromuiCustomization.tsand reuse it in both locations.🤖 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 `@web/src/pages/settings/InterfaceSettings.tsx` at line 124, Define and export a shared menu-limit constant with value 64 from uiCustomization.ts, then update the InterfaceSettings menuAtLimit calculation and the related schema/parser checks to reference that constant instead of hardcoding 64.
🤖 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 `@internal/userdb/setting_mutation_tx.go`:
- Around line 67-78: Update the deferred rollback in the setting mutation
transaction to capture and log any ROLLBACK error before defer conn.Close
returns the connection to the pool. Preserve the existing
context.WithoutCancel(ctx) execution and only add failure reporting around
exec.ExecContext in the !committed path.
In `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql`:
- Around line 5-8: Update the migration’s Up and Down sections to remove
StatementBegin/StatementEnd wrappers around ordinary SQL statements, leaving
each non-function statement unannotated so Goose executes it separately.
Preserve StatementBegin/StatementEnd only around CREATE FUNCTION ... $$ blocks,
if present.
In `@web/src/api/client.ts`:
- Line 553: Replace the Object.assign call in the device-header setup with
setHeader-based application so each device header replaces any existing case
variant case-insensitively. Reuse the existing setHeader behavior and ensure
caller-provided casing variants cannot coexist with the canonical device
headers.
- Around line 125-146: Update the queued sidebar-pin write path to use
isCapturedProfileAuthorityActive with its captured ProfileRequestContextSnapshot
before executing the write. Ensure writes captured for a previous profile are
rejected after a profile switch, while preserving the existing auth-context and
server-origin checks.
In `@web/src/components/AppSidebar.tsx`:
- Around line 252-372: Update the primaryMenuLinks useMemo to return null when
primaryMenu exists but primaryMenu.items resolves to no links, including when
all configured items are filtered out due to unavailable libraries. Preserve the
existing resolved-link behavior for non-empty results so the Home,
Recommendations, and Calendar fallback navigation renders whenever no custom
menu item is usable.
In `@web/src/components/ItemGrid.tsx`:
- Around line 52-64: Update the grid virtualization flow around useGridLayout so
changes to rowHeight trigger virtualizer.measure(). Add rowHeight as the effect
dependency and invoke the returned virtualizer’s measurement reset when it
changes, preserving existing layout behavior otherwise.
In `@web/src/pages/Collections.tsx`:
- Around line 46-47: Update the loading-card skeleton classes in
ServerCollectionsSection to derive their width from the existing
cardPresentation value, reusing carouselCardWidthClasses just like the loaded
cards. Replace the fixed width classes in both referenced skeleton sections so
non-default poster_size values preserve consistent widths and avoid layout
shift.
In `@web/src/pages/settings/InterfaceSettings.test.tsx`:
- Around line 168-169: Update the capability-gate assertion in the
InterfaceSettings test to query the button by the rendered accessible name “Save
menu” instead of “Save navigation”, while preserving the existing
not-in-document assertion.
---
Outside diff comments:
In `@web/src/pages/Recommendations.tsx`:
- Around line 178-179: Update the DiscoverSkeletons call in Recommendations to
pass the computed posterWidthClasses, and modify DiscoverSkeletons to accept and
apply those classes instead of its fixed width classes. Ensure loading skeletons
use the same configured poster width as the loaded recommendation cards.
---
Nitpick comments:
In `@internal/api/handlers/settings_values_test.go`:
- Around line 1496-1518: Extend the response body assertions in the settings
values test to include supports_atomic_shortcuts, supports_batched_effective,
and supports_idempotent_writes. Decode these fields using their response names
and assert each is enabled, alongside the existing APIVersion, Revision, Scopes,
and ClientFamilies checks.
In `@internal/userdb/schema.go`:
- Around line 438-489: Make settingContractSchema and the rebuild DDL share one
table-definition constant containing all columns and CHECK constraints, and
interpolate it in both CREATE TABLE statements. Move
user_setting_values_profile_client_uq into settingContractSchema alongside the
other unique indexes, removing its separate creation from
ensureSettingValuesClientFamily while preserving IF NOT EXISTS behavior for
existing databases.
In `@internal/userdb/setting_mutation_tx.go`:
- Around line 90-126: Update all five methods on sqliteSettingMutationWriter to
honor their per-call context: replace the discarded context parameters in
GetSettingValue, UpsertSettingValue, GetSettingMutation, and PutSettingMutation,
and delegate through the corresponding context-aware executor methods, matching
CompareAndSetSettingValue. Preserve each method’s existing arguments and return
behavior.
In `@internal/userstore/pgstore/setting_values.go`:
- Around line 112-122: Align the SQL lines in the raw query literal within the
setting-values query so the lines containing the scope conditions and ORDER BY
match the indentation used by the preceding SQL lines. Preserve the SQL text and
behavior; change only the inconsistent source indentation.
In `@internal/userstore/settingvalues.go`:
- Around line 156-171: Embed SettingValueCompareAndSetter in the
SettingMutationWriter interface and remove its duplicate
CompareAndSetSettingValue declaration, preserving the other transaction-scoped
methods unchanged.
In `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql`:
- Around line 10-28: Reduce lock duration for large user_setting_values
deployments by adding the new CHECK constraints in NOT VALID form and moving
their validation to a later migration with VALIDATE CONSTRAINT. Keep the unique
index creation and migration ordering compatible with the seeding INSERT, since
the index must exist before seeding and cannot be created concurrently in this
transaction.
In `@web/src/api/client.test.ts`:
- Around line 321-334: Add a third test case to the
isCapturedProfileAuthorityActive parameterized cases that changes only the
profile ID, leaves the existing profile token unchanged, and expects the
authority to be inactive. Keep the existing active-profile and active-PIN cases
unchanged so the profile-ID comparison is independently exercised.
In `@web/src/contexts/UICustomizationProvider.tsx`:
- Around line 41-66: Extract the primary-menu and card-presentation source
values alongside primaryMenuValue, shortcutsValue, and cardPresentationValue
from query.data in UICustomizationProvider. Use those source variables in the
memoized value instead of inline query.data lookups, and replace query.data in
the useMemo dependency list with the two extracted source values while
preserving the existing default and isSupported behavior.
In `@web/src/hooks/queries/settingValues.ts`:
- Around line 300-304: Memoize the object returned by
useSetNavigationShortcutPresence so its identity remains stable across renders;
wrap the mutateAsync-containing return value in useMemo with the appropriate
mutateAsync dependency, preserving the existing callback behavior.
In `@web/src/hooks/queries/sidebarPins.integration.test.tsx`:
- Around line 81-110: Replace the hard-coded settings capability implementations
in the mock with the real settings capability predicate module, overriding only
the required hooks while preserving the existing mock behavior. Reuse the
production `settingsCapabilitiesSupportKey` and
`settingsCapabilitiesSupportAtomicShortcuts` symbols so contract version and
revision changes are reflected in this test.
In `@web/src/hooks/queries/sidebarPins.ts`:
- Around line 316-334: Memoize the result of sidebarPinsOverlayQueryKey() with
useMemo so overlayQueryKey remains stable across renders, then keep
readCachedValue’s dependency on that memoized key to prevent unnecessary
recreation of readCachedValue and isPinned.
In `@web/src/lib/settingsConformance.json`:
- Around line 6-40: Add a second conformance case alongside the existing
profile_client scenario, using the same profile and client context but omitting
the profile_device stored row. Expect the profile_client value and source, so
the fixture explicitly verifies profile_client outranks the profile fallback.
In `@web/src/lib/uiCustomization.ts`:
- Around line 115-117: Update parseMenuItem to trim section_id and collection_id
before storing or using them in menuItemKey, matching the existing label
normalization. Keep isTargetId focused on validation, and ensure padded IDs such
as " recent " are represented canonically as "recent".
In `@web/src/pages/catalogSearchParams.ts`:
- Around line 179-183: The sameCatalogDestination documentation must state that
stable destination identity is limited to section, library_collection, and
user_collection, while all other sources return false even for identical
arguments. In web/src/pages/catalogSearchParams.ts lines 179-183, update the doc
comment accordingly; in web/src/pages/catalogSearchParams.test.ts lines 139-158,
add assertions that identical query states and identical favorites states return
false.
In `@web/src/pages/settings/InterfaceSettings.tsx`:
- Line 124: Define and export a shared menu-limit constant with value 64 from
uiCustomization.ts, then update the InterfaceSettings menuAtLimit calculation
and the related schema/parser checks to reference that constant instead of
hardcoding 64.
🪄 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: 42b9a202-3f88-4b44-9c98-de5729750a39
📒 Files selected for processing (90)
README.mdcmd/settingsgen/main.gocontracts/settings/v1/conformance.jsoncontracts/settings/v1/manifest.jsoncontracts/settings/v1/manifest.schema.jsoncontracts/settings/v1/schemas/card-presentation.jsoncontracts/settings/v1/schemas/navigation-shortcuts.jsoncontracts/settings/v1/schemas/primary-menu.jsondocs/settings-api.mddocs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.mdinternal/api/handlers/settings.gointernal/api/handlers/settings_audit.gointernal/api/handlers/settings_values.gointernal/api/handlers/settings_values_admin.gointernal/api/handlers/settings_values_admin_test.gointernal/api/handlers/settings_values_test.gointernal/api/router.gointernal/database/settings_backfill_test.gointernal/notifications/interest_hooks.gointernal/notifications/interest_hooks_test.gointernal/settingscontract/contract.gointernal/settingscontract/contract_test.gointernal/settingscontract/validate.gointernal/settingskeys/keys.gointernal/settingsresolve/conformance_test.gointernal/settingsresolve/resolve.gointernal/userdb/conformance_test.gointernal/userdb/migrate.gointernal/userdb/migrate_v18_test.gointernal/userdb/navigation_shortcuts_migrate.gointernal/userdb/preference_settings_tx.gointernal/userdb/schema.gointernal/userdb/setting_mutation_tx.gointernal/userdb/setting_values.gointernal/userdb/sqlitestore.gointernal/userstore/pgstore/setting_mutation_tx.gointernal/userstore/pgstore/setting_values.gointernal/userstore/settingvalues.gointernal/userstore/storetest/settingvalues.gomigrations/sql/20260803191207_add_profile_client_settings_scope.sqlmigrations/user_setting_values_test.goweb/src/App.tsxweb/src/api/client.test.tsweb/src/api/client.tsweb/src/components/AppSidebar.test.tsxweb/src/components/AppSidebar.tsxweb/src/components/ContinueWatchingCard.tsxweb/src/components/ItemCard.tsxweb/src/components/ItemGrid.tsxweb/src/components/RecommendationGrid.test.tsxweb/src/components/RecommendationGrid.tsxweb/src/components/SectionItemCard.tsxweb/src/components/SectionRow.test.tsxweb/src/components/SectionRow.tsxweb/src/components/calendar/CalendarEventCard.tsxweb/src/components/calendar/DayGroup.tsxweb/src/components/collections/CollectionPosterCard.tsxweb/src/contexts/UICustomizationProvider.test.tsxweb/src/contexts/UICustomizationProvider.tsxweb/src/contexts/uiCustomizationContext.tsweb/src/hooks/queries/settingValues.test.tsxweb/src/hooks/queries/settingValues.tsweb/src/hooks/queries/sidebarPins.integration.test.tsxweb/src/hooks/queries/sidebarPins.test.tsweb/src/hooks/queries/sidebarPins.tsweb/src/hooks/useGridLayout.tsweb/src/hooks/useUICustomization.tsweb/src/lib/deviceSettingGroups.tsweb/src/lib/documentTitle.tsweb/src/lib/settingsConformance.jsonweb/src/lib/settingsConformance.test.tsweb/src/lib/settingsContract.tsweb/src/lib/settingsResolve.tsweb/src/lib/uiCustomization.test.tsweb/src/lib/uiCustomization.tsweb/src/pages/Collections.tsxweb/src/pages/ItemDetail/components/SectionSkeletons.test.tsxweb/src/pages/ItemDetail/components/SectionSkeletons.tsxweb/src/pages/LibraryCollections.tsxweb/src/pages/LibraryRecommended.tsxweb/src/pages/Recommendations.tsxweb/src/pages/RecommendationsSection.tsxweb/src/pages/SettingsLayout.test.tsxweb/src/pages/SettingsLayout.tsxweb/src/pages/audiobooks/components/RelatedRail.test.tsxweb/src/pages/audiobooks/components/RelatedRail.tsxweb/src/pages/catalogSearchParams.test.tsweb/src/pages/catalogSearchParams.tsweb/src/pages/settings/InterfaceSettings.test.tsxweb/src/pages/settings/InterfaceSettings.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cace9cedee
ℹ️ 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".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/pages/settings/InterfaceSettings.tsx (1)
342-398: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy liftImplement one shared radio-group primitive for the settings controls.
Apply roving
tabIndexand arrow-key navigation to these groups and the equivalent groups inAppearanceSettings.tsx,AccessibilitySettings.tsx, andSubtitleAppearancePanelView.tsx. Each group must provide one tab stop and move both selection and focus with arrow keys.🤖 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 `@web/src/pages/settings/InterfaceSettings.tsx` around lines 342 - 398, Create and reuse a shared radio-group primitive for the controls in InterfaceSettings.tsx and the equivalent groups in AppearanceSettings.tsx, AccessibilitySettings.tsx, and SubtitleAppearancePanelView.tsx. Replace the current button-group implementations so each group uses roving tabIndex with exactly one tab stop, and handle arrow keys to update the selected value and move focus to the corresponding option while preserving existing save behavior.Source: Learnings
🤖 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 `@web/src/pages/settings/InterfaceSettings.tsx`:
- Around line 342-398: Create and reuse a shared radio-group primitive for the
controls in InterfaceSettings.tsx and the equivalent groups in
AppearanceSettings.tsx, AccessibilitySettings.tsx, and
SubtitleAppearancePanelView.tsx. Replace the current button-group
implementations so each group uses roving tabIndex with exactly one tab stop,
and handle arrow keys to update the selected value and move focus to the
corresponding option while preserving existing save behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d289753f-e237-4bff-98fa-b4513a867518
📒 Files selected for processing (11)
internal/userdb/setting_mutation_tx.gomigrations/sql/20260803191207_add_profile_client_settings_scope.sqlweb/src/api/client.test.tsweb/src/api/client.tsweb/src/components/ItemGrid.tsxweb/src/hooks/queries/sidebarPins.integration.test.tsxweb/src/hooks/queries/sidebarPins.tsweb/src/pages/Collections.tsxweb/src/pages/Recommendations.tsxweb/src/pages/settings/InterfaceSettings.test.tsxweb/src/pages/settings/InterfaceSettings.tsx
🚧 Files skipped from review as they are similar to previous changes (8)
- web/src/pages/Recommendations.tsx
- web/src/pages/Collections.tsx
- migrations/sql/20260803191207_add_profile_client_settings_scope.sql
- internal/userdb/setting_mutation_tx.go
- web/src/api/client.test.ts
- web/src/components/ItemGrid.tsx
- web/src/api/client.ts
- web/src/hooks/queries/sidebarPins.ts
15a6b26 to
dfa7845
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfa78454cf
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
migrations/sql/20260803191207_add_profile_client_settings_scope.sql (1)
184-198: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winMake the
Downconstraint drops tolerant of a partially appliedUp.
Downdropsuser_setting_values_client_family_checkwithoutIF EXISTS. IfUpfailed after the column add but before the constraint add, or if an operator repaired the table by hand,Downaborts and leaves the schema stuck. The index drop on Line 182 already usesIF EXISTS; apply the same guard to the constraint drops.♻️ Proposed guard for the constraint drops
ALTER TABLE public.user_setting_values - DROP CONSTRAINT user_setting_values_client_family_check, - DROP CONSTRAINT user_setting_values_scope_check, - DROP CONSTRAINT user_setting_values_identity_check, + DROP CONSTRAINT IF EXISTS user_setting_values_client_family_check, + DROP CONSTRAINT IF EXISTS user_setting_values_scope_check, + DROP CONSTRAINT IF EXISTS user_setting_values_identity_check, ADD CONSTRAINT user_setting_values_scope_check🤖 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 `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql` around lines 184 - 198, Make the constraint removals in the Down migration tolerant of partially applied Up migrations by adding IF EXISTS to each DROP CONSTRAINT for user_setting_values_client_family_check, user_setting_values_scope_check, and user_setting_values_identity_check. Leave the added constraints and client_family column removal unchanged.
🤖 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 `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql`:
- Around line 109-123: Update the valid_pins filter to require that each pin’s
JSON id and label fields have type string before applying the existing length
and non-whitespace checks. Use jsonb_typeof on pin.pin_value->'id' and
pin.pin_value->'label' in the query, preserving all other filtering and backfill
behavior.
In `@web/src/pages/settings/DeviceSettings.tsx`:
- Around line 241-256: Update the device settings flow around supportedKeys and
useEffectiveSettings to filter revision-derived keys through
settingsCapabilitiesSupportKey, including API-version, batched-read, and
idempotent-write requirements. Enable the effective-settings query only when the
filtered key list is nonempty, and treat missing revision, incompatible
versions, or missing capability flags as unavailable. Add coverage for
API-version mismatch, missing flags, and missing revision.
---
Nitpick comments:
In `@migrations/sql/20260803191207_add_profile_client_settings_scope.sql`:
- Around line 184-198: Make the constraint removals in the Down migration
tolerant of partially applied Up migrations by adding IF EXISTS to each DROP
CONSTRAINT for user_setting_values_client_family_check,
user_setting_values_scope_check, and user_setting_values_identity_check. Leave
the added constraints and client_family column removal unchanged.
🪄 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: 50bb6af5-486e-40f6-a4b2-027cff67eb61
📒 Files selected for processing (98)
README.mdcmd/settingsgen/main.gocontracts/settings/v1/conformance.jsoncontracts/settings/v1/manifest.jsoncontracts/settings/v1/manifest.schema.jsoncontracts/settings/v1/schemas/card-presentation.jsoncontracts/settings/v1/schemas/navigation-shortcuts.jsoncontracts/settings/v1/schemas/primary-menu.jsondocs/settings-api.mddocs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.mdinternal/api/handlers/settings.gointernal/api/handlers/settings_audit.gointernal/api/handlers/settings_values.gointernal/api/handlers/settings_values_admin.gointernal/api/handlers/settings_values_admin_test.gointernal/api/handlers/settings_values_test.gointernal/api/router.gointernal/database/settings_backfill_test.gointernal/notifications/interest_hooks.gointernal/notifications/interest_hooks_test.gointernal/settingscontract/contract.gointernal/settingscontract/contract_test.gointernal/settingscontract/validate.gointernal/settingskeys/keys.gointernal/settingsresolve/conformance_test.gointernal/settingsresolve/resolve.gointernal/userdb/conformance_test.gointernal/userdb/migrate.gointernal/userdb/migrate_v18_test.gointernal/userdb/navigation_shortcuts_migrate.gointernal/userdb/preference_settings_tx.gointernal/userdb/schema.gointernal/userdb/setting_mutation_tx.gointernal/userdb/setting_values.gointernal/userdb/sqlitestore.gointernal/userstore/pgstore/setting_mutation_tx.gointernal/userstore/pgstore/setting_values.gointernal/userstore/settingvalues.gointernal/userstore/storetest/settingvalues.gomigrations/sql/20260803191207_add_profile_client_settings_scope.sqlmigrations/user_setting_values_test.goweb/src/App.tsxweb/src/api/client.test.tsweb/src/api/client.tsweb/src/components/AppSidebar.test.tsxweb/src/components/AppSidebar.tsxweb/src/components/ContinueWatchingCard.tsxweb/src/components/ItemCard.tsxweb/src/components/ItemGrid.tsxweb/src/components/RecommendationGrid.test.tsxweb/src/components/RecommendationGrid.tsxweb/src/components/SectionItemCard.tsxweb/src/components/SectionRow.test.tsxweb/src/components/SectionRow.tsxweb/src/components/calendar/CalendarEventCard.tsxweb/src/components/calendar/DayGroup.tsxweb/src/components/collections/CollectionPosterCard.tsxweb/src/contexts/UICustomizationProvider.test.tsxweb/src/contexts/UICustomizationProvider.tsxweb/src/contexts/uiCustomizationContext.tsweb/src/hooks/queries/admin/users.settings.test.tsweb/src/hooks/queries/admin/users.tsweb/src/hooks/queries/settingValues.test.tsxweb/src/hooks/queries/settingValues.tsweb/src/hooks/queries/sidebarPins.integration.test.tsxweb/src/hooks/queries/sidebarPins.test.tsweb/src/hooks/queries/sidebarPins.tsweb/src/hooks/useGridLayout.tsweb/src/hooks/useUICustomization.tsweb/src/lib/deviceSettingGroups.tsweb/src/lib/documentTitle.tsweb/src/lib/settingsConformance.jsonweb/src/lib/settingsConformance.test.tsweb/src/lib/settingsContract.tsweb/src/lib/settingsDisplay.test.tsweb/src/lib/settingsDisplay.tsweb/src/lib/settingsResolve.tsweb/src/lib/uiCustomization.test.tsweb/src/lib/uiCustomization.tsweb/src/pages/AdminUserDetail.test.tsxweb/src/pages/AdminUserDetail.tsxweb/src/pages/Collections.tsxweb/src/pages/ItemDetail/components/SectionSkeletons.test.tsxweb/src/pages/ItemDetail/components/SectionSkeletons.tsxweb/src/pages/LibraryCollections.tsxweb/src/pages/LibraryRecommended.tsxweb/src/pages/Recommendations.tsxweb/src/pages/RecommendationsSection.tsxweb/src/pages/SettingsLayout.test.tsxweb/src/pages/SettingsLayout.tsxweb/src/pages/audiobooks/components/RelatedRail.test.tsxweb/src/pages/audiobooks/components/RelatedRail.tsxweb/src/pages/catalogSearchParams.test.tsweb/src/pages/catalogSearchParams.tsweb/src/pages/settings/DeviceSettings.test.tsxweb/src/pages/settings/DeviceSettings.tsxweb/src/pages/settings/InterfaceSettings.test.tsxweb/src/pages/settings/InterfaceSettings.tsx
🚧 Files skipped from review as they are similar to previous changes (82)
- internal/userdb/preference_settings_tx.go
- web/src/lib/deviceSettingGroups.ts
- internal/api/router.go
- internal/database/settings_backfill_test.go
- contracts/settings/v1/schemas/card-presentation.json
- web/src/lib/documentTitle.ts
- internal/api/handlers/settings.go
- contracts/settings/v1/schemas/navigation-shortcuts.json
- web/src/pages/LibraryRecommended.tsx
- web/src/lib/uiCustomization.test.ts
- web/src/hooks/useUICustomization.ts
- internal/userdb/sqlitestore.go
- web/src/components/SectionRow.test.tsx
- web/src/contexts/uiCustomizationContext.ts
- web/src/pages/SettingsLayout.test.tsx
- web/src/components/RecommendationGrid.tsx
- web/src/pages/RecommendationsSection.tsx
- web/src/pages/audiobooks/components/RelatedRail.test.tsx
- web/src/pages/LibraryCollections.tsx
- web/src/components/calendar/CalendarEventCard.tsx
- web/src/components/ItemCard.tsx
- web/src/components/ItemGrid.tsx
- web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx
- cmd/settingsgen/main.go
- web/src/pages/catalogSearchParams.ts
- README.md
- web/src/pages/Collections.tsx
- web/src/components/calendar/DayGroup.tsx
- migrations/user_setting_values_test.go
- web/src/pages/catalogSearchParams.test.ts
- contracts/settings/v1/conformance.json
- web/src/lib/settingsConformance.json
- web/src/lib/settingsConformance.test.ts
- web/src/components/collections/CollectionPosterCard.tsx
- web/src/components/SectionRow.tsx
- web/src/components/SectionItemCard.tsx
- contracts/settings/v1/manifest.schema.json
- web/src/hooks/queries/sidebarPins.test.ts
- internal/userdb/navigation_shortcuts_migrate.go
- internal/settingskeys/keys.go
- web/src/components/RecommendationGrid.test.tsx
- internal/settingscontract/contract_test.go
- internal/settingsresolve/conformance_test.go
- web/src/components/ContinueWatchingCard.tsx
- web/src/pages/audiobooks/components/RelatedRail.tsx
- web/src/pages/ItemDetail/components/SectionSkeletons.tsx
- internal/settingscontract/validate.go
- internal/settingscontract/contract.go
- internal/api/handlers/settings_values_admin.go
- internal/userdb/conformance_test.go
- internal/userdb/migrate.go
- contracts/settings/v1/manifest.json
- web/src/lib/settingsResolve.ts
- web/src/lib/uiCustomization.ts
- web/src/components/AppSidebar.test.tsx
- internal/notifications/interest_hooks.go
- web/src/contexts/UICustomizationProvider.tsx
- web/src/pages/Recommendations.tsx
- web/src/pages/SettingsLayout.tsx
- internal/notifications/interest_hooks_test.go
- web/src/contexts/UICustomizationProvider.test.tsx
- contracts/settings/v1/schemas/primary-menu.json
- internal/settingsresolve/resolve.go
- web/src/lib/settingsContract.ts
- web/src/components/AppSidebar.tsx
- internal/api/handlers/settings_values_test.go
- web/src/pages/settings/InterfaceSettings.tsx
- web/src/App.tsx
- internal/api/handlers/settings_values_admin_test.go
- internal/userstore/settingvalues.go
- web/src/pages/settings/InterfaceSettings.test.tsx
- web/src/hooks/useGridLayout.ts
- web/src/hooks/queries/sidebarPins.integration.test.tsx
- internal/userstore/storetest/settingvalues.go
- web/src/hooks/queries/sidebarPins.ts
- internal/userdb/setting_mutation_tx.go
- web/src/api/client.ts
- docs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.md
- internal/userdb/schema.go
- internal/api/handlers/settings_values.go
- internal/api/handlers/settings_audit.go
- web/src/api/client.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16a30d27fc
ℹ️ 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".
There was a problem hiding this comment.
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 `@web/src/pages/settings/DeviceSettings.test.tsx`:
- Around line 144-147: Update the useEffectiveSettings assertion in the
DeviceSettings test to remove ui.card_presentation from the expected
device-setting keys, and add an assertion that the request excludes this key
while preserving the player.hdr_enabled expectation.
🪄 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: 314878fa-2402-4f8c-8acb-80c0677a085f
📒 Files selected for processing (14)
migrations/sql/20260803191207_add_profile_client_settings_scope.sqlmigrations/user_setting_values_test.goweb/src/components/AppSidebar.test.tsxweb/src/components/AppSidebar.tsxweb/src/components/RecommendationGrid.test.tsxweb/src/contexts/UICustomizationProvider.test.tsxweb/src/contexts/UICustomizationProvider.tsxweb/src/contexts/uiCustomizationContext.tsweb/src/pages/ItemDetail/components/SectionSkeletons.test.tsxweb/src/pages/audiobooks/components/RelatedRail.test.tsxweb/src/pages/settings/DeviceSettings.test.tsxweb/src/pages/settings/DeviceSettings.tsxweb/src/pages/settings/InterfaceSettings.test.tsxweb/src/pages/settings/InterfaceSettings.tsx
🚧 Files skipped from review as they are similar to previous changes (11)
- web/src/components/RecommendationGrid.test.tsx
- web/src/pages/audiobooks/components/RelatedRail.test.tsx
- web/src/contexts/UICustomizationProvider.tsx
- web/src/pages/settings/InterfaceSettings.test.tsx
- web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx
- web/src/pages/settings/DeviceSettings.tsx
- migrations/user_setting_values_test.go
- web/src/pages/settings/InterfaceSettings.tsx
- migrations/sql/20260803191207_add_profile_client_settings_scope.sql
- web/src/components/AppSidebar.test.tsx
- web/src/components/AppSidebar.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e185e6e59
ℹ️ 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".
| AND NOT EXISTS ( | ||
| SELECT 1 | ||
| FROM user_setting_values AS current | ||
| WHERE current.key = 'nav.shortcuts' | ||
| AND current.scope = 'profile' | ||
| AND current.profile_id = legacy.profile_id | ||
| ) |
There was a problem hiding this comment.
Keep legacy pin writes synchronized after migration
When a revision-4 web client or an already-open pre-upgrade tab writes ui.sidebar_pins after the server reaches revision 5, this one-time migration has already run and the existing nav.shortcuts row prevents any later conversion. The old client continues to see its edit because the legacy endpoint remains writable, while revision-5 clients read the stale nav.shortcuts document, so removed pins reappear and newly added pins disappear when switching clients. Preserve synchronization for accepted legacy writes or explicitly migrate them again before serving the new key.
AGENTS.md reference: AGENTS.md:L112-L119
Useful? React with 👍 / 👎.
| export function cardTextAreaHeight(caption: CardCaption): number { | ||
| if (caption === "artwork") return 0; | ||
| return caption === "title" ? 28 : 44; |
There was a problem hiding this comment.
Match artwork skeletons to the zero-height estimate
With the Artwork Only caption selected in a paginated ItemGrid, this makes the virtualizer reserve no caption space, but unloaded cells in ItemGrid.tsx still render an mt-2 h-4 caption skeleton. Those placeholder rows are therefore 24px taller than the virtualizer's estimate, so visible-range calculations drift and the catalog can jump or fetch the wrong page while scrolling through unloaded content. Hide that skeleton in artwork mode or include its height in the estimate.
AGENTS.md reference: AGENTS.md:L12-L14
Useful? React with 👍 / 👎.
Problem
Part of #376
Users could not keep navigation and card presentation preferences consistent across similar devices. Pinned shortcuts also used whole-document writes, so concurrent clients could overwrite one another.
Approach
profile_clientscope and canonicaltv,mobile,tablet,desktop, andwebfamilies.Testing
Passed:
go test ./internal/api/handlers -count=1go test ./internal/notifications -count=1go test ./internal/userdb ./internal/userstore ./internal/userstore/pgstore -count=1(PostgreSQL live conformance skips withoutSILO_TEST_DATABASE_URL)go test ./cmd/silo -run '^$' -count=1make verify-settings-bindings-allmake migrate-validategolangci-lint:0 issuesNODE_OPTIONS=--no-experimental-webstorage make test-web: 266 files / 1,792 testscd web && pnpm run buildcd web && pnpm run lint: 0 errors (existing warnings remain)cd web && pnpm run format:checkgit diff --checkBroader baseline notes:
make lintstill reports the repository's existing whole-tree lint backlog; the changed-lines CI invocation is clean.go test ./...run reached two existing timing-sensitive NVENC aggregate failures; the affected focused tests and all settings/handler/storage suites above pass.--no-experimental-webstorageso Vitest uses jsdom storage; with that workstation-specific flag, the repository's CI-equivalent web gate passes. The two remaining failures in a direct unfiltered run are both listed inWEBTEST_KNOWN_FAILURESon the base branch.AI Disclosure
Checklist
make lint,cd web && pnpm run lint,cd web && pnpm run format:check, and relevantgo test ./....Summary by CodeRabbit
New Features
Documentation
Migration