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.

Fix default agent rollout status noise

rcourtman22ea442ed7b5
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index d799d491ed..235e15d0d6 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -4740,6 +4740,21 @@
"repo": "pulse",
"path": "internal/monitoring/monitor_unified_state_test.go",
"kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/remoteconfig/signature.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "internal/remoteconfig/signature_test.go",
+ "kind": "file"
+ },
+ {
+ "repo": "pulse",
+ "path": "tests/integration/tests/75-settings-infrastructure-fleet-status-coherence.spec.ts",
+ "kind": "file"
}
]
},
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 9cb47e27f3..73bb6577a1 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -251,6 +251,9 @@ Passive agent config or rollout handshakes whose only cause is a missing
comparable applied agent configuration fingerprint are not operator-actionable
setup attention and must not be counted as a visible infrastructure problem
unless a row or member still renders them as an actionable highlight.
+The API-owned distinction is important: an unmanaged default agent config is
+not a rollout at all, while a managed desired config that lacks an applied
+fingerprint is rollout attention until the agent report proves convergence.
Configured-node settings tables follow the same boundary:
`frontend-modern/src/components/Settings/ConfiguredNodeTables.tsx` may own node,
credential, capability, status, and action cells, but table scroll framing must
@@ -1964,10 +1967,14 @@ config `signature` backward-compatible with installed agents by signing the
legacy canonical payload shape only; newer clients validate `desiredConfig` by
recomputing it from the signed command decision and signed settings payload,
restricted to the agent-applied settings key schema. Broader applied-state
-reporting remains the next contract gap: until the runtime report carries a
-comparable applied config fingerprint, `/api/connections` must surface desired
-config metadata as pending or unknown and must not claim rollout convergence
-from host report fields such as `commandsEnabled` or `diskExclude`.
+reporting remains the next contract gap for managed config: until the runtime
+report carries a comparable applied config fingerprint for an assigned managed
+desired config, `/api/connections` must surface that desired config metadata as
+pending or unknown and must not claim rollout convergence from host report
+fields such as `commandsEnabled` or `diskExclude`. The empty default desired
+config is different: it may be signed and served for compatibility, but without
+a managed command decision or agent-applied setting it is not a rollout and
+must project as `configDrift: not-applicable` with a current applied rollout.
Command policy follows the same lifecycle truth boundary: the server desired
command setting is not applied runtime truth until a current agent report
confirms it. `/api/connections` must expose desired command policy, applied
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 4eb260880e..e9922521b7 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -898,11 +898,18 @@ the canonical monitored-system blocked payload.
fetch or frontend-local host reconciliation rules.
Agent config drift on that same payload must source desired fingerprints
from `Monitor.GetHostAgentConfig(...).DesiredConfig` or the same
- `remoteconfig.BuildDesiredConfigMetadata` path. The aggregator must not
- manufacture convergence by assigning desired and applied to the same local
- report-field fingerprint; when host state lacks a trustworthy applied
- config fingerprint, `configDrift` stays pending or unknown and rollout
- stays non-current.
+ `remoteconfig.BuildDesiredConfigMetadata` path. Desired config metadata is
+ actionable only when the server has assigned a managed desired value, such
+ as an explicit command-execution policy or an agent-applied settings key.
+ The empty default host-agent config may still carry signed metadata for
+ validation, but `/api/connections` must not turn that passive default into
+ an operator-visible pending rollout. Agent rows without a managed config
+ override expose `configDrift.status: not-applicable` and a current applied
+ rollout with a bounded no-rollout reason. When a managed desired
+ fingerprint exists, the aggregator must not manufacture convergence by
+ assigning desired and applied to the same local report-field fingerprint;
+ if host state lacks a trustworthy applied config fingerprint,
+ `configDrift` stays pending or unknown and rollout stays non-current.
Appliance-specific Pulse Agent compatibility is an additive host-profile
fact on that same identity payload. For Unraid and similar host profiles,
`agentIdentity.platform` remains the canonical runtime platform such as
@@ -2837,6 +2844,13 @@ credential validity/rotation facts, and command-policy enforcement state used
by Settings and CLI consumers. Frontend settings surfaces may format those
facts, but must not infer a second fleet state from row labels, error-message
text, or provider-local table heuristics.
+Unmanaged host-agent defaults are not a fleet rollout. When the backend
+resolved only the default signed config with no managed command policy or
+agent-applied setting, `fleet.configDrift` must remain `not-applicable` and
+`fleet.rollout` must remain `current`/`applied`; Settings may show deeper
+diagnostics, but must not count that passive state as source setup attention.
+Only a real managed desired config fingerprint can create pending rollout
+attention when an applied fingerprint is absent or mismatched.
The `fleet.commandPolicy` object is the canonical desired/applied convergence
contract for remote command enablement. It must carry the desired server
policy, the applied agent-reported truth when available, the effective
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 29e097acce..d27b74b0fa 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -601,7 +601,11 @@ bypass the API fail-closed execution gate.
vocabulary. If `/api/connections` reports agent config drift as pending or
unknown because no trustworthy applied fingerprint exists, storage and
recovery must preserve that uncertainty instead of translating it into a
- storage-local current/drifted verdict.
+ storage-local current/drifted verdict. If `/api/connections` reports
+ `configDrift: not-applicable` with a current applied rollout because no
+ managed host-agent config override is assigned, storage and recovery must
+ preserve that no-rollout state instead of translating it into a pending
+ storage/recovery problem.
When `/api/connections` attaches an exact-match host agent to a blocked
Proxmox API source without fresh node inventory, storage and recovery must
treat that as one represented source with host telemetry, not as a second
diff --git a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
index bd9ed2b955..a77a0f945e 100644
--- a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
@@ -64,6 +64,46 @@ describe('visibleFleetGovernanceSignals', () => {
]);
});
+ it('does not turn default unmanaged agent config into setup attention', () => {
+ const rawSignals = fleetGovernanceSignalsForConnection(
+ connectionFixture({
+ fleet: {
+ enrollmentState: 'enrolled',
+ livenessState: 'active',
+ versionDrift: 'current',
+ adapterHealth: 'healthy',
+ configRollout: 'reported',
+ credentialStatus: 'verified',
+ updateStatus: 'current',
+ remoteControl: 'disabled',
+ configDrift: {
+ status: 'not-applicable',
+ reason: 'no managed agent configuration override is assigned',
+ },
+ rollout: {
+ status: 'current',
+ stage: 'applied',
+ reason: 'no managed agent configuration rollout is assigned',
+ },
+ credentialHealth: { status: 'verified', kind: 'agent-token' },
+ commandPolicy: {
+ status: 'disabled',
+ desired: 'unknown',
+ applied: 'disabled',
+ enforcement: 'not-applicable',
+ },
+ },
+ }),
+ );
+
+ expect(rawSignals.map((signal) => signal.label)).toEqual(
+ expect.arrayContaining(['No config drift', 'Rollout current', 'Remote control disabled']),
+ );
+ expect(visibleFleetGovernanceSignals(rawSignals).map((signal) => signal.label)).toEqual([
+ 'Remote control disabled',
+ ]);
+ });
+
it('keeps actionable config and rollout warnings visible', () => {
const rawSignals = fleetGovernanceSignalsForConnection(
connectionFixture({
diff --git a/internal/api/connections_aggregator.go b/internal/api/connections_aggregator.go
index b4c4d20556..6793ff880e 100644
--- a/internal/api/connections_aggregator.go
+++ b/internal/api/connections_aggregator.go
@@ -14,6 +14,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/platformsupport"
+ "github.com/rcourtman/pulse-go-rewrite/internal/remoteconfig"
pulseutils "github.com/rcourtman/pulse-go-rewrite/internal/utils"
)
@@ -406,11 +407,7 @@ func buildAgentConnection(host models.Host, expectedAgentVersion string, now tim
AgentUpdateAvailable: updateAvailable,
Capabilities: ConnectionCapabilities{SupportsPause: false, SupportsScope: false, SupportsTest: false},
}, now)
- var desiredFingerprint *ConnectionFleetConfigFingerprint
- if desiredConfig != nil {
- desiredFingerprint = desiredConfig.Fingerprint
- }
- conn.Fleet.ConfigDrift = connectionFleetAgentConfigDrift(conn, desiredFingerprint)
+ conn.Fleet.ConfigDrift = connectionFleetAgentConfigDrift(conn, desiredConfig)
conn.Fleet.CredentialHealth = connectionFleetAgentCredentialHealth(conn, host, now)
conn.Fleet.CommandPolicy = connectionFleetAgentCommandPolicy(conn, host, desiredConfig)
conn.Fleet.Rollout = connectionFleetRollout(conn)
@@ -562,8 +559,21 @@ func connectionFleetConfigDrift(conn Connection) *ConnectionFleetConfigDrift {
}
}
-func connectionFleetAgentConfigDrift(conn Connection, desired *ConnectionFleetConfigFingerprint) *ConnectionFleetConfigDrift {
- return connectionFleetAgentConfigDriftForFingerprints(conn, desired, nil)
+func connectionFleetAgentConfigDrift(conn Connection, desiredConfig *connectionAgentDesiredConfig) *ConnectionFleetConfigDrift {
+ if desiredConfig == nil {
+ return &ConnectionFleetConfigDrift{
+ Status: fleetStateUnknown,
+ Reason: "Pulse has not resolved canonical desired agent configuration metadata",
+ }
+ }
+ if desiredConfig.Fingerprint == nil {
+ return &ConnectionFleetConfigDrift{
+ Status: fleetConfigDriftNotApplicable,
+ LastObservedAt: conn.LastSeen,
+ Reason: "no managed agent configuration override is assigned",
+ }
+ }
+ return connectionFleetAgentConfigDriftForFingerprints(conn, desiredConfig.Fingerprint, nil)
}
func connectionFleetAgentConfigDriftForFingerprints(conn Connection, desired, applied *ConnectionFleetConfigFingerprint) *ConnectionFleetConfigDrift {
@@ -666,6 +676,12 @@ func connectionFleetRollout(conn Connection) *ConnectionFleetRolloutState {
Stage: fleetRolloutStagePending,
Reason: "rollout state cannot be confirmed without comparable desired and applied agent config fingerprints",
}
+ case fleetConfigDriftNotApplicable:
+ return &ConnectionFleetRolloutState{
+ Status: fleetStateCurrent,
+ Stage: fleetRolloutStageApplied,
+ Reason: "no managed agent configuration rollout is assigned",
+ }
}
}
stage := fleetRolloutStageLocal
@@ -849,7 +865,7 @@ func connectionAgentDesiredConfigFingerprints(monitor *monitoring.Monitor, hosts
desired := connectionAgentDesiredConfig{
CommandsEnabled: cloneBoolPtr(cfg.CommandsEnabled),
}
- if cfg.DesiredConfig != nil {
+ if cfg.DesiredConfig != nil && remoteconfig.HasAppliedDesiredConfig(cfg.CommandsEnabled, cfg.Settings) {
if fp := connectionConfigFingerprintFromMetadata(cfg.DesiredConfig.Version, cfg.DesiredConfig.Hash); fp != nil {
desired.Fingerprint = fp
}
diff --git a/internal/api/connections_aggregator_test.go b/internal/api/connections_aggregator_test.go
index a3f033636a..0b03834826 100644
--- a/internal/api/connections_aggregator_test.go
+++ b/internal/api/connections_aggregator_test.go
@@ -489,6 +489,42 @@ func TestBuildConnections_AgentFleetGovernance(t *testing.T) {
}
}
+func TestBuildConnections_AgentWithoutManagedDesiredConfigDoesNotReportRolloutPending(t *testing.T) {
+ now := time.Now()
+ in := aggregatorInputs{
+ hosts: []models.Host{
+ {
+ ID: "default-agent",
+ Hostname: "default-agent",
+ LastSeen: now,
+ CommandsEnabled: false,
+ },
+ },
+ agentDesiredConfigs: map[string]connectionAgentDesiredConfig{
+ "default-agent": {},
+ },
+ now: now,
+ }
+
+ got := buildConnections(in)
+ if len(got) != 1 {
+ t.Fatalf("expected 1 connection, got %d", len(got))
+ }
+
+ fleet := got[0].Fleet
+ if fleet.ConfigDrift == nil ||
+ fleet.ConfigDrift.Status != fleetConfigDriftNotApplicable ||
+ fleet.ConfigDrift.Desired != nil ||
+ fleet.ConfigDrift.Applied != nil {
+ t.Fatalf("default agent config drift = %+v", fleet.ConfigDrift)
+ }
+ if fleet.Rollout == nil ||
+ fleet.Rollout.Status != fleetStateCurrent ||
+ fleet.Rollout.Stage != fleetRolloutStageApplied {
+ t.Fatalf("default agent rollout = %+v", fleet.Rollout)
+ }
+}
+
func TestBuildConnections_AgentCommandPolicyDesiredAppliedConvergence(t *testing.T) {
now := time.Now()
desiredDisabled := desiredAgentConfig(t, ptrBool(false), nil)
@@ -618,6 +654,40 @@ func TestBuildConnections_AgentConfigDriftUsesCanonicalDesiredMetadataWithoutSel
}
}
+func TestConnectionAgentDesiredConfigFingerprintsSkipsEmptyDefaultConfig(t *testing.T) {
+ monitor, err := monitoring.New(&config.Config{DataPath: t.TempDir()})
+ if err != nil {
+ t.Fatalf("monitoring.New: %v", err)
+ }
+ t.Cleanup(func() { monitor.Stop() })
+
+ hostID := "default-agent"
+ got := connectionAgentDesiredConfigFingerprints(monitor, []models.Host{{ID: hostID}})
+ desired, ok := got[hostID]
+ if !ok {
+ t.Fatalf("expected resolved desired config entry for %q, got %+v", hostID, got)
+ }
+ if desired.Fingerprint != nil {
+ t.Fatalf("empty default config should not create rollout fingerprint, got %+v", desired.Fingerprint)
+ }
+ if desired.CommandsEnabled != nil {
+ t.Fatalf("empty default config should not set command override, got %+v", desired.CommandsEnabled)
+ }
+
+ commandsEnabled := true
+ if err := monitor.UpdateHostAgentConfig(hostID, &commandsEnabled); err != nil {
+ t.Fatalf("UpdateHostAgentConfig: %v", err)
+ }
+ got = connectionAgentDesiredConfigFingerprints(monitor, []models.Host{{ID: hostID}})
+ desired = got[hostID]
+ if desired.Fingerprint == nil {
+ t.Fatalf("managed command override should create desired config fingerprint")
+ }
+ if desired.CommandsEnabled == nil || !*desired.CommandsEnabled {
+ t.Fatalf("managed command override = %+v, want true", desired.CommandsEnabled)
+ }
+}
+
func TestConnectionFleetAgentConfigDriftComparesAppliedFingerprintsWhenAvailable(t *testing.T) {
now := time.Now()
conn := Connection{
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 1169605ff7..2932a86d5a 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -13192,6 +13192,40 @@ func TestContract_AgentConnectionPayloadIncludesVersionFields(t *testing.T) {
assertJSONSnapshot(t, body, want)
}
+func TestContract_AgentDefaultDesiredConfigDoesNotCreateRolloutAttention(t *testing.T) {
+ now := time.Date(2026, 5, 14, 10, 30, 0, 0, time.UTC)
+ connections := buildConnections(aggregatorInputs{
+ hosts: []models.Host{
+ {
+ ID: "host-1",
+ Hostname: "host-1",
+ ReportIP: "192.0.2.42",
+ LastSeen: now.Add(-10 * time.Second),
+ AgentVersion: "6.0.0",
+ Platform: "linux",
+ CommandsEnabled: false,
+ TokenID: "token-1",
+ },
+ },
+ agentDesiredConfigs: map[string]connectionAgentDesiredConfig{
+ "host-1": {},
+ },
+ expectedAgentVersion: "6.0.0",
+ now: now,
+ })
+ if len(connections) != 1 {
+ t.Fatalf("expected one agent connection, got %d", len(connections))
+ }
+
+ body, err := json.Marshal(connections[0])
+ if err != nil {
+ t.Fatalf("marshal agent Connection: %v", err)
+ }
+
+ want := `{"id":"agent:host-1","type":"agent","name":"host-1","address":"host-1","hostAliases":["host-1","192.0.2.42"],"state":"active","enabled":true,"surfaces":["host"],"scope":{"host":true},"lastSeen":"2026-05-14T10:29:50Z","source":"agent","agentIdentity":{"hostname":"host-1","platform":"linux","reportIp":"192.0.2.42"},"agentVersion":"6.0.0","expectedAgentVersion":"6.0.0","fleet":{"enrollmentState":"enrolled","livenessState":"active","versionDrift":"current","adapterHealth":"healthy","configRollout":"reported","credentialStatus":"verified","updateStatus":"current","remoteControl":"disabled","configDrift":{"status":"not-applicable","lastObservedAt":"2026-05-14T10:29:50Z","reason":"no managed agent configuration override is assigned"},"rollout":{"status":"current","stage":"applied","reason":"no managed agent configuration rollout is assigned"},"credentialHealth":{"status":"verified","kind":"agent-token","rotation":"healthy","lastVerifiedAt":"2026-05-14T10:29:50Z"},"commandPolicy":{"status":"disabled","desired":"unknown","applied":"disabled","enforcement":"not-applicable","reason":"no desired command-policy override is configured; reporting the agent-applied state"}},"capabilities":{"supportsPause":false,"supportsScope":false,"supportsTest":false}}`
+ assertJSONSnapshot(t, body, want)
+}
+
func TestContract_ConnectionsListIncludesAgentHostsFromUnifiedReadState(t *testing.T) {
cfg := &config.Config{DataPath: t.TempDir()}
monitor, err := monitoring.New(cfg)
diff --git a/internal/remoteconfig/signature.go b/internal/remoteconfig/signature.go
index cf9a9238bc..5343000a0d 100644
--- a/internal/remoteconfig/signature.go
+++ b/internal/remoteconfig/signature.go
@@ -94,6 +94,17 @@ func BuildDesiredConfigMetadata(commandsEnabled *bool, settings map[string]inter
}, nil
}
+// HasAppliedDesiredConfig reports whether the desired config contains any
+// server-managed value an agent is expected to apply. The empty default config
+// still has a stable fingerprint for signing/validation, but it must not be
+// treated as an actionable rollout.
+func HasAppliedDesiredConfig(commandsEnabled *bool, settings map[string]interface{}) bool {
+ if commandsEnabled != nil {
+ return true
+ }
+ return len(desiredConfigAppliedSettings(settings)) > 0
+}
+
// ValidateDesiredConfigMetadata verifies that metadata matches the desired config payload.
func ValidateDesiredConfigMetadata(metadata DesiredConfigMetadata, commandsEnabled *bool, settings map[string]interface{}) error {
metadata = normalizeDesiredConfigMetadata(metadata)
diff --git a/internal/remoteconfig/signature_test.go b/internal/remoteconfig/signature_test.go
index 449a167098..483b476b0e 100644
--- a/internal/remoteconfig/signature_test.go
+++ b/internal/remoteconfig/signature_test.go
@@ -114,6 +114,41 @@ func TestBuildDesiredConfigMetadataIgnoresUnknownUnappliedSettings(t *testing.T)
}
}
+func TestHasAppliedDesiredConfig(t *testing.T) {
+ commandsEnabled := false
+ tests := []struct {
+ name string
+ commandsEnabled *bool
+ settings map[string]interface{}
+ want bool
+ }{
+ {name: "empty default", want: false},
+ {
+ name: "unknown unapplied settings only",
+ settings: map[string]interface{}{"token_value": "redacted"},
+ want: false,
+ },
+ {
+ name: "applied profile setting",
+ settings: map[string]interface{}{"interval": "1m"},
+ want: true,
+ },
+ {
+ name: "command override",
+ commandsEnabled: &commandsEnabled,
+ want: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := HasAppliedDesiredConfig(tt.commandsEnabled, tt.settings); got != tt.want {
+ t.Fatalf("HasAppliedDesiredConfig() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
func TestValidateDesiredConfigMetadata(t *testing.T) {
commandsEnabled := true
settings := map[string]interface{}{"interval": "1m"}
diff --git a/tests/integration/tests/75-settings-infrastructure-fleet-status-coherence.spec.ts b/tests/integration/tests/75-settings-infrastructure-fleet-status-coherence.spec.ts
new file mode 100644
index 0000000000..790bd57fa9
--- /dev/null
+++ b/tests/integration/tests/75-settings-infrastructure-fleet-status-coherence.spec.ts
@@ -0,0 +1,191 @@
+import { expect, test as base, type Page } from "@playwright/test";
+
+import {
+ apiRequest,
+ ensureAuthenticated,
+ getMockMode,
+ setMockMode,
+} from "./helpers";
+
+type ConnectionFleetConfigDrift = {
+ status?: string;
+};
+
+type ConnectionFleetRollout = {
+ status?: string;
+};
+
+type Connection = {
+ id: string;
+ type?: string;
+ name?: string;
+ fleet?: {
+ configDrift?: ConnectionFleetConfigDrift | null;
+ rollout?: ConnectionFleetRollout | null;
+ };
+};
+
+type ConnectionSystem = {
+ id: string;
+ components?: Array<{ connectionId?: string }>;
+ members?: Array<{ id?: string; name?: string }>;
+};
+
+const test = base;
+
+let mockModeWasEnabled: boolean | null = null;
+
+async function ensureMockModeEnabled(page: Page): Promise<void> {
+ const state = await getMockMode(page);
+ if (mockModeWasEnabled === null) {
+ mockModeWasEnabled = state.enabled;
+ }
+ if (!state.enabled) {
+ await setMockMode(page, true);
+ }
+}
+
+async function readConnections(page: Page): Promise<{
+ connections: Connection[];
+ systems: ConnectionSystem[];
+}> {
+ const response = await apiRequest(page, "/api/connections");
+ expect(
+ response.ok(),
+ `Expected /api/connections to succeed, got ${response.status()}`,
+ ).toBe(true);
+ const payload = (await response.json()) as {
+ connections?: Connection[];
+ systems?: ConnectionSystem[];
+ };
+ return {
+ connections: payload.connections ?? [],
+ systems: payload.systems ?? [],
+ };
+}
+
+async function assertSettingsInfrastructureDoesNotBlank(
+ page: Page,
+ durationMs: number,
+): Promise<void> {
+ const result = await page.evaluate(async (sampleDurationMs) => {
+ const failures: Array<{ elapsedMs: number; bodyText: string }> = [];
+ const startedAt = performance.now();
+ let samples = 0;
+
+ while (performance.now() - startedAt < sampleDurationMs) {
+ const root = document.getElementById("root");
+ const summary = document.querySelector<HTMLElement>(
+ '[aria-label="Infrastructure setup summary"]',
+ );
+ const table = document.querySelector("table");
+ const bodyText = (document.body?.innerText ?? "")
+ .replace(/\s+/g, " ")
+ .trim();
+
+ if (
+ !root ||
+ root.childElementCount === 0 ||
+ !summary ||
+ !table ||
+ bodyText.includes("Config pending") ||
+ bodyText.includes("Rollout pending")
+ ) {
+ failures.push({
+ elapsedMs: Math.round(performance.now() - startedAt),
+ bodyText: bodyText.slice(0, 160),
+ });
+ }
+
+ samples += 1;
+ await new Promise((resolve) => window.setTimeout(resolve, 250));
+ }
+
+ return { failures, samples };
+ }, durationMs);
+
+ expect(result.samples).toBeGreaterThan(0);
+ expect(
+ result.failures,
+ "Expected Settings Infrastructure to stay mounted without passive config/rollout warnings",
+ ).toEqual([]);
+}
+
+test.describe.serial("Settings Infrastructure fleet status coherence", () => {
+ test.setTimeout(180_000);
+
+ test.afterAll(async ({ browser }) => {
+ if (mockModeWasEnabled === null) return;
+
+ const context = await browser.newContext();
+ const page = await context.newPage();
+ try {
+ const current = await getMockMode(page);
+ if (current.enabled !== mockModeWasEnabled) {
+ await setMockMode(page, mockModeWasEnabled);
+ }
+ } finally {
+ await context.close();
+ }
+ });
+
+ test("does not surface default agent config as pending rollout attention", async ({
+ page,
+ }, testInfo) => {
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop settings runtime proof",
+ );
+
+ await ensureAuthenticated(page);
+ await ensureMockModeEnabled(page);
+
+ const { connections, systems } = await readConnections(page);
+ const agents = connections.filter((connection) => connection.type === "agent");
+
+ expect(agents.length, "Expected mock/runtime data to include agents").toBeGreaterThan(0);
+ for (const agent of agents) {
+ expect(
+ agent.fleet?.configDrift?.status,
+ `Default agent ${agent.name ?? agent.id} must not look like a pending config rollout`,
+ ).not.toBe("pending");
+ expect(
+ agent.fleet?.rollout?.status,
+ `Default agent ${agent.name ?? agent.id} must not look like a pending rollout`,
+ ).not.toBe("pending");
+ }
+
+ const systemIDs = new Set<string>();
+ for (const system of systems) {
+ expect(systemIDs.has(system.id), `Duplicate system id ${system.id}`).toBe(false);
+ systemIDs.add(system.id);
+
+ const componentIDs = (system.components ?? [])
+ .map((component) => component.connectionId)
+ .filter((id): id is string => Boolean(id));
+ expect(
+ new Set(componentIDs).size,
+ `System ${system.id} should not duplicate component connection ids`,
+ ).toBe(componentIDs.length);
+
+ const memberKeys = (system.members ?? [])
+ .map((member) => (member.name || member.id || "").trim().toLowerCase())
+ .filter(Boolean);
+ expect(
+ new Set(memberKeys).size,
+ `System ${system.id} should not duplicate member names`,
+ ).toBe(memberKeys.length);
+ }
+
+ await page.goto("/settings/infrastructure/operations", {
+ waitUntil: "domcontentloaded",
+ });
+ await expect(
+ page.getByRole("region", { name: "Infrastructure setup summary" }),
+ ).toBeVisible();
+ await expect(page.getByText("Connected systems", { exact: true })).toBeVisible();
+ await expect(page.getByText("Config pending", { exact: true })).toHaveCount(0);
+ await expect(page.getByText("Rollout pending", { exact: true })).toHaveCount(0);
+ await assertSettingsInfrastructureDoesNotBlank(page, 4_000);
+ });
+});