Commit Graph
4 Commits
Author SHA1 Message Date
timothyandClaude Opus 5 9691f93056 fix(820): anchor the obligation at the WRAPPER, and correct what the first commit overclaimed
Cross-family cold review (Codex) returned BLOCKED on bafc8f65d with a working
bypass. It was right, and the fix is a different population, not a patch.

THE BLOCKER. Stating the obligation per-SCHEMA made it dischargeable from
anywhere. Demonstrated: strip `Complete<>` off the `updateFFmpegProfile` wrapper
and retype `ffmpegProfiles.test.ts`'s fixture to name `UpdateFFmpegProfileRequest`
— the Create/Update schemas are structurally identical and that fixture already
goes to both endpoints — and every assertion stayed green while the production
wrapper stopped protecting its callers. #820's Done-when asks for "construction
sites (or WRAPPER SIGNATURES)"; schemas are the weaker population, and that is
exactly the false green it permits.

So the wrappers are now derived too. `scanWriteWrappers` finds every exported
`web/src/api/*.ts` function with a `body` parameter and a mutating `method:`, and
`scanSchemaReferences` builds the schema graph so a body reaching a droppable
schema NESTED inside it counts — `MultiCollectionItemRequest` is reachable from
`UpdateMultiCollectionRequest`, not equal to it, and hand-listing that is the
thing this guard exists to avoid. A test-file annotation no longer discharges a
production obligation.

That found a SECOND live hole immediately: `createMultiCollection` took a bare
`CreateMultiCollectionRequest` whose `items` reach `MultiCollectionItemRequest.weight`.
`MultiCollectionsScreen` builds ONE body and sends it to both the create and the
full-replace update wrapper, so nothing was dropped in practice — the create
wrapper simply protected no future caller. One helper, two callers, opposite
widths. Now annotated.

Also from the review, each verified before acting on it:
- A one-line scope edit (`&& path !== 'src/api/playouts.ts'`) removed this
  guard's reach over the file whose defect motivated it while staying above every
  floor. Floors cannot see selective narrowing, so the load-bearing paths are
  pinned by name, and every tracked in-scope path must now be supplied by the
  glob — the inner join was silent before.
- Schema discovery was any property named `schemas` anywhere, so a `declare
  module` block could overwrite a real schema with an empty optional list.
  Constrained to `interface components`, and duplicate or computed-key schemas
  now THROW rather than silently shrinking the population.
- A local `type Complete<T> = T` would make annotations identity types while
  reading as covered; asserted against. An alias-name collision across files
  would credit the wrong schema; rejected rather than resolved last-write-wins.
- `CreateChannelFromLineupAdvancedOptionsRequest` was CREATE (permissive) while
  its own note said annotating would collapse a load-bearing third state. It is
  MUST-NOT-ANNOTATE, so the prohibition is asserted rather than described.

CORRECTIONS to bafc8f65d, which overstated in four places:
- "set equality against a reviewed disposition table" was true of the SCHEMA
  discovery only, never of where `Complete<>` is applied. Reworded everywhere.
- spa-conventions §4b said deleting an annotation reddens the suite. That was
  false for the per-site half and is now scoped to the wrapper half, with the
  construction-site half stated plainly as review-only.
- the guard-inventory row claimed tracked-file completeness "yes"; it is partial,
  and the row now says which half holds and which is only path-pinned.
- the decision record's BODY still described #820 as unbuilt while its own
  frontmatter said it was closed. Reconciled; both now name the wrapper/site split.
- "whole-suite time went 60s to 27s" was a single-run comparison whose slower arm
  contained a timing-out test. The memoisation is still right (the population was
  walked twice per call), but the number was not a controlled measurement and is
  dropped rather than defended.

Six mutations witnessed, each reddening its own assertion and only that one:
the two bypasses above, plus stripping a covered site, annotating a forbidden
schema, reverting a wrapper to a hand-written mirror, and deleting a disposition
row. They are hand-run, NOT re-executed per suite — this guard claims no standing
MUTATION grade, the same footing as pageSizeCallSites.guard.test.ts.

