refactor(epg): shrink the two oversized files this PR grew, keep portal cards in scope

Two review follow-ups.

Greptile: the repo requires refactoring an already-oversized production file
before adding to it, and this PR had grown both files it touched. Extracted,
without behaviour change:

- `EpgProgramCache` — the 60 s "currently airing" memory, its in-flight
  request slots and the scope/offset cache keys.
- `EpgChannelMetadataLookup` — the icon/display-name lookup with the same
  playlist-first, Settings-fallback ladder.
- `DashboardLiveEpgPresenter` — the rails' XMLTV lookup and card enrichment,
  component-provided so the 30 s heartbeat dies with the page.

`epg.service.ts` 901 -> 727 and the rails component 1000 -> 842, both now
smaller than before this PR; the three new files are well under the 400-line
limit, and the generated max-lines baseline is unchanged.

Codex P2: the any-source retry now applies only to cards that carry a real
XMLTV key. An Xtream or Stalker card has none, so its lookup key is just its
display title, and searching every imported guide by title would let a
same-named M3U channel answer for a portal channel. Those cards keep the
strict scope — their own programmes come from the portal — and the flag is
part of the scope identity, so a guide-less M3U card and a portal card never
share an answer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5 committed 2026-09-20 20:27:32 +02:00
1 parent 6579151dcf
commit 2ef0afbeca
9 files changed
+565 -402

No files matched your search

+8 -1
View File
@@ -998,7 +998,14 @@ These URLs are playlist-scoped by default:
that scope: a `tvg-id` is unique inside a guide, not across imports, so a
single flat map keyed by lookup key alone would hand one playlist's card
the programme another playlist's guide resolved for the same id. Playlists
sharing a guide share one lookup. The channel list keeps the strict scope. Single-channel current
sharing a guide share one lookup. Only a card that carries a real XMLTV key
is widened: an Xtream or Stalker card has none, so its lookup key is just
its display title, and searching every guide by title would let a
same-named M3U channel answer for a portal channel. Those cards keep the
strict scope (their own programmes come from the portal), and the
any-source flag is part of the scope identity so the two never share an
answer. Wiring: `DashboardLiveEpgPresenter` in
`libs/workspace/dashboard/feature/src/lib/rails/`. The channel list keeps the strict scope. Single-channel current
program lookups include the source URL set in their cache and in-flight keys,
so playlist-local and global lookups deduplicate without reusing the wrong
source scope. Batch current-program lookups use the same source-scoped