docs: advance ChicoryTV issue queue past #102 (PR #119); next prompt = SPA stack merge pass

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 07:45:34 +02:00
co-authored by Claude Fable 5
parent a867eecaa5
commit f6306d622f
+98 -132
View File
@@ -1,172 +1,138 @@
# ChicoryTV issue-queue handoff (living document)
Paste the prompt below into a fresh session to work the next issue. Each session ends by
UPDATING THIS FILE in place (rewrite the "Issue #N state" section and the queue for the next
issue) so it always holds the current handoff. History: created 2026-07-02 after the plan audit
(#59 epic) filed backend gap issues #100–#111; a 7–9-way parallel workflow build once exhausted
RAM, so builds are limited to 2–3 concurrent, never wide fan-outs. Done so far: #97 (PR #112,
still stacked on docs/59-ui-redesign-brief), #105 (PR #113), #108 (PR #114), #100+#101+#107+#110
(PR #116), #103+#106 (PR #115, Codex), #104 (PR #117), #111 (PR #118, implemented by Codex,
reviewed/finished/merged by Claude). All merged to main and closed as of 2026-07-04.
Paste the prompt below into a fresh session to work the next item. Each session ends by
UPDATING THIS FILE in place (rewrite the state section and the queue for the next item) so it
always holds the current handoff. History: created 2026-07-02 after the plan audit (#59 epic)
filed backend gap issues #100–#111; a 7–9-way parallel workflow build once exhausted RAM, so
builds are limited to 2–3 concurrent, never wide fan-outs. Done so far: #97 (PR #112, still
stacked on docs/59-ui-redesign-brief), #105 (PR #113), #108 (PR #114), #100+#101+#107+#110
(PR #116), #103+#106 (PR #115, Codex), #104 (PR #117), #111 (PR #118), #102 (PR #119 — the
last backend gap issue). All backend issues merged to main and closed as of 2026-07-04.
**Session state (2026-07-04)**: Codex usage is EXHAUSTED — no more parallel Codex sessions;
this handoff now carries a SINGLE prompt per session. main is at 43f81d3a (post-#118) with the
full backend read API + artwork upload; ErsatzTV.Tests on main = 312 tests, all green.
Remaining pre-seeded WIP branch: feat/102-json-guide only.
**Session state (2026-07-04, post-#102)**: Codex usage is EXHAUSTED — single prompt per
session. main is at 6f6f37b7 (post-#119): FULL backend read API + artwork upload + JSON guide.
ErsatzTV.Tests on main = 323 tests; ErsatzTV.Core.Tests = 488 (+1 skipped) — all green.
No pre-seeded WIP branches remain. Worktree .worktrees/issue-97-channel-state-api still
exists for open PR #112 (targets docs/59-ui-redesign-brief); .worktrees/feat-102 is merged
(remove it). The docs/59-ui-redesign-brief branch (this file's branch) carries the SPA
foundation (web/) + #96/#98 + PR-#112-pending #97 — none of it on main yet → MERGE PASS is
the next item.
**Lessons for all remaining prompts** (accumulated from #116/#104/#111 reviews):
**Lessons for all remaining prompts** (accumulated from #116/#104/#111/#102 reviews):
- DTO records in ErsatzTV.Core/Api MUST get file-scoped `#nullable enable` — with the project
default Nullable=disable the regenerated OpenAPI documents every string as `["null","string"]`
(breaks SPA typegen with needless `| null`); with it, non-`?` properties emit plain `string`.
This exact miss was the one MAJOR in the #104 review. Precedent:
ErsatzTV.Core/Api/Playouts/PlayoutResponseModel.cs.
Precedent: ErsatzTV.Core/Api/Playouts/PlayoutResponseModel.cs. NOTE (#102): ErsatzTV.Application
has NO nullable context — `string?` there trips CS8632; returning null from a plain `string`
method is fine and the DTO's `string?` param keeps the spec nullable.
- NSubstitute + ConfigElementKey (#102): `ConfigElementKey.X` returns a FRESH instance per
access (reference equality) — stubbing `GetValue<T>(ConfigElementKey.X, …)` never matches.
Use `Arg.Any<ConfigElementKey>()` disambiguated by the generic `<T>` (precedent:
FFmpegProfileHandlerTests).
- `Option<T>.ToNullable()` does NOT exist in this LanguageExt version; Option→nullable is
`MatchUnsafe(v => (T?)v, () => null)` (idiom: ErsatzTV.Application/Health/Mapper.cs). Plain
`Match` throws ResultIsNullException on a null-returning branch.
- ./scripts/update-openapi.sh runs `dotnet build -t:GenerateOpenApiDocuments` ONLY — after
editing code, run a normal `dotnet build ErsatzTV/ErsatzTV.csproj` FIRST or the script fails
with MSB3680 ("ErsatzTV.json does not exist": the rename target runs but generation was
skipped against the stale build).
with MSB3680.
- Id-taking child-collection GETs 404 on unknown parent via a pre-check + ApiResults
(precedent: ScheduleController.GetItems, PlayoutController.GetItems) + an
OpenApiErrorResponseContractTests [TestCase] entry.
- Backlog nits (not filed as issues yet): pageSize is unclamped on all paged endpoints;
PlayoutController Create/Delete lack route Name=; PlayoutController.GetItems' existence
pre-check reuses GetPlayoutById (3 Includes) instead of a lightweight exists query;
uploads >30 MB hit Kestrel's default cap and return a bare 413 (no ProblemDetails) — an
operator raising ETV_MAXIMUM_UPLOAD_MB past 30 silently can't take effect; artwork
content-type is trusted from the client header (magic-byte sniffing = #66); schedule
duration estimator: expression-based `Count` and `Count="0"` both yield null estimates,
and it fully materializes each referenced collection per GET (SQL aggregate if ever polled).
uploads >30 MB hit Kestrel's default cap and return a bare 413 (no ProblemDetails);
artwork content-type is trusted from the client header (magic-byte sniffing = #66);
schedule duration estimator: expression-based `Count` and `Count="0"` both yield null
estimates, and it fully materializes each referenced collection per GET.
NEW from #102 (also commented on #85): GET /api/guide runs the full 21-include
eager-load per channel per request (loads artwork/genres/guids the JSON never uses) —
trim the projection or add caching before the EPG grid polls it; and `fillerKind` in the
JSON guide is almost always `None` because the shared projector merges filler into
adjacent programmes (the no-drift requirement) — discrete filler entries need a JSON-only
projection mode (follow-up if #85 wants them).
---
# PROMPT — Finish issue #102 — JSON guide endpoint (the hardest one)
# PROMPT — MERGE PASS: land the docs/59-ui-redesign-brief SPA stack on main
You are the ORCHESTRATOR in the main conversation (Fable). Fable is EXPENSIVE — reserve it for
orchestration decisions and the adversarial review; DELEGATE the bulk work to cheaper models:
- Recon/reads (issue body, WIP diff, RefreshChannelDataHandler + XMLTV pipeline study):
Explore agent or model: haiku.
- Implementation (shared projection extraction, handler, DTOs, controller, tests): Agent with
model: sonnet (opus only if sonnet's attempt fails review twice). Give it exact file paths,
conventions, and the diff. For the projection-extraction refactor specifically, consider
opus first — it touches the XMLTV generation path guarded by golden tests.
- Mechanical chores (regen scripts, commit wording, API curls): inline, no Fable subagents.
- Adversarial review (final review step): the ONE place to use a fable subagent (read-only,
high effort).
You are the ORCHESTRATOR in the main conversation (Fable). Fable is EXPENSIVE — delegate bulk
work to cheaper models; use ONE fable subagent only for the final read-only review. This
session is mostly git surgery + verification, so much of it is fine inline.
HARD CONSTRAINTS:
- Never 5+ simultaneous dotnet builds MACHINE-WIDE; 2–3 concurrent are fine. No Codex session
runs in parallel anymore (usage exhausted) — but the user may be working in the main checkout.
- Do NOT use the Workflow tool. Sequential Agent calls or inline work only.
- Do NOT regenerate the XMLTV/M3U golden files (ETV_UPDATE_GOLDENS) — they are the regression
net for this exact refactor. A golden diff means the refactor changed guide output: fix the
code, not the goldens.
- Never 5+ simultaneous dotnet builds machine-wide; 2–3 concurrent fine. No Workflow tool.
- Do NOT regenerate XMLTV/M3U goldens (ETV_UPDATE_GOLDENS) — a golden diff means broken code.
- The user may be working in the main checkout (/Users/timothy/ersatztv, currently on
docs/59-ui-redesign-brief). Do git surgery in a WORKTREE, and coordinate before checking
out branches in the main tree.
- Merging PRs needs a fresh one-word "merge" consent from the user per PR.
- End by updating this handoff file (see "On completion").
- Merging your own green PR will be blocked by the permission classifier — ask the user for a
one-word "merge" consent (they pre-approved "merge when tests are green and issue complete"
last session, but consent doesn't carry across sessions).
## Project context (read CLAUDE.md first; docs/contributing.md + docs/rest-api.md before code)
## Project context (read CLAUDE.md first)
- Repo: /Users/timothy/ersatztv — ErsatzTV fork (.NET 10, CQRS/MediatR, LanguageExt, EF Core),
being rebuilt as React SPA "ChicoryTV" (web/) over its REST API. Gitea:
rebuilt as React SPA "ChicoryTV" (web/) over the REST API. Gitea:
http://192.168.1.95:3000/timothy/ersatztv (API auth: basic timothy:ded89Lm4).
- Tests: NUnit + Shouldly + NSubstitute in ErsatzTV.Tests (NOT xUnit). Error contract:
ProblemDetails; 404 title "Resource not found", 422 "Validation failed". main has 312 tests
green. XMLTV golden tests live in ErsatzTV.Core.Tests (ChannelGuideGoldenTests) — run that
project too when touching guide code: TZ=UTC dotnet test ErsatzTV.Core.Tests.
- OpenAPI regen: ./scripts/update-openapi.sh — run a normal
`dotnet build ErsatzTV/ErsatzTV.csproj` first or it fails with MSB3680 (see Lessons above).
origin/main has NO web/ dir — SKIP web type-regen steps.
- BRANCH TOPOLOGY: origin/main (43f81d3a) has the full backend API through #104/#111. The
docs/59-ui-redesign-brief branch carries the SPA foundation + #96/#98; PR #112 (#97) targets
it — all unmerged to main. feat/102-json-guide is based on the PRE-#113 origin/main:
REBASE onto origin/main first — v1.json WILL conflict; resolve by taking either side and
re-running the regen at the end (regen is authoritative).
- Patterns proven in #97/#105/#108/#116/#104/#111: 200-only GETs use typed returns with
`[HttpGet("/api/...", Name = "...")]`, `[Tags]`, `[EndpointSummary]`,
`[EndpointGroupName("general")]` (precedent: PlayoutController, FillerPresetController);
endpoints that can 404/422 use ApiResults/ProblemDetails + an
OpenApiErrorResponseContractTests [TestCase] entry; DTO records in ErsatzTV.Core/Api/...
with file-scoped `#nullable enable` (see Lessons — this was the #104 review MAJOR); handler
tests use ErsatzTV.Tests/Support/InMemoryTvContext; controller tests assert route template +
Name + mediator pass-through (ErsatzTV.Tests/Controllers/PlayoutControllerTests.cs).
Branch protection: PR must pass "Build & test (.NET)" to merge.
- **LanguageExt traps**: `Option<T>.Match` THROWS if a branch returns null — use
`MatchUnsafe(v => (T?)v, () => null)`; `Option<T>.ToNullable()` does not exist.
## Issue state (UNTRUSTED WIP — review before trusting anything)
- Branch feat/102-json-guide covers #102 (JSON guide/EPG endpoint; unblocks #85 EPG screen).
Read the issue body + comments via the Gitea API before anything else.
- The branch has a "wip: partial implementation salvaged from interrupted workflow run"
commit — never built, never tested. Prior WIPs in this series ranged from structurally-sound
(#104) to needing controller fixes; audit every file.
- The hard part: the XMLTV guide is produced by
ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs fed by data assembled in
RefreshChannelDataHandler — #102 wants a JSON guide endpoint sharing that projection WITHOUT
duplicating it and WITHOUT changing XMLTV output. The XMLTV goldens
(ChannelGuideGoldenTests in ErsatzTV.Core.Tests) are the regression net: they must pass
UNCHANGED. Run them before starting (baseline) and after every refactor step.
- Session pattern that worked for #104/#108/#116: recon brief (haiku) → sonnet/opus
implement+test → inline verify + regen → fable adversarial review → fix majors inline →
amend/push → PR.
- Work in a worktree: git worktree add .worktrees/feat-102 feat/102-json-guide.
Worktrees to LEAVE ALONE: .worktrees/issue-97-channel-state-api (open PR #112). Stale
merged worktrees (.worktrees/feat-111, .worktrees/feat-103) may still exist — ignore or
`git worktree remove` them, they're merged.
- main = 6f6f37b7 (post PR #119/#102): complete backend API. ErsatzTV.Tests 323 green;
ErsatzTV.Core.Tests 488 green (+1 skipped). Branch protection: PRs need "Build & test
(.NET)" green.
- docs/59-ui-redesign-brief (a867eeca before this session's doc commits) carries: the #59
brief/design docs, design-system/, the SPA foundation web/ (#78–#83), and backend bits
#96/#98 that were later ALSO landed on main via the feat/* PRs — expect overlap/conflicts.
- PR #112 (issue #97, channel state API) targets docs/59-ui-redesign-brief and is OPEN;
its worktree is .worktrees/issue-97-channel-state-api. #97's endpoints may ALSO overlap
with what later landed on main — diff before merging.
## Plan
1. RECON [Explore agent or haiku]: fetch #102 body+comments; diff
origin/main...origin/feat/102-json-guide; map the XMLTV data flow
(RefreshChannelDataHandler → GetChannelGuideHandler → goldens) and what the WIP extracted;
structured brief with per-file WIP verdicts + a proposed extraction seam that leaves XMLTV
byte-identical.
2. IMPLEMENT/FIX [Agent, sonnet or opus — see above]: rebase onto origin/main (v1.json
conflict — any resolution, regen wins later), then fix/complete per recon. Handler tests
(InMemoryTvContext) + controller tests; contract-test entries for any 404/422. One build
slot. Golden tests must pass unchanged at every step.
3. VERIFY [inline]: dotnet build ErsatzTV.sln; TZ=UTC dotnet test on ErsatzTV.Tests AND
ErsatzTV.Core.Tests (goldens); dotnet build ErsatzTV/ErsatzTV.csproj then
./scripts/update-openapi.sh; re-test; commit.
4. FINAL REVIEW [fable subagent, high effort, read-only]: diff origin/main...HEAD. Focus:
XMLTV output preservation (is the shared projection truly identical — timezone handling,
{RequestBase}/{AccessTokenUri} substitution, etv-tag strip, ShowInEpg, decimal channel
ordering?), duplication vs extraction quality, error contract, DTO nullability vs the
regenerated spec, pagination/time-window semantics of the JSON endpoint, test
meaningfulness. Fix blockers/majors (+ quick minors), re-verify, push.
5. PR against main [inline]: title "feat(api): JSON channel guide endpoint (#102)", body with
endpoint + review verdict, "fixes #102", footer
"🤖 Generated with [Claude Code](https://claude.com/claude-code)". Poll
.../actions/runs?limit=10 by head_sha (zsh: don't name a variable `status`). Ask for
one-word "merge" consent when green; after merge verify main's post-merge run is also green.
6. Comment on #102 as you work + closing comment per CLAUDE.md Task Completion Protocol.
1. RECON [Explore/haiku]: map the divergence — git log/diff main...docs/59-ui-redesign-brief
(which commits are docs/web-only, which touch backend files that main since changed);
same for PR #112's diff vs main (did #100/#116 already land equivalent channel-state
endpoints?). Product: a conflict forecast + recommendation (rebase vs merge main into the
stack; whether #112 still adds value or needs slimming to the delta).
2. MERGE #112 [inline, after consent]: if it still adds value, merge PR #112 into
docs/59-ui-redesign-brief (ask "merge"); else close it with an explanatory comment and
cherry-pick any residual delta.
3. REBASE/RECONCILE [worktree]: git worktree add .worktrees/merge-pass docs/59-ui-redesign-brief
(after user OK, since the main checkout sits on that branch — safer: do the work on a NEW
branch, e.g. feat/59-spa-foundation, from the same head). Rebase or merge onto main
(recon decides; a single merge commit is acceptable for a long-lived stack). v1.json:
take main's, then re-run ./scripts/update-openapi.sh at the end (regen is authoritative).
web/ SPA types: regen from the final v1.json (web/ has the typegen script — check
web/package.json; main's v1.json now includes everything through /api/guide).
4. VERIFY [inline]: dotnet build ErsatzTV.sln; TZ=UTC dotnet test ErsatzTV.Tests +
ErsatzTV.Core.Tests; web/: npm ci + typecheck/build if the stack has them.
5. REVIEW [fable subagent, read-only]: the RECONCILIATION diff only (what changed vs both
parents) — dropped commits, double-applied backend code, stale SPA types, v1.json drift.
6. PR the stack → main [inline]: title "feat(web): ChicoryTV SPA foundation (#59 stack)",
body listing the SPA issues it closes (#78–#83, #96, #98, #97 if #112 merged), poll CI by
head_sha, ask "merge" consent, then verify main's post-merge run. Comment on/close the
covered issues per the Task Completion Protocol.
7. Cleanup: remove merged worktrees (.worktrees/feat-102, .worktrees/issue-97-* once #112
is resolved).
## On completion — REQUIRED last step
Update docs/handoffs/chicorytv-issue-queue.md in place: pop #102, write the next prompt (next
up is the MERGE PASS for the docs/59-ui-redesign-brief stack — see queue item 2), and record
anything the next session must know (PR numbers, branch/CI state). Commit+push the doc update
to docs/59-ui-redesign-brief. Print the new prompt in a fenced code block.
Update docs/handoffs/chicorytv-issue-queue.md in place: pop the merge pass, write the next
prompt (#109 Dashboard follow-up — see queue item 2 and its /api/health polling note), record
PR numbers + the new main SHA + where web/ lives now. Commit+push the doc update (to main if
the stack landed, else to docs/59-ui-redesign-brief). Print the new prompt in a fenced code
block.
---
## Issue queue (work top-down)
Single-session now (Codex usage exhausted). feat/102-json-guide is the LAST pre-seeded WIP
branch ("wip: partial implementation salvaged from interrupted workflow run" — untrusted,
never built/tested; based on PRE-#113 main, so it conflicts on v1.json: rebase and let the
regen win).
1. #102 JSON guide endpoint — feat/102-json-guide ← PROMPT above (hardest; unblocks #85)
2. MERGE PASS: merge PR #112 (#97) into docs/59-ui-redesign-brief, rebase that stack onto
current main once, and PR the stack to main (auto-closes #97 and validates the closed SPA
issues #78–#83/#96/#98 on main). All backend feat/* PRs are already merged.
3. #109 Dashboard follow-up (frontend; needs merge pass done). NOTE from #108: GET /api/health
Single-session (Codex usage exhausted). No pre-seeded WIP branches remain.
1. MERGE PASS: PR #112 (#97) + docs/59-ui-redesign-brief stack → main ← PROMPT above
(validates SPA issues #78–#83/#96/#98 on main; unblocks all frontend work).
2. #109 Dashboard follow-up (frontend; needs merge pass). NOTE from #108: GET /api/health
re-runs all ~14 checks per request (only the warn/error summary is cached) — the SPA
footer/Dashboard must load on demand or poll gently; add a TTL cache first if it needs to poll.
4. Back to UX conversion: #84 Channels (deps #96/#98/#97 now available) → #86 Schedule editor
(duration estimates from #111 available) → #87 Playouts → #88 Libraries → #85 EPG (needs
#102) → #89 Channel Builder (artwork upload from #104 available; also needs #62: #63/#64/#65)
→ #93 Settings → #90 rebrand → #91 cutover.
3. Back to UX conversion: #84 Channels (deps #96/#98/#97 available post-merge-pass) → #86
Schedule editor (duration estimates from #111) → #87 Playouts → #88 Libraries → #85 EPG
(JSON guide from #102 available — mind the fillerKind + per-request-cost notes above) →
#89 Channel Builder (artwork upload from #104; also needs #62: #63/#64/#65) → #93 Settings
→ #90 rebrand → #91 cutover.
Cross-refs: #99 (TS/HLS-Direct sessions) stays backlog; "Definition of Ready" for screen issues
lives in the #59 epic body. Done: #105 (PR #113), #108 (PR #114), #100+#101+#107+#110 (PR #116),
#103+#106 (PR #115), #104 (PR #117, artwork upload POST /api/artwork/uploads — unblocks #89),
#111 (PR #118, GET /api/schedules/{id}/items envelope with durationEstimate/totalDurationEstimate
— unblocks #86). Languages-list endpoint from #105 still unimplemented — open a follow-up when
#103+#106 (PR #115), #104 (PR #117, artwork upload — unblocks #89), #111 (PR #118, schedule item
duration estimates — unblocks #86), #102 (PR #119, GET /api/guide + shared ChannelGuideProjector —
unblocks #85). Languages-list endpoint from #105 still unimplemented — open a follow-up when
#86/#89 need it; filler/watermark lists return DB order — SPA should client-sort.