Residuals unchanged and still stated: the per-construction-site population is not
derived (#777), so the phantom direction rests on review; the two disposition
tables overlap rather than coincide; and a MUST-NOT-ANNOTATE violation written
inside a `*.guard.test.ts` is not caught, which changes no production behaviour.

Verified: web 1315 tests green, scripts/tests 1228 green (2 skipped), typecheck +
eslint + ruff clean, decisions-validate OK.

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UYNbVwgVszv6Pum7ZuGd75
2026-08-29 22:34:30 +02:00
timothyandClaude Opus 5 66b965a4b5 fix(820): derive the population of Complete<T> APPLICATIONS, not just its semantics
member fails typecheck. Two guards then existed and neither covered application.
`completeRequest.guard.test.ts` proves the TYPE's semantics and would stay green
with every annotation in the SPA deleted. `test_optional_request_members.py`
derives which schemas can silently drop a member and files each under a
disposition — one of which, COVERED, is worded "the builder is annotated
`Complete<T>`".

That wording was a claim about another language's source that nothing checked. A
COVERED row and a SPA with the annotation deleted were indistinguishable to the
whole suite, and §4b's opposite rule — do NOT annotate a schema whose optional
members are computed server-side — was prose with no executable form.

`completeAnnotations.guard.test.ts` closes both. The droppable-schema population
is read every run off the generated `v1.d.ts` with the compiler API; the
annotation population is read off the SPA AST, intersected with the git index.
Neither is a list. Set equality against a reviewed disposition table means a new
optional member fails until someone rules on it.

Why the compiler API and not a regex: `Complete<Foo>` also appears in doc
comments, string literals and the `import type` specifier. Those are three
different AST node kinds, so they are excluded structurally rather than by a
string predicate — the class this repo has a withdrawn guard (six rounds, then
deleted) recording the cost of.

It found a real defect on landing. `playouts.ts` declared
ReplacePlayoutTemplatesRequest and ReplacePlayoutAlternateSchedulesRequest as
hand-written object literals that SHADOWED generated schemas of the same name,
so `Complete<>` on those wrappers was checking a local mirror rather than the
contract — the #754 mechanism wearing the annotation meant to prevent it. They
narrowed `null | Array<T>` to `T[]` and dropped no field, which is why nothing
else saw them. Now aliased to the generated schemas; the stated reason for the
hand-written form (satisfying the `Record<string, unknown>` RequestBody bound)
never required re-declaring the shape, since an alias is already a `type`.

Four mutations witnessed, each reddening one assertion and only that one:
stripping `Complete<>` from a covered site (Done-when's witnessed red),
annotating the forbidden schema, reverting a wrapper to a hand-written mirror,
and deleting a disposition row. The scanner's own fixture suite is mutation-
proven separately, over synthetic sources, so its correctness does not depend on
what the repo happens to contain today.

A deep `Complete<T>` was probed and NOT taken. It works — measured against the
real generated types, it catches a missing NESTED member, preserves the `null`
arm of `null | Array<X>`, keeps explicit `undefined` legal and still rejects
phantoms — and flipping it repo-wide left one real gap, a test fixture omitting
`weight`. It is not shipped because it cannot be applied blanket-wise
(`UpdateChannelRequest.logo` reaches ArtworkContentTypeModel, where annotating
is a bug by §4b) and because it closes only the missing direction: the phantom
direction needs a fresh literal in a contextually typed position, which a
generic `.map` callback's return is not. Recorded so it is not re-proposed on
plausibility.

The guard passed in isolation and timed out at vitest's 5s default under
full-suite load, because the population was walked twice per call across four
tests. Memoised (module-level, immutable inputs, fresh process per run, so it
cannot mask a mutation) and given explicit per-test timeouts per
ci.web-test-per-test-timeouts. Whole-suite time went 60s to 27s.

Residuals stated rather than implied closed: this is per-SCHEMA, not
per-construction-site, so the phantom direction still rests on the §4b site rule
and review (sites-in-code is #777); and the two disposition tables overlap
rather than coincide (13 rows vs 9 — this side also sees response models), so
re-dispositioning one does not redden the other. What neither can miss is a
schema unnoticed by BOTH, since both derive from the same `required` arrays.

Verified: web 1297 tests green, scripts/tests 1228 green, typecheck + eslint +
ruff clean, decisions-validate OK.

fixes #820

Decisions-Edit: yes
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UYNbVwgVszv6Pum7ZuGd75
2026-08-29 22:34:30 +02:00
timothy 761e575836 fix(787): derive the dropped-step guard's scope, and reconcile its snapshot against the server (#861)
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / CI toolchain image resolves (push) Successful in 6s
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 21s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m45s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m22s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 5m56s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 4m33s
Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-27 22:37:02 +00:00
timothy 3e2c07b42f fix(807): SPA full-replace bodies are built as Complete&lt;T&gt;, with a derived guard over droppable request members (#827)
Build ErsatzTV Image / CI toolchain image resolves (push) Successful in 14s
Build ErsatzTV Image / Delimiter ban (release path) (push) Successful in 30s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 8m36s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 6m9s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (push) Successful in 5m49s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (push) Skipped
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (push) Skipped
Build ErsatzTV Image / Build & push image (amd64) (push) Failing after 15s
Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be>
2026-08-23 00:58:19 +00:00