docs: advance ChicoryTV queue past #145 (PR #199); next = #198 casing drift + #193; #91 phase b gated on cold review
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 7m36s
Build ErsatzTV Image / Docs update reminder (push) Has been skipped
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 10m7s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 11m28s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-09 08:24:05 +02:00
co-authored by Claude Fable 5
parent af17dafcab
commit 415da214ec
+118 -123
View File
@@ -6,140 +6,135 @@ always holds the current handoff. History: created 2026-07-02 after the plan aud
all backend gap issues (#100–#111), all SPA screens (#84–#89, #93, #109), the rebrand (#90),
the cutover root-flip (#91 phase a), full scheduling parity (#144/#162), media/troubleshooting
parity (#141/#161/#158/#180), onboarding docs (#185), the collections/API-gap batch
(#155/#151/#152-backend/#184), and now the **multi/rerun/playlist SPA editors** (#151/#152 PR
#194, #153 PR #195) + **CI speedups** (#190 PR #192) are MERGED. **v26.5.0 in prod; v26.6.0
tagged** (awaiting a Komodo pin bump 26.5.0→26.6.0 in server-management to deploy).
(#155/#151/#152-backend/#184), the multi/rerun/playlist SPA editors (#151/#152 PR #194, #153
PR #195), CI speedups (#190 PR #192), and now **#145 playback troubleshooting (PR #199)** are
MERGED. **v26.5.0 in prod; v26.6.0 tagged** (awaiting Komodo pin bump in server-management).
**Blazor removal (#91 phase b) is now gated ONLY on #145 (playback troubleshooting)** — every
API gap (#151/#152/#153/#155) is closed.
**#145 is CLOSED — every SPA-parity screen exists. Blazor removal (#91 phase b) is now gated
ONLY on the cold adversarial review** (hard-gate comment on #91; runs from the external
`~/adversarial-reviewer` project, zero shared context, brief embedded in the #91 comment).
**Session state (2026-07-08, multi/rerun/playlist editors + CI/runner session)**: main =
81bcfec8. Merged THREE PRs (all fork-reviewed + live-E2E'd + CI-green before merge):
- PR #192 → **#190 CLOSED**: CI speedups — NuGet package cache (`actions/cache@v4` on
`~/.nuget/packages`) in the `test`+`migrations` jobs, shallow checkout for `test`
(`fetch-depth 1`), and a Dockerfile openapi-generator jar-layer reorder. Validated on main's
image build.
- PR #194 → **#151/#152 CLOSED**: SPA multi-collection editor (`/app/multi-collections`) +
rerun-collection editor (`/app/rerun-collections`), on the PR-#188 REST APIs. Mirror
`CollectionsScreen` dialogs + a type→picker→playback-order machinery. Follow-up commit unions
an out-of-set stored playback order into the rerun edit-load Select.
- PR #195 → **#153 CLOSED**: playlist CRUD REST API (9 endpoints + `RenamePlaylistGroup`
command + DTOs) **and** SPA editor (`/app/playlists`: group tree + item editor with
reorder/copy + playout preview). Review hardening: HIGH — `PUT /api/playlists/{id}` now guards
`IsSystem`→422 (a system playlist could be renamed/wiped via API); MEDIUMs — system-group
rename guard + preview draft validation→422; SPA — `Promise.allSettled` on the tree load.
- New issues filed: **#193** (rerun create/update should existence-check `selectedId` — a bad id
can dangling-FK/500; S, backend-only, still OPEN) and **server-management#570** (relocate the
Gitea act-runner off bumblebee — DONE by user, runner now on **VM 127** on pve4).
- Tests on main: `ErsatzTV.Tests` **913**, web **369** (45 files), `Core.Tests` 493(+1 skip),
Architecture 5 — all green (verified via the PR runs).
**Session state (2026-07-09, #145 playback troubleshooting session)**: main = af17dafc
(post PR #199, merge pre-approved by user after CI green; post-merge main run was being
verified at handoff-write time — confirm `Build & test` + image jobs green before relying on
`:latest`). Tests on main: `ErsatzTV.Tests` **927**, web **385**, `Core.Tests` 493(+1 skip),
Architecture 5 — all green. Worktree `.worktrees/feat-145` removed after merge.
**CI RUNNER (server-management#570 — RESOLVED 2026-07-08)**: the act-runner moved off bumblebee
(where it starved Kodi/Jellyfin playback) to **VM 127** on pve4 (`ci-runner`, **12 vCPU / 16 GB**,
shared `ci-net`, persistent `/data/cache`, capacity 2). An interim mis-config (6 vCPU + per-job
networks that left the internal `actions/cache` server unreachable → a 15-min cache-save hang that
killed run #363) was fixed. **Verified fixed on run #371**: the test-job log shows `Cache restored
from key: nuget-linux-…` (732 MB) + `Cache saved successfully` (~1 s, no hang) + cache-hit→skip.
Warm `Build & test` ~**9 min** (was 18m53s on the broken VM, ~4–5 min on bumblebee bare-metal —
the ~2× is virtualization overhead, an accepted trade for off-prod isolation). **Still true:** a
red MAIN push can be a CANCELLED job from VM churn (reboots) rather than a code fault — check the
job conclusion (cancelled vs failed) and re-trigger via a `workflow_dispatch` re-run (Gitea 1.24
has no per-run rerun API) before assuming a regression. The non-blocking `docs-reminder` job runs
on PRs only.
What PR #199 added:
- Backend: `GET /api/troubleshoot/playback/{stream-selectors,subtitles/{id},status}`;
`ITroubleshootingPlaybackStatusStore` (Core singleton, `TroubleshootingNotifier` precedent)
filled by a MediatR `INotificationHandler<PlaybackTroubleshootingCompletedNotification>`,
reset at session lock in `PrepareTroubleshootingPlaybackHandler` — the pollable replacement
for Blazor's in-process Courier completion event. `GET /api/graphics-elements?refresh=true`.
- SPA: `/app/troubleshooting/playback` (`?channel=`/`?mediaItem=` modes) mirroring
`PlaybackTroubleshooting.razor`; reusable `web/src/media/HlsPlayer.tsx` (hls.js; `playToken`
prop forces re-attach — REQUIRED because the m3u8 GET is what starts a session and identical
URLs are React no-ops); 2s status polling with a starting→running→settled phase machine
(30s start timeout); entry points: channels-table Troubleshoot action + movie detail page.
- New issues filed: **#198** (OpenAPI spec/runtime property-casing drift, see lessons — M,
includes a LIVE ChannelEditScreen bug on main), **#197** (cold API contract+security review,
runs when MCP PR #76 stabilizes; HARD GATE on #58 closing/go-live). #91 got the phase-(b)
review-gate comment.
**Lessons for all remaining prompts** (conventions live in docs/; this is workflow lore):
- READ docs/README.md → the convention docs FIRST; point recon/implementer agents at specific
doc sections. The convention docs (api/spa/e2e/domain-model/blazor-route-parity) replace
re-recon — only recon the task-specific delta (exact merged-API signatures, a Blazor page's
field list) that docs deliberately don't freeze.
- The main checkout (/Users/timothy/ersatztv) sits on a STALE branch. NEVER recon/edit there —
worktrees off origin/main only; copy `web/node_modules` from the main checkout (`cp -R`) into
NEW web worktrees instead of `npm ci`. Docs-only worktrees need none. Remove worktrees when the
PR merges.
- **Subagent connection drops = the laptop slept, NOT a turn-length problem.** The agent's
context AND on-disk work survive. Re-resume with `SendMessage` ("you dropped when the laptop
slept; git status shows X on disk; continue from step N"). This session recovered the #153
backend agent mid-task with zero lost work.
- **Build/verify locally, then trust it; CI is now the slow+flaky part (VM 127).** Full local
passes (dotnet test + web test/lint/build + check:api) + fork review + live-E2E gate a merge;
the runner just confirms. Watch CI by commit status:
`/api/v1/repos/timothy/ersatztv/commits/{sha}/status` (per-context state). Only `Build & test
(.NET)` is branch-protection-required; the image `build` job is skipped on PR runs.
- PR routine (works): worktree off origin/main → implement (opus for judgment-heavy, sonnet for
mechanical; give doc pointers + exact facts; mandate the csharp-lsp for C#) → for API changes
build the app project FIRST then `./scripts/update-openapi.sh` (regens v1.json +
endpoint-index) then `npm run generate:api` → merge origin/main into the branch before PR
(resolve route-parity by hand; regen v1.json authoritatively) → full test pass → push, PR →
fork adversarial review (SCOPE it "review only; do not answer unrelated questions") + sonnet
live-E2E for UI changes (`scripts/e2e-local.sh`) → apply review should-fixes as follow-up
COMMITS (never amend+force — auto-mode blocks the force-push) → CI green → merge (session
pre-approval: RE-ASK each new session; this session the user OK'd auto-merge on CI-green +
review-clean) → structured close comments per CLAUDE.md protocol.
- Combine tightly-coupled API+SPA work (like #153) on ONE branch/PR to save CI cycles — extra
relevant now that CI is slow. Do the backend first (it regenerates the TS types the SPA needs).
- Never run TWO committing agents on the same worktree concurrently (races on git state). A
read-only review fork alongside an editing agent is fine (the fork reads a committed SHA).
- Reusable API facts: collection-item listings → reuse `PagedLibraryBrowseItemsResponseModel` +
`LibraryBrowseItemMapper`; multi/rerun/playlist Application handlers ALL exist (API = controller
+DTO+tests). Response DTO records need file-scoped `#nullable enable`; ErsatzTV.Application has
NO nullable context (`string?` trips CS8632). `LanguageExtensions.Apply` collapses a
`NotFoundError` subtype into a plain `BaseError` (→422) — use a controller existence pre-check
for a real 404. The in-repo `RerunCollectionsScreen` is now the canonical mirror for a per-item
CollectionType→picker→playback-order editor.
doc sections. Only recon the task-specific delta.
- **#198 / spec-typed mocks blind spot**: runtime JSON is Newtonsoft-cased
(`FFmpegProfileId`→`ffmpegProfileId`) but the OpenAPI generator uses STJ naming
(`fFmpegProfileId`) — generated TS types are WRONG for leading-acronym response fields, and
unit-test mocks typed from them stay green while the real screen breaks. Until #198 lands:
read such fields via a typed escape hatch pinned to the runtime key (precedent:
`PlaybackTroubleshootingScreen` default-profile derivation), and make test mocks use the
runtime casing. Only live E2E catches this class — one more reason the per-PR live-E2E gate
is non-negotiable.
- **Playwright-MCP E2E: never open tabs/window.open for file-download endpoints** — a download
never renders a page and wedges the browser session hard enough to kill the agent (stalled a
sonnet E2E agent 3× this session; had to pkill the mcp-chrome profile). Verify downloads with
plain HTTP (curl) instead. If browser tools stall repeatedly, `pkill -f ms-playwright-mcp`
and drive a fresh session.
- The user's main checkout (/Users/timothy/ersatztv) is now ON main and pulled each session —
keep it that way (stale-checkout confusion resolved 2026-07-09; stale branches pruned).
Still do feature work in worktrees off origin/main; copy `web/node_modules` from the main
checkout into new web worktrees instead of `npm ci`.
- Subagent connection drops = laptop sleep; re-resume via SendMessage (work survives).
- Build/verify locally, then trust it; CI (VM 127) is the slow confirming step (~9 min warm).
Watch by commit status: `/api/v1/repos/timothy/ersatztv/commits/{sha}/status`. A red MAIN
push is most likely a CANCELLED job from VM churn — check conclusion before assuming
regression.
- PR routine (works): worktree off origin/main → implement (opus judgment-heavy / sonnet
mechanical; doc pointers + exact facts; csharp-lsp for C#) → API changes: build app project
FIRST then `./scripts/update-openapi.sh` then `npm run generate:api` → full local test pass
→ push, PR → fork adversarial review (SCOPED "review only") + live-E2E for UI changes
(`scripts/e2e-local.sh`) → review fixes as follow-up COMMITS (never amend/force-push) → CI
green → merge (consent per session; 2026-07-09 session had pre-approval for #199 only) →
structured close comments per CLAUDE.md protocol.
- Never run TWO committing agents on one worktree concurrently. Read-only review forks are fine.
- Reusable API facts: DTO records in ErsatzTV.Core/Api need file-scoped `#nullable enable`;
ErsatzTV.Application has NO nullable context (CS8632); `Option<T>`→nullable =
`MatchUnsafe(v => (T?)v, () => null)`; `LanguageExtensions.Apply` collapses NotFoundError→422,
so real 404s need a controller pre-check; id-taking child GETs get an
OpenApiErrorResponseContractTests [TestCase].
---
# PROMPT — #145 playback troubleshooting (the LAST functional gate for #91 phase b)
# PROMPT — #198 OpenAPI casing drift (live ChannelEditScreen bug) + #193 warm-up
You are Fable, the ORCHESTRATOR in the main Claude Code session (Claude Code only). Fable is
EXPENSIVE: delegate (recon → Explore/haiku; mechanical/reconciles → sonnet; judgment-heavy code
→ opus; fable forks for review). FIRST read CLAUDE.md, docs/README.md + the convention docs it
indexes, and the Lessons above.
You are Fable, the ORCHESTRATOR in the main Claude Code session. Fable is EXPENSIVE: delegate
(recon → Explore/haiku; mechanical → sonnet; judgment-heavy → opus; fable forks for review).
FIRST read CLAUDE.md, docs/README.md + the convention docs it indexes, and the Lessons above.
HARD CONSTRAINTS:
- Work in worktrees off origin/main; NEVER touch /Users/timothy/ersatztv (stale). Copy
`web/node_modules` from the main checkout into NEW web worktrees.
- Up to 3 concurrent builds OK; never 5+/wide fan-outs. NEVER set ETV_UPDATE_GOLDENS.
- Subagent drops = laptop sleep; re-resume via SendMessage (work survives).
- Merge consent in-conversation per session (last session's pre-approval does NOT carry over).
- CI runner = VM 127 (server-management#570 RESOLVED — 12 vCPU, working `actions/cache`, ~9 min
warm `Build & test`; verified on run #371). A red MAIN push is most likely a CANCELLED job from
VM churn, not a code fault — check job conclusion (cancelled vs failed) + re-trigger via a
`workflow_dispatch` re-run before assuming a regression. Apply review should-fixes as follow-up
commits (no force-push).
- Live-E2E new screens via scripts/e2e-local.sh (docs/e2e-local.md). Adversarial review fork per
PR diff, SCOPED "review only". Update docs/blazor-route-parity.md rows in the same PR.
- Work in worktrees off origin/main. The main checkout should stay on main/pulled — safe for
reading, but do feature work in a worktree. Copy web/node_modules from the main checkout.
- Up to 3 concurrent builds; never 5+. NEVER set ETV_UPDATE_GOLDENS.
- Merge consent in-conversation per session (prior pre-approvals do NOT carry over).
- Live-E2E via scripts/e2e-local.sh; NEVER exercise download endpoints via browser tabs (curl
them). Adversarial review fork per PR diff, SCOPED "review only".
## Task — #145 playback troubleshooting [L, OWN SESSION]
This is the last gate before #91 phase (b) (Blazor removal). It is LARGE and was deliberately
deferred to its own session. The #91 issue body has the phase-(b) checklist.
1. RECON [Explore, thorough]: map the legacy Blazor playback-troubleshooting UI (`ErsatzTV/Pages/`
— the FFmpeg/playback troubleshooting page(s), ffmpeg-troubleshooting report/download,
session/HLS diagnostics) and what REST API exists vs is missing for it. Playback/session
endpoints may be partial (see #99 TS/HLS-Direct sessions, still backlog). Product a mirror
map: Blazor fields/actions → needed API → SPA screen.
2. Decide the API gap: what troubleshooting/diagnostics endpoints must be added (mirror the
controller+DTO+tests pattern; handlers may already exist) before the SPA screen.
3. Implement backend (if needed) → SPA screen → live-E2E → full PR routine → close #145.
4. Then #91 phase (b): with #145 done, plan/execute the Blazor removal (redirect remaining routes,
delete legacy pages, update blazor-route-parity.md). This may itself be a separate session —
scope it when #145 lands.
5. Consider clearing #193 (rerun existence-check hardening, S backend) as a warm-up/interleave.
6. Update THIS handoff, commit to main, print the next prompt in a fenced block.
## Task 1 — #198 OpenAPI spec/runtime casing drift [M]
Read issue #198 first — it has the full analysis. Summary: MVC responses serialize via
Newtonsoft (leading acronyms fully lowercased: `ffmpegProfileId`) but the OpenAPI generator
uses STJ naming (`fFmpegProfileId`), so generated TS types lie about response keys.
**ChannelEditScreen.tsx:122 reads the phantom key → with >1 ffmpeg profile, editing a channel
shows/saves the WRONG profile (repro'd live 2026-07-09).**
1. Root fix: make spec generation match runtime naming (schema transformer or serializer
alignment — investigate what ErsatzTV/Startup.cs + the OpenAPI pipeline allow). Regen
v1.json/endpoint-index/web types (expect broad-but-mechanical v1.json diff).
2. Fix all SPA readers of drifted fields (grep web/src for `fFmpeg`/`fFprobe`/`rFrameRate`/
`zIndex`; at minimum ChannelEditScreen + remove the #145 escape hatch in
PlaybackTroubleshootingScreen) and their test mocks; verify each candidate field against a
live scratch instance (curl) — the single-leading-cap ones (`zIndex`, `rFrameRate`) may not
actually drift.
3. Add the CI guard from the issue: a test that round-trips a known DTO through the real MVC
serializer and asserts the OpenAPI schema uses those exact keys.
4. Live-E2E the channel editor with 2 profiles (the repro case) + playback screen preselect.
5. Full PR routine; close #198.
## Known facts (2026-07-08 — re-verify cheaply)
- main = 4c58e19b (+ this doc commit); ErsatzTV.Tests 913 / web 369 / Core.Tests 493(+1) / Arch 5
all green. PR #196 (docs-first rule + `docs-reminder` CI job) merged.
- v26.6.0 tagged (deploy = user bumps Komodo pin). CI runner = VM 127, retuned + verified stable
(#570 resolved; ~9 min warm build).
- Open follow-ups: #193 (rerun existence-check, S). #99 (TS/HLS-Direct sessions) still backlog —
likely relevant to #145's diagnostics.
- **NU1903 `Microsoft.OpenApi` 2.0.0 (GHSA-v5pm-xwqc-g5wc)** — a HIGH-CVSS advisory that appears as
a build warning. Assessed 2026-07-08: **DoS-only** (stack overflow) reachable ONLY by *parsing*
an untrusted OpenAPI doc with circular `$ref`s; we only GENERATE our own spec (transitive via
`Microsoft.AspNetCore.OpenApi` 10.0.2), so it's **not reachable** — correctly non-blocking under
the #8 policy (`Directory.Build.props` exempts NU1901–1903; criticals/NU1904 still block). Fixed
in `Microsoft.OpenApi` 2.7.5. LOW-PRIORITY hygiene: let Renovate bump it, or pin `Microsoft.OpenApi`
2.7.5 as a transitive override in `Directory.Packages.props` (SQLitePCLRaw precedent) + rebuild &
confirm `v1.json` is byte-identical. Not urgent.
- #91 phase (b) gated ONLY on #145 now.
## Task 2 (warm-up/interleave) — #193 rerun-collection existence check [S, backend]
Per issue: existence pre-check for `selectedId` per selection type in RerunCollection
create/update → 404/422 ProblemDetails instead of dangling FK/500. api-conventions §3
precedent. Can ride as its own small PR.
## On completion — REQUIRED last step
Update THIS handoff (pop #198/#193, promote the #91 phase-(b) queue item), commit to main,
print the next prompt in a fenced code block.
---
## Issue queue (work top-down)
1. **#198** casing drift + **#193** rerun existence-check ← PROMPT above.
2. **#91 phase (b)** Blazor removal — HARD GATE: cold adversarial plan review first (brief in
the #91 gate comment; run `/review` from `~/adversarial-reviewer`, zero shared context,
findings via `/dispatch`, MUST-FIXes resolved before implementation). Then: redirect the
Section-2 routes in docs/blazor-route-parity.md, delete Blazor pages/MudBlazor deps
(also kills the 3 deprecated Renovate-dashboard packages incl. MediatR.Courier), update
docs. Likely its own session (or two: review, then removal).
3. **#197** cold API contract+security review — runs when MCP PR #76 stabilizes; HARD GATE on
#58 close/go-live and MANDATORY before any remote exposure.
4. Backlog: #99 (TS/HLS-Direct session tracking — makes channel-state `onAir` universal),
#66 (artwork magic-byte sniffing), backlog nits (unclamped pageSize, 30 MB bare 413,
PlayoutController route Name=/lightweight exists-check, guide 21-include eager-load +
fillerKind notes — see #85/#102 issue comments).
Cross-refs: v26.6.0 deploy = Komodo pin bump (server-management). Real-transcode E2E of the
playback screen: do once on the test container (`ersatztv-test` runs `:latest`) — local ffmpeg
8.1.2 lacks subtitles/zscale filters.