Skip to content

fix(apiv2): mark the unsaved dashboard layout members nullable - #3584

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
blurbery:fix/dashboard-layout-nullable
Nov 9, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
blurbery:fix/dashboard-layout-nullable

Conversation

@blurbery

@blurbery blurbery commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #2908
Related issue: N/A
Validation tasks: none

An administrator who has never saved a dashboard layout gets {"layout":null,"updated_at":null} from GET /api/v2/admin/dashboard/layout, but the AdminDashboardLayout schema says both members are never null. The response fails its own document, and a client generated from it either fails to decode the body or types both members as always present. This change marks both members nullable so the schema matches what the server already sends.

Approach

layout and updated_at on the AdminDashboardLayout response get nullable:"true" and a short description of when they are null. The request schema for saving a layout (AdminDashboardLayoutSaveBody) shares the DashboardLayoutDocument type and is unchanged: a save still needs an object. The handler and the wire format don't change.

oasdiff reports both members as response-property-became-nullable, so breaking-approvals.json gets one entry for each. It's a correction, not a new break: the server has sent null here since the operation was added, the operation description already says "Null means retain the local/default arrangement", and v2 isn't locked. The web admin already types layout as unknown and updated_at as string | null and falls back to the default arrangement on null. silo-apple and silo-android don't call this operation. #3535 also adds entries to breaking-approvals.json, so whichever of the two merges second needs a small rebase there.

There was no contract fixture for this operation, so I added one for the unsaved read. verify-apiv2-fixtures validates its body against the schema: it fails on main and passes on this branch.

Validation

  • make verify-apiv2-openapi, make verify-apiv2-web-types: current.
  • make verify-apiv2-contract BASE_REF=upstream/main: spec lint passes; 2 changes, both approved.
  • go test ./internal/apiv2/ and TestCommittedFixturesValidate in ./internal/contractspec/: pass.
  • Web typecheck (scripts/typecheck.mjs) with the regenerated types: passes.
  • Changed-line Go lint: left to CI.

Evidence

Server change with no visible client change. The response body is the same before and after; the schema now accepts it.

Response for an account with no saved layout, recorded through the v2 router in the new fixture admin_dashboard_layout_unsaved:

{
  "layout": null,
  "updated_at": null
}

components.schemas.AdminDashboardLayout.properties in contracts/api/v2/openapi.json:

Before (main at 6e8c68d)After (this branch)
"layout": {
  "additionalProperties": true,
  "type": "object",
  "x-silo-extension-bag": "admin-dashboard-layout"
},
"updated_at": {
  "description": "RFC 3339 instant in UTC with millisecond precision",
  "format": "date-time",
  "pattern": "...",
  "patternDescription": "a non-zero RFC 3339 instant",
  "type": "string"
}
"layout": {
  "additionalProperties": true,
  "description": "Stored layout; null when this account has none saved, and the client keeps its local or default arrangement",
  "type": ["object", "null"],
  "x-silo-extension-bag": "admin-dashboard-layout"
},
"updated_at": {
  "description": "When the stored layout was last saved; null when none is saved",
  "format": "date-time",
  "pattern": "...",
  "patternDescription": "a non-zero RFC 3339 instant",
  "type": ["string", "null"]
}

Validating that body against each document (TestCommittedFixturesValidate):

Before: fixtures/admin_dashboard_layout_unsaved: body violates #/components/schemas/AdminDashboardLayout
        - at '/layout': got null, want object
        - at '/updated_at': got null, want string
After:  ok  github.com/Silo-Server/silo-server/internal/contractspec

Risks

A generated client that already decodes this response now types both members as optional. That matches what the server has always sent, and no first-party native client calls the operation. No migration.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (desktop app)
  • Tool(s): Claude Code, GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted with Claude Opus. I directed the task and designed the work.
  • Adversarial review: n/a

Note

Mark layout and updated_at nullable in AdminDashboardLayout API contract

When an account has no saved dashboard layout, GET /api/v2/admin/dashboard/layout can return null for layout and updated_at. The OpenAPI schema, generated TypeScript schema, and Go struct metadata in admin_dashboard_layout.go now allow null for both fields. Go pointer types and JSON field names are unchanged.

Macroscope summarized 1020007.

