docs(catalogs): PATCH /api/catalogs/{catalogId} rename contract (chat#1942)
Row 2 of chat#1942. Contract-first: this is the spec the api implementation fulfills, and it merges before it.
What this documents
PATCH /api/catalogs/{catalogId} — rename a catalog. The only mutable field is name; membership stays with the catalog-songs endpoints.
- Request:
{ "name": string }(required, non-empty) → newUpdateCatalogRequestschema. - 200:
{ "status": "success", "catalog": Catalog }→ newUpdateCatalogResponse, reusing the existingCatalogschema. - 400 / 401 / 404 / 500, all on the existing
CatalogsErrorResponseschema.
The one decision worth reviewing: 404, not 403
chat#1942 proposed "a non-member gets 403; an unknown id gets 404." This contract documents 404 for both, because that is what the sibling catalog reads already do — getCatalogMeasurementsHandler resolves visibility with getCatalogOwnerIds + selectAccountCatalog and returns 404 when no link is found, deliberately: "a catalog owned by nobody in accountIds returns null, indistinguishable from not existing" (selectAccountCatalog).
A 403 on a catalog you cannot see would confirm that catalog exists — an IDOR-shaped leak the catalog read paths were explicitly built to avoid. Splitting the semantics across verbs on the same resource would be worse than either choice alone, so rename follows the read paths. Flagged on the issue as a deviation from its acceptance criteria.
Files
api-reference/openapi/releases.json— new/api/catalogs/{catalogId}path + 2 schemas. Purely additive: 119 insertions, 0 deletions; re-parsed after the edit.api-reference/songs/catalog-rename.mdx— reference page.docs.json— nav entry under Catalogs, which is also what puts it in the generatedllms.txt.
Merge order
docs (this) → api PATCH implementation. Both land after api#820 (the naming fix, which needs no contract change) per the issue's sequencing.
🤖 Generated with Claude Code
Summary by cubic
Documents the PATCH /api/catalogs/{catalogId} rename contract so existing catalogs can be given real names. Uses 404 for non-visible catalogs to match read paths and avoid leaking existence (aligns with chat#1942).
-
New Features
- Add
PATCH /api/catalogs/{catalogId}to OpenAPI: body{ "name": string }(required, non-empty) viaUpdateCatalogRequest. - 200 returns
{ "status": "success", "catalog": Catalog }viaUpdateCatalogResponse; 400/401/404/500 reuseCatalogsErrorResponse. - Document 404 (not 403) when the catalog isn’t visible to the caller, consistent with read endpoints.
- Add
api-reference/songs/catalog-rename.mdxand a nav entry indocs.json. Purely additive toapi-reference/openapi/releases.json.
- Add
-
Bug Fixes
- Require
statusandcataloginUpdateCatalogResponseso clients don’t treatcatalogas optional. - Keep the reference page frontmatter-only per docs policy.
- Require