Repository navigation
feat(api): list each template bundle's templates - #1894
Conversation
Starter packs show each pack's lists by title, poster and source, but the /api/v2 bundle list carried only template ids, and the admin template catalog cannot resolve them all: it will stop listing Discover and Franchise templates, which only bundles create. Each bundle in listAdminCollectionTemplateBundles now carries templates, a summary of every template in template_ids order: id, title, source, media_kind, featured, poster_path and needs_setup. needs_setup marks the TMDB Franchise placeholder, whose collection is created empty and cannot sync until an admin sets its TMDB id; Template.NeedsSetup now also decides when bundle apply skips the first sync. The summaries live on the /api/v2 mapping only, so the frozen /api/v1 bundle list is byte-identical. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
poster_path is optional in the schema, so the bundle summary test now treats a missing value as an empty poster instead of failing. The registry also notes why every bundle template reference resolves. 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. |
…s' into feat/api-bundle-template-summaries # Conflicts: # contracts/api/v2/fixtures/get_system_info_ok.json
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fafc221996
ℹ️ 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".
| } | ||
| type CollectionTemplateBundle struct { | ||
| templates.Bundle | ||
| Templates []CollectionTemplateSummary `json:"templates" doc:"The bundle's templates, in template_ids order."` |
There was a problem hiding this comment.
Advertise template summaries in capabilities
When a client can be newer than the server, it has no supported way to determine whether the bundle response includes templates: /api/v2/admin/collections/capabilities exposes no corresponding flag, so the client must inspect the response shape or infer support from a version before enabling the starter-packs flow. Add an explicit admin-collection capability for bundle template summaries so mixed-version clients can feature-detect this addition.
AGENTS.md reference: AGENTS.md:L251-L252
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8fc2934: getAdminCollectionCapabilities now carries template_summaries: true, and docs/catalog-api.md tells clients to check it before relying on templates.
…emplate-summaries Brings in personal login sharing (#1875), the scrobble lock fix (#1887), and the preview-poster work. The only conflict was the contract digest in get_system_info_ok.json; regenerated the OpenAPI document, fixtures, and web types after the merge. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…at/api-bundle-template-summaries # Conflicts: # contracts/api/v2/fixtures/get_system_info_ok.json
A client newer than the server could only tell whether bundles carry templates by inspecting the response. The template_summaries flag on getAdminCollectionCapabilities lets it feature-detect the summaries before enabling the starter-packs flow. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…at/api-bundle-template-summaries # Conflicts: # contracts/api/v2/fixtures/get_system_info_ok.json
Problem
Related issue: #192
Validation tasks: reaches #193 S5 (Pass)
The admin template bundle list names a bundle's templates only by ID. To show what a bundle will create (titles, posters, which collections start pinned), the web has to look up each ID in the admin template catalog. The Starter packs dialog that replaces the gallery's bundle view needs this from the bundle list itself, because a follow-up change narrows the admin template catalog to templates an admin can create one at a time. That drops the TMDB Discover and Franchise templates the bundles use.
This adds a
templatessummary to each bundle returned byGET /api/v2/admin/collections/template-bundles.Approach
templatesarray intemplate_idsorder. An entry hasid,title,source,media_kind,featuredandneeds_setup, plusposter_pathwhen the template has a poster.needs_setupis true when applying the template creates a collection that can't sync until an admin sets its source. Today onlytmdb_franchise_placeholderqualifies, because it has no TMDB collection ID. Bundle apply already skipped the first sync for that case. The check is now oneTemplate.NeedsSetupmethod that both apply and the list use, so apply behaves as before.franchise_collections. Removing it from the bundle would not be additive, so the summary flags it and the Starter packs dialog will hide it.getAdminCollectionCapabilitiesgainstemplate_summaries: true, so a client can feature-detect the summaries instead of inspecting the bundle response./api/v2mapping changes. The frozen/api/v1bundle list still serializes the old type, and a test pins its body byte for byte. TheBundleCatalogandCollectionTemplateBundleschema names are unchanged.docs/catalog-api.mddocuments the summaries and the capability flag.docs/architecture/collection-templates.mdnotes whereNeedsSetupapplies.list_admin_collection_template_bundles_okfixture, the system-info digest and the web types are regenerated.This uses two defaults for product questions that are still open:
needs_setupflag, instead of being removed from the bundle.featureddescription reads "Collections created from this template are pinned first on their shelf", matching the proposed "Pin to the start of its shelf" wording. If that wording is rejected, only the field description changes.No web code reads
templatesyet; the Starter packs dialog uses it in a later PR. jellycompat needs no change. The user manual doesn't describe API fields, andsilo-appleandsilo-androiddon't call this admin route, so neither needs a follow-up.Validation
make lint-changedagainstfeat/api-personal-preview-postersare clean.make test-gopasses.collections/templates,apiv2andapi/handlerspackages ran against a freshly migrated database. The new tests cover template order for every built-in bundle, Discover and Franchise templates in the summaries,needs_setuponly on the placeholder, the v1 body byte for byte, and Collections — Server #193 S5: a regular account and a non-primary profile on an admin account both get permission denied, and the bundle list is never read.TestAdminSubtitleListPageDBandTestCatalogTransferPersistsJobsAndSignedLink, fail on that database. They fail the same way on the base branch.verify-apiv2-openapi,verify-apiv2-contract(two additive changes, both required response properties, nothing breaking),verify-apiv2-fixtures,verify-apiv2-web-types,verify-route-inventory,verify-migration-ledgerandTestCommittedArtifactMatchesRouterpass. So doverify-settings-bindings-all,verify-playback-fixtures,verify-scenario-catalogsandverify-offline-routes.tsc -bandmake test-webpass.make verify-local-pathspasses.Risks
/api/v2;/api/v1requests and responses are unchanged.templatesis a new required response property. The contract isn't locked yet, and clients that don't know the field ignore it.Template.NeedsSetupis the exact inverse of the helper it replaces, so the set of collections that get a first sync on bundle apply doesn't change.Checklist
AI Disclosure
NeedsSetupto false, hard-codingneeds_setup, droppingposter_path, reversing template order) and confirmed that tests fail for each. It found no blocking problems and two nits. A test failed on a template without a poster, which the schema allows; that is fixed. The registry silently skips template IDs it can't resolve; that can't happen because bundle registration rejects unknown IDs, and a comment now says so.🤖 Generated with Claude Code
Note
Add template summaries to API v2 template-bundle listing
listAdminCollectionTemplateBundlesendpoint now returns each bundle with its resolved templates, intemplate_idsorder, via newCollectionTemplateBundleandCollectionTemplateSummarytypes in admin_collection_extras.gotemplates.Registry.BundlesWithTemplatesandtemplates.Template.NeedsSetup;NeedsSetupmarks TMDB collection templates with no or invalid collection ID as requiring administrator setup. Bundle application skips the initial sync for setup-required templatestemplate_summariesflag, set to true only when the collection service is configuredTestV1TemplateBundleListKeepsFrozenShapein collection_templates_test.go; v1 clients are unaffected. The domain schema name mapping fortemplates.Bundleis removed from schema_names.goMacroscope summarized 24d051a.