mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-21 10:43:36 +00:00
ee21942f2a
Foundational wedge for the operator-set per-resource state feature (intentionally offline, never auto-remediate, maintenance windows, criticality hint). Defines the canonical schema, validation, and persistence contract; subsequent slices wire in the API surface and the finding-suppression / action-broker integrations. ResourceOperatorState carries four narrow operator-intent fields plus attribution metadata. The shape is intentionally fixed (not a freeform metadata bag) so consumers have a stable contract to honor. ValidateResourceOperatorState rejects malformed records with a stable sentinel (partial maintenance window, end <= start, unknown criticality); NormalizeResourceOperatorState handles whitespace and case. Adds GetResourceOperatorState / SetResourceOperatorState / ClearResourceOperatorState to the ResourceStore interface, implements both on SQLite (new resource_operator_state table) and Memory. Set is upsert by canonical_id; Clear is idempotent. Tests cover IsEmpty, IsInMaintenanceAt window semantics (half-open interval, partial windows treated as no window), validation rejections, and round-trip persistence on both stores.