Repository navigation
feat(collections): Starter packs replace template bundles - #1941
Conversation
Template bundles were buried in the template gallery, turned hero banners on by default (clearing hand-set heroes) and offered a switch that deleted every server collection in the chosen libraries. Starter packs is a two-pane dialog on the admin Collections page: a pack rail, the chosen libraries, and a per-library table from the bundle's dry run (new, already there, not for this library, pinned first). Hero banners are opt-in and each page line names the hero it replaces; the web never sends delete_existing. One pack is added at a time: the dry run runs again right before the job, and the dialog stays open with an Added tag and the result. Templates that need setup are hidden. Open it from the header, the empty state, or ?dialog=starter-packs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…o its pane After an apply with hero banners, the switch stayed on and the next check offered "Set hero banners" for heroes that were just set; it now turns off once the job succeeds. A run where nothing new landed and lists failed no longer tags the pack Added; its summary says it finished with problems. The pack rail's tabs now control a labelled tabpanel, opening and closing the dialog replaces the URL so Back leaves the page, and the template doc paragraph is rewrapped. 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: 1f7843e173
ℹ️ 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".
| // Also checks the pack again, so the table shows what is there now. | ||
| void invalidateAdminCollectionQueries(queryClient); | ||
| void queryClient.invalidateQueries({ queryKey: sectionKeys.all }); |
There was a problem hiding this comment.
Invalidate the starter-pack dry run after apply
When an apply job finishes with the hero switch off, this effect only invalidates the generic admin collection and section keys; it never invalidates the adminKeys.starterPackDryRun(...) query used for the table. As a result, the dialog can continue showing the pre-apply would_create/new rows instead of reflecting the collections just created, despite the comment claiming it checks the pack again. Invalidate or explicitly refetch the active dry-run query after the job completes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not a bug: the dry-run key is ["admin", "collections", "templateBundles", packId, "dryRun", body] (adminKeys.starterPackDryRun in web/src/hooks/queries/keys.ts), and invalidateAdminCollectionQueries invalidates the ["admin", "collections"] prefix, so the active dry run refetches once the job ends. The test "sends no featured member while the hero switch is off, then a fresh dry run and the job" pins this with the switch off: it waits for a third dry-run call after the job finishes. Commenting out the invalidation makes that test fail with 2 calls instead of 3.
Problem
Related issue: #192
Validation tasks: changes #194 A1 (Not run; needs a walk on a running build before merge); reaches #1141 C1 (Not run) and #193 S5 (Pass) through unchanged API routes
Template bundles add a set of synced lists to libraries in one go. In the admin web they are a view inside the single-template gallery. By default, applying one sets a hero banner on Home and on each chosen library, which takes the banner away from the row an admin picked by hand. The optional Preview is one line of counts, so an admin can't see per library which lists are new and which already exist. A "Delete Existing Server Collections" switch sits just above Apply Defaults.
This PR moves bundles into their own Starter packs dialog. It shows per library what a pack will add before anything changes, hero banners are opt-in, and the web no longer offers to delete existing collections.
Stacked on #1939 (
feat(collections): one collection editor page, starting with Manual).Approach
StarterPacksDialogopens from a new "Starter packs…" button in the Admin > Collections header, from "Add a starter pack" on both empty states (it replaces "Start from a template" there), and from/admin/collections?dialog=starter-packs. Opening and closing replace the URL entry, so Back leaves the page.POST /api/v2/admin/collections/template-bundles/{bundle_id}/applywithdry_run: trueanddelete_existing: false. Add runs the same dry run again, then queues the existing apply job. The dialog stays open while the job runs. When it ends, the dialog moves focus to a per-library result and checks the pack again. The pack gets an Added tag only when a new list landed or nothing failed; otherwise the result is titled "finished with problems".featuredmember, so the server never clears a page's current hero banner. On, each page (Home and each chosen library) gets a select of the pack's lists for that page or Keep current, and the line names the hero banner it would replace, read from the admin sections list. The dry run and the job carry the samefeatured, pages left on Keep current are not in it, and the table adds a line for each banner. After the banners are set, the switch turns back off.templatessummaries added in feat(api): list each template bundle's templates #1894, never the admin template catalog. Discover and Franchise lists therefore keep their titles once a follow-up narrows that catalog, and that follow-up must merge after this PR. Templates markedneeds_setup(the TMDB Franchise placeholder) are not shown or counted.docs/architecture/collection-templates.mdgains a Starter packs section with these rules.This uses defaults for product questions that are still open:
needs_setupflag, instead of being removed from the bundle on the server.No API change. The Apple and Android clients don't use this admin flow, and jellycompat needs no change. The user manual's page on template bundles needs updating: they are now Starter packs, with a per-library table, opt-in hero banners that name what they replace, packs keeping the template's pinned-first setting, and no delete option. That siloserver.org issue is not filed yet.
Validation
tsc -bandmake test-web(809 files, 7,533 tests) pass.make verify-apiv2-web-typesandmake verify-local-pathspass.featured. With it on, the dry runs and the job carry the samefeaturedand leave out Keep current pages.delete_existingis never true, and Add repeats the dry run before queuing the job. They also cover the table built from a dry-run fixture, Discover and Franchise titles taken from the summaries, the hidden placeholder, Retry after a failed check, "Nothing new to add", the link to Libraries when no library fits, focus moving to the result, the Added tag only when something landed, the switch turning off after banners are set, the phone Pack select, the rail tabs tied to their pane, and Back after closing.featured, and the delete-existing bodies are gone.make verify-case-collisionsdoes not exist on this base.Risks
delete_existingoption is unchanged for other callers.Checklist
AI Disclosure
tsc -b, eslint and the focused tests, and mutation-tested the dialog. Turning hero banners on by default, sendingdelete_existing: true, dropping the dry run before Add, removing the focus move and showingneeds_setuptemplates each made tests fail. It found no blockers and reported four minor findings and two nits. Fixed, with tests: after a run that set hero banners, the switch stayed on and offered to set the same banners again; the Added tag showed even when every list failed; the rail's tabs controlled no panel; and opening the dialog added a history entry, so Back reopened it. A long line in the architecture doc was rewrapped. Not changed: the placeholder collection the dialog doesn't count, which is listed under Risks because fixing it needs a server change.🤖 Generated with Claude Code
Note
Add Starter packs dialog to replace Template Bundles apply flow
StarterPacksDialog, opened from the Collections page header, empty states, or astarter-packsquery param. It lists packs as vertical tabs (mobile select), runs non-deleting dry runs per selected library, supports opt-in hero banner choices, queues one apply job at a time, and shows per-library results.starterPackDryRunQuery) with retries disabled.delete_existingas false, apply queuing no longer shows a success toast, and Add performs a fresh dry run before queueing; collection/section queries are invalidated after apply.Macroscope summarized 1f7843e.