feat(podcasts): smart collections play as a sequence — the Daily Fiction acceptance (item 2.5)

ACCEPTANCE (plan §0 item 2.5): "Daily Fiction" = feed ∈ {A} ∧ unplayed
∧ <7d matches exactly today's episodes, and PLAY = today's episodes
back-to-back. Two pieces were missing after item 2.4:

- The chain builder only read static membership (collection_items) — a
  smart collection has none. buildSmartCollectionSequenceContext now
  evaluates the rules LIVE for the requesting user (mode from the
  collection, family lens via the visible set) and chains the
  downloaded episode matches in NATIVE feed order — the collection's
  computed order is content (R1: never written back; OrderEpisodes is
  the order chokepoint per R3). A match that aged out of the briefing
  (played since, published beyond the window) falls back to the feed
  queue instead of breaking the page.
- The smart-detail branch rendered match cards as books: episode
  matches are now flagged (IsEpisode + download state) so they carry
  the play affordance and the header's Play-as-Sequence button;
  feed titles stay empty on smart cards for now (batch lookup is
  polish, not acceptance).

Pinned by TestPodcastSmartCollections' acceptance subtests: the
briefing starts at index 1/2 and chains into the second with the
queue param on both hops; the order control stays hidden (computed
order); a stale match falls back to the feed queue honestly.
This commit is contained in:
John O'Keefe committed 2026-10-30 17:12:07 -04:00
1 parent cc56b9ef2a
commit 69773ec307
3 files changed
+159

No files matched your search

+11
View File
@@ -308,6 +308,17 @@ func (cfg *Config) collectionBooksForScope(c *echo.Context, userUUID uuid.UUID,
return nil, isSmart, "books_load_error"
}
books = handlers.BookCardsFromMediaItems(matches, libTypes)
// Episode-awareness for smart matches (item 2.5): episode cards
// carry the play affordance (chain via ?queue=collection:).
// BookCardsFromMediaItems preserves match order, so a parallel
// walk is enough; feed titles stay empty here (batch lookup is
// polish, not acceptance).
for i := range books {
if i < len(matches) && matches[i].Source == "podcast_episode" {
books[i].IsEpisode = true
books[i].DownloadState = matches[i].DownloadState
}
}
} else if collection.IsSystemCollection.Bool && collection.QueryType.Valid && collection.QueryType.String != "" && collection.QueryType.String != "filter" {
dashboardSvc := services.NewDashboardService(cfg.Queries)
sections, secErr := dashboardSvc.GetDashboardSections(c.Request().Context(), userUUID, libUUID, 1000, []string{}, []string{})