docs(handoff): lore — post-commit invalidation on None + SetValues positional reconcile (#251, #252)
Build ErsatzTV Image / Docs update reminder (push) Has been skipped
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (push) Successful in 4m30s
Build ErsatzTV Image / Build & test (.NET) (push) Successful in 5m15s
Build ErsatzTV Image / Build & push image (amd64) (push) Successful in 3m30s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-11 15:28:29 +02:00
co-authored by Claude Opus 4.8
parent 87060aa3de
commit 06c877b5fc
+21
View File
@@ -185,3 +185,24 @@ HARD CONSTRAINTS:
always grep the build for `error CS` before trusting a `--no-build` test result. (Codex-found High
this session: an outer `catch` that unlocked unconditionally cross-released another session's lock on
a pre-acquisition exception — the fix was a Handle-scoped ownership flag gating the catch.)
- **Post-commit side-effect invalidation must run its QUERIES on `CancellationToken.None`, not just the
enqueue** (2026-07-11, #251, Codex-found Medium the fork missed): the deco-invalidation handlers committed
the edit on the request token (correct — a pre-commit cancel safely aborts), then queried the affected
playouts *also* on the request token before a `WriteAsync(..., None)` enqueue. A cancel landing in the
window between commit and query throws before the enqueue → edit persisted, no rebuild queued, stale-content
bug re-opens. Fix: once `SaveChangesAsync` has committed, run the ENTIRE side effect (affected-entity
queries + enqueue) on `CancellationToken.None` — a committed change's compensating side effect must not be
half-abortable. Generalizes the audit #22 policy from "the enqueue" to "everything after the commit". The
fork review OK'd it; only the independent Codex pass caught the query-token gap — evidence for keeping both
reviewers when quota allows.
- **Replace-all handler with NO client stable id → positional in-place reconcile via `CurrentValues.SetValues`**
(2026-07-11, #252): to stop a delete-and-reinsert handler from cascade-wiping a child that FKs the item
(`PlayoutScheduleItemFillGroupIndex` owns fill-group enumerator state, `OnDelete(Cascade)`), reconcile by
ordered POSITION (the DTO carries no id): same-runtime-type slot → `built = BuildItem(...); built.Id =
existing.Id; dbContext.Entry(existing).CurrentValues.SetValues(built)` (reuse the builder as the SetValues
source so NO field is hand-copied/dropped; set the key first so SetValues doesn't zero it), then rebuild
child join rows; subtype change/surplus → delete+insert that slot only. Keeps the row id → the cascade never
fires. The schedule-item hierarchy is **TPT** (table-per-type), not TPH — SetValues is still safe (same-type
guard; no discriminator). This is the SCOPED placeholder; true content-aware stable child identity is #253
(a moved fill-group item still inherits the state of whatever held its new slot). Anyone doing #253 builds on
/ replaces this positional reconcile in `ReplaceProgramScheduleItemsHandler`.