Repository navigation
feat(api): accept a description when creating a personal collection - #1888
Conversation
The new collection editor saves a description with the collection it creates. Until now /api/v2 createCollection rejected the member, so a client had to create first and PATCH the description afterwards. createCollection takes an optional description, and the collection capabilities report create_description so clients can detect it. The shared handler request carries the field as json:"-", so the frozen /api/v1 create still ignores a description in JSON and multipart bodies. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12125ad416
ℹ️ 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".
| // PersonalCollectionCreate is the createCollection body. | ||
| type PersonalCollectionCreate struct { | ||
| Name string `json:"name" minLength:"1" example:"Rainy days"` | ||
| Description *string `json:"description,omitempty" nullable:"false" doc:"Empty when omitted. Accepted when getCollectionCapabilities reports create_description" example:"For wet afternoons"` |
There was a problem hiding this comment.
File the required client follow-ups
This introduces a client-visible create field, but the commit states that the matching silo-apple and silo-android work has not been filed. File or land both follow-ups before shipping; otherwise the first-party clients cannot use the new capability and the repository's completion gate for API changes remains unmet.
AGENTS.md reference: AGENTS.md:L146-L152
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No code change for this one. It's a tracking item, not a defect in the diff: the field is optional and gated behind create_description, so shipped clients keep working without it. The PR body already says the silo-apple and silo-android follow-ups aren't filed yet. This PR merges into feat/collections-revamp, not main, so those issues will be filed, with maintainer sign-off, before the collections stack ships to main.
Brings in login-wide personal collection sharing (#1875), the scrobble lock fix (#1887), and the import owner-access fix (#1874). Conflict resolution keeps both sides: the capabilities test expects login_sharing and create_description, the fixture list keeps collection_order_foreign_id before this branch's appended cases, and the create-description DB test no longer sets the removed AllowedProfileIDs. The OpenAPI document, fixtures, and web types are regenerated. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4897a8b8e
ℹ️ 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".
| CollectionSortPreferences: v.CollectionSortPreferences, | ||
| EffectiveCollectionSort: v.EffectiveCollectionSort, | ||
| SortPreferenceKinds: NonNil(v.SortPreferenceKinds), | ||
| CreateDescription: true, |
There was a problem hiding this comment.
Do not advertise create descriptions on SQLite
When userdb.backend=sqlite, this unconditionally reports support, but internal/userdb/collections.go's CreateCollection neither inserts input.Description nor includes it in the returned collection. A client following the capability therefore sends a description, receives a 201 response with an empty description, and later reads back an empty value, silently losing the user's input. Persist descriptions in the SQLite schema/store or report this capability only when the active store supports it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 51d3805. Stores now report description support through CollectionFeatures (Postgres yes, SQLite no), create_description follows the acting account's store, and a create with a description on a store without support answers 501 capability_unsupported instead of dropping it.
|
The current Suggested replacement: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…rged An approval lives only on the pull request that needs it. The #1615 removals merged into feat/collections-revamp with #1875, so these entries now match no change and fail the contract gate. The record stays in the file's history; the final merge into main carries them again. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The SQLite user store has no description column, so a description sent on create was dropped while getCollectionCapabilities still reported create_description. Stores now report description support through CollectionFeatures: Postgres reports it, SQLite does not. The capability follows the acting account's store, and a create carrying a description on a store without support answers 501 capability_unsupported, now declared on createCollection. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Related issue: #192
Validation tasks: none
A profile can't give a personal collection a description when it creates one.
POST /api/v2/collectionshas nodescriptionmember, so a client has to create the collection and then send aPATCHto set it. The redesigned collection editor shows Description at create time for every collection, so the create call needs to accept it.This adds an optional
descriptiontocreateCollectionand acreate_descriptioncapability flag that clients can check before sending it.Approach
PersonalCollectionCreategets an optionaldescription. Leaving it out stores an empty description, as today.nullanswers 422, like the other optional create members./api/v1/collectionscreate. The new field is taggedjson:"-"there and only the v2 adapter sets it, so v1 still ignoresdescriptionin both JSON and multipart bodies. The store already accepted a description, so there is no migration.getCollectionCapabilitiesreportscreate_descriptionwhen the acting account's user store keeps descriptions. Stores report this throughCollectionFeatures: the Postgres store does, the SQLite store has no description column and doesn't. On a store without support, a create with a non-emptydescriptionanswers501 capability_unsupported(now declared oncreateCollection) instead of dropping it.PersonalCollectionCreaterefuses unknown members, so an older server rejectsdescription; clients should check the flag first.docs/catalog-api.mddocuments the field next to the other personal collection capability notes.No web code sends the field yet; the editor uses it in a later PR. jellycompat needs no change, since BoxSets read stored collections. The user manual doesn't describe API fields and needs no change. The matching
silo-appleandsilo-androidfollow-up (senddescriptionon create whencreate_descriptionis true) is not filed yet.Validation
make lint-changedagainstfeat/collections-revampare clean;make test-gopasses.handlers,apiv2anduserstorepass on a freshly migrated database. They cover create with and without a description, the v1 create ignoring it, and Collections — Server #193 S2 isolation for a new collection: another profile on the account gets 404 on read and update of a private collection, a profile it is shared with can read it but gets 403 on update, and another login gets 404.verify-apiv2-openapi,verify-apiv2-contract(three additive changes, none breaking),verify-apiv2-fixtures,verify-apiv2-web-types,verify-route-inventory,verify-migration-ledgerandTestCommittedArtifactMatchesRouterpass.tsc -bandmake test-webpass.make verify-local-pathspasses.handlerspackage against a database also failsTestAdminSubtitleListPageDBandTestCatalogTransferPersistsJobsAndSignedLink. Both fail the same way onfeat/collections-revampand don't touch collections.Risks
descriptionand ignore the new capability member./api/v1requests and responses are unchanged.Checklist
AI Disclosure
json:"-"tag, the v2 copy and capability flag) to confirm a test fails for each. It also reran the contract and local-path checks in a clean checkout. It found no problems and noted that create doesn't limit description length, matching update. Nothing changed as a result.🤖 Generated with Claude Code
Note
Add optional description to v2 personal collection creation
The v2
createCollectionendpoint now accepts an optional non-nulldescriptionstring.GET /api/v2/collections/capabilitiesreports a newcreate_descriptionboolean, sourced from the newuserstore.CollectionFeatures.Descriptionflag, which the PostgreSQL store sets to true. SQLite stores reject a non-empty description with 501 and leave no collection behind; an omitted description stays empty and works on all stores. Adds contract fixtures, generated TypeScript schema updates, and PostgreSQL/SQLite integration coverage in collections_create_description_test.go. Risk:create_descriptionis required inCollectionCapabilitiesresponses, and v1 JSON and multipart create paths deliberately ignore the newDescriptionfield onhandlers.PersonalCollectionCreateRequest— check personal_collections.go and collections.go when auditing.Macroscope summarized 51d3805.