Skip to content

feat(settings): sync navigation and card customization by client family - #538

Merged
Quick104 merged 5 commits into
mainfrom
codex/ui-customization-contract
Aug 4, 2026
Merged

Quick104 merged 5 commits into
mainfrom
codex/ui-customization-contract

Conversation

@Quick104

@Quick104 Quick104 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Advance the settings contract to revision 5 with a profile_client scope and canonical tv, mobile, tablet, desktop, and web families.
  • Add validated primary-menu, navigation-shortcut, and card-presentation schemas with Balanced, Compact, Cinema, and Artwork Only presets.
  • Resolve menu/card preferences by device and client family while keeping shortcuts profile-wide, and migrate convertible legacy sidebar pins.
  • Add an atomic per-shortcut endpoint with CAS plus transactional mutation receipts for exact idempotent replay on SQLite and PostgreSQL.
  • Add the web customization editor/provider, capability-gated sync, auth/profile-safe durable queueing, semantic sidebar matching, and configurable card rendering.
  • Keep session whole-document shortcut writes/deletes blocked; retain the admin PUT repair path without physical delete/ABA behavior.

Testing

Passed:

  • go test ./internal/api/handlers -count=1
  • go test ./internal/notifications -count=1
  • focused/race SQLite and handler mutation-transaction concurrency tests, including same-ID replay, different-hash conflict, rollback, and wrapped production-provider coverage
  • go test ./internal/userdb ./internal/userstore ./internal/userstore/pgstore -count=1 (PostgreSQL live conformance skips without SILO_TEST_DATABASE_URL)
  • go test ./cmd/silo -run '^$' -count=1
  • focused admin identity/shortcut repair handler tests after review feedback
  • make verify-settings-bindings-all
  • make migrate-validate
  • CI-pinned changed-lines golangci-lint: 0 issues
  • NODE_OPTIONS=--no-experimental-webstorage make test-web: 266 files / 1,792 tests
  • focused final review regressions: 7 files / 57 tests
  • cd web && pnpm run build
  • cd web && pnpm run lint: 0 errors (existing warnings remain)
  • cd web && pnpm run format:check
  • git diff --check
  • required external autoreview plus independent transaction, production-wrapper, and final review-feedback audits

Broader baseline notes:

  • make lint still reports the repository's existing whole-tree lint backlog; the changed-lines CI invocation is clean.
  • The earlier full go test ./... run reached two existing timing-sensitive NVENC aggregate failures; the affected focused tests and all settings/handler/storage suites above pass.
  • The local Node 25 runtime requires --no-experimental-webstorage so 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 in WEBTEST_KNOWN_FAILURES on the base branch.
  • No browser screenshot is attached; the production UI build and component/integration tests are the rendered-web validation in this PR.

AI Disclosure

  • Tool(s): OpenAI Codex
  • Model(s): gpt-5.6-sol
  • Involvement: fully AI-generated
  • Adversarial review: Findings were verified and resolved across legacy JSON migration, strict shortcut identity and numeric validation, atomic shortcut CAS, transactional receipts, production capability forwarding, captured auth/profile safety, durable queue ordering, inherited reset behavior, semantic navigation matching, rapid card-edit reconciliation, revision-4 compatibility, full capability gating, fail-closed provider outages, and unsupported global built-in routing. The final independent follow-up review reported no remaining P1/P2 findings.

Checklist

  • I ran an adversarial AI review of the diff and summarized findings above.
  • I ran the repo verify commands: make lint, cd web && pnpm run lint, cd web && pnpm run format:check, and relevant go test ./....

Summary by CodeRabbit

  • New Features

    • Added “Navigation & Cards” settings for poster sizes, captions, and customizable primary menus.
    • Added navigation shortcuts for libraries, sections, and collections with streamlined pin management.
    • Added client-specific settings for web, mobile, tablet, desktop, and TV.
    • Added reliable, atomic shortcut updates with conflict handling and safe retries.
    • Added compatibility checks for supported settings features.
  • Documentation

    • Added comprehensive Settings API guidance and linked it from issue-reporting documentation.
  • Migration

    • Existing sidebar pins are converted to navigation shortcuts automatically.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

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

Changes

Settings contract, storage, and customization

