--- key: release.api-contract-ci-gate title: 2026-07-12 — Blocking CI gate for API-contract artifacts (#303 H4/H5) status: active since: '2026-07-12' supersedes: none superseded-by: none rule: A PR touching `ErsatzTV/Controllers/Api/**` or `ErsatzTV.Core/Api/**` must ship regenerated OpenAPI artifacts (`v1.json`, `v1.d.ts`, `endpoint-index.md`) in the same diff, enforced by a blocking `api-docs` CI job that regenerates-and-diffs against a fresh build. signals: 'OpenAPI drift gate, blocking CI, api-docs job · paths: `ErsatzTV/wwwroot/openapi/v1.json`, `web/src/api/generated/v1.d.ts`, `docs/endpoint-index.md` · issues: #303 (H4/H5)' mechanics: '`docs/api-conventions.md` §5; `scripts/update-openapi.sh`; `.gitea/workflows` `api-docs` job' --- **A PR whose diff touches `ErsatzTV/Controllers/Api/**` or `ErsatzTV.Core/Api/**` must ship the regenerated OpenAPI artifacts in that same diff, enforced by a blocking `api-docs` CI job.** It rebuilds `ErsatzTV/wwwroot/openapi/v1.json`, `web/src/api/generated/v1.d.ts`, and `docs/endpoint-index.md` from source and fails on any drift. This mechanizes the previously prose-only "docs-update in the same PR" rule for the API contract (the `docs-reminder` job stays a non-blocking nudge for the route-parity doc). Path-gated *inside* the job (not via a top-level `if:`) so it always reports a status on every PR — API-free PRs skip the expensive regen and pass trivially, so it is safe as a required check. Rationale: generation is deterministic from a **fresh** build (verified — a clean checkout reproduces the committed spec exactly, including the 244 auth `security`/`401` blocks), so CI can trust regenerate-and-diff. The one caveat is local-only: `update-openapi.sh` runs `dotnet-getdocument` against the already-built assembly, so a stale `bin/` silently yields a stale spec — always `dotnet build` first (see `api-conventions.md` §5). CI is immune (no `bin/` on a fresh checkout).