--- key: concurrency.schedule-item-child-identity title: '2026-07-11 — Stable child identity for schedule-item replace (#259, split from #252/#253)' status: active since: '2026-07-11' supersedes: none superseded-by: none rule: '`PUT /api/schedules/{id}/items` reconciles by an optional round-tripped child `Id` (null/absent/0 ⇒ new item), never by array position, so fill-group/shuffle state follows the logical item across reorders; an unknown or duplicate id is rejected 422 (checked after the §7a `CheckVersion`, so 412 precedes 422).' signals: 'stable child identity, schedule-item replace, id-based reconcile · paths: `api-conventions.md` §7c · issues: #259, #252, #253, #197' mechanics: '`docs/api-conventions.md` §7c' --- `PUT /api/schedules/{id}/items` now reconciles by an optional round-tripped child id, not by array position, so an item's persisted fill-group/shuffle state (`PlayoutScheduleItemFillGroupIndex`, FK `OnDelete(Cascade)`) follows the logical item across reorders/inserts instead of being inherited by whatever previously held its new slot. Contract + rules in **api-conventions §7c**. Key decisions: - **`ScheduleItemRequest.Id` (`int?`)**: null/absent/`0` ⇒ new item (controller normalizes `0`→null so the handler is two-state). Any id present ⇒ id-based reconcile; a fully id-less payload keeps the verbatim positional fallback (legacy; retires with the §7a Phase-2 `If-Match`→428 flip). - **Unknown or duplicate id ⇒ 422, nothing persisted**; the guards live in the handler **after** §7a `CheckVersion`, so **412 precedes 422** — a client that is both version-stale and id-stale gets the reload signal, not a payload-bug signal. Rationale for reject-not-insert on an unknown id: under Phase-1 force-write a stale id is a live lost-update signal, so silently inserting-as-new would duplicate the item and return a different id than the client sent (the exact class §7a exists to surface). This is also the correct #197 posture — never honor an unrecognized identifier. - **Scope = schedule items only.** Blocks/templates/deco-templates/playlists stay positional: their children are stateless config rows (no FK'd state to misattribute; #3/#4 have no GET child id). Child ids are added only where a child row anchors server-side state; the contract can be retrofitted per-endpoint later (field stays optional) — so this is not #197 ossification pressure. - **TPT subtype change at a matched id** stays delete+insert (EF can't retype in place); state resets and a new id is returned, so the SPA must re-seed item state from the PUT response (a stale id on a second save now 422s).