Repository navigation
feat(collections): one Smart page for create and edit, with a live poster preview - #1943
Conversation
…ster preview Smart collections now open on the collection editor page, like Manual ones, for server and personal collections and for create and edit. The two-step SmartCollectionWizard and the Simple/Advanced builder are gone: Contents is the Home rows rule sentence with the libraries in it, then an Order block, and a live preview shows the posters the unsaved rules match across every chosen library. A rule the builder can't show stays as a locked line and is saved unchanged; rules about the viewer are offered only on personal collections. A stored default sort is named with Clear, and changing Order clears it so the new order takes effect. Editor saves leave out `featured` and personal saves send the description, as Manual already does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An admin could untick every library on a saved server collection and press Save; the empty library list fails the legacy library foreign key and the admin got only "Couldn't save". Save now waits for a library and says why, as Create already did, and the preview names the same reason. Also from review: after creating a Smart collection, focus moves to the libraries in the rule sentence instead of dropping to the page; a zero-match preview is announced once; the header shows the title count, as the approved mockup does; and the preview's debounce has its own test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
userCollectionsShared.tsx held only a pass-through wrapper once the old collection form left it. 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. |
|
Major validation impact: #194 A1–A3, #195 W4–W5, and the cross-client C7 cases. Smart CRUD, rules, Order, and artwork now use the shared editor/draft-save path; the live preview uses a new debounced query path, and changing Order can clear a stored sort. The native refresh code is unchanged, but C7 verifies the collection state produced by this new web writer. These cases are currently Not run, so no recorded pass is invalidated; the PR should explain why the existing Smart workflow/data path is changing. They need a live walk before acceptance, and any evidence accepted from a pre-merge build must be re-validated after merge. Minor changes: #195 W2 and W6 now start at the Manual/Smart chooser; W7 sees the sharing switch in the shared “Where it shows” panel. The switch’s behavior is unchanged, and W7 still depends on #1615. For W5, #1618 was already closed by #1702 on the base; #1616’s cross-profile collection-list ordering is separate and this PR does not change it. #193 S4 remains Partial: the saved-membership service and library-scan path are unchanged; this PR adds an unsaved-rules preview. #1141 C1 has no behavior change because RuleBuilder’s Home-row defaults preserve its existing query behavior. Suggested Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…at/collection-editor-smart # Conflicts: # web/src/components/homeRows/addRow/RuleBuilder.tsx # web/src/pages/CollectionEditorPage.tsx
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85b41015eb
ℹ️ 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".
| function parsedLimit(text: string, current: number | undefined): number | undefined { | ||
| if (text.trim() === "") return undefined; | ||
| const parsed = Number.parseInt(text, 10); | ||
| return parsed > 0 ? parsed : current; |
There was a problem hiding this comment.
Reject decimal max-title values instead of truncating
When a user enters a decimal or exponent-form value such as 2.5 or 1e2 in the Max titles field, the browser permits it for this type="number" input, but parseInt silently converts it to 2 or 1 and saves that unintended limit. Since this field is documented as accepting only positive whole numbers, validate the complete numeric string and keep the previous value (or show an error) for non-integer input rather than truncating it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ff9ad44: only whole digits change the limit now; 2.5 and 1e2 keep the previous value (covered in OrderBlock.test.tsx).
|
One additional major validation impact: #193 S3. The new personal Smart editor calls Suggested addition: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…at/collection-editor-smart # Conflicts: # web/src/components/collections/editor/CollectionMetaLine.tsx # web/src/pages/Collections.tsx
parseInt read "2.5" as 2 and "1e2" as 1, so a non-integer entry saved an unintended limit. Only whole digits now change the limit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Added #193 S3 to the Validation tasks line: the personal Smart editor's live preview shows posters, so S3 needs a restricted-profile re-check after merge. |
…at/collection-editor-smart # Conflicts: # web/src/components/collections/editor/CollectionEditor.tsx # web/src/pages/AdminCollectionEditor.tsx # web/src/pages/AdminCollections.test.tsx # web/src/pages/CollectionEditorPage.snapshot.test.tsx # web/src/pages/SmartCollectionWizard.artwork.test.tsx # web/src/pages/SmartCollectionWizard.rules.test.tsx # web/src/pages/SmartCollectionWizard.tsx
There was a problem hiding this comment.
💡 Codex Review
silo-server/web/src/pages/CollectionEditorPage.tsx
Lines 164 to 167 in 629daf6
collectionKindOf deliberately classifies every collection type other than manual and smart as synced, but this branch now always renders ImportedCollectionEditor, which assumes the value is one of mdblist, tmdb, or trakt and indexes an undefined SOURCE_THEMES entry for any legacy or future synced type. Opening such a personal collection will therefore fail while rendering instead of showing an editor or a controlled unsupported-state page; keep the previous type guard/fallback or make the imported editor handle unknown sources.
ℹ️ 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".
| // Only synced lists open here; Manual and Smart collections use the editor page. | ||
| if (!isMDBListCollection && !isTMDBCollection && !isTraktCollection) return null; |
There was a problem hiding this comment.
Do not render a blank admin page for unknown synced types
collectionKindOf maps any non-manual/non-smart value to synced, so an existing legacy or future synced type reaches CollectionEditForm; this new guard returns null for anything outside the three known import types. Editing that collection in the admin UI now produces a blank page with no fallback, whereas the previous generic form handled non-import collections.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not a change in behavior: the only caller, AdminCollectionEditor, renders CollectionEditForm only when isListBackedCollectionType(collection.collection_type) is true (mdblist, tmdb, trakt), and it gated it the same way before this PR. So the old CollectionForm fallback inside CollectionEditForm was already unreachable for any other type, and the null branch here is too. The v2 schema also limits collection_type to manual, smart, mdblist, tmdb and trakt.
Problem
Related issue: #192
Validation tasks: changes #194 A1–A3 and #195 W2, W4–W7 (W7 still needs #1615; all Not run, each needs a walk on a running build before merge); changes Silo-Server/silo-apple#20 C7, Silo-Server/silo-apple#21 C7, Silo-Server/silo-android#5 C7, and Silo-Server/silo-android#6 C7 (they check collections written by the new web editor); changes #193 S3 (the personal Smart editor now shows preview posters from
POST /api/v2/collections/preview; re-check them as a restricted profile after merge); reaches #193 S4 (Partial) with no server change, and #192 AC5 (parent criterion)Smart collections are created in one place and edited in another, and neither matches the editor page that Manual collections moved to in #1939. Create goes through a form (
CollectionFormfor admins,UserCollectionFormfor profiles) with its own Simple/Advanced rule builder and a text list of 12 matches. Edit opens a two-step wizard (SmartCollectionWizard) built on the catalog filters. This PR moves Smart collections, server and personal, create and edit, onto the editor page. Contents is the Home rows rule sentence with the libraries inside it, then an Order block, and a live preview shows the posters the unsaved rules match. The wizard, the older builder and both forms are deleted.Stacked on #1940 (
fix(web): name the libraries in the rule sentence).Approach
ManualCollectionEditorbecomesCollectionEditorand takes the collection type. Smart uses the same draft, save bar, conflict handling, header, Details and Where it shows panels as Manual. Rules and Order are draft fields: the save bar says "Rules not saved" and adds "The preview already shows them." A library change counts once, as Libraries. The header shows a Smart tag, the title count and "Updates itself as titles are added". Below 1024px the panel switcher reads Rules / Details / Where it shows.RuleBuilder. Its new optional props (context,librariesRequired,allLibrariesLabel,librariesId) default to the Home rows behaviour, so Home rows doesn't change.CollectionGuidedRulesEditorstays because the catalog filters use it.sort_configthat wins over the rules' sort. The Order block names it ("A saved default sort, Title A–Z, wins over this Order.") with Clear. Changing the sort or direction clears it too, so the new Order takes effect. Clearing drops onlyfieldandorderand keeps any othersort_configkey. An untouched stored sort is sent back as it was.{"mode":"manual_pins"}but never orders by it, and the editor sends a stored mode back unchanged.poster_urlfrom feat(api): include poster URLs in personal smart previews #1892. It sends the whole draft rules across every chosen library, 300 ms after the last edit, and keeps the last result on screen while the next one loads. The count is a polite live region. Zero matches shows ghost posters with "No titles match yet", and Save still works.useScopePreviewinhooks/queries/collectionScope.tsreplaceshooks/queries/collectionPreviews.ts.featured: false, and the PATCH now leavesfeaturedout, so saving keeps an existing pin.description, which feat(api): accept a description when creating a personal collection #1888 added to the API.?type=smart, and personal/collections/newwith no type shows a two-choice Manual / Smart picker that opens the editor page. Saved Smart collections open the editor page. Synced lists keep their current editors.docs/architecture/collection-editor.mdgains a section on Smart rules, the preview and the stored default sort.Differences from the approved design, for the owner to accept or reject:
No API change. jellycompat and the Apple and Android clients need no change. The user manual's collections page needs lines saying the Smart page replaces the two-step wizard, uses the same rule sentence as Home rows and shows a live preview. That siloserver.org issue is not filed yet.
Validation
tsc -bandmake test-web(807 files, 7,493 tests) pass.poster_url, the count announced once in a polite live region, a locked rule kept on save, zero matches still saving, viewer rules only on personal collections, the stored default sort (sent back untouched; cleared by an Order change or Clear with other keys kept), Create staying on the editor and moving focus, a server collection that can't be created or saved with no library, the read-only redirect, "all my libraries" on personal collections, and the layout at 1023, 1024, 1279 and 1280px. A hook test with the real debounce checks that a burst of edits inside 300 ms sends one request while the earlier posters stay shown. The wizard and builder tests were ported to the page;RuleBuilder, the Order block and the draft helpers have their own tests.featured, and personal Smart create and PATCH senddescription. The Smart limit goldens (no limit, the sentinel, 250) for both scopes now run through the page.make verify-local-pathspasses. No Go, contract or migration files changed, so the Go and contract checks were not run.make verify-case-collisionsdoes not exist on this base.Risks
Checklist
AI Disclosure
library_ids. The tests caught the first two but not the third, which is only a safety net. It approved once one major finding was fixed: an admin could save a saved server Smart collection with every library unticked, which the old wizard blocked, and the PATCH then failed the legacy library foreign key with a generic "Couldn't save". Save now waits for a library and says why, with a test. Also fixed: focus dropped to the page after a Smart Create; the 300 ms debounce had no test; a zero-match preview was announced twice; a module left holding one pass-through function was removed; and the header now shows the title count, as the mockup does.🤖 Generated with Claude Code
Note
Unify Smart and Manual collection create/edit into one editor page with live poster preview
CollectionEditorcomponent that handles create and edit for both kinds (CollectionEditor.tsx, CollectionEditorPage.tsx)SmartRulesPaneland a new interactive smart mode inOrderBlock, which now requires libraries for non-personal scopeuseScopePreview, 300ms, 24-item limit) that keeps the previous results while a new preview loads, rendered byCollectionPreviewPanewith loading, empty, error, and refreshing stateslibraryIdsfieldSmartCollectionWizardandCollectionFormare removed; any references outsideweb/src/pages/adminCollectionsShared.tsxand the deleted suites must be gone. Admin Smart unchanged PATCH bodies no longer sendfeatured, and personal Smart requests now includedescription(see collectionBodies.ts)Macroscope summarized 629daf6.