API gap: rerun collections have no REST endpoints (blocks full #140 parity / #91) #152

Closed
opened 2026-07-07 12:22:35 +02:00 by timothy · 2 comments
Owner

Recon for #140 (2026-07-07): rerun collections are Blazor-only — no API controller exists (RerunCollectionViewModel + handlers are there). GET /api/collections returns only manual collections, so no read-only fallback either.

Needed for full Blazor parity (#91 phase b): CRUD controller per the CollectionController pattern, then SPA coverage (Blazor reference: RerunCollectionEditor.razor — autocomplete over collections/multi/smart/shows/seasons/artists + first-run/rerun playback orders).

Part of epic #59; blocks #91 phase (b) alongside #140.

Recon for #140 (2026-07-07): rerun collections are Blazor-only — no API controller exists (`RerunCollectionViewModel` + handlers are there). `GET /api/collections` returns only manual collections, so no read-only fallback either. Needed for full Blazor parity (#91 phase b): CRUD controller per the CollectionController pattern, then SPA coverage (Blazor reference: `RerunCollectionEditor.razor` — autocomplete over collections/multi/smart/shows/seasons/artists + first-run/rerun playback orders). Part of epic #59; blocks #91 phase (b) alongside #140.
Author
Owner

Backend REST API landed via PR #188 (merged to main 1c035cc9) — issue kept OPEN pending the SPA editor screen.

Done: RerunCollectionController (/api/rerun-collections) CRUD (list paged/get/create/update/delete) over the existing MediatR handlers, following the CollectionController pattern (ApiResults, 404 pre-checks, #nullable enable DTOs, OpenApiErrorResponseContractTests entries). Thin api-client web/src/api/rerunCollections.ts added. OpenAPI + TS types regenerated. docs/blazor-route-parity.md updated.

Still pending (this issue): the ChicoryTV SPA editor screen mirroring the Blazor Rerun-collectionEditor.razor (composition of collections/smart-collections; rerun adds the CollectionType autocomplete + first-run/rerun playback orders). Next-session work.

Deferred follow-up (from adversarial review): the rerun create/update path does not existence-check the selected entity id (a non-existent SelectedId can produce a dangling-FK row or a 500 on SaveChanges) — consistent with api-conventions §3's deliberate deep-FK precedent, but the API now exposes it as a single top-level FK. Worth a small hardening issue. (The invalid-CollectionType hole — Playlist/internal types persisting a wrong-kind id — WAS fixed in this PR: both verbs now 422 via IsSupportedSelectionType.)

**Backend REST API landed** via PR #188 (merged to main 1c035cc9) — issue kept OPEN pending the SPA editor screen. **Done:** `RerunCollectionController (/api/rerun-collections)` CRUD (list paged/get/create/update/delete) over the existing MediatR handlers, following the CollectionController pattern (ApiResults, 404 pre-checks, `#nullable enable` DTOs, OpenApiErrorResponseContractTests entries). Thin api-client `web/src/api/rerunCollections.ts` added. OpenAPI + TS types regenerated. `docs/blazor-route-parity.md` updated. **Still pending (this issue):** the ChicoryTV **SPA editor screen** mirroring the Blazor `Rerun-collectionEditor.razor` (composition of collections/smart-collections; rerun adds the CollectionType autocomplete + first-run/rerun playback orders). Next-session work. **Deferred follow-up (from adversarial review):** the rerun create/update path does not existence-check the selected entity id (a non-existent SelectedId can produce a dangling-FK row or a 500 on SaveChanges) — consistent with api-conventions §3's deliberate deep-FK precedent, but the API now exposes it as a single top-level FK. Worth a small hardening issue. (The invalid-CollectionType hole — Playlist/internal types persisting a wrong-kind id — WAS fixed in this PR: both verbs now 422 via IsSupportedSelectionType.)
Author
Owner

Closed via PR #194 (merged to main 636b680a).

What was done — the SPA rerun-collection editor screen, completing #152 (the REST API landed earlier in PR #188). New screen RerunCollectionsScreen at /app/rerun-collections: list + editor with a Name field, a Collection Type select over the 13 REST-supported types (RerunCollectionRequestMapping.IsSupportedSelectionType) — Collection/MultiCollection/SmartCollection + TelevisionShow/TelevisionSeason/Artist/Movie/Episode/MusicVideo/OtherVideo/Song/Image/RemoteStream, with Playlist correctly excluded — a conditional single-selection picker per type, and type-conditional First-Run / Rerun playback-order selects. Changing type atomically resets the selection + both orders to a valid default.

Files: web/src/screens/RerunCollectionsScreen.tsx (+ .test.tsx), web/src/api/rerunCollections.ts (added messageFromRerunCollectionError) + rerunCollections.test.ts, web/src/api/index.ts, web/src/App.tsx, App.test.tsx.

Verification: 354 web tests pass, lint + build clean. Adversarial fork review — clean; one Low finding fixed in a follow-up commit (3a260e67): edit-load now unions an out-of-set stored playback order into the Select's options so an API-created rerun collection with a type-invalid order renders and round-trips faithfully instead of silently blanking/re-sending stale. Live-E2E passed: verified the type→picker→order coupling (MultiCollection collapses both orders to Shuffle-only, no stale selection), Playlist absent, and a full create/save cycle — zero console errors.

Docs: docs/blazor-route-parity.md #152 row → SPA DONE; docs/domain-model.md rerun-collection row → /app/rerun-collections.

Follow-up filed: #193 (backend hardening — existence-check selectedId on rerun create/update; a bad id can currently persist a dangling row or 500).

Unblocks #91 phase (b).

Closed via PR #194 (merged to main `636b680a`). **What was done** — the SPA rerun-collection editor screen, completing #152 (the REST API landed earlier in PR #188). New screen **`RerunCollectionsScreen`** at `/app/rerun-collections`: list + editor with a Name field, a **Collection Type** select over the 13 REST-supported types (`RerunCollectionRequestMapping.IsSupportedSelectionType`) — Collection/MultiCollection/SmartCollection + TelevisionShow/TelevisionSeason/Artist/Movie/Episode/MusicVideo/OtherVideo/Song/Image/RemoteStream, with **Playlist correctly excluded** — a conditional single-selection picker per type, and type-conditional First-Run / Rerun playback-order selects. Changing type atomically resets the selection + both orders to a valid default. **Files**: `web/src/screens/RerunCollectionsScreen.tsx` (+ `.test.tsx`), `web/src/api/rerunCollections.ts` (added `messageFromRerunCollectionError`) + `rerunCollections.test.ts`, `web/src/api/index.ts`, `web/src/App.tsx`, `App.test.tsx`. **Verification**: 354 web tests pass, lint + build clean. Adversarial fork review — clean; one Low finding **fixed in a follow-up commit** (`3a260e67`): edit-load now unions an out-of-set stored playback order into the Select's options so an API-created rerun collection with a type-invalid order renders and round-trips faithfully instead of silently blanking/re-sending stale. **Live-E2E passed**: verified the type→picker→order coupling (MultiCollection collapses both orders to Shuffle-only, no stale selection), Playlist absent, and a full create/save cycle — zero console errors. **Docs**: `docs/blazor-route-parity.md` #152 row → **SPA DONE**; `docs/domain-model.md` rerun-collection row → `/app/rerun-collections`. **Follow-up filed**: #193 (backend hardening — existence-check `selectedId` on rerun create/update; a bad id can currently persist a dangling row or 500). Unblocks #91 phase (b).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#152