Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Carry operator decisions across a rebuild that cannot read them

rcourtmane63e50fe1303
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index ab25b4cbda..72155c251e 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -6980,7 +6980,10 @@ operator split from the agent that cached it
(`enrichContainerWithAgentLXCFilesystems`), whether or not a report cleared
it. A report uses the link `UpsertHost` kept when a split lands between
the report's own check and the state's store. The split's rules and its one record,
-the resource store, are in the unified-resources contract.
+the resource store, are in the unified-resources contract. A registry
+rebuild that cannot read the store's decisions carries the replaced
+generation's, so the decider keeps reporting a split through a store outage
+and the state does not link the pair again until the store has been read.
`Monitor.LinkHostAgent` first removes an older split of that pair from the
store, and records it again if the intent fails to persist, without replacing
a decision the operator recorded in between. A split recorded
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index eb6b8fd3a7..2b084f8ee2 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -7682,10 +7682,21 @@ agent's usage alerts cover (`hostAgentNodeLinks`) changes when it checks the
agent's next report, or when the agent goes offline, so the node's CPU,
memory and disk alerts stay with the agent until then. Mock mode's
consumers read the fixture graph, whose links ignore operator decisions,
-as the mock-mode view does. A rebuild that cannot read the store's
-decisions loads none, so for that generation the registry and the decider
-both treat the pair as undecided, as they do for every operator decision,
-and the next readable rebuild applies the split again. An exclusion that
+as the mock-mode view does. A rebuild that cannot read the store's links or
+exclusions carries the decisions of the generation it replaces, whole
+(`carryOverridesFrom`), even when only one of the two reads failed, so for
+that generation the registry keeps the pair split and applies the same manual
+links, and the decider finds the same split (it still confirms a split
+against the store's latest decisions when they can be read); the next
+readable rebuild loads the store's current decisions, one recorded or lifted during
+the outage included. Carried decisions keep the IDs they were loaded under,
+so a canonical-ID succession during the outage reaches them when the store
+can be read again. Only the decisions are carried: the rebuild still
+publishes its snapshot, since stale resource data is worse than stale
+decisions. The overlay a read builds for saved-host continuity carries them
+the same way. The resources API's own registry, rebuilt from the store for a
+listing, does not. A first generation built while the store is unreadable
+has nothing to carry and holds only what its reads returned. An exclusion that
names the node by its source-specific ID stops naming it if the node's
source ID changes, like every exclusion keyed by a canonical ID. A report
reads the split before it stores the agent and the state reads it again
diff --git a/internal/unifiedresources/adapter_coverage_test.go b/internal/unifiedresources/adapter_coverage_test.go
index 439ae536cf..de8777abca 100644
--- a/internal/unifiedresources/adapter_coverage_test.go
+++ b/internal/unifiedresources/adapter_coverage_test.go
@@ -8,6 +8,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/internal/storagehealth"
"github.com/rcourtman/pulse-go-rewrite/pkg/diskinventory"
+ "github.com/stretchr/testify/require"
)
func strPointer(v string) *string {
@@ -119,6 +120,73 @@ func TestMonitorSourceType(t *testing.T) {
}
}
+// Only the operator's decisions are carried. A rebuild that cannot read the
+// store still publishes the snapshot it was given, so resource data is never
+// held back to protect the decisions.
+func TestRebuildThatCannotReadDecisionsStillPublishesFreshResources(t *testing.T) {
+ f, flaky, apart, _ := splitMonitorFixture(t)
+ flaky.failAll(true)
+
+ f.state.UpsertHost(models.Host{
+ ID: "host-late", Hostname: "late-arrival", MachineID: "machine-late", Status: "online", LastSeen: time.Now().UTC(),
+ })
+ // The first rebuild after the outage starts leaves the rows apart whether
+ // or not the decisions are carried, since the state still holds the link
+ // back; it is the decider's answer, and so the next report, that differs.
+ for cycle := 1; cycle <= 2; cycle++ {
+ f.cycle()
+ listed := f.adapter.GetAll()
+ late := false
+ for _, resource := range listed {
+ late = late || resource.Name == "late-arrival"
+ }
+ require.True(t, late, "cycle %d: a host reported during the outage was not published", cycle)
+ requirePairApart(t, listed, apart)
+ require.True(t, f.splitReadByDecider(), "cycle %d: the decider lost the split", cycle)
+ }
+}
+
+// requirePairApart checks, by ID, that the node and the agent are still two
+// rows in a listing that may hold other agents.
+func requirePairApart(t *testing.T, listed []Resource, apart nodeAgentRows) {
+ t.Helper()
+ byID := map[string]Resource{}
+ for _, resource := range listed {
+ byID[resource.ID] = resource
+ }
+ node, agent := byID[apart.node], byID[apart.agent]
+ require.NotNil(t, node.Proxmox, "the node row %s is gone", apart.node)
+ require.Nil(t, node.Agent, "the node row took the agent in")
+ require.NotNil(t, agent.Agent, "the agent row %s is gone", apart.agent)
+ require.Nil(t, agent.Proxmox, "the agent row took the node in")
+}
+
+// The overlay a read builds for saved-host continuity is a registry of its
+// own on the same store, so it carries the decisions of the generation it
+// overlays when the store cannot be read. The rows it copies from that
+// generation are already split, so the overlay's own decisions are what is
+// checked: its split decider and the presentation listing it coalesces.
+func TestHostContinuityOverlayKeepsDecisionsItsStoreCannotRead(t *testing.T) {
+ f, flaky, apart, _ := splitMonitorFixture(t)
+ flaky.failAll(true)
+
+ saved := models.Host{ID: "host-saved", Hostname: "saved-away", MachineID: "machine-saved", Status: "offline", LastSeen: time.Now().UTC().Add(-time.Hour)}
+ view := ReadStateWithHostContinuity(f.adapter, []IngestRecord{HostIngestRecord(saved)})
+ overlay, ok := view.(*MonitorAdapter)
+ require.True(t, ok)
+ require.NotSame(t, f.adapter, overlay, "the saved host did not build an overlay")
+ require.True(t, overlay.currentRegistry().overridesUnreadable, "the overlay read the store")
+
+ saw := false
+ for _, resource := range overlay.GetAll() {
+ saw = saw || resource.Name == "saved-away"
+ }
+ require.True(t, saw, "the overlay lost the saved host")
+ snapshot := f.state.GetSnapshot()
+ require.True(t, overlay.ProxmoxNodeAgentSplit(snapshot.Nodes[0], snapshot.Hosts[0]), "the overlay's decider lost the split")
+ requirePairApart(t, overlay.currentRegistry().ListForPresentation(), apart)
+}
+
func TestResourceFromVMProjectsExpectedGuestAgentOutageIncident(t *testing.T) {
now := time.Now()
resource, _ := resourceFromVM(models.VM{
diff --git a/internal/unifiedresources/monitor_adapter.go b/internal/unifiedresources/monitor_adapter.go
index fa996645e2..ed5930b9f8 100644
--- a/internal/unifiedresources/monitor_adapter.go
+++ b/internal/unifiedresources/monitor_adapter.go
@@ -154,7 +154,7 @@ func readStateWithRecords(readState ReadState, source DataSource, records []Inge
}
}
- cloned := NewRegistry(registry.store)
+ cloned := newRegistryFrom(registry)
cloned.IngestResourcesWithStaleThresholds(registry.List(), thresholds)
cloned.ingestRecords(source, records, onlyMissing, thresholds)
overlay := NewMonitorAdapterWithStaleThresholds(cloned, thresholds)
@@ -487,7 +487,7 @@ func (a *MonitorAdapter) replaceRegistryLocked(snapshot models.StateSnapshot, re
return
}
- rebuilt := NewRegistry(registry.store)
+ rebuilt := newRegistryFrom(registry)
staleThresholds := a.currentStaleThresholds()
rebuilt.IngestSnapshotWithStaleThresholds(snapshot, staleThresholds)
sources := make([]DataSource, 0, len(recordsBySource))
diff --git a/internal/unifiedresources/registry.go b/internal/unifiedresources/registry.go
index 1e1aa35333..da5a9f4c29 100644
--- a/internal/unifiedresources/registry.go
+++ b/internal/unifiedresources/registry.go
@@ -5,6 +5,7 @@ import (
"encoding/hex"
"fmt"
"log"
+ "maps"
"slices"
"sort"
"strings"
@@ -98,6 +99,11 @@ type ResourceRegistry struct {
splitAgents map[string]nodeAgentLinkSide // node source ID -> the linked agent the operator split it from
identityPins *identityPinIndex
pbsBackups []models.PBSBackup
+ // overridesUnreadable records that the store could not be read for the
+ // operator's links or exclusions when this registry loaded them, so
+ // links, linksByID and exclusions lack the decisions that read held
+ // (carryOverridesFrom).
+ overridesUnreadable bool
// linkFoldIndex maps each canonical ID a manual link folded into another
// resource to the rows that took it in (Resource.linkFolds). Folded
// resources are still observed, so identity succession treats them as
@@ -264,6 +270,7 @@ func (rr *ResourceRegistry) loadOverrides() {
rr.links = links
} else {
log.Printf("unifiedresources: failed to load manual links from store: %v", err)
+ rr.overridesUnreadable = true
}
exclusions, err := rr.store.GetExclusions()
if err == nil {
@@ -279,9 +286,45 @@ func (rr *ResourceRegistry) loadOverrides() {
}
} else {
log.Printf("unifiedresources: failed to load manual exclusions from store: %v", err)
+ rr.overridesUnreadable = true
+ }
+}
+
+// carryOverridesFrom keeps the operator's decisions across a rebuild that
+// could not read them. A registry whose store read for links or exclusions
+// failed lacks what that read held; with both lost it lists every pair the
+// operator split as one machine again, drops every manual link and answers
+// the monitor's node<->agent split decider (ProxmoxNodeAgentSplit)
+// "undecided", so the rebuild would undo the decisions the generation it
+// replaces applied. It takes that generation's links and exclusions whole,
+// even when only one read failed, as they stood when the store last answered,
+// and the next rebuild that can read the store replaces them with its current
+// ones. Nothing else is carried: the rebuild's resources stay live, since
+// stale resource data is worse than stale decisions. A registry whose reads
+// succeeded keeps what it read.
+func (rr *ResourceRegistry) carryOverridesFrom(previous *ResourceRegistry) {
+ if previous == nil || previous == rr || !rr.overridesUnreadable {
+ return
+ }
+ previous.mu.RLock()
+ defer previous.mu.RUnlock()
+ rr.links = slices.Clone(previous.links)
+ rr.linksByID = indexLinksByID(rr.links)
+ rr.exclusions = maps.Clone(previous.exclusions)
+ if rr.exclusions == nil {
+ rr.exclusions = make(map[string]time.Time)
}
}
+// newRegistryFrom builds a registry on the previous generation's store to
+// stand in for that generation, carrying its operator decisions forward when
+// the store cannot be read (carryOverridesFrom).
+func newRegistryFrom(previous *ResourceRegistry) *ResourceRegistry {
+ rr := NewRegistry(previous.store)
+ rr.carryOverridesFrom(previous)
+ return rr
+}
+
// IngestSnapshot ingests all resources from the current state snapshot.
func (rr *ResourceRegistry) IngestSnapshot(snapshot models.StateSnapshot) {
rr.ingestSnapshot(snapshot, nil)
diff --git a/internal/unifiedresources/store_test.go b/internal/unifiedresources/store_test.go
index 73d28d348a..aa9e2bcadc 100644
--- a/internal/unifiedresources/store_test.go
+++ b/internal/unifiedresources/store_test.go
@@ -10,6 +10,7 @@ import (
"reflect"
"sort"
"strings"
+ "sync/atomic"
"testing"
"time"
@@ -4090,6 +4091,269 @@ func TestMonitorStateKeepsASplitWhenTheAgentStopsReportingItsMachineID(t *testin
}
}
+// unreadableDecisionStore fails reads of the operator's manual decisions
+// while its flags are set, as a store that cannot be read for a moment does.
+// Writes pass through, so a test can record a decision during the outage.
+type unreadableDecisionStore struct {
+ ResourceStore
+ failLinks atomic.Bool
+ failExclusions atomic.Bool
+}
+
+func (s *unreadableDecisionStore) failAll(fail bool) {
+ s.failLinks.Store(fail)
+ s.failExclusions.Store(fail)
+}
+
+func (s *unreadableDecisionStore) GetLinks() ([]ResourceLink, error) {
+ if s.failLinks.Load() {
+ return nil, errors.New("links unreadable")
+ }
+ return s.ResourceStore.GetLinks()
+}
+
+func (s *unreadableDecisionStore) GetExclusions() ([]ResourceExclusion, error) {
+ if s.failExclusions.Load() {
+ return nil, errors.New("exclusions unreadable")
+ }
+ return s.ResourceStore.GetExclusions()
+}
+
+// splitMonitorFixture returns a node and agent the operator split with a
+// report-merge style exclusion, the decision stored and applied by a
+// generation that read it, and the store that can then stop answering.
+func splitMonitorFixture(t *testing.T) (*monitorSplitFixture, *unreadableDecisionStore, nodeAgentRows, string) {
+ t.Helper()
+ var flaky *unreadableDecisionStore
+ f := newMonitorSplitFixtureWithStore(t, "lab", "pve1", "0123456789abcdef", func(store ResourceStore) ResourceStore {
+ flaky = &unreadableDecisionStore{ResourceStore: store}
+ return flaky
+ })
+ f.cycle()
+ f.cycle()
+ merged := hostRowsByFacet(t, f.adapter.GetAll()).joined
+ require.NotEmpty(t, merged, "fixture did not join the node and its agent")
+ nodeCandidate := SourceSpecificID(ResourceTypeAgent, SourceProxmox, f.node.ID)
+ require.NoError(t, f.store.AddExclusion(ResourceExclusion{ResourceA: merged, ResourceB: nodeCandidate, CreatedAt: time.Now().UTC()}))
+ for i := 0; i < 3; i++ {
+ f.cycle()
+ }
+ apart := hostRowsByFacet(t, f.adapter.GetAll())
+ require.Empty(t, apart.joined, "the split did not reach the registry")
+ require.NotEmpty(t, apart.node)
+ require.NotEmpty(t, apart.agent)
+ nodeLink, agentLink := f.links()
+ require.Empty(t, nodeLink+agentLink, "the split did not reach the state")
+ return f, flaky, apart, nodeCandidate
+}
+
+func (f *monitorSplitFixture) splitReadByDecider() bool {
+ f.t.Helper()
+ snapshot := f.state.GetSnapshot()
+ require.Len(f.t, snapshot.Nodes, 1)
+ for _, host := range snapshot.Hosts {
+ if host.ID == f.host.ID {
+ return f.adapter.ProxmoxNodeAgentSplit(snapshot.Nodes[0], host)
+ }
+ }
+ f.t.Fatalf("the state lost the fixture's agent %s", f.host.ID)
+ return false
+}
+
+// A rebuild whose store reads fail loads no decisions, and without the carry
+// it would publish a registry that lists a split node and agent as one
+// machine and answers the monitor's split decider "undecided", so the
+// monitor relinks the pair until the next readable rebuild.
+func TestRebuildThatCannotReadDecisionsKeepsANodeAgentSplit(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ fail func(*unreadableDecisionStore)
+ // during changes what the store can still read while the other half
+ // cannot: the carry is the previous generation's decisions whole.
+ during func(t *testing.T, f *monitorSplitFixture, flaky *unreadableDecisionStore)
+ }{
+ {name: "both reads", fail: func(s *unreadableDecisionStore) { s.failAll(true) }},
+ {name: "exclusions only", fail: func(s *unreadableDecisionStore) { s.failExclusions.Store(true) }},
+ {
+ name: "links only, the exclusion lifted meanwhile",
+ fail: func(s *unreadableDecisionStore) { s.failLinks.Store(true) },
+ during: func(t *testing.T, f *monitorSplitFixture, flaky *unreadableDecisionStore) {
+ exclusions, err := flaky.ResourceStore.GetExclusions()
+ require.NoError(t, err)
+ require.NotEmpty(t, exclusions)
+ for _, exclusion := range exclusions {
+ _, found, err := f.store.TakeExclusion(exclusion.ResourceA, exclusion.ResourceB)
+ require.NoError(t, err)
+ require.True(t, found)
+ }
+ },
+ },
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ f, flaky, apart, _ := splitMonitorFixture(t)
+ require.True(t, f.splitReadByDecider(), "a readable generation did not report the split")
+
+ if tc.during != nil {
+ tc.during(t, f, flaky)
+ }
+ tc.fail(flaky)
+ for cycle := 1; cycle <= 3; cycle++ {
+ f.cycle()
+ require.True(t, f.adapter.currentRegistry().overridesUnreadable, "cycle %d: the rebuild read the store", cycle)
+ rows := hostRowsByFacet(t, f.adapter.GetAll())
+ require.Equal(t, apart, rows, "cycle %d: the rebuild that could not read the decisions rejoined the pair", cycle)
+ require.True(t, f.splitReadByDecider(), "cycle %d: the decider lost the split", cycle)
+ nodeLink, agentLink := f.links()
+ require.Empty(t, nodeLink+agentLink, "cycle %d: the state relinked the split pair", cycle)
+ }
+ })
+ }
+}
+
+// The negative control: a generation published with no decisions, which is
+// what a rebuild without the carry published for an unreadable store, loses
+// the split in both places. The decider answers "undecided", so the state
+// relinks the pair on the next report, and the rebuild joins the rows.
+func TestGenerationWithoutDecisionsRejoinsASplitNodeAgent(t *testing.T) {
+ f, flaky, _, _ := splitMonitorFixture(t)
+ flaky.failAll(true)
+
+ bare := NewRegistry(flaky)
+ require.True(t, bare.overridesUnreadable)
+ require.Empty(t, bare.exclusions, "an unreadable store loaded decisions")
+ f.adapter.mu.Lock()
+ f.adapter.registry = bare
+ f.adapter.mu.Unlock()
+ require.False(t, f.splitReadByDecider(), "a generation holding no decisions still reported the split")
+
+ f.cycle()
+ rows := hostRowsByFacet(t, f.adapter.GetAll())
+ require.NotEmpty(t, rows.joined, "without decisions the rebuild kept the pair apart: %+v", rows)
+ nodeLink, agentLink := f.links()
+ require.NotEmpty(t, nodeLink+agentLink, "without decisions the state kept the pair unlinked")
+}
+
+// Carried decisions are good only until the store answers again: the next
+// readable rebuild loads its current decisions, one the operator recorded or
+// lifted during the outage included.
+func TestCarriedDecisionsYieldToTheNextReadableRebuild(t *testing.T) {
+ f, flaky, apart, nodeCandidate := splitMonitorFixture(t)
+ merged := hostRowsByFacet(t, f.adapter.GetAll())
+ _ = merged
+
+ flaky.failAll(true)
+ exclusions, err := f.store.(*unreadableDecisionStore).ResourceStore.GetExclusions()
+ require.NoError(t, err)
+ require.NotEmpty(t, exclusions)
+ for _, exclusion := range exclusions {
+ _, found, err := flaky.ResourceStore.TakeExclusion(exclusion.ResourceA, exclusion.ResourceB)
+ require.NoError(t, err)
+ require.True(t, found)
+ }
+ f.cycle()
+ require.Equal(t, apart, hostRowsByFacet(t, f.adapter.GetAll()), "the outage generation dropped the carried split")
+ require.True(t, f.splitReadByDecider(), "the outage generation's decider dropped the carried split")
+
+ flaky.failAll(false)
+ var rows nodeAgentRows
+ for cycle := 1; cycle <= 4; cycle++ {
+ f.cycle()
+ rows = hostRowsByFacet(t, f.adapter.GetAll())
+ require.False(t, f.adapter.currentRegistry().overridesUnreadable, "cycle %d: the store answers again", cycle)
+ }
+ require.NotEmpty(t, rows.joined, "a readable rebuild kept the carried split after the operator lifted it (node candidate %s): %+v", nodeCandidate, rows)
+ require.False(t, f.splitReadByDecider(), "the decider kept a split the store no longer holds")
+}
+
+// A manual link is carried the same way, so an outage does not unfold the
+// pair it joins, whichever read failed.
+func TestRebuildThatCannotReadDecisionsKeepsAManualLink(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ fail func(*unreadableDecisionStore)
+ // unlink changes what the store can still read while the other half
+ // cannot: the carry is the previous generation's decisions whole.
+ unlink bool
+ }{
+ {name: "both reads", fail: func(s *unreadableDecisionStore) { s.failAll(true) }},
+ {name: "links only", fail: func(s *unreadableDecisionStore) { s.failLinks.Store(true) }},
+ {name: "exclusions only, the pair unlinked meanwhile", fail: func(s *unreadableDecisionStore) { s.failExclusions.Store(true) }, unlink: true},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ now := time.Now().UTC()
+ snapshot := models.StateSnapshot{
+ Hosts: []models.Host{
+ {ID: "host-app", Hostname: "app-guest", MachineID: "machine-app", Status: "online", LastSeen: now},
+ {ID: "host-nas", Hostname: "nas-a-mgmt", MachineID: "machine-nas", Status: "online", LastSeen: now},
+ },
+ LastUpdate: now,
+ }
+ flaky := &unreadableDecisionStore{ResourceStore: NewMemoryStore()}
+ adapter := NewMonitorAdapter(NewRegistry(flaky))
+ adapter.PopulateFromSnapshot(snapshot)
+ listed := adapter.GetAll()
+ require.Len(t, listed, 2, "fixture hosts did not stay separate: %v", resourceIDs(listed))
+
+ require.NoError(t, flaky.AddLink(ResourceLink{ResourceA: listed[0].ID, ResourceB: listed[1].ID, PrimaryID: listed[0].ID}))
+ adapter.PopulateFromSnapshot(snapshot)
+ require.Len(t, adapter.GetAll(), 1, "a readable rebuild did not fold the linked pair")
+ require.Len(t, adapter.ManualLinks(), 1)
+
+ if tc.unlink {
+ require.NoError(t, flaky.AddExclusion(ResourceExclusion{ResourceA: listed[0].ID, ResourceB: listed[1].ID, CreatedAt: time.Now().UTC()}))
+ }
+ tc.fail(flaky)
+ adapter.PopulateFromSnapshot(snapshot)
+ require.True(t, adapter.currentRegistry().overridesUnreadable)
+ require.Len(t, adapter.GetAll(), 1, "the rebuild that could not read the decisions unfolded the pair")
+ require.Len(t, adapter.ManualLinks(), 1, "the rebuild that could not read the decisions dropped the link")
+
+ // The generation published with nothing to carry folds nothing.
+ flaky.failAll(true)
+ bare := NewRegistry(flaky)
+ bare.IngestSnapshot(snapshot)
+ require.Len(t, bare.List(), 2, "negative control: a generation holding no link still folded the pair")
+ })
+ }
+}
+
+// A carry owns its copy: the registry that took the decisions neither shares
+// a map or slice it could be written through with the generation it replaced.
+func TestCarriedDecisionsAreCopiedNotAliased(t *testing.T) {
+ store := NewMemoryStore()
+ at := time.Date(2026, 10, 10, 9, 0, 0, 0, time.UTC)
+ require.NoError(t, store.AddExclusion(ResourceExclusion{ResourceA: "agent-a", ResourceB: "agent-b", CreatedAt: at}))
+ require.NoError(t, store.AddLink(ResourceLink{ResourceA: "agent-c", ResourceB: "agent-d", PrimaryID: "agent-c", CreatedAt: at}))
+ previous := NewRegistry(store)
+ require.False(t, previous.overridesUnreadable)
+ require.Len(t, previous.exclusions, 1)
+ require.Len(t, previous.links, 1)
+
+ flaky := &unreadableDecisionStore{ResourceStore: store}
+ flaky.failAll(true)
+ next := NewRegistry(flaky)
+ require.Empty(t, next.links)
+ next.carryOverridesFrom(previous)
+ require.Equal(t, previous.exclusions, next.exclusions)
+ require.Equal(t, previous.links, next.links)
+ require.Equal(t, previous.linksByID, next.linksByID)
+
+ next.exclusions["extra"] = at
+ next.links[0].PrimaryID = "agent-d"
+ require.Len(t, previous.exclusions, 1, "the carry shared the exclusions map")
+ require.Equal(t, "agent-c", previous.links[0].PrimaryID, "the carry shared the links slice")
+
+ // A registry that read the store keeps what it read, and one with no
+ // previous generation stays empty.
+ readable := NewRegistry(store)
+ readable.carryOverridesFrom(NewRegistry(nil))
+ require.Len(t, readable.exclusions, 1)
+ first := NewRegistry(flaky)
+ first.carryOverridesFrom(nil)
+ require.Empty(t, first.exclusions)
+ require.NotNil(t, first.exclusions)
+}
+
// An operator split of a node and its agent reaches monitoring's own link:
// once the adapter's registry generation carries the split, the state names
// neither side on the other, and every view of the registry still keeps the