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.

Expose honest Proxmox update evidence

pulse-triage[bot]8c65d716f41c
diff --git a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx
index b9c8062c53..310f7dc4ab 100644
--- a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx
+++ b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx
@@ -11,6 +11,7 @@ import type { Alert, Disk, Node, Temperature } from '@/types/api';
import { alertTypeDisplayLabel } from '@/features/alerts/helpers';
import { formatBytes, normalizeDiskArray } from '@/utils/format';
import type { MetricDisplayThresholds } from '@/utils/metricThresholds';
+import { getProxmoxUpdateEvidencePresentation } from '@/utils/proxmoxUpdateEvidence';
import { formatTemperature, getCpuTemperature, getTemperatureTextClass } from '@/utils/temperature';
import { buildDrawerDiskListItems } from './DrawerDiskListCard';
@@ -146,6 +147,7 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {
return clock && clock !== '0' ? clock : '';
};
const loadAverageLabel = () => formatLoadAverage(props.node.loadAverage);
+ const updateEvidence = () => getProxmoxUpdateEvidencePresentation(props.node);
const platformRows = (): NodeOverviewRow[] => [
...(cleanText(props.node.kernelVersion)
@@ -282,6 +284,7 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {
const overviewSections = () => {
const primaryTemperature = getCpuTemperature(props.node.temperature);
+ const updates = updateEvidence();
const temperatureClass =
typeof primaryTemperature === 'number'
? getTemperatureTextClass(primaryTemperature, props.temperatureThresholds)
@@ -295,8 +298,11 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {
'Pulse coverage',
linkedAgentId() ? `Agent ${stripAgentPrefix(linkedAgentId())}` : 'PVE API only',
),
- typeof props.node.pendingUpdates === 'number' && props.node.pendingUpdates > 0
- ? makeDetailRow('Updates', `${props.node.pendingUpdates} pending`, { tone: 'warning' })
+ updates
+ ? makeDetailRow('Updates', updates.value, {
+ tone: updates.tone,
+ title: updates.title,
+ })
: null,
typeof primaryTemperature === 'number' &&
(temperatureClass.includes('yellow') || temperatureClass.includes('red'))
diff --git a/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.updateEvidence.test.tsx b/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.updateEvidence.test.tsx
new file mode 100644
index 0000000000..52f83acd37
--- /dev/null
+++ b/frontend-modern/src/components/Workloads/__tests__/NodeDrawerOverview.updateEvidence.test.tsx
@@ -0,0 +1,57 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { NodeDrawerOverview } from '@/components/Workloads/NodeDrawerOverview';
+import type { Node } from '@/types/api';
+
+const makeNode = (overrides: Partial<Node>): Node =>
+ ({
+ id: 'lab-pve1',
+ name: 'pve1',
+ instance: 'lab',
+ status: 'online',
+ type: 'node',
+ cpu: 0,
+ memory: { total: 1024, used: 256, free: 768, usage: 25 },
+ disk: { total: 1024, used: 256, free: 768, usage: 25 },
+ uptime: 3600,
+ loadAverage: [],
+ kernelVersion: '6.8.12',
+ pveVersion: 'pve-manager/9.0.1',
+ cpuInfo: { model: 'CPU', cores: 4, sockets: 1, mhz: '2400' },
+ lastSeen: '2026-08-29T12:00:00Z',
+ connectionHealth: 'healthy',
+ ...overrides,
+ }) as Node;
+
+afterEach(cleanup);
+
+describe('NodeDrawerOverview update evidence', () => {
+ it('shows confirmed zero evidence instead of omitting the update row', () => {
+ render(() => (
+ <NodeDrawerOverview
+ node={makeNode({
+ pendingUpdates: 0,
+ pendingUpdatesStatus: 'checked',
+ pendingUpdatesCheckedAt: new Date().toISOString(),
+ })}
+ />
+ ));
+
+ expect(screen.getByText('Updates')).toBeInTheDocument();
+ expect(screen.getByText(/No pending updates · checked/)).toBeInTheDocument();
+ });
+
+ it('explains why update evidence is unavailable', () => {
+ render(() => (
+ <NodeDrawerOverview
+ node={makeNode({
+ pendingUpdatesStatus: 'unavailable',
+ pendingUpdatesReason: 'permission_denied',
+ })}
+ />
+ ));
+
+ expect(screen.getByText('Unavailable · Sys.Audit permission required')).toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 6013e5b9aa..1ec4d85569 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -52,6 +52,7 @@ import { type WorkloadsMetricDisplayMode } from '@/components/Workloads/workload
import { type WorkloadTableMetricHistoryRange } from '@/components/Workloads/workloadMetricHistoryModel';
import type { Disk, Node as LegacyNode } from '@/types/api';
import type { Resource } from '@/types/resource';
+import { hasCurrentProxmoxUpdateEvidence } from '@/utils/proxmoxUpdateEvidence';
import { nodeFromResource } from '@/utils/resourceStateAdapters';
import {
getResourceClusterLabel,
@@ -451,6 +452,10 @@ export const ProxmoxNodesTable: Component<{
return shimmed ? getNodeExternalUrl(shimmed) : '';
};
const pendingUpdates = () => drawerNode()?.pendingUpdates ?? 0;
+ const pendingUpdatesAreCurrent = () => {
+ const currentNode = drawerNode();
+ return currentNode ? hasCurrentProxmoxUpdateEvidence(currentNode) : false;
+ };
const alertStyles = createMemo(() =>
getAlertStyles(node.id, activeAlerts, alertsEnabled(), node.name),
);
@@ -514,7 +519,11 @@ export const ProxmoxNodesTable: Component<{
{availabilityLabel()}
</span>
</Show>
- <Show when={isOnline() && pendingUpdates() > 0}>
+ <Show
+ when={
+ isOnline() && pendingUpdatesAreCurrent() && pendingUpdates() > 0
+ }
+ >
<span
class={`hidden rounded px-1 py-0 text-[9px] font-medium whitespace-nowrap sm:inline-flex ${
pendingUpdates() >= 10
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
index 196cd9508a..36419d8f0e 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxNodesTable.test.tsx
@@ -383,8 +383,6 @@ describe('ProxmoxNodesTable', () => {
nodes={[
makeNodeResource({
uptime: 187_200, // 2d 4h
- // pendingUpdates rides the raw proxmox payload; the narrow
- // ResourceProxmoxMeta type does not declare it yet.
proxmox: {
clusterName: 'homelab',
nodeName: 'pve-node-1',
@@ -417,6 +415,30 @@ describe('ProxmoxNodesTable', () => {
expect(offlineRow).toHaveTextContent('Offline');
});
+ it('does not present a retained stale update count as current in the node row', () => {
+ render(() => (
+ <ProxmoxNodesTable
+ nodes={[
+ makeNodeResource({
+ proxmox: {
+ clusterName: 'homelab',
+ nodeName: 'pve-node-1',
+ pendingUpdates: 12,
+ pendingUpdatesStatus: 'stale',
+ pendingUpdatesReason: 'source_unavailable',
+ },
+ }),
+ ]}
+ guests={[]}
+ emptyIcon={<span />}
+ emptyTitle="No Proxmox VE nodes"
+ emptyDescription="No nodes"
+ />
+ ));
+
+ expect(screen.queryByTitle('12 pending apt updates')).not.toBeInTheDocument();
+ });
+
it('labels stale provider telemetry and does not present old metrics as current', () => {
render(() => (
<ProxmoxNodesTable
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index 67246b24c7..3a6c77e9e6 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -269,6 +269,9 @@ type APIResource = {
pendingUpdates?: number;
temperatureMonitoringEnabled?: boolean;
pendingUpdatesCheckedAt?: string;
+ pendingUpdatesStatus?: 'checked' | 'stale' | 'unavailable' | 'not_checked';
+ pendingUpdatesReason?:
+ 'permission_denied' | 'source_unavailable' | 'check_failed' | 'node_offline';
swapUsed?: number;
swapTotal?: number;
balloon?: number;
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index d300184b0e..76054871b6 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -172,6 +172,9 @@ export interface Node {
temperatureMonitoringEnabled?: boolean | null; // Per-node temperature monitoring override
pendingUpdates?: number; // Number of pending apt updates
pendingUpdatesCheckedAt?: string; // When updates were last checked
+ pendingUpdatesStatus?: 'checked' | 'stale' | 'unavailable' | 'not_checked';
+ pendingUpdatesReason?:
+ 'permission_denied' | 'source_unavailable' | 'check_failed' | 'node_offline';
lastSeen: string;
connectionHealth: string;
isClusterMember?: boolean; // True if part of a cluster
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index 00b946dacc..88d7c03da7 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -752,6 +752,9 @@ export interface ResourceProxmoxMeta {
loadAverage?: number[];
temperatureMonitoringEnabled?: boolean;
pendingUpdatesCheckedAt?: string;
+ pendingUpdatesStatus?: 'checked' | 'stale' | 'unavailable' | 'not_checked';
+ pendingUpdatesReason?:
+ 'permission_denied' | 'source_unavailable' | 'check_failed' | 'node_offline';
lock?: string;
pveVersion?: string;
kernelVersion?: string;
diff --git a/frontend-modern/src/utils/__tests__/proxmoxUpdateEvidence.test.ts b/frontend-modern/src/utils/__tests__/proxmoxUpdateEvidence.test.ts
new file mode 100644
index 0000000000..07a1fefddd
--- /dev/null
+++ b/frontend-modern/src/utils/__tests__/proxmoxUpdateEvidence.test.ts
@@ -0,0 +1,68 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ getProxmoxUpdateEvidencePresentation,
+ hasCurrentProxmoxUpdateEvidence,
+} from '@/utils/proxmoxUpdateEvidence';
+
+const relative = () => '5 mins ago';
+
+describe('Proxmox update evidence presentation', () => {
+ it('makes a confirmed zero visible', () => {
+ expect(
+ getProxmoxUpdateEvidencePresentation(
+ {
+ pendingUpdates: 0,
+ pendingUpdatesStatus: 'checked',
+ pendingUpdatesCheckedAt: '2026-08-29T12:00:00Z',
+ },
+ relative,
+ ),
+ ).toEqual({
+ value: 'No pending updates · checked 5 mins ago',
+ title: 'Last successful update check 5 mins ago',
+ tone: 'success',
+ current: true,
+ });
+ });
+
+ it('labels retained counts stale after a failed refresh', () => {
+ expect(
+ getProxmoxUpdateEvidencePresentation(
+ {
+ pendingUpdates: 12,
+ pendingUpdatesStatus: 'stale',
+ pendingUpdatesReason: 'source_unavailable',
+ pendingUpdatesCheckedAt: '2026-08-29T12:00:00Z',
+ },
+ relative,
+ ),
+ ).toMatchObject({
+ value: '12 pending · stale · checked 5 mins ago',
+ title: 'Proxmox source unavailable · last success 5 mins ago',
+ current: false,
+ });
+ });
+
+ it('explains unavailable permission evidence without exposing provider errors', () => {
+ expect(
+ getProxmoxUpdateEvidencePresentation({
+ pendingUpdatesStatus: 'unavailable',
+ pendingUpdatesReason: 'permission_denied',
+ }),
+ ).toMatchObject({
+ value: 'Unavailable · Sys.Audit permission required',
+ current: false,
+ });
+ });
+
+ it('only treats checked or legacy-positive evidence as current', () => {
+ expect(hasCurrentProxmoxUpdateEvidence({ pendingUpdates: 3 })).toBe(true);
+ expect(
+ hasCurrentProxmoxUpdateEvidence({ pendingUpdates: 3, pendingUpdatesStatus: 'stale' }),
+ ).toBe(false);
+ expect(
+ hasCurrentProxmoxUpdateEvidence({ pendingUpdates: 0, pendingUpdatesStatus: 'checked' }),
+ ).toBe(true);
+ });
+});
diff --git a/frontend-modern/src/utils/proxmoxUpdateEvidence.ts b/frontend-modern/src/utils/proxmoxUpdateEvidence.ts
new file mode 100644
index 0000000000..a8c144ae19
--- /dev/null
+++ b/frontend-modern/src/utils/proxmoxUpdateEvidence.ts
@@ -0,0 +1,99 @@
+import type { Node } from '@/types/api';
+import { formatRelativeTime } from '@/utils/format';
+
+export interface ProxmoxUpdateEvidencePresentation {
+ value: string;
+ title: string;
+ tone: 'success' | 'warning' | 'default';
+ current: boolean;
+}
+
+type UpdateEvidenceNode = Pick<
+ Node,
+ 'pendingUpdates' | 'pendingUpdatesCheckedAt' | 'pendingUpdatesStatus' | 'pendingUpdatesReason'
+>;
+
+const reasonLabel = (reason: Node['pendingUpdatesReason']): string => {
+ switch (reason) {
+ case 'permission_denied':
+ return 'Sys.Audit permission required';
+ case 'source_unavailable':
+ return 'Proxmox source unavailable';
+ case 'check_failed':
+ return 'Latest check failed';
+ case 'node_offline':
+ return 'Node offline';
+ default:
+ return '';
+ }
+};
+
+const countLabel = (count: number): string =>
+ count === 0 ? 'No pending updates' : `${count} pending`;
+
+export const getProxmoxUpdateEvidencePresentation = (
+ node: UpdateEvidenceNode,
+ formatCheckedAt: (value: string) => string = (value) => formatRelativeTime(value),
+): ProxmoxUpdateEvidencePresentation | null => {
+ const count = Math.max(0, Math.trunc(node.pendingUpdates ?? 0));
+ const checkedAt = node.pendingUpdatesCheckedAt
+ ? formatCheckedAt(node.pendingUpdatesCheckedAt)
+ : '';
+ const reason = reasonLabel(node.pendingUpdatesReason);
+ const status =
+ node.pendingUpdatesStatus ||
+ (node.pendingUpdatesCheckedAt || (typeof node.pendingUpdates === 'number' && count > 0)
+ ? 'checked'
+ : '');
+
+ switch (status) {
+ case 'checked': {
+ const value = [countLabel(count), checkedAt ? `checked ${checkedAt}` : '']
+ .filter(Boolean)
+ .join(' · ');
+ return {
+ value,
+ title: checkedAt ? `Last successful update check ${checkedAt}` : 'Update check completed',
+ tone: count > 0 ? 'warning' : 'success',
+ current: true,
+ };
+ }
+ case 'stale': {
+ const value = [countLabel(count), 'stale', checkedAt ? `checked ${checkedAt}` : '']
+ .filter(Boolean)
+ .join(' · ');
+ return {
+ value,
+ title: [
+ reason || 'Latest update check failed',
+ checkedAt ? `last success ${checkedAt}` : '',
+ ]
+ .filter(Boolean)
+ .join(' · '),
+ tone: 'warning',
+ current: false,
+ };
+ }
+ case 'unavailable':
+ return {
+ value: ['Unavailable', reason].filter(Boolean).join(' · '),
+ title: reason || 'Update evidence is unavailable',
+ tone: 'warning',
+ current: false,
+ };
+ case 'not_checked':
+ return {
+ value: ['Not checked', reason].filter(Boolean).join(' · '),
+ title: reason || 'Update evidence has not been checked',
+ tone: 'default',
+ current: false,
+ };
+ default:
+ return null;
+ }
+};
+
+export const hasCurrentProxmoxUpdateEvidence = (node: UpdateEvidenceNode): boolean => {
+ if (node.pendingUpdatesStatus) return node.pendingUpdatesStatus === 'checked';
+ return Boolean(node.pendingUpdatesCheckedAt) || (node.pendingUpdates ?? 0) > 0;
+};
diff --git a/frontend-modern/src/utils/resourceStateAdapters.ts b/frontend-modern/src/utils/resourceStateAdapters.ts
index cfb004bdaa..6d1c15bdf2 100644
--- a/frontend-modern/src/utils/resourceStateAdapters.ts
+++ b/frontend-modern/src/utils/resourceStateAdapters.ts
@@ -1339,6 +1339,8 @@ export const nodeFromResource = (resource: Resource): Node | null => {
null,
pendingUpdates: asNumber(proxmox?.pendingUpdates),
pendingUpdatesCheckedAt: asString(proxmox?.pendingUpdatesCheckedAt),
+ pendingUpdatesStatus: asString(proxmox?.pendingUpdatesStatus) as Node['pendingUpdatesStatus'],
+ pendingUpdatesReason: asString(proxmox?.pendingUpdatesReason) as Node['pendingUpdatesReason'],
lastSeen: toISOTime(undefined, resource.lastSeen),
connectionHealth: asString(proxmox?.connectionHealth) || resource.status || 'unknown',
isClusterMember: asBoolean(proxmox?.isClusterMember),
diff --git a/internal/models/models.go b/internal/models/models.go
index 1a260abe7d..1e428f1481 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -153,7 +153,9 @@ type Node struct {
// Package updates - polled less frequently (every 30 mins)
PendingUpdates int `json:"pendingUpdates"` // Number of pending apt updates
- PendingUpdatesCheckedAt time.Time `json:"pendingUpdatesCheckedAt,omitempty"` // When updates were last checked
+ PendingUpdatesCheckedAt time.Time `json:"pendingUpdatesCheckedAt,omitempty"` // When updates were last successfully checked
+ PendingUpdatesStatus string `json:"pendingUpdatesStatus,omitempty"` // checked, stale, unavailable, or not_checked
+ PendingUpdatesReason string `json:"pendingUpdatesReason,omitempty"` // Fixed diagnostic category; never a raw provider error
// Linking: When a host agent is running on this PVE node, link them together
LinkedAgentID string `json:"linkedAgentId,omitempty"` // ID of the host agent running on this node
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 50a6a64328..57c961c328 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -3452,6 +3452,8 @@ func nodeFromReadStateView(view *unifiedresources.NodeView) models.Node {
ClusterName: view.ClusterName(),
PendingUpdates: view.PendingUpdates(),
PendingUpdatesCheckedAt: view.PendingUpdatesCheckedAt(),
+ PendingUpdatesStatus: view.PendingUpdatesStatus(),
+ PendingUpdatesReason: view.PendingUpdatesReason(),
LinkedAgentID: view.LinkedAgentID(),
}
}
diff --git a/internal/monitoring/monitor_polling_node_helpers.go b/internal/monitoring/monitor_polling_node_helpers.go
index a2aa52e298..d6984f45fc 100644
--- a/internal/monitoring/monitor_polling_node_helpers.go
+++ b/internal/monitoring/monitor_polling_node_helpers.go
@@ -344,6 +344,12 @@ func (m *Monitor) applyNodePendingUpdates(ctx context.Context, instanceName stri
if modelNode == nil {
return
}
+ modelNode.PendingUpdatesStatus = "not_checked"
+ modelNode.PendingUpdatesReason = ""
+ if effectiveStatus != "online" {
+ modelNode.PendingUpdatesReason = "node_offline"
+ return
+ }
// Poll pending apt updates (less frequently - every 30 minutes)
// Only for online nodes to avoid wasting API calls on offline nodes
@@ -366,20 +372,26 @@ func (m *Monitor) applyNodePendingUpdates(ctx context.Context, instanceName stri
// Time to check for updates
pendingPkgs, err := client.GetNodePendingUpdates(ctx, node.Node)
if err != nil {
- // API call failed - preserve cached value if available, don't spam logs
+ // Preserve the last successful value, but mark it stale rather than
+ // presenting a permission or reachability failure as a confirmed zero.
log.Debug().
Err(err).
Str("node", node.Node).
Str("instance", instanceName).
Msg("Could not check pending apt updates (may require Sys.Audit permission)")
+ modelNode.PendingUpdatesReason = pendingUpdatesFailureReason(err)
if hasCached {
modelNode.PendingUpdates = cached.count
modelNode.PendingUpdatesCheckedAt = cached.checkedAt
+ modelNode.PendingUpdatesStatus = "stale"
+ } else {
+ modelNode.PendingUpdatesStatus = "unavailable"
}
} else {
updateCount := len(pendingPkgs)
modelNode.PendingUpdates = updateCount
modelNode.PendingUpdatesCheckedAt = now
+ modelNode.PendingUpdatesStatus = "checked"
// Cache the result
m.mu.Lock()
@@ -399,10 +411,28 @@ func (m *Monitor) applyNodePendingUpdates(ctx context.Context, instanceName stri
// Use cached value
modelNode.PendingUpdates = cached.count
modelNode.PendingUpdatesCheckedAt = cached.checkedAt
+ modelNode.PendingUpdatesStatus = "checked"
}
}
}
+func pendingUpdatesFailureReason(err error) string {
+ if err == nil {
+ return ""
+ }
+ message := strings.ToLower(err.Error())
+ switch {
+ case strings.Contains(message, "403"), strings.Contains(message, "permission"):
+ return "permission_denied"
+ case strings.Contains(message, "no healthy nodes"), strings.Contains(message, "595"),
+ strings.Contains(message, "offline"), strings.Contains(message, "unavailable"),
+ strings.Contains(message, "connection"), strings.Contains(message, "timeout"):
+ return "source_unavailable"
+ default:
+ return "check_failed"
+ }
+}
+
func (m *Monitor) recordNodePollMetrics(instanceName string, node proxmox.Node, modelNode *models.Node, nodeStart time.Time) {
if m.pollMetrics == nil || modelNode == nil {
return
diff --git a/internal/monitoring/node_pending_updates_evidence_test.go b/internal/monitoring/node_pending_updates_evidence_test.go
new file mode 100644
index 0000000000..bad7a8ab4d
--- /dev/null
+++ b/internal/monitoring/node_pending_updates_evidence_test.go
@@ -0,0 +1,80 @@
+package monitoring
+
+import (
+ "context"
+ "errors"
+ "testing"
+ "time"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/models"
+ "github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"
+)
+
+type pendingUpdatesPVEClient struct {
+ *stubPVEClient
+ packages []proxmox.AptPackage
+ err error
+}
+
+func (c *pendingUpdatesPVEClient) GetNodePendingUpdates(context.Context, string) ([]proxmox.AptPackage, error) {
+ return c.packages, c.err
+}
+
+func TestApplyNodePendingUpdatesEvidenceStates(t *testing.T) {
+ t.Run("confirmed zero", func(t *testing.T) {
+ monitor := &Monitor{}
+ node := &models.Node{}
+ client := &pendingUpdatesPVEClient{stubPVEClient: &stubPVEClient{}}
+
+ monitor.applyNodePendingUpdates(context.Background(), "lab", client, proxmox.Node{Node: "pve1"}, "lab-pve1", "online", node)
+
+ if node.PendingUpdates != 0 || node.PendingUpdatesStatus != "checked" || node.PendingUpdatesCheckedAt.IsZero() {
+ t.Fatalf("expected checked zero evidence, got %+v", node)
+ }
+ })
+
+ t.Run("permission unavailable", func(t *testing.T) {
+ monitor := &Monitor{}
+ node := &models.Node{}
+ client := &pendingUpdatesPVEClient{
+ stubPVEClient: &stubPVEClient{},
+ err: errors.New("authentication error: API error 403 (Forbidden)"),
+ }
+
+ monitor.applyNodePendingUpdates(context.Background(), "lab", client, proxmox.Node{Node: "pve1"}, "lab-pve1", "online", node)
+
+ if node.PendingUpdatesStatus != "unavailable" || node.PendingUpdatesReason != "permission_denied" || !node.PendingUpdatesCheckedAt.IsZero() {
+ t.Fatalf("expected unavailable permission evidence, got %+v", node)
+ }
+ })
+
+ t.Run("cached value becomes stale", func(t *testing.T) {
+ checkedAt := time.Now().Add(-pendingUpdatesCacheTTL - time.Minute)
+ monitor := &Monitor{nodePendingUpdatesCache: map[string]pendingUpdatesCache{
+ "lab-pve1": {count: 7, checkedAt: checkedAt},
+ }}
+ node := &models.Node{}
+ client := &pendingUpdatesPVEClient{
+ stubPVEClient: &stubPVEClient{},
+ err: errors.New("no healthy nodes available"),
+ }
+
+ monitor.applyNodePendingUpdates(context.Background(), "lab", client, proxmox.Node{Node: "pve1"}, "lab-pve1", "online", node)
+
+ if node.PendingUpdates != 7 || node.PendingUpdatesStatus != "stale" || node.PendingUpdatesReason != "source_unavailable" || !node.PendingUpdatesCheckedAt.Equal(checkedAt) {
+ t.Fatalf("expected stale retained evidence, got %+v", node)
+ }
+ })
+
+ t.Run("offline is not checked", func(t *testing.T) {
+ monitor := &Monitor{}
+ node := &models.Node{}
+ client := &pendingUpdatesPVEClient{stubPVEClient: &stubPVEClient{}}
+
+ monitor.applyNodePendingUpdates(context.Background(), "lab", client, proxmox.Node{Node: "pve1"}, "lab-pve1", "offline", node)
+
+ if node.PendingUpdatesStatus != "not_checked" || node.PendingUpdatesReason != "node_offline" {
+ t.Fatalf("expected offline not-checked evidence, got %+v", node)
+ }
+ })
+}
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index 95a761286d..4f83195127 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -73,6 +73,8 @@ func resourceFromProxmoxNode(node models.Node, linkedHost *models.Host) (Resourc
PendingUpdates: node.PendingUpdates,
TemperatureMonitoringEnabled: cloneBoolPtr(node.TemperatureMonitoringEnabled),
PendingUpdatesCheckedAt: zeroTimeToPtr(node.PendingUpdatesCheckedAt),
+ PendingUpdatesStatus: node.PendingUpdatesStatus,
+ PendingUpdatesReason: node.PendingUpdatesReason,
MemoryCache: node.Memory.Cache,
Memory: &node.Memory,
SwapUsed: node.Memory.SwapUsed,
diff --git a/internal/unifiedresources/proxmox_update_evidence_test.go b/internal/unifiedresources/proxmox_update_evidence_test.go
new file mode 100644
index 0000000000..1ae905d14a
--- /dev/null
+++ b/internal/unifiedresources/proxmox_update_evidence_test.go
@@ -0,0 +1,34 @@
+package unifiedresources
+
+import (
+ "testing"
+ "time"
+)
+
+func TestMergeProxmoxDataTreatsUpdateEvidenceAsAuthoritative(t *testing.T) {
+ oldCheckedAt := time.Date(2026, 8, 29, 10, 0, 0, 0, time.UTC)
+ newCheckedAt := oldCheckedAt.Add(time.Hour)
+ existing := &ProxmoxData{
+ PendingUpdates: 9,
+ PendingUpdatesCheckedAt: &oldCheckedAt,
+ PendingUpdatesStatus: "checked",
+ }
+ incoming := &ProxmoxData{
+ PendingUpdates: 0,
+ PendingUpdatesCheckedAt: &newCheckedAt,
+ PendingUpdatesStatus: "checked",
+ }
+
+ merged := mergeProxmoxData(existing, incoming)
+ if merged.PendingUpdates != 0 || merged.PendingUpdatesStatus != "checked" || merged.PendingUpdatesCheckedAt == nil || !merged.PendingUpdatesCheckedAt.Equal(newCheckedAt) {
+ t.Fatalf("expected confirmed zero to replace old positive evidence, got %+v", merged)
+ }
+
+ incoming.PendingUpdatesStatus = "unavailable"
+ incoming.PendingUpdatesReason = "permission_denied"
+ incoming.PendingUpdatesCheckedAt = nil
+ merged = mergeProxmoxData(merged, incoming)
+ if merged.PendingUpdatesStatus != "unavailable" || merged.PendingUpdatesReason != "permission_denied" || merged.PendingUpdatesCheckedAt != nil {
+ t.Fatalf("expected unavailable evidence to clear inherited check metadata, got %+v", merged)
+ }
+}
diff --git a/internal/unifiedresources/registry.go b/internal/unifiedresources/registry.go
index 3a4ab82f41..6945b9e468 100644
--- a/internal/unifiedresources/registry.go
+++ b/internal/unifiedresources/registry.go
@@ -3682,8 +3682,18 @@ func mergeProxmoxData(existing *ProxmoxData, incoming *ProxmoxData) *ProxmoxData
if len(incoming.LoadAverage) > 0 {
merged.LoadAverage = append([]float64(nil), incoming.LoadAverage...)
}
- if incoming.PendingUpdates != 0 {
+ // Update evidence is one authoritative observation. A checked zero must
+ // clear an older positive count, while unavailable/not-checked evidence
+ // must not silently inherit an older "checked" status.
+ if incoming.PendingUpdatesStatus != "" {
merged.PendingUpdates = incoming.PendingUpdates
+ merged.PendingUpdatesCheckedAt = cloneTimePtr(incoming.PendingUpdatesCheckedAt)
+ merged.PendingUpdatesStatus = incoming.PendingUpdatesStatus
+ merged.PendingUpdatesReason = incoming.PendingUpdatesReason
+ } else if incoming.PendingUpdates != 0 {
+ // Compatibility for sources produced before explicit evidence states.
+ merged.PendingUpdates = incoming.PendingUpdates
+ merged.PendingUpdatesCheckedAt = cloneTimePtr(incoming.PendingUpdatesCheckedAt)
}
if len(incoming.Disks) > 0 {
merged.Disks = append([]DiskInfo(nil), incoming.Disks...)
diff --git a/internal/unifiedresources/types.go b/internal/unifiedresources/types.go
index 37c11caf3b..1f81777669 100644
--- a/internal/unifiedresources/types.go
+++ b/internal/unifiedresources/types.go
@@ -388,6 +388,8 @@ type ProxmoxData struct {
PendingUpdates int `json:"pendingUpdates,omitempty"`
TemperatureMonitoringEnabled *bool `json:"temperatureMonitoringEnabled,omitempty"`
PendingUpdatesCheckedAt *time.Time `json:"pendingUpdatesCheckedAt,omitempty"`
+ PendingUpdatesStatus string `json:"pendingUpdatesStatus,omitempty"`
+ PendingUpdatesReason string `json:"pendingUpdatesReason,omitempty"`
Disks []DiskInfo `json:"disks,omitempty"`
SwapUsed int64 `json:"swapUsed,omitempty"`
SwapTotal int64 `json:"swapTotal,omitempty"`
diff --git a/internal/unifiedresources/views.go b/internal/unifiedresources/views.go
index 5c93bd90f9..b1385c9be2 100644
--- a/internal/unifiedresources/views.go
+++ b/internal/unifiedresources/views.go
@@ -852,6 +852,20 @@ func (v NodeView) PendingUpdatesCheckedAt() time.Time {
return *v.r.Proxmox.PendingUpdatesCheckedAt
}
+func (v NodeView) PendingUpdatesStatus() string {
+ if v.r == nil || v.r.Proxmox == nil {
+ return ""
+ }
+ return strings.TrimSpace(v.r.Proxmox.PendingUpdatesStatus)
+}
+
+func (v NodeView) PendingUpdatesReason() string {
+ if v.r == nil || v.r.Proxmox == nil {
+ return ""
+ }
+ return strings.TrimSpace(v.r.Proxmox.PendingUpdatesReason)
+}
+
func (v NodeView) CPUPercent() float64 {
if v.r == nil {
return 0
diff --git a/internal/unifiedresources/views_test.go b/internal/unifiedresources/views_test.go
index cc6c6465d5..54b8eb8b0b 100644
--- a/internal/unifiedresources/views_test.go
+++ b/internal/unifiedresources/views_test.go
@@ -557,6 +557,8 @@ func TestView_NodeViewAccessors(t *testing.T) {
PendingUpdates: 7,
TemperatureMonitoringEnabled: &tempEnabled,
PendingUpdatesCheckedAt: &updatesCheckedAt,
+ PendingUpdatesStatus: "stale",
+ PendingUpdatesReason: "source_unavailable",
LinkedAgentID: " agent-123 ",
CPUs: 4, // should be ignored when CPUInfo is valid
},
@@ -605,6 +607,9 @@ func TestView_NodeViewAccessors(t *testing.T) {
if !v.PendingUpdatesCheckedAt().Equal(updatesCheckedAt) {
t.Fatalf("expected PendingUpdatesCheckedAt %v, got %v", updatesCheckedAt, v.PendingUpdatesCheckedAt())
}
+ if v.PendingUpdatesStatus() != "stale" || v.PendingUpdatesReason() != "source_unavailable" {
+ t.Fatalf("expected update evidence state to survive the view, got status=%q reason=%q", v.PendingUpdatesStatus(), v.PendingUpdatesReason())
+ }
if v.LinkedAgentID() != "agent-123" {
t.Fatalf("expected LinkedAgentID %q, got %q", "agent-123", v.LinkedAgentID())
}
diff --git a/pkg/proxmox/cluster_client.go b/pkg/proxmox/cluster_client.go
index eb451db22e..be6d44c381 100644
--- a/pkg/proxmox/cluster_client.go
+++ b/pkg/proxmox/cluster_client.go
@@ -1594,17 +1594,6 @@ func (cc *ClusterClient) GetNodePendingUpdates(ctx context.Context, node string)
return nil
})
- // Don't return error for transient connectivity issues or permission issues
- if err != nil && (strings.Contains(err.Error(), "no healthy nodes available") ||
- strings.Contains(err.Error(), "403") || strings.Contains(err.Error(), "permission")) {
- log.Debug().
- Str("cluster", cc.name).
- Str("node", node).
- Err(err).
- Msg("Could not get pending updates - returning empty list")
- return []AptPackage{}, nil
- }
-
return result, err
}
diff --git a/pkg/proxmox/cluster_client_additional_api5_test.go b/pkg/proxmox/cluster_client_additional_api5_test.go
index a855979910..6af8afbf4d 100644
--- a/pkg/proxmox/cluster_client_additional_api5_test.go
+++ b/pkg/proxmox/cluster_client_additional_api5_test.go
@@ -54,10 +54,10 @@ func TestClusterClient_GetNodePendingUpdates_PermissionDenied(t *testing.T) {
cc := NewClusterClient("test", cfg, []string{server.URL}, nil)
updates, err := cc.GetNodePendingUpdates(context.Background(), "node1")
- if err != nil {
- t.Fatalf("expected permission error to be swallowed, got %v", err)
+ if err == nil {
+ t.Fatal("expected permission error to remain distinguishable from a confirmed empty update list")
}
if len(updates) != 0 {
- t.Fatalf("expected empty updates on permission error, got %+v", updates)
+ t.Fatalf("expected no updates on permission error, got %+v", updates)
}
}
diff --git a/pkg/proxmox/cluster_client_additional_api6_test.go b/pkg/proxmox/cluster_client_additional_api6_test.go
index 142b62a4d8..d969ed0461 100644
--- a/pkg/proxmox/cluster_client_additional_api6_test.go
+++ b/pkg/proxmox/cluster_client_additional_api6_test.go
@@ -23,8 +23,8 @@ func TestClusterClient_GetNodePendingUpdates_NoHealthyNodes(t *testing.T) {
}
updates, err := cc.GetNodePendingUpdates(context.Background(), "node1")
- if err != nil {
- t.Fatalf("expected no error, got %v", err)
+ if err == nil {
+ t.Fatal("expected unavailable cluster error to remain distinguishable from a confirmed empty update list")
}
if len(updates) != 0 {
t.Fatalf("expected empty updates on no healthy nodes, got %+v", updates)