Description
Reduce accidental state replacement in the control API. POST blueprint and scenario arrays currently replace the entire disabled/active set, so a client posting one desired item can unintentionally clear unrelated state.
Acceptance Criteria
- #1 The API offers explicit additive and removal operations or requires an unambiguous full-replacement contract in request shape
- #2 Existing full-replacement behavior remains versioned/backward-compatible or has a documented migration
- #3 UI operations preserve unrelated blueprint and scenario state under concurrent changes
- #4 Tests cover single-item add/remove, full replacement, stale client state, and concurrent mutation semantics
Definition of Done
- #1 make gate (build vet test race rw-proto-check spdx-check forbidden-words)
- #2 make blueprint-schema (only if a blueprint field or construct/workload config struct changed)
- #3 DRY_RUN=true go run ./cmd/synthkit -once -dump — inventory diffed against signals/
Implementation Plan
-
Add failing control tests for explicit add/remove operations, stale state, and concurrent mutation preservation.
-
Extend the existing control API and UI client without creating a parallel state implementation; keep full replacement backward compatible.
-
Document migration semantics and run focused Go/UI validation.
Implementation Notes
Added authenticated idempotent item mutations for blueprint enable/disable and scenario activate/deactivate while preserving the versioned full-array replacement endpoints. UI single-item actions now use atomic operations; intentional bulk actions retain replacement semantics. Focused control tests including race/concurrency, vet, 38 UI tests, typecheck/build, and diff checks passed. Full gate and deployment remain root integration checks.
Integrated CodeRabbit review raised no task-specific issue. Wave integration make gate and dry-run inventories passed; no blueprint schema regeneration was required.
Final Summary
Landed in e98411b: authenticated atomic item mutations for blueprint and scenario state, backward-compatible full replacement, and UI migration away from stale whole-set writes. Verified with Go and race tests, 38 UI tests, UI typecheck/build, CodeRabbit, make gate, and inventories.