Repository navigation
fix(apiv2): mark the unsaved dashboard layout members nullable - #3584
Conversation
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 Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedThis 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. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Review summaryReviewed head: I found no defects. The server has always sent Branch update. The branch conflicted with main in the fixture case list in Checked on the merged head
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)
🤖 Claude Code (claude-opus-5-5) |
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]>
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]>
) * 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]>
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}fromGET /api/v2/admin/dashboard/layout, but theAdminDashboardLayoutschema 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
layoutandupdated_aton theAdminDashboardLayoutresponse getnullable:"true"and a short description of when they are null. The request schema for saving a layout (AdminDashboardLayoutSaveBody) shares theDashboardLayoutDocumenttype 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, sobreaking-approvals.jsongets 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 typeslayoutasunknownandupdated_atasstring | nulland falls back to the default arrangement on null. silo-apple and silo-android don't call this operation. #3535 also adds entries tobreaking-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-fixturesvalidates its body against the schema: it fails onmainand 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/andTestCommittedFixturesValidatein./internal/contractspec/: pass.scripts/typecheck.mjs) with the regenerated types: passes.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.propertiesincontracts/api/v2/openapi.json:Validating that body against each document (
TestCommittedFixturesValidate):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
AI Disclosure
Note
Mark
layoutandupdated_atnullable inAdminDashboardLayoutAPI contractWhen an account has no saved dashboard layout,
GET /api/v2/admin/dashboard/layoutcan return null forlayoutandupdated_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.layoutandupdated_atbecame nullable, a contract-level breaking change for API consumersMacroscope summarized 1020007.