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.

Reject out-of-range backup dates before calculating contributions

pulse-triage[bot]5d60aa4f1c8e
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupActivityPresentation.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupActivityPresentation.test.ts
index dc11a6eed2..0f7621e220 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupActivityPresentation.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupActivityPresentation.test.ts
@@ -215,14 +215,19 @@ describe('proxmoxBackupActivityPresentation', () => {
it('skips in-window items classified as null without classifying out-of-window items', () => {
const classifySpy = vi.fn((item: ActivityItem) => item.kind);
+ const getValueSpy = vi.fn(() => 1);
const items: ActivityItem[] = [
{ ts: localMs(2026, 1, 6, 12, 0), kind: 'ok' },
{ ts: localMs(2026, 1, 13, 9, 0), kind: null },
{ ts: localMs(2026, 1, 13, 10, 0), kind: 'ok' },
];
- const timeline = buildBackupActivityTimeline(7, items, itemMs, classifySpy, { now: NOW });
+ const timeline = buildBackupActivityTimeline(7, items, itemMs, classifySpy, {
+ now: NOW,
+ getValue: getValueSpy,
+ });
expect(classifySpy).toHaveBeenCalledTimes(2);
+ expect(getValueSpy).toHaveBeenCalledExactlyOnceWith(items[2]);
expect(timeline.points.at(-1)!.total).toBe(1);
});
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupActivityPresentation.ts b/frontend-modern/src/features/proxmox/proxmoxBackupActivityPresentation.ts
index f2f4763c1d..0f8744c891 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupActivityPresentation.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupActivityPresentation.ts
@@ -113,15 +113,15 @@ export function buildBackupActivityTimeline<T>(
if (ts === undefined || !Number.isFinite(ts)) continue;
// A future time on today's date is still not observed past activity.
if (ts > now.getTime()) continue;
- const kind = classify(item);
- if (!kind) continue;
- const value = getValue(item);
- if (!Number.isFinite(value) || value <= 0) continue;
const key = recoveryDateKeyFromTimestamp(ts);
// Membership in the calendar window includes the entire first local day
// and today's observed hours even when a day lasts 23, 25 or 24.5 hours.
const bucket = buckets.get(key);
if (!bucket) continue;
+ const kind = classify(item);
+ if (!kind) continue;
+ const value = getValue(item);
+ if (!Number.isFinite(value) || value <= 0) continue;
bucket.counts[kind] += value;
bucket.total += value;
}