ci: advisory functional-E2E curl harness (#299) #362

Merged
timothy merged 1 commits from functional-e2e/299 into main 2026-07-16 14:00:06 +02:00
Owner

Fixes #299 (first cut).

Codifies the manual live-E2E curl flows into a CI regression net.

What

  • New functional-e2e CI job (.gitea/workflows/docker-build.yml): builds SPA + solution (Release), ensures ffmpeg, boots dotnet ErsatzTV.dll via scripts/e2e-local.sh (now ETV_BUILD_CONFIG-parameterized), runs the harness, traps-kills the instance.
  • New scripts/e2e-functional.sh: the assertions — runs identically locally and in CI.

Contracts asserted (curl-only, deterministic — no seeded media / ffmpeg-transcode / browser)

  • Legacy->SPA redirects: representative sweep 302->/app/* + the /api,/artwork never-redirect exemption.
  • Auth/CSRF/security-stamp: setup-claim 200 / re-claim 409, read-gate 401->200, session-mutation 403-without-X-CSRF, login 401/200, logout 403/204, post-logout stamp-revocation 401.
  • Library-scan status contract: unknown-lib 404, empty-lib queue 202, scan-status 200.
  • If-Match/412: rerun-collections GET-ETag -> stale 412 / current 200 / malformed 400.

Design decisions

  • Boot from source, not the built image — the image is only built on main/v*, so a PR must build its own code. Reuses e2e-local.sh so the harness is the same by hand and in CI.
  • Advisory — separate job, not a build needs:, not a required check, so a flake can't block the unit-test gate; promote once proven (migrations-job rollout precedent). SQLite default -> no DB service.
  • Deferred to #299 follow-ups (need scanner+seeded media or a browser to be non-racy): the 409 "already-scanning" re-trigger, playout-build lock 409, Playwright UI-interactive flows.

Verification

  • Harness 30/30 green against a real Release-built instance locally (both Debug and Release build configs).
  • Probing the live instance caught a real discrepancy vs a static read: /artwork/* returns 400, not 404 — assertions match observed behavior.

Docs (same PR)

  • docs/ci-cd.md — new job subsection.
  • docs/e2e-local.md — harness usage + ETV_BUILD_CONFIG.
  • docs/decisions.md — append-only entry.

No .cs or /api/* surface change (format / api-docs CI jobs skip). Pure CI + scripts + docs.

Generated with Claude Code (Opus 4.8)

Fixes #299 (first cut). Codifies the manual live-E2E curl flows into a CI regression net. ## What - **New `functional-e2e` CI job** (`.gitea/workflows/docker-build.yml`): builds SPA + solution (Release), ensures ffmpeg, boots `dotnet ErsatzTV.dll` via `scripts/e2e-local.sh` (now `ETV_BUILD_CONFIG`-parameterized), runs the harness, traps-kills the instance. - **New `scripts/e2e-functional.sh`**: the assertions — runs identically locally and in CI. ## Contracts asserted (curl-only, deterministic — no seeded media / ffmpeg-transcode / browser) - **Legacy->SPA redirects**: representative sweep 302->`/app/*` + the `/api`,`/artwork` never-redirect exemption. - **Auth/CSRF/security-stamp**: setup-claim 200 / re-claim 409, read-gate 401->200, session-mutation 403-without-`X-CSRF`, login 401/200, logout 403/204, post-logout stamp-revocation 401. - **Library-scan status contract**: unknown-lib 404, empty-lib queue 202, `scan-status` 200. - **If-Match/412**: `rerun-collections` GET-ETag -> stale 412 / current 200 / malformed 400. ## Design decisions - **Boot from source, not the built image** — the image is only built on main/`v*`, so a PR must build its own code. Reuses `e2e-local.sh` so the harness is the same by hand and in CI. - **Advisory** — separate job, not a `build` `needs:`, not a required check, so a flake can't block the unit-test gate; promote once proven (migrations-job rollout precedent). SQLite default -> no DB service. - **Deferred to #299 follow-ups** (need scanner+seeded media or a browser to be non-racy): the 409 "already-scanning" re-trigger, playout-build lock 409, Playwright UI-interactive flows. ## Verification - Harness **30/30 green** against a real Release-built instance locally (both Debug and Release build configs). - Probing the live instance caught a real discrepancy vs a static read: `/artwork/*` returns **400**, not 404 — assertions match observed behavior. ## Docs (same PR) - `docs/ci-cd.md` — new job subsection. - `docs/e2e-local.md` — harness usage + `ETV_BUILD_CONFIG`. - `docs/decisions.md` — append-only entry. No `.cs` or `/api/*` surface change (format / api-docs CI jobs skip). Pure CI + scripts + docs. Generated with Claude Code (Opus 4.8)
Author
Owner

Cold-context adversarial review (review-only, independent) complete. Traced every one of the 30 assertions back to the real controllers/DTOs and stress-tested the failure modes; the headline question — can any assertion pass vacuously — is no (connection failure yields curl 000 which never equals an expected 2xx/4xx; redirect checks require positive 302 + exact Location evidence). Confirmed the FD/PID/trap launch wiring cannot hang the command-substitution, the if:/ETV_BUILD_CONFIG=Release CI wiring is correct, and the docs are accurate + decisions.md is insertion-only.

No Critical/High/Medium findings. Two Low config-drift observations (create bodies omit required mediaKind/paths — works today, would fail loudly if validation tightens; advisory-status hinges on branch-protection config outside this diff) and three nits (defensive ffmpeg apt install, double-curl per redirect, uncleaned mktemp temps) — all non-blocking, no code change needed.

Review-verdict: MERGEABLE @ a0e47b5425c8bdb29b80bfc5f74a20e4d0758719

Cold-context adversarial review (review-only, independent) complete. Traced every one of the 30 assertions back to the real controllers/DTOs and stress-tested the failure modes; the headline question — can any assertion pass vacuously — is **no** (connection failure yields curl `000` which never equals an expected 2xx/4xx; redirect checks require positive `302 + exact Location` evidence). Confirmed the FD/PID/`trap` launch wiring cannot hang the command-substitution, the `if:`/`ETV_BUILD_CONFIG=Release` CI wiring is correct, and the docs are accurate + `decisions.md` is insertion-only. No Critical/High/Medium findings. Two Low config-drift observations (create bodies omit `required` mediaKind/paths — works today, would fail *loudly* if validation tightens; advisory-status hinges on branch-protection config outside this diff) and three nits (defensive ffmpeg apt install, double-curl per redirect, uncleaned mktemp temps) — all non-blocking, no code change needed. Review-verdict: MERGEABLE @ a0e47b5425c8bdb29b80bfc5f74a20e4d0758719
timothy force-pushed functional-e2e/299 from a0e47b5425 to dd0c9ddd51 2026-07-16 13:48:48 +02:00 Compare
timothy force-pushed functional-e2e/299 from dd0c9ddd51 to 0d7803079c 2026-07-16 13:49:47 +02:00 Compare
Author
Owner

Rebased onto origin/main (main advanced with the #247 shell/routing merge). The rebase's only conflict was a pure append in docs/decisions.md (both PRs added a dated entry) — resolved by keeping both entries in date order, TOC append-only intact. The 5 reviewed non-docs files (docker-build.yml, both scripts, ci-cd.md, e2e-local.md) are byte-identical to the reviewed commit (git diff a0e47b54 HEAD -- <those files> is empty); decisions.md only gained #247's coexisting entry + a blank-line separator. No change to reviewed substance.

Re-attesting at the new head:

Review-verdict: MERGEABLE @ 0d7803079c

Rebased onto origin/main (main advanced with the #247 shell/routing merge). The rebase's only conflict was a pure append in `docs/decisions.md` (both PRs added a dated entry) — resolved by keeping both entries in date order, TOC append-only intact. The 5 reviewed non-docs files (`docker-build.yml`, both scripts, `ci-cd.md`, `e2e-local.md`) are **byte-identical** to the reviewed commit (`git diff a0e47b54 HEAD -- <those files>` is empty); `decisions.md` only gained #247's coexisting entry + a blank-line separator. No change to reviewed substance. Re-attesting at the new head: Review-verdict: MERGEABLE @ 0d7803079c61235abfd891aac0ebcb7f406c449f
timothy merged commit 0d7803079c into main 2026-07-16 14:00:06 +02:00
timothy deleted branch functional-e2e/299 2026-07-16 14:00:06 +02:00
Sign in to join this conversation.