GET /api/v2/admin/dashboard/layout answers null for layout and
updated_at when the account has no saved layout, but the schema declared
both as never null, so the response failed its own document. Mark both
response members nullable (the save body is unchanged), approve the two
response-property-became-nullable changes, and add a contract fixture for
the unsaved read so its body is validated against the schema.

Closes Silo-Server#2908
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 5, 2026
@silo-kody

silo-kody Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 33595959-8437-4ee2-9efb-5a72d0fb165a
Commits

Reviewing files that changed from the base of the PR and between 58cb430 and 1020007.

Files selected for processing: 8

  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/fixtures/admin_dashboard_layout_unsaved.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/openapi.json
  • internal/apiv2/admin_dashboard_layout.go
  • internal/apiv2/admin_dashboard_layout_test.go
  • internal/apiv2/fixtures_test.go
  • web/src/api/v2/schema.ts

No actionable comments were generated in the recent review.

Walkthrough

The v2 admin dashboard layout response contract now permits layout and updated_at to be null when no layout is saved. Go schema metadata, OpenAPI, and web types reflect this shape. A fixture covers the unsaved-layout response, and breaking-change approvals record the nullable changes.

Changes: Dashboard layout response contract

Layer / File(s) Summary
Align dashboard layout nullability
internal/apiv2/admin_dashboard_layout.go, contracts/api/v2/openapi.json, web/src/api/v2/schema.ts, contracts/api/v2/breaking-approvals.json
The Go schema metadata, OpenAPI schema, and web types allow layout and updated_at to be null. The breaking-change approvals record both nullable changes.
Cover unsaved layout responses
contracts/api/v2/fixtures/*, internal/apiv2/admin_dashboard_layout_test.go, internal/apiv2/fixtures_test.go
A fixture and fixture case cover an unsaved layout response with null members, an HTTP 200 status, and an ETag. Fixture generation includes the dashboard layout dependency.

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

Severity of issue fixed: Medium

Suggested reviewers: quick104

Merge Risk: Minimal · previous review 58cb4

The schema now represents unsaved layouts as returned by the server. No merge-blocking issue was identified.

Security architecture risk: Minimal · up to 58cb4

The change corrects the documented response for an unsaved dashboard without changing access requirements, account selection, returned data, or save requirements. No material security risk was identified in the change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The contract correction does not expand attacker-controlled input, account selection, or privileged reachability. Its effective change is the description and typing of an existing account-scoped response, rather than a new route or a broader data-access capability.

Trust Boundaries and Controls

  • observed — The read operation retains its acting-administrator classification and obtains the target account from authenticated claims rather than request input. Existing test assertions check that unauthenticated and ordinary-member requests are rejected before the layout service is called; these assertions were inspected, not executed.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title identifies the main change: marking the unsaved dashboard layout response members nullable.
Description check Passed The description explains the nullable response schema, fixture, and breaking-change approvals.
Linked Issues check Passed [#2908] The response schema marks layout and updated_at nullable. The generated TypeScript types include null, and the unsaved-layout fixture tests the null response. Both required contract approv…
Out of Scope Changes check Passed [#2908] The schema metadata, generated contracts, fixture, tests, and breaking-change approvals support the linked issue. The summary shows no unrelated changes.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

[#2908] The response schema marks layout and updated_at nullable. The generated TypeScript types include null, and the unsaved-layout fixture tests the null response. Both required contract approvals are present.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files. (5 skipped: 4 unsupported, 1 too large.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 584abc17-bb12-433b-a1ff-0db7ddb612f0
Commits

Reviewing files that changed from the base of the PR and between 6e8c68d and 58cb430.

Files selected for processing: 8

  • contracts/api/v2/breaking-approvals.json
  • contracts/api/v2/fixtures/admin_dashboard_layout_unsaved.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/openapi.json
  • internal/apiv2/admin_dashboard_layout.go
  • internal/apiv2/admin_dashboard_layout_test.go
  • internal/apiv2/fixtures_test.go
  • web/src/api/v2/schema.ts

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

@silo-triage silo-triage Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Nov 5, 2026
@Quick104

Quick104 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: 1020007f0 (58cb43022 with main merged in).

I found no defects. The server has always sent {"layout":null,"updated_at":null} to an account with no saved layout, and docs/admin-api.md documents both fields as nullable. Only the schema disagreed, and this PR fixes it with the same nullable:"true" and doc tags other v2 types use for nullable members. The save body keeps its own non-nullable layout, so a save still needs an object.

Branch update. The branch conflicted with main in the fixture case list in internal/apiv2/fixtures_test.go, because main added adminCatalogMatchHintsFixtureCases. I merged main into the branch and kept both entries (1020007f0). Nothing in the PR's own change was altered.

Checked on the merged head

  • make verify-apiv2-openapi, verify-apiv2-web-types, verify-apiv2-fixtures: current.
  • make verify-apiv2-contract BASE_REF=origin/main: 2 changes, both response-property-became-nullable on getAdminDashboardLayout, both covered by the new approvals.
  • go test ./internal/apiv2/ ./internal/contractspec/: pass.
  • Web typecheck: passes.
  • TestCommittedFixturesValidate fails on the PR's base with the new fixture (at '/layout': got null, want object, at '/updated_at': got null, want string), so the fixture detects the bug.

Validated features. The PR lists no validation tasks, and the response body doesn't change, so the web admin dashboard behaves as before. I couldn't query the v1.0 board to confirm this, because this account's token lacks the project scope.

User manual. Unaffected. This is a schema correction with nothing a user sees.

Apple and Android. Neither app calls this operation, so no follow-up is needed.

Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green)

  • Fit: it fixes the v2 document so generated clients get the response right before v2 locks at 1.0, with no new surface.
  • Readiness: the change is small and matches what the handler and docs already do. The new fixture fails without it and passes with it.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit 8701691 into Silo-Server:main Nov 9, 2026
20 checks passed
Quick104 added a commit to Rhainland/silo-server that referenced this pull request Nov 9, 2026
The two getAdminDashboardLayout approvals from Silo-Server#3584 match no change
once that change is in the branch's merge base, and the contract check
refuses stale approvals.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 10, 2026
The two getAdminDashboardLayout entries from #2908 merged with #3584. An
approval lives only on the pull request that needs it, so the next pull
request removes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104 added a commit that referenced this pull request Nov 10, 2026
)

* feat(sections): send title keys for server-written section titles

Clients could not translate home and library section titles: every row
reached them as English, and nothing told a built-in or generated title
apart from one an admin or profile typed.

v2 sections, layout entries and profile section settings now carry
title_key (a shared translation catalog key such as
home.section.continueWatching) and title_args (named string values such
as {"library": "Movies"}) while the title is the server's own text.
getHomeCapabilities reports section_title_keys.

page_sections stores the key beside the title. Defaults and generated
library rows set it when the server writes them, and a trigger clears it
on any update that changes the title without changing the key, so a
rename by any writer, older binaries included, drops it without comparing
text. The migration keys existing rows that still hold a default's exact
text. A library rename keeps a generated row's key with the new name.
Next Up, the Because You Watched heading that names its title, and the
shared row a For You or taste-match section shows a new profile get keys
from the code that words them. A fetch that replaces the title without a
key of its own (seasonal, editorial) drops the stored key.

/api/v1 and jellycompat are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(sections): keep a late library rename off a newer generated title

A library rename reads the old name before it renames the folder, so two
renames can sync generated Home titles out of order. A keyed generated
row now syncs only while its stored library argument is the rename's old
name, as an unkeyed row syncs only while its title still names it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(sections): sync keyed generated titles to the library's current name

A library rename syncs Home titles after the library row commits, and
logs a failed sync. Reading the rename's old name made a missed sync
stick: every later rename skipped the row. A keyed generated row now takes
the library's current name from media_folders inside the sync, so a late
sync cannot undo a newer rename and the next rename repairs a missed one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(sections): say title_args is left out without placeholders

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(apiv2): clear breaking-change approvals that have merged

The two getAdminDashboardLayout entries from #2908 merged with #3584. An
approval lives only on the pull request that needs it, so the next pull
request removes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(sections): match the title-key docs to the trigger, renames and backfill

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(apiv2): say a profile title equal to the administrator's keeps its key

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(sections): say fetched rows carry their own title, and how unkeyed rows rename

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] v2 dashboard layout read returns null members its schema marks non-nullable

2 participants