Layer / File(s) Summary
Contract and validation
contracts/settings/v1/manifest.json, contracts/settings/v1/manifest.schema.json, contracts/settings/v1/conformance.json, contracts/settings/v1/schemas/*.json, cmd/settingsgen/main.go, docs/settings-api.md, docs/superpowers/specs/...
Manifest revision 5 adds nav.primary_menu, nav.shortcuts, and ui.card_presentation with client-family and device scopes. Schemas define menu item destinations, shortcut targets, and card presentation choices. Conformance cases verify profile-device precedence over profile-client and profile. API documentation covers client-family headers, atomic shortcuts, effective reads, and admin operations. TypeScript generator exports SETTINGS_API_VERSION constant.
Client-family type and resolution
internal/settingscontract/contract.go, internal/settingscontract/validate.go, internal/settingsresolve/resolve.go, web/src/lib/settingsResolve.ts, web/src/lib/settingsContract.ts
Adds ClientFamily type with five canonical values (tv, mobile, tablet, desktop, web) and validation. Semantic navigation validation enforces menu uniqueness and shortcut constraints after JSON schema checks. Resolution context includes client-family, batched queries require matching families, profile-client scope requires profile and family equality. Web contract and resolver mirror server definitions.
Database schema and migration
internal/userdb/schema.go, internal/userdb/migrate.go, internal/userdb/migrate_v18_test.go, internal/userdb/navigation_shortcuts_migrate.go, internal/userstore/pgstore/setting_values.go, internal/userstore/settingvalues.go, migrations/sql/20260803191207_add_profile_client_settings_scope.sql, migrations/user_setting_values_test.go
Schema version 18 adds nullable client_family column, profile_client scope constraint, and partial uniqueness index. Both SQLite and PostgreSQL stores include client-family in queries, ordering, and upserts. Migration v18 converts legacy sidebar pins to nav.shortcuts, deduplicates entries, validates identifiers, and preserves timestamps. Down migration removes profile-client rows and reverts constraints.
Compare-and-set and transactions
internal/userdb/setting_values.go, internal/userdb/setting_mutation_tx.go, internal/userstore/pgstore/setting_values.go, internal/userstore/pgstore/setting_mutation_tx.go, internal/userstore/settingvalues.go
Stores implement compare-and-set supporting insert-if-absent (revision 0) and revision-checked updates. Mutation transactions acquire dedicated connections or advisory locks, start BEGIN IMMEDIATE, execute callbacks with transactional writers, and commit atomically. Revision conflicts return ErrSettingValueRevisionConflict.
Conformance tests
internal/settingsresolve/conformance_test.go, internal/userdb/conformance_test.go, internal/userstore/storetest/settingvalues.go, web/src/lib/settingsConformance.test.ts
Fixtures and test harness decode client-family and propagate it into resolver contexts and stored identities. Conformance suite validates compare-and-set, transactional rollback, concurrent same-ID idempotency, uniqueness, deletion, and resolution with client-family filtering.
API handlers
internal/api/handlers/settings.go, internal/api/handlers/settings_values.go, internal/api/handlers/settings_values_admin.go, internal/api/handlers/settings_audit.go, internal/api/router.go
Handlers add X-Silo-Client-Family header parsing and validation. Profile-client explicit reads include family discriminator. Atomic shortcut mutations validate input, normalize items, retry compare-and-set conflicts, support transactional idempotency with replay, enforce whole-document restrictions, map errors, and audit updates. Direct navigation-shortcut deletion rejected. Admin requests require and validate client-family parameter. Capabilities advertise profile-client and supported families. Audit records store and emit client-family. New PUT /api/v1/settings/values/nav.shortcuts/item endpoint added.
Interest tracking decorator
internal/notifications/interest_hooks.go, internal/notifications/interest_hooks_test.go
Tracking store forwards compare-and-set and mutation-transaction methods, returns explicit unsupported-capability errors when wrapped store lacks interfaces.
Handler and conformance tests
internal/api/handlers/settings_values_test.go, internal/api/handlers/settings_values_admin_test.go, internal/database/settings_backfill_test.go
Tests cover mutation lifecycle, idempotent replay, concurrent requests, compare-and-set merging, transactional failures, notification wrapping, document limits, explicit client-family headers, mutation hashing, and admin profile-client restrictions.

Web client, hooks, and customization

Layer / File(s) Summary
Request context capture and stale protection
web/src/api/client.ts, web/src/api/client.test.ts
Client captures profile request context (access token, auth generation, server origin, profile ID, profile token). Captured-context requests validate context before and after fetch, reject stale contexts on account/origin changes. Token rotation updates access token without changing auth context. Device header applies web client-family. Tests verify context preservation, refresh safety, profile-unverified cleanup, and delayed rejection.
Settings mutations and capabilities
web/src/hooks/queries/settingValues.ts, web/src/hooks/queries/settingValues.test.tsx
Hooks add profile-client scope, optional client-family to effective settings, deferred cache invalidation option, atomic navigation-shortcut presence mutations with captured profile auth, typed capability data with fail-closed checks. Removed obsolete contract-ahead hook. Tests verify mutation identity isolation, pending state, and capability gates.
Sidebar pin synchronization
web/src/hooks/queries/sidebarPins.ts, web/src/hooks/queries/sidebarPins.test.ts, web/src/hooks/queries/sidebarPins.integration.test.tsx
Helpers convert sidebar pins to shortcut documents, toggle targets, set presence. Hooks synchronize operations per query key and profile, send profile-authenticated requests, support optimistic queues with stale-context protection, expose canToggle. Unit tests verify parsing, serialization, toggling, and presence updates. Integration tests verify queue serialization, profile context capture, cancellation on account/server changes, and legacy reads.
Admin settings
web/src/hooks/queries/admin/users.ts, web/src/hooks/queries/admin/users.settings.test.ts
Hook adds profile-client scope, optional client-family metadata, client-family query parameter serialization, PUT empty-items request for navigation-shortcut resets instead of DELETE. Tests verify client-family preservation and mutation behavior.
Customization context and provider
web/src/contexts/uiCustomizationContext.ts, web/src/contexts/UICustomizationProvider.tsx, web/src/contexts/UICustomizationProvider.test.tsx, web/src/hooks/useUICustomization.ts
Context stores card presentation, primary menu, shortcuts, capability flags, and loading/unavailability state. Provider checks capabilities, conditionally loads effective settings, ignores cached values until support confirmed, parses values, exposes source metadata. Hook returns context value. Tests verify capability gating, revision checking, batched-read requirement, atomic-shortcut flag, error states, and defaults.
Customization utilities
web/src/lib/uiCustomization.ts, web/src/lib/uiCustomization.test.ts
Library exports card presentation contracts, defaults, presets. Menu helpers validate home requirement, parse destination types with bounds and deduplication. Card-presentation parser validates sizes and captions with fallback defaults. Responsive layout helpers compute grid and carousel classes by poster size, caption heights by mode. Tests verify fallbacks, presets, home requirement, sanitization, shortcut filtering, item movement.
Settings contract and resolution
web/src/lib/settingsContract.ts, web/src/lib/settingsConformance.json, web/src/lib/settingsConformance.test.ts, web/src/lib/settingsResolve.ts, web/src/lib/settingsDisplay.ts, web/src/lib/deviceSettingGroups.ts, web/src/lib/documentTitle.ts
Web contract exports API version and revision 5, navigation and card keys, and full definitions. Conformance fixture increments revision and adds profile-client resolution cases. Resolver adds profile-client scope and client-family matching. Resolution-aware device filtering returns only keys introduced by requested revision. Device settings exclude navigation and card keys. Settings search includes interface route title.
App layout and grid
web/src/App.tsx, web/src/hooks/useGridLayout.ts
UICustomizedLayout wraps children in UICustomizationProvider and Layout. Settings and profile routes use customized layout. /settings/interface maps to InterfaceSettings. Grid layout hook accepts optional layoutKey to trigger remeasurement when responsive classes change.
Card components
web/src/components/ContinueWatchingCard.tsx, web/src/components/ItemCard.tsx, web/src/components/ItemGrid.tsx, web/src/components/RecommendationGrid.tsx, web/src/components/SectionItemCard.tsx, web/src/components/RecommendationGrid.test.tsx
Card components read cardPresentation, conditionally render captions (hidden for artwork-only, title-only for title mode, title+metadata for title-metadata mode), compute poster widths from customization. ItemGrid computes grid gap, caption height, and layout key from poster size. Loading skeletons use computed classes. Virtualizer measurements refresh when row height changes. Tests verify grid columns and caption rendering.
Carousel and collection cards
web/src/components/SectionRow.tsx, web/src/components/calendar/CalendarEventCard.tsx, web/src/components/calendar/DayGroup.tsx, web/src/components/collections/CollectionPosterCard.tsx, web/src/pages/Collections.tsx, web/src/pages/LibraryRecommended.tsx
Carousels derive card widths from configured poster size. Collection cards conditionally render captions, include library ID in links, gate pin button on canToggle. DayGroup computes event card widths. Removed exported grid-classes constant. Server collections sections compute widths for loading and rendered cards.
Recommendations and related
web/src/pages/Recommendations.tsx, web/src/pages/RecommendationsSection.tsx, web/src/pages/ItemDetail/components/SectionSkeletons.tsx, web/src/pages/audiobooks/components/RelatedRail.tsx, web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx, web/src/pages/audiobooks/components/RelatedRail.test.tsx
Recommendations compute grid classes from poster size, pass to loaders and grids. Related rail derives widths and conditionally renders titles and metadata. Skeleton components use computed classes and optional captions. Tests mock customization context with presets.
Navigation sidebar
web/src/components/AppSidebar.tsx, web/src/components/AppSidebar.test.tsx
Sidebar resolves customized menu items into navigable links for libraries, sections, collections, Home, For You, Calendar. Missing libraries and unsupported destinations omitted. Collection links include library ID. Custom Home replaces default. Recommendations and Calendar appear only without custom menu. Pin controls gated by canToggle. Tests verify library filtering, global media handling, active-state matching, collection identity matching.
Interface settings page
web/src/pages/settings/InterfaceSettings.tsx, web/src/pages/settings/InterfaceSettings.test.tsx
Page loads libraries and customization state, provides card preset selection, poster size and caption controls with live preview, device-override clearing, editable primary menu with reordering and item addition, menu save and reset with mutations and notifications. Loads and unavailable states shown separately. Tests cover card resets, menu management, rapid edits, unsupported-server alert, and disabled unavailable-customization state.
Device settings
web/src/pages/settings/DeviceSettings.tsx, web/src/pages/settings/DeviceSettings.test.tsx
Device settings fetch capabilities, compute supported keys by revision, delay effective-settings loading until compatibility known, show unavailability alert with retry when compatibility fails. Removed unconditional all-keys request. Tests verify fail-closed behavior, capability compatibility, and success paths.
Settings layout and admin
web/src/pages/SettingsLayout.tsx, web/src/pages/SettingsLayout.test.tsx, web/src/pages/AdminUserDetail.tsx, web/src/pages/AdminUserDetail.test.tsx
Settings adds Appearance section with "Navigation & Cards" item at interface route with metadata and indexed settings. Search match count increases with new section. Admin settings list and mutate preserve client-family identity, display scope with family context, include family in reset and update mutation parameters. Tests verify search discovery and client-family preservation.
Catalog navigation
web/src/pages/catalogSearchParams.ts, web/src/pages/catalogSearchParams.test.ts
Helper sameCatalogDestination compares stable catalog identity while ignoring presentation and filters. Library collection href builder accepts optional library ID. Tests verify identity matching and href generation.

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
Loading

Possibly related PRs

  • Silo-Server/silo-server#26: Both changes modify web/src/components/AppSidebar.tsx for library navigation link and active-state behavior.
  • Silo-Server/silo-server#140: Both changes modify web/src/pages/SettingsLayout.tsx; PR #140 introduces search filtering that enables discovery of the new "Navigation & Cards" interface settings entry added here.
  • Silo-Server/silo-server#479: This change extends the settings contract, resolver, storage, and migration systems introduced by PR #479.

Suggested labels: v1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.44% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: client-family synchronization for navigation and card customization.
✨ 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/ui-customization-contract

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

@coderabbitai coderabbitai Bot added the v1.0 Silo v1 scope - auto-adds to the Silo v1 project label Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Match the skeleton width to the configured poster size.

Line 192 now sizes recommendation cards with posterWidthClasses. DiscoverSkeletons at line 134 still uses the fixed w-[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 win

Assert the three capability flags in the response.

docs/settings-api.md states that a revision-5 client requires supports_atomic_shortcuts, supports_batched_effective, and supports_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 win

Add a case that proves profile_client outranks profile.

The case name states that profile_client sits between device and profile. The fixture always includes a profile_device row, so the expectation only proves that profile_device wins. A resolver that ranked profile_client below profile would still pass this case. Add a second case with the same stored rows minus the profile_device row and expect the profile_client value.

♻️ 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 value

Honor the per-call context in the writer methods.

Four of the five writer methods discard the context.Context parameter with _. CompareAndSetSettingValue at lines 105-112 forwards it. The delegated helpers reach the database through the non-context executor methods, which bind the captured e.ctx from the enclosing transaction. A caller that passes a narrower context to GetSettingValue, UpsertSettingValue, GetSettingMutation, or PutSettingMutation gets no effect from it.

The outer context already bounds the transaction, so behavior is correct today. Forwarding the parameter through the *Context executor 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 lift

Derive the rebuild DDL from one shared definition.

The table definition and the index set now exist in two places: settingContractSchema at 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:

  1. user_setting_values_profile_client_uq is created only in ensureSettingValuesClientFamily, not in settingContractSchema next to the other five unique indexes. A reader of settingContractSchema sees no uniqueness guarantee for the profile_client scope. Move that index into settingContractSchema so all six live together, and let the count > 0 branch rely on the IF NOT EXISTS form already executed by db.Exec(Schema).
  2. Extract the column list and CHECK constraints into a single constant that both the CREATE TABLE user_setting_values statement 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 value

Align 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. gofmt does 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 win

Trim section_id and collection_id like labels.

isTargetId accepts a padded id such as " recent " because it only tests the trimmed length. parseMenuItem then stores the raw value, while label is stored trimmed. The padded id becomes a distinct menuItemKey, 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 value

Embed SettingValueCompareAndSetter in SettingMutationWriter.

SettingMutationWriter repeats the CompareAndSetSettingValue signature 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 tradeoff

Consider the lock duration on user_setting_values.

Lines 10 to 24 add three CHECK constraints in validating mode, and line 26 creates a unique index without CONCURRENTLY. Both take an ACCESS EXCLUSIVE lock and scan the table. On a small table this completes quickly, and the seeding INSERT in the same transaction requires the index to already exist, so CONCURRENTLY is not usable here.

If user_setting_values is already large in any deployment, split the work: add the CHECK constraints as NOT VALID, then VALIDATE CONSTRAINT in 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 value

Extract the two source values for consistency with the three extracted values.

Lines 33-39 extract primaryMenuValue, shortcutsValue, and cardPresentationValue from query.data. Lines 45 and 49 instead read query.data?.[...]?.source inline, so query.data must stay in the dependency array.

Because query.data is 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 data reference 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 win

Add a case that changes only the profile ID.

Both current cases change the PIN token. isCapturedProfileAuthorityActive returns false through the getProfileToken() === snapshot.profileToken comparison in both cases. The getProfileId() === snapshot.profileId comparison 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 win

The sameCatalogDestination fallthrough is neither documented nor tested. The function returns false at line 202 for every source outside section, library_collection, and user_collection, so it is not reflexive for query, favorites, watchlist, history, or person. The name suggests a general destination comparison, and nothing records or verifies the restriction. Current callers in web/src/components/AppSidebar.tsx pass only sections and collections, so behavior is correct today.

  • web/src/pages/catalogSearchParams.ts#L179-L183: extend the doc comment to state that only section, library_collection, and user_collection have 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 asserts sameCatalogDestination returns false for two identical query states and for two identical favorites states.
🤖 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 value

Memoize overlayQueryKey to stop dependency churn.

sidebarPinsOverlayQueryKey() returns a new array on every render. readCachedValue lists overlayQueryKey as a dependency, so readCachedValue and isPinned get a new identity on every render. Wrap the key in useMemo.

♻️ 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 win

Reuse the real capability predicates in this mock.

The mock reimplements settingsCapabilitiesSupportKey and settingsCapabilitiesSupportAtomicShortcuts with hard-coded api_version === 1 and revision >= 5. Both functions are pure and depend only on the generated contract. If the contract raises SETTINGS_API_VERSION or the introducedIn revision of nav.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 value

Memoize the returned object to keep the caller's callback identity stable.

useSetNavigationShortcutPresence returns a new object on every render. useToggleSidebarPin lists setShortcutPresence in the dependency array of togglePin (see web/src/hooks/queries/sidebarPins.ts line 415), so togglePin gets a new identity on every render of that hook. Components that receive togglePin as a prop re-render each time. Wrap the return value in useMemo.

♻️ 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 value

Centralize the menu limit.

The schema, parser, and UI currently use the same value, 64. Export one shared client constant from uiCustomization.ts and 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

📥 Commits

Reviewing files that changed from the base of the PR and between c1cac4e and cace9ce.

📒 Files selected for processing (90)
  • README.md
  • cmd/settingsgen/main.go
  • contracts/settings/v1/conformance.json
  • contracts/settings/v1/manifest.json
  • contracts/settings/v1/manifest.schema.json
  • contracts/settings/v1/schemas/card-presentation.json
  • contracts/settings/v1/schemas/navigation-shortcuts.json
  • contracts/settings/v1/schemas/primary-menu.json
  • docs/settings-api.md
  • docs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.md
  • internal/api/handlers/settings.go
  • internal/api/handlers/settings_audit.go
  • internal/api/handlers/settings_values.go
  • internal/api/handlers/settings_values_admin.go
  • internal/api/handlers/settings_values_admin_test.go
  • internal/api/handlers/settings_values_test.go
  • internal/api/router.go
  • internal/database/settings_backfill_test.go
  • internal/notifications/interest_hooks.go
  • internal/notifications/interest_hooks_test.go
  • internal/settingscontract/contract.go
  • internal/settingscontract/contract_test.go
  • internal/settingscontract/validate.go
  • internal/settingskeys/keys.go
  • internal/settingsresolve/conformance_test.go
  • internal/settingsresolve/resolve.go
  • internal/userdb/conformance_test.go
  • internal/userdb/migrate.go
  • internal/userdb/migrate_v18_test.go
  • internal/userdb/navigation_shortcuts_migrate.go
  • internal/userdb/preference_settings_tx.go
  • internal/userdb/schema.go
  • internal/userdb/setting_mutation_tx.go
  • internal/userdb/setting_values.go
  • internal/userdb/sqlitestore.go
  • internal/userstore/pgstore/setting_mutation_tx.go
  • internal/userstore/pgstore/setting_values.go
  • internal/userstore/settingvalues.go
  • internal/userstore/storetest/settingvalues.go
  • migrations/sql/20260803191207_add_profile_client_settings_scope.sql
  • migrations/user_setting_values_test.go
  • web/src/App.tsx
  • web/src/api/client.test.ts
  • web/src/api/client.ts
  • web/src/components/AppSidebar.test.tsx
  • web/src/components/AppSidebar.tsx
  • web/src/components/ContinueWatchingCard.tsx
  • web/src/components/ItemCard.tsx
  • web/src/components/ItemGrid.tsx
  • web/src/components/RecommendationGrid.test.tsx
  • web/src/components/RecommendationGrid.tsx
  • web/src/components/SectionItemCard.tsx
  • web/src/components/SectionRow.test.tsx
  • web/src/components/SectionRow.tsx
  • web/src/components/calendar/CalendarEventCard.tsx
  • web/src/components/calendar/DayGroup.tsx
  • web/src/components/collections/CollectionPosterCard.tsx
  • web/src/contexts/UICustomizationProvider.test.tsx
  • web/src/contexts/UICustomizationProvider.tsx
  • web/src/contexts/uiCustomizationContext.ts
  • web/src/hooks/queries/settingValues.test.tsx
  • web/src/hooks/queries/settingValues.ts
  • web/src/hooks/queries/sidebarPins.integration.test.tsx
  • web/src/hooks/queries/sidebarPins.test.ts
  • web/src/hooks/queries/sidebarPins.ts
  • web/src/hooks/useGridLayout.ts
  • web/src/hooks/useUICustomization.ts
  • web/src/lib/deviceSettingGroups.ts
  • web/src/lib/documentTitle.ts
  • web/src/lib/settingsConformance.json
  • web/src/lib/settingsConformance.test.ts
  • web/src/lib/settingsContract.ts
  • web/src/lib/settingsResolve.ts
  • web/src/lib/uiCustomization.test.ts
  • web/src/lib/uiCustomization.ts
  • web/src/pages/Collections.tsx
  • web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx
  • web/src/pages/ItemDetail/components/SectionSkeletons.tsx
  • web/src/pages/LibraryCollections.tsx
  • web/src/pages/LibraryRecommended.tsx
  • web/src/pages/Recommendations.tsx
  • web/src/pages/RecommendationsSection.tsx
  • web/src/pages/SettingsLayout.test.tsx
  • web/src/pages/SettingsLayout.tsx
  • web/src/pages/audiobooks/components/RelatedRail.test.tsx
  • web/src/pages/audiobooks/components/RelatedRail.tsx
  • web/src/pages/catalogSearchParams.test.ts
  • web/src/pages/catalogSearchParams.ts
  • web/src/pages/settings/InterfaceSettings.test.tsx
  • web/src/pages/settings/InterfaceSettings.tsx

Comment thread internal/userdb/setting_mutation_tx.go Resolved
Comment thread web/src/api/client.ts Resolved
Comment thread web/src/api/client.ts Resolved
Comment thread web/src/components/AppSidebar.tsx Resolved
Comment thread web/src/components/ItemGrid.tsx Resolved
Comment thread web/src/pages/Collections.tsx Resolved

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

Comment thread web/src/hooks/queries/sidebarPins.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
web/src/pages/settings/InterfaceSettings.tsx (1)

342-398: 🎯 Functional Correctness | 🔵 Trivial | 🏗️ Heavy lift

Implement one shared radio-group primitive for the settings controls.

Apply roving tabIndex and arrow-key navigation to these groups and the equivalent groups in AppearanceSettings.tsx, AccessibilitySettings.tsx, and SubtitleAppearancePanelView.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

📥 Commits

Reviewing files that changed from the base of the PR and between cace9ce and 15a6b26.

📒 Files selected for processing (11)
  • internal/userdb/setting_mutation_tx.go
  • migrations/sql/20260803191207_add_profile_client_settings_scope.sql
  • web/src/api/client.test.ts
  • web/src/api/client.ts
  • web/src/components/ItemGrid.tsx
  • web/src/hooks/queries/sidebarPins.integration.test.tsx
  • web/src/hooks/queries/sidebarPins.ts
  • web/src/pages/Collections.tsx
  • web/src/pages/Recommendations.tsx
  • web/src/pages/settings/InterfaceSettings.test.tsx
  • web/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

@Quick104
Quick104 force-pushed the codex/ui-customization-contract branch from 15a6b26 to dfa7845 Compare August 4, 2026 04:14

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

Comment thread web/src/lib/settingsContract.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
migrations/sql/20260803191207_add_profile_client_settings_scope.sql (1)

184-198: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Make the Down constraint drops tolerant of a partially applied Up.

Down drops user_setting_values_client_family_check without IF EXISTS. If Up failed after the column add but before the constraint add, or if an operator repaired the table by hand, Down aborts and leaves the schema stuck. The index drop on Line 182 already uses IF 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

📥 Commits

Reviewing files that changed from the base of the PR and between 15a6b26 and 16a30d2.

📒 Files selected for processing (98)
  • README.md
  • cmd/settingsgen/main.go
  • contracts/settings/v1/conformance.json
  • contracts/settings/v1/manifest.json
  • contracts/settings/v1/manifest.schema.json
  • contracts/settings/v1/schemas/card-presentation.json
  • contracts/settings/v1/schemas/navigation-shortcuts.json
  • contracts/settings/v1/schemas/primary-menu.json
  • docs/settings-api.md
  • docs/superpowers/specs/2026-07-10-cross-platform-user-settings-contract-design.md
  • internal/api/handlers/settings.go
  • internal/api/handlers/settings_audit.go
  • internal/api/handlers/settings_values.go
  • internal/api/handlers/settings_values_admin.go
  • internal/api/handlers/settings_values_admin_test.go
  • internal/api/handlers/settings_values_test.go
  • internal/api/router.go
  • internal/database/settings_backfill_test.go
  • internal/notifications/interest_hooks.go
  • internal/notifications/interest_hooks_test.go
  • internal/settingscontract/contract.go
  • internal/settingscontract/contract_test.go
  • internal/settingscontract/validate.go
  • internal/settingskeys/keys.go
  • internal/settingsresolve/conformance_test.go
  • internal/settingsresolve/resolve.go
  • internal/userdb/conformance_test.go
  • internal/userdb/migrate.go
  • internal/userdb/migrate_v18_test.go
  • internal/userdb/navigation_shortcuts_migrate.go
  • internal/userdb/preference_settings_tx.go
  • internal/userdb/schema.go
  • internal/userdb/setting_mutation_tx.go
  • internal/userdb/setting_values.go
  • internal/userdb/sqlitestore.go
  • internal/userstore/pgstore/setting_mutation_tx.go
  • internal/userstore/pgstore/setting_values.go
  • internal/userstore/settingvalues.go
  • internal/userstore/storetest/settingvalues.go
  • migrations/sql/20260803191207_add_profile_client_settings_scope.sql
  • migrations/user_setting_values_test.go
  • web/src/App.tsx
  • web/src/api/client.test.ts
  • web/src/api/client.ts
  • web/src/components/AppSidebar.test.tsx
  • web/src/components/AppSidebar.tsx
  • web/src/components/ContinueWatchingCard.tsx
  • web/src/components/ItemCard.tsx
  • web/src/components/ItemGrid.tsx
  • web/src/components/RecommendationGrid.test.tsx
  • web/src/components/RecommendationGrid.tsx
  • web/src/components/SectionItemCard.tsx
  • web/src/components/SectionRow.test.tsx
  • web/src/components/SectionRow.tsx
  • web/src/components/calendar/CalendarEventCard.tsx
  • web/src/components/calendar/DayGroup.tsx
  • web/src/components/collections/CollectionPosterCard.tsx
  • web/src/contexts/UICustomizationProvider.test.tsx
  • web/src/contexts/UICustomizationProvider.tsx
  • web/src/contexts/uiCustomizationContext.ts
  • web/src/hooks/queries/admin/users.settings.test.ts
  • web/src/hooks/queries/admin/users.ts
  • web/src/hooks/queries/settingValues.test.tsx
  • web/src/hooks/queries/settingValues.ts
  • web/src/hooks/queries/sidebarPins.integration.test.tsx
  • web/src/hooks/queries/sidebarPins.test.ts
  • web/src/hooks/queries/sidebarPins.ts
  • web/src/hooks/useGridLayout.ts
  • web/src/hooks/useUICustomization.ts
  • web/src/lib/deviceSettingGroups.ts
  • web/src/lib/documentTitle.ts
  • web/src/lib/settingsConformance.json
  • web/src/lib/settingsConformance.test.ts
  • web/src/lib/settingsContract.ts
  • web/src/lib/settingsDisplay.test.ts
  • web/src/lib/settingsDisplay.ts
  • web/src/lib/settingsResolve.ts
  • web/src/lib/uiCustomization.test.ts
  • web/src/lib/uiCustomization.ts
  • web/src/pages/AdminUserDetail.test.tsx
  • web/src/pages/AdminUserDetail.tsx
  • web/src/pages/Collections.tsx
  • web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx
  • web/src/pages/ItemDetail/components/SectionSkeletons.tsx
  • web/src/pages/LibraryCollections.tsx
  • web/src/pages/LibraryRecommended.tsx
  • web/src/pages/Recommendations.tsx
  • web/src/pages/RecommendationsSection.tsx
  • web/src/pages/SettingsLayout.test.tsx
  • web/src/pages/SettingsLayout.tsx
  • web/src/pages/audiobooks/components/RelatedRail.test.tsx
  • web/src/pages/audiobooks/components/RelatedRail.tsx
  • web/src/pages/catalogSearchParams.test.ts
  • web/src/pages/catalogSearchParams.ts
  • web/src/pages/settings/DeviceSettings.test.tsx
  • web/src/pages/settings/DeviceSettings.tsx
  • web/src/pages/settings/InterfaceSettings.test.tsx
  • web/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

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

Comment thread web/src/components/AppSidebar.tsx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 16a30d2 and 5e185e6.

📒 Files selected for processing (14)
  • migrations/sql/20260803191207_add_profile_client_settings_scope.sql
  • migrations/user_setting_values_test.go
  • web/src/components/AppSidebar.test.tsx
  • web/src/components/AppSidebar.tsx
  • web/src/components/RecommendationGrid.test.tsx
  • web/src/contexts/UICustomizationProvider.test.tsx
  • web/src/contexts/UICustomizationProvider.tsx
  • web/src/contexts/uiCustomizationContext.ts
  • web/src/pages/ItemDetail/components/SectionSkeletons.test.tsx
  • web/src/pages/audiobooks/components/RelatedRail.test.tsx
  • web/src/pages/settings/DeviceSettings.test.tsx
  • web/src/pages/settings/DeviceSettings.tsx
  • web/src/pages/settings/InterfaceSettings.test.tsx
  • web/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

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

Comment on lines +34 to +40
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
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment on lines +280 to +282
export function cardTextAreaHeight(caption: CardCaption): number {
if (caption === "artwork") return 0;
return caption === "title" ? 28 : 44;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@Quick104
Quick104 merged commit 3bdfc58 into main Aug 4, 2026
13 checks passed
@Quick104
Quick104 deleted the codex/ui-customization-contract branch August 4, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0 Silo v1 scope - auto-adds to the Silo v1 project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant