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.

Harden infrastructure ledger posture tests

rcourtman546f80582383
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index fa1b7434b9..f3edcefbed 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -2384,6 +2384,7 @@
"test",
"--",
"src/components/Settings/__tests__/ConnectionsTable.test.tsx",
+ "src/components/Settings/__tests__/connectionsTableModel.test.ts",
"src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx",
"src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx",
"src/components/Settings/__tests__/useConnectionsLedger.test.ts",
@@ -2403,6 +2404,11 @@
"path": "frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
+ "kind": "file"
+ },
{
"repo": "pulse",
"path": "frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx",
@@ -3749,6 +3755,11 @@
"path": "frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
+ "kind": "file"
+ },
{
"repo": "pulse",
"path": "frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx",
@@ -4580,6 +4591,11 @@
"path": "frontend-modern/src/components/Settings/__tests__/ConnectionsTable.test.tsx",
"kind": "file"
},
+ {
+ "repo": "pulse",
+ "path": "frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts",
+ "kind": "file"
+ },
{
"repo": "pulse",
"path": "frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx",
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
index 0356a62e9b..c92ce5649b 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureSourceManager.test.tsx
@@ -1,7 +1,11 @@
import { cleanup, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it } from 'vitest';
import { InfrastructureSourceManager } from '../InfrastructureSourceManager';
-import type { FleetGovernanceSignal, InfrastructureSystemRow } from '../connectionsTableModel';
+import type {
+ FleetGovernanceSignal,
+ InfrastructureSystemMemberRow,
+ InfrastructureSystemRow,
+} from '../connectionsTableModel';
import type { Connection } from '@/api/connections';
const connectionFixture = (overrides: Partial<Connection> = {}): Connection => ({
@@ -61,6 +65,24 @@ const row = (overrides: Partial<InfrastructureSystemRow> = {}): InfrastructureSy
};
};
+const member = (
+ overrides: Partial<InfrastructureSystemMemberRow> = {},
+): InfrastructureSystemMemberRow => ({
+ id: overrides.id ?? 'member-1',
+ name: overrides.name ?? 'member-1',
+ subtitle: overrides.subtitle ?? 'Cluster member',
+ source: overrides.source ?? 'agent',
+ host: overrides.host ?? 'https://member-1:8006',
+ coverageLabels: overrides.coverageLabels ?? ['Host telemetry'],
+ statusLabel: overrides.statusLabel ?? 'Active',
+ statusClassName: overrides.statusClassName ?? 'bg-green-100 text-green-800',
+ lastActivityText: overrides.lastActivityText ?? '5s ago',
+ fleetSignals: overrides.fleetSignals ?? [],
+ fleetHighlights: overrides.fleetHighlights ?? [],
+ primary: overrides.primary ?? false,
+ agentConnection: overrides.agentConnection,
+});
+
describe('InfrastructureSourceManager setup summary', () => {
afterEach(() => cleanup());
@@ -160,4 +182,56 @@ describe('InfrastructureSourceManager setup summary', () => {
expect(screen.queryByText('Config pending')).toBeNull();
expect(screen.queryByText('Rollout pending')).toBeNull();
});
+
+ it('still counts actionable member posture when the cluster parent is healthy', () => {
+ render(() => (
+ <InfrastructureSourceManager
+ rows={() => [
+ row({
+ id: 'pve:homelab',
+ ownerType: 'pve',
+ name: 'homelab',
+ source: 'both',
+ isCluster: true,
+ fleetSignals: [signal({ key: 'liveness', label: 'Live', tone: 'ok' })],
+ fleetHighlights: [signal({ key: 'liveness', label: 'Fleet OK', tone: 'ok' })],
+ members: [
+ member({
+ id: 'node-delly',
+ name: 'delly',
+ fleetSignals: [
+ signal({
+ key: 'config-drift',
+ label: 'Config drift',
+ detail: 'Desired and applied fingerprints differ.',
+ tone: 'warning',
+ }),
+ ],
+ fleetHighlights: [
+ signal({
+ key: 'config-drift',
+ label: 'Config drift',
+ detail: 'Desired and applied fingerprints differ.',
+ tone: 'warning',
+ }),
+ ],
+ primary: true,
+ }),
+ ],
+ }),
+ ]}
+ discoveredNodes={() => []}
+ discoveryEnabled
+ discoveryScanStatus={() => ({ scanning: false })}
+ readOnly
+ />
+ ));
+
+ expect(screen.getByText('Needs attention').nextElementSibling?.textContent).toBe('1 system');
+ expect(screen.getByText('Fleet OK')).toBeInTheDocument();
+ expect(screen.getByText('Config drift')).toHaveAttribute(
+ 'title',
+ 'Desired and applied fingerprints differ.',
+ );
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
new file mode 100644
index 0000000000..6e57d5df67
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/connectionsTableModel.test.ts
@@ -0,0 +1,149 @@
+import { describe, expect, it } from 'vitest';
+import type { Connection } from '@/api/connections';
+import {
+ fleetGovernanceSignalsForConnection,
+ visibleFleetGovernanceSignals,
+ type FleetGovernanceSignal,
+} from '../connectionsTableModel';
+
+const connectionFixture = (overrides: Partial<Connection> = {}): Connection => ({
+ id: 'agent:host-1',
+ type: 'agent',
+ name: 'host-1',
+ address: 'host-1',
+ state: 'active',
+ stateReason: '',
+ enabled: true,
+ surfaces: ['host'],
+ scope: { host: true },
+ lastSeen: '2026-04-23T12:00:00Z',
+ lastError: null,
+ source: 'agent',
+ capabilities: { supportsPause: false, supportsScope: false, supportsTest: false },
+ ...overrides,
+});
+
+describe('visibleFleetGovernanceSignals', () => {
+ it('hides passive agent config fingerprint handshakes while preserving raw fleet facts', () => {
+ const rawSignals = fleetGovernanceSignalsForConnection(
+ connectionFixture({
+ fleet: {
+ enrollmentState: 'enrolled',
+ livenessState: 'active',
+ versionDrift: 'current',
+ adapterHealth: 'healthy',
+ configRollout: 'reported',
+ credentialStatus: 'verified',
+ updateStatus: 'current',
+ remoteControl: 'disabled',
+ configDrift: {
+ status: 'pending',
+ reason: 'Pulse has not received a comparable applied agent configuration fingerprint yet',
+ },
+ rollout: {
+ status: 'pending',
+ reason: 'waiting for the agent to report an applied configuration fingerprint',
+ },
+ 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(['Config pending', 'Rollout pending', '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({
+ fleet: {
+ enrollmentState: 'enrolled',
+ livenessState: 'active',
+ versionDrift: 'current',
+ adapterHealth: 'healthy',
+ configRollout: 'reported',
+ credentialStatus: 'verified',
+ updateStatus: 'current',
+ remoteControl: 'disabled',
+ configDrift: {
+ status: 'pending',
+ reason: 'Desired config v2 has been assigned and the agent has not applied it yet.',
+ },
+ rollout: {
+ status: 'pending',
+ reason: 'The staged rollout is waiting for the next canary batch.',
+ },
+ credentialHealth: { status: 'verified', kind: 'agent-token' },
+ commandPolicy: {
+ status: 'disabled',
+ desired: 'disabled',
+ applied: 'disabled',
+ enforcement: 'in-sync',
+ },
+ },
+ }),
+ );
+
+ expect(visibleFleetGovernanceSignals(rawSignals).map((signal) => signal.label)).toEqual([
+ 'Config pending',
+ 'Rollout pending',
+ 'Remote control disabled',
+ ]);
+ });
+
+ it('does not hide unrelated warning signals just because their detail mentions fingerprints', () => {
+ const signals: FleetGovernanceSignal[] = [
+ {
+ key: 'credentials',
+ label: 'Credentials expiring',
+ detail: 'Token rotation must refresh the credential fingerprint before expiry.',
+ tone: 'warning',
+ },
+ {
+ key: 'config-drift',
+ label: 'Config pending',
+ detail: 'Pulse has not received a comparable applied agent configuration fingerprint yet.',
+ tone: 'warning',
+ },
+ ];
+
+ expect(visibleFleetGovernanceSignals(signals).map((signal) => signal.label)).toEqual([
+ 'Credentials expiring',
+ ]);
+ });
+
+ it('falls back to Fleet OK only when every warning was a passive handshake', () => {
+ const signals: FleetGovernanceSignal[] = [
+ {
+ key: 'config-drift',
+ label: 'Config pending',
+ detail: 'Pulse has not received a comparable applied agent config fingerprint yet.',
+ tone: 'warning',
+ },
+ {
+ key: 'rollout',
+ label: 'Rollout pending',
+ detail: 'Waiting for the agent to report an applied configuration fingerprint.',
+ tone: 'warning',
+ },
+ ];
+
+ expect(visibleFleetGovernanceSignals(signals)).toMatchObject([
+ {
+ key: 'liveness',
+ label: 'Fleet OK',
+ tone: 'ok',
+ },
+ ]);
+ });
+});