Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/lib/yaml/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,10 +703,28 @@ const resourceGroupHandler = defineHandler<YamlResourceGroup, Schemas['ResourceG

// ── Monitor ─────────────────────────────────────────────────────────────

// Derived from UpdateMonitorRequest minus control-only fields (clearAuth,
// clearEnvironmentId, managedBy) that are mutation signals, not state.
// auth and incidentPolicy need | null because monitors can lack them.
type MonitorSnapshotBase = Required<Omit<Schemas['UpdateMonitorRequest'], 'clearEnvironmentId' | 'clearAuth' | 'managedBy'>>
// YAML-managed update fields only. Do not Required<> the whole UpdateMonitorRequest
// — additive optional keys (capturePolicy, package, status, …) must not break
// snapshot constructors after spec regen (evolution harness).
type MonitorSnapshotKeys =
| 'name'
| 'config'
| 'frequencySeconds'
| 'enabled'
| 'regions'
| 'environmentId'
| 'assertions'
| 'auth'
| 'incidentPolicy'
| 'alertChannelIds'
| 'tags'
type MonitorUpdateFields = Omit<
Schemas['UpdateMonitorRequest'],
'clearEnvironmentId' | 'clearAuth' | 'managedBy'
>
type MonitorSnapshotBase = Required<
Pick<MonitorUpdateFields, Extract<MonitorSnapshotKeys, keyof MonitorUpdateFields>>
>
type MonitorSnapshot = Omit<MonitorSnapshotBase, 'auth' | 'incidentPolicy'> & {
auth: MonitorSnapshotBase['auth'] | null
incidentPolicy: MonitorSnapshotBase['incidentPolicy'] | null
Expand Down
Loading