mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 14:00:29 +00:00
69b5ec22fd
The #1601 follow-on: per-container alert overrides were keyed by Docker container ID (docker:{host}/{containerID}), which changes on every recreate, so each image update silently re-armed alerts the user had switched off and left a dead entry behind in alerts.json — the unbounded growth that pushed the reporter's config past the old 64KB body cap (raised in38434a513). The v6 thresholds UI additionally wrote keys from the unified hash id (docker:{host}/app-container-{16hex}), which the evaluator never read at all. Overrides now key on stable identity, docker:{host}/{containerName}: - The evaluator resolves the name key first and falls back to the legacy container-ID key so pre-migration entries keep working (evaluateDockerContainer, checkDockerContainerState, the container-update resolver, and reevaluateActiveAlertsLocked). - MigrateDockerContainerOverrideKeys runs in the monitor sync next to MigrateCanonicalOverrideKeys, driven by the unified resource snapshot: it re-homes live legacy-ID and unified-hash keys onto the name key and prunes orphaned ID-shaped entries, ending the per-update orphan accumulation. Name-keyed entries for absent containers are kept so a recreate under the same name still honours them. - The UI candidate chain (single implementation in alertOverridesModel) now leads with docker:{host}/{name} and trails the container-ID, short ID, unified-hash and slash-tail forms, so rows bind pre-existing overrides of every historical shape and the next save re-homes them. Rows carry overrideStorageId/overrideIdCandidates so toggle, connectivity, offline-state, edit and remove all write the stable key. - The ignored-containers card copy now documents the wildcard forms (runner-*, *-dev, *staging*) shipped inb5fa6a9af, under the title "Ignored container patterns". Contract deltas: alerts, frontend-primitives, monitoring, and unified-resources now pin the name-keyed override identity, the single frontend candidate-chain owner, the sync-cadence migration, and the resource-facet-backed table identity respectively. Verified live against a mock instance: a UI toggle persists docker:{host}/loki and binds back after reload, and seeded legacy/hash/orphan keys converge to name keys on disk within two sync ticks. go test ./internal/alerts/... ./internal/monitoring/... green; recreate survival pinned in TestDockerContainerOverrideSurvivesContainerRecreate. Refs #1601