Skip to content

feat(api): list each template bundle's templates - #1894

Merged
Quick104 merged 7 commits into
feat/collections-revampfrom
feat/api-bundle-template-summaries
Oct 4, 2026
Merged

Quick104 merged 7 commits into
feat/collections-revampfrom
feat/api-bundle-template-summaries

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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 templates summary to each bundle returned by GET /api/v2/admin/collections/template-bundles.

Approach

  • Each bundle gets a required templates array in template_ids order. An entry has id, title, source, media_kind, featured and needs_setup, plus poster_path when the template has a poster.
  • needs_setup is true when applying the template creates a collection that can't sync until an admin sets its source. Today only tmdb_franchise_placeholder qualifies, because it has no TMDB collection ID. Bundle apply already skipped the first sync for that case. The check is now one Template.NeedsSetup method that both apply and the list use, so apply behaves as before.
  • The bundles themselves don't change: the placeholder stays in franchise_collections. Removing it from the bundle would not be additive, so the summary flags it and the Starter packs dialog will hide it.
  • getAdminCollectionCapabilities gains template_summaries: true, so a client can feature-detect the summaries instead of inspecting the bundle response.
  • Only the /api/v2 mapping changes. The frozen /api/v1 bundle list still serializes the old type, and a test pins its body byte for byte. The BundleCatalog and CollectionTemplateBundle schema names are unchanged.
  • docs/catalog-api.md documents the summaries and the capability flag. docs/architecture/collection-templates.md notes where NeedsSetup applies.
  • The OpenAPI document, a new list_admin_collection_template_bundles_ok fixture, the system-info digest and the web types are regenerated.

This uses two defaults for product questions that are still open:

  • The franchise placeholder stays in its bundle and gets the additive needs_setup flag, instead of being removed from the bundle.
  • The featured description 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 templates yet; the Starter packs dialog uses it in a later PR. jellycompat needs no change. The user manual doesn't describe API fields, and silo-apple and silo-android don't call this admin route, so neither needs a follow-up.

Validation

  • Go: build, gofmt, vet and make lint-changed against feat/api-personal-preview-posters are clean. make test-go passes.
  • The collections/templates, apiv2 and api/handlers packages 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_setup only 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.
  • Two DB-backed handler tests that this branch doesn't touch, TestAdminSubtitleListPageDB and TestCatalogTransferPersistsJobsAndSignedLink, fail on that database. They fail the same way on the base branch.
  • Contract: 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-ledger and TestCommittedArtifactMatchesRouter pass. So do verify-settings-bindings-all, verify-playback-fixtures, verify-scenario-catalogs and verify-offline-routes.
  • Web: lint, format:check, build, budget:check, tsc -b and make test-web pass.
  • make verify-local-paths passes.

Risks

  • Additive on /api/v2; /api/v1 requests and responses are unchanged. templates is a new required response property. The contract isn't locked yet, and clients that don't know the field ignore it.
  • Template.NeedsSetup is the exact inverse of the helper it replaces, so the set of collections that get a first sync on bundle apply doesn't change.
  • The summaries come from the in-memory template registry, so the route makes no extra queries.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent read the full diff and checked every caller of the changed service method, the bundle registration path and the regenerated contract. In a scratch copy it broke the change four ways (forcing NeedsSetup to false, hard-coding needs_setup, dropping poster_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

  • The listAdminCollectionTemplateBundles endpoint now returns each bundle with its resolved templates, in template_ids order, via new CollectionTemplateBundle and CollectionTemplateSummary types in admin_collection_extras.go
  • Adds templates.Registry.BundlesWithTemplates and templates.Template.NeedsSetup; NeedsSetup marks TMDB collection templates with no or invalid collection ID as requiring administrator setup. Bundle application skips the initial sync for setup-required templates
  • The administrator capabilities document advertises a new template_summaries flag, set to true only when the collection service is configured
  • Updates generated OpenAPI and TypeScript contract artifacts, plus docs
  • Risk: API v1 bundle shape is frozen and now guarded by TestV1TemplateBundleListKeepsFrozenShape in collection_templates_test.go; v1 clients are unaffected. The domain schema name mapping for templates.Bundle is removed from schema_names.go

Macroscope summarized 24d051a.

Quick104 and others added 2 commits October 4, 2026 04:10
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]>
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5cb4b341-821d-4149-8cf8-e0f22d84e350

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T18:39:05.731118Z 24d051a New commits
ℹ️ 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" or "@codex security review".

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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."`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
Base automatically changed from feat/api-personal-preview-posters to feat/collections-revamp October 4, 2026 17:50
Quick104 and others added 3 commits October 4, 2026 14:05
…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
@Quick104
Quick104 merged commit df4145d into feat/collections-revamp Oct 4, 2026
15 checks passed
@Quick104
Quick104 deleted the feat/api-bundle-template-summaries branch October 4, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant