Files
ersatztv/web
timothy 539fcde902 feat(807): SPA full-replace bodies are built as Complete<T>
The six SPA screens that hand-build write-request objects field-by-field could
silently drop a DTO field on a full-replace write — #754's mechanism narrowed to
optional fields, filed as residue by `testing.full-replace-asserts-field-list`.

The premise that residue was filed on turned out to be wrong, and the correction
is the more useful half. The mechanism was LATENT, not live: the OpenAPI type
generator renders a nullable DTO property as a required member of a nullable type
(`"name": null | string`), not as an optional one, and none of the eleven request
schemas these builders target declares a single `?:` member. tsc was already
checking all of them. But it was doing so contingently — on a generator behaviour
nothing asserts, for a set of DTOs none of which had yet acquired an optional
property. Optional members already occur elsewhere in the same generated file, so
the contingency was one modelling decision away from lapsing silently.

`Complete<T>` removes the contingency rather than asserting the generator's
current behaviour: it maps a request type so every member is required, making an
omission a hard error however the generator emitted it. Applied at the
full-replace wrapper boundary so future callers inherit it without knowing it
exists, and at each construction site, which is what keeps the excess-property
(phantom-field) direction alive — two sites had lost it by building through an
inferred local or a spread rather than a fresh annotated literal.

Measured, not argued: injecting an optional member into `ScheduleItemRequest`
reddens `normalizeForSave` with TS2741 under `Complete<T>` and compiles CLEAN
without it. Mutating `Complete<T>` to drop `Required` reddens the guard's case 2;
`Partial<T>` reddens cases 2 and 4. Case 4 does not discriminate against the
realistic mutation and the guard says so, because no real request type can today
— which is the contingency itself.

The proof ships as `@ts-expect-error` cases re-executed on every `npm run
typecheck` (a marked CI step), not witnessed once by hand.

Verification: typecheck clean, eslint clean, 1200 web tests pass (new guard test
confirmed executed by name), 833 scripts/tests pass.

fixes #807

Decisions-Edit: yes
2026-08-23 01:36:31 +02:00
..
2026-07-07 10:05:39 +02:00
2026-07-02 18:36:56 +02:00
2026-07-07 10:05:39 +02:00