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.

Surface PBS job health evidence in drawer

rcourtman5ac37b257b14
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
index 0ac1aafbf0..42e36e95c0 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx
@@ -48,6 +48,7 @@ import {
RESOURCE_SAFE_SUMMARY_LABEL,
} from '@/utils/resourceAnalysisPresentation';
import { formatInteger } from './resourceDetailMappers';
+import { buildPbsJobHealthEvidenceModel } from './resourceDetailDrawerServiceModel';
import { ResourceDetailDrawerSupportDisclosure as SupportDisclosure } from './ResourceDetailDrawerSupportDisclosure';
import type { UseResourceDetailDrawerStateResult } from './useResourceDetailDrawerState';
@@ -70,6 +71,21 @@ const vmwareRowToneClass = (tone?: 'default' | 'accent' | 'warning'): string =>
}
};
+const pbsEvidenceBadgeClass = (tone: string): string => {
+ switch (tone) {
+ case 'danger':
+ return 'border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-700 dark:bg-rose-950/40 dark:text-rose-300';
+ case 'warning':
+ return 'border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-300';
+ case 'success':
+ return 'border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300';
+ case 'info':
+ return 'border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-700 dark:bg-sky-950/40 dark:text-sky-300';
+ default:
+ return 'border-border bg-surface-hover text-muted';
+ }
+};
+
const timelineKindOptions: Array<{ label: string; value: ResourceChangeKind | '' }> = [
{ label: getAllFilterOptionLabel('kinds'), value: '' },
...RESOURCE_CHANGE_KIND_ORDER.map((kind) => ({
@@ -102,6 +118,7 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
) => {
const { resource, drawer } = props;
const showPlatformId = shouldShowResourcePlatformId(resource);
+ const pbsJobHealthEvidence = () => buildPbsJobHealthEvidenceModel(drawer.pbsData());
return (
<div class="space-y-3">
@@ -1087,6 +1104,103 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOver
</div>
</div>
</Show>
+ <Show when={pbsJobHealthEvidence().evidenceCount > 0}>
+ <div
+ data-testid="pbs-job-health-evidence"
+ class="rounded border border-indigo-200 bg-surface px-2 py-1.5 dark:border-indigo-700"
+ >
+ <div class="flex flex-wrap items-center justify-between gap-2">
+ <span class="text-[10px] font-medium uppercase tracking-wide text-muted">
+ Job health evidence
+ </span>
+ <span class="text-[10px] font-semibold text-indigo-700 dark:text-indigo-300">
+ {pbsJobHealthEvidence().countLabel}
+ </span>
+ </div>
+ <div class="mt-2 space-y-2 border-t border-indigo-200 pt-2 dark:border-indigo-700">
+ <For each={pbsJobHealthEvidence().entries}>
+ {(entry) => (
+ <div class="min-w-0 rounded border border-border bg-surface-hover px-2 py-1.5 text-[10px]">
+ <div class="flex flex-wrap items-start justify-between gap-2">
+ <div class="min-w-0">
+ <div
+ class="truncate font-medium text-base-content"
+ title={entry.label}
+ >
+ {entry.label}
+ </div>
+ <div
+ class="truncate text-muted"
+ title={entry.sourceLabel}
+ >
+ {entry.sourceLabel}
+ </div>
+ </div>
+ <div class="flex max-w-full flex-wrap justify-end gap-1">
+ <For each={entry.badges}>
+ {(badge) => (
+ <span
+ class={`shrink-0 rounded-full border px-2 py-0.5 font-medium ${pbsEvidenceBadgeClass(
+ badge.tone,
+ )}`}
+ >
+ {badge.label}
+ </span>
+ )}
+ </For>
+ </div>
+ </div>
+ <div class="mt-1 grid gap-1 text-muted sm:grid-cols-2">
+ <Show when={entry.context}>
+ <span
+ class="truncate"
+ title={entry.context ?? undefined}
+ >
+ {entry.context}
+ </span>
+ </Show>
+ <Show when={entry.stateLabel}>
+ <span
+ class="truncate"
+ title={entry.stateLabel ?? undefined}
+ >
+ State:{' '}
+ <span class="font-medium text-base-content">
+ {entry.stateLabel}
+ </span>
+ </span>
+ </Show>
+ <Show when={entry.freshnessLabel}>
+ <span
+ class="truncate"
+ title={entry.freshnessLabel ?? undefined}
+ >
+ {entry.freshnessLabel}
+ </span>
+ </Show>
+ <Show when={entry.postureReason}>
+ <span
+ class="truncate text-amber-700 dark:text-amber-300"
+ title={entry.postureReason ?? undefined}
+ >
+ {entry.postureReason}
+ </span>
+ </Show>
+ <Show when={entry.error}>
+ <span
+ class="truncate text-rose-700 dark:text-rose-300"
+ title={entry.error ?? undefined}
+ >
+ {entry.error}
+ </span>
+ </Show>
+ </div>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ </Show>
<details class="rounded border border-indigo-200 bg-surface px-2 py-1.5 dark:border-indigo-700">
<summary class="flex cursor-pointer list-none items-center justify-between text-[10px] font-medium text-muted">
<span>Types</span>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
index d77c9af1f2..64b34a4f5e 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx
@@ -857,6 +857,40 @@ describe('ResourceDetailDrawer change history section', () => {
connectionHealth: 'online',
datastoreCount: 2,
backupJobCount: 3,
+ jobHealthEvidenceCount: 2,
+ jobHealthEvidence: [
+ {
+ id: 'backup:task-history:fast:vm/100',
+ family: 'backup',
+ store: 'fast',
+ confidence: 'direct-task-match',
+ evidenceSource: 'pbs-task-history',
+ evidenceScope: 'task-history',
+ 'last-run-state': 'OK',
+ 'last-run-upid': 'UPID:backup:1',
+ 'last-run-endtime': 1776717000,
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'observed',
+ },
+ posture: 'healthy',
+ },
+ {
+ id: 'prune:partial',
+ family: 'prune',
+ store: 'archive',
+ confidence: 'partial-permission',
+ evidenceSource: 'pbs-partial-read',
+ evidenceScope: 'partial-read',
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'partial',
+ },
+ posture: 'unknown',
+ postureReason: 'PBS token cannot read prune job configuration.',
+ error: 'permission denied',
+ },
+ ],
},
},
});
@@ -883,9 +917,17 @@ describe('ResourceDetailDrawer change history section', () => {
expect(screen.queryByText('Backup summary')).toBeNull();
expect(screen.queryByText('Job breakdown')).toBeNull();
expect(screen.queryByText('Types')).toBeNull();
+ expect(screen.queryByText('Job health evidence')).toBeNull();
expect(screen.queryByText('Show job detail')).toBeNull();
fireEvent.click(screen.getByRole('button', { name: 'Show jobs' }));
expect(screen.getByText('Types')).toBeInTheDocument();
+ const evidence = within(screen.getByTestId('pbs-job-health-evidence'));
+ expect(evidence.getByText('2 evidence records')).toBeInTheDocument();
+ expect(evidence.getByText('Observed backup task history')).toBeInTheDocument();
+ expect(evidence.getByText('Partial PBS read')).toBeInTheDocument();
+ expect(evidence.getByText('Partial read')).toBeInTheDocument();
+ expect(evidence.getByText('Permission gap')).toBeInTheDocument();
+ expect(evidence.queryByText(/scheduled backup/i)).toBeNull();
});
it('keeps PMG node count out of the primary mail-flow metric grid', () => {
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerServiceModel.test.ts b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerServiceModel.test.ts
index 3bc5669cf7..2c898e7336 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerServiceModel.test.ts
+++ b/frontend-modern/src/components/Infrastructure/__tests__/resourceDetailDrawerServiceModel.test.ts
@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';
import {
buildPbsActiveTasks,
+ buildPbsJobHealthEvidenceModel,
getPbsActivitySummary,
buildPbsVisibleJobBreakdown,
buildPmgVisibleMailBreakdown,
@@ -121,6 +122,112 @@ describe('resourceDetailDrawerServiceModel', () => {
).toBe('2 datastores · 2 active tasks');
});
+ it('builds PBS job health evidence presentation from observed resource evidence', () => {
+ const pbs = {
+ jobHealthEvidenceCount: 3,
+ jobHealthEvidence: [
+ {
+ id: 'backup:task-history:fast:vm/100',
+ family: 'backup',
+ store: 'fast',
+ confidence: 'direct-task-match',
+ evidenceSource: 'pbs-task-history',
+ evidenceScope: 'task-history',
+ 'last-run-state': 'OK',
+ 'last-run-upid': 'UPID:backup:1',
+ 'last-run-endtime': 1776717000,
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'observed',
+ },
+ posture: 'healthy',
+ },
+ {
+ id: 'prune:partial',
+ family: 'prune',
+ store: 'archive',
+ confidence: 'partial-permission',
+ evidenceSource: 'pbs-partial-read',
+ evidenceScope: 'partial-read',
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'partial',
+ },
+ posture: 'unknown',
+ postureReason: 'PBS token cannot read prune job configuration.',
+ error: 'permission denied',
+ },
+ {
+ id: 'verify:task-history:fast:truncated',
+ family: 'verify',
+ store: 'fast',
+ confidence: 'bounded-task-history-truncated',
+ evidenceSource: 'pbs-task-history',
+ evidenceScope: 'partial-read',
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'partial',
+ },
+ posture: 'unknown',
+ error: 'bounded task history query was truncated',
+ },
+ ],
+ };
+
+ expect(buildPbsJobHealthEvidenceModel(pbs)).toEqual({
+ evidenceCount: 3,
+ visibleCount: 3,
+ countLabel: '3 evidence records',
+ entries: [
+ {
+ id: 'backup:task-history:fast:vm/100',
+ label: 'Backup backup:task-history:fast:vm/100',
+ sourceLabel: 'Observed backup task history',
+ context: 'fast',
+ stateLabel: 'OK',
+ freshnessLabel: 'Last run 2026-04-20T20:30:00Z',
+ postureLabel: 'healthy',
+ postureReason: null,
+ error: null,
+ badges: [
+ { label: 'Direct Task Match', tone: 'info' },
+ { label: 'Healthy', tone: 'success' },
+ ],
+ },
+ {
+ id: 'prune:partial',
+ label: 'Prune prune:partial',
+ sourceLabel: 'Partial PBS read',
+ context: 'archive',
+ stateLabel: 'partial',
+ freshnessLabel: 'Observed 2026-04-20T21:30:00Z',
+ postureLabel: 'unknown',
+ postureReason: 'PBS token cannot read prune job configuration.',
+ error: 'permission denied',
+ badges: [
+ { label: 'Partial read', tone: 'warning' },
+ { label: 'Permission gap', tone: 'danger' },
+ ],
+ },
+ {
+ id: 'verify:task-history:fast:truncated',
+ label: 'Verify verify:task-history:fast:truncated',
+ sourceLabel: 'Observed task history',
+ context: 'fast',
+ stateLabel: 'partial',
+ freshnessLabel: 'Observed 2026-04-20T21:30:00Z',
+ postureLabel: 'unknown',
+ postureReason: null,
+ error: 'bounded task history query was truncated',
+ badges: [
+ { label: 'Partial read', tone: 'warning' },
+ { label: 'Task history truncated', tone: 'warning' },
+ ],
+ },
+ ],
+ });
+ });
+
it('keeps PMG backlog and breakdown visibility canonical', () => {
const pmg = {
queueTotal: 519,
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerServiceModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerServiceModel.ts
index 7a94357a2b..9213d6c1f2 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerServiceModel.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerServiceModel.ts
@@ -1,12 +1,9 @@
-import type {
- DockerPlatformData,
- PBSPlatformData,
- PMGPlatformData,
-} from './resourceDetailMappers';
+import type { DockerPlatformData, PBSPlatformData, PMGPlatformData } from './resourceDetailMappers';
import { formatInteger } from './resourceDetailMappers';
import type {
PBSBackupJob,
PBSGarbageJob,
+ PBSJobHealthEvidence,
PBSPruneJob,
PBSSyncJob,
PBSVerifyJob,
@@ -18,9 +15,7 @@ export type ResourceDetailValueBreakdownEntry = {
warn?: boolean;
};
-const filterVisibleBreakdown = <T extends ResourceDetailValueBreakdownEntry>(
- entries: T[],
-): T[] => {
+const filterVisibleBreakdown = <T extends ResourceDetailValueBreakdownEntry>(entries: T[]): T[] => {
const nonZero = entries.filter((entry) => entry.value > 0);
return nonZero.length > 0 ? nonZero : entries;
};
@@ -37,11 +32,7 @@ const normalizeDelimitedLabel = (value: string): string =>
.join(' ');
const normalizePbsTaskStatus = (status?: string): string =>
- (status || '')
- .trim()
- .toLowerCase()
- .replace(/[_-]+/g, ' ')
- .replace(/\s+/g, ' ');
+ (status || '').trim().toLowerCase().replace(/[_-]+/g, ' ').replace(/\s+/g, ' ');
const PBS_ACTIVE_STATUS_TOKENS = [
'running',
@@ -70,9 +61,7 @@ const PBS_INACTIVE_STATUS_TOKENS = [
] as const;
const hasStatusToken = (status: string, token: string): boolean =>
- new RegExp(`(?:^|\\b)${token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?:$|\\b)`, 'i').test(
- status,
- );
+ new RegExp(`(?:^|\\b)${token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?:$|\\b)`, 'i').test(status);
const isPbsTaskStatusActive = (status?: string): boolean => {
const normalized = normalizePbsTaskStatus(status);
@@ -130,14 +119,36 @@ export type PbsActivitySummary = {
activeTaskCount: number;
};
+export type PbsJobHealthEvidenceBadgeTone = 'neutral' | 'info' | 'warning' | 'danger' | 'success';
+
+export type PbsJobHealthEvidenceBadge = {
+ label: string;
+ tone: PbsJobHealthEvidenceBadgeTone;
+};
+
+export type PbsJobHealthEvidenceEntry = {
+ id: string;
+ label: string;
+ sourceLabel: string;
+ context: string | null;
+ stateLabel: string | null;
+ freshnessLabel: string | null;
+ postureLabel: string | null;
+ postureReason: string | null;
+ error: string | null;
+ badges: PbsJobHealthEvidenceBadge[];
+};
+
+export type PbsJobHealthEvidenceModel = {
+ evidenceCount: number;
+ visibleCount: number;
+ countLabel: string | null;
+ entries: PbsJobHealthEvidenceEntry[];
+};
+
const buildPbsActiveTaskEntry = (
taskType: string,
- job:
- | PBSBackupJob
- | PBSSyncJob
- | PBSVerifyJob
- | PBSPruneJob
- | PBSGarbageJob,
+ job: PBSBackupJob | PBSSyncJob | PBSVerifyJob | PBSPruneJob | PBSGarbageJob,
context: string | null,
): PbsActiveTaskEntry | null => {
if (!isPbsTaskStatusActive(job.status)) {
@@ -211,28 +222,21 @@ export const buildPbsActiveTasks = (pbs: PBSPlatformData | undefined): PbsActive
}
for (const job of pbs.garbageJobs ?? []) {
- const entry = buildPbsActiveTaskEntry(
- 'Garbage Collection',
- job,
- joinPbsTaskContext(job.store),
- );
+ const entry = buildPbsActiveTaskEntry('Garbage Collection', job, joinPbsTaskContext(job.store));
if (entry) tasks.push(entry);
}
return tasks;
};
-export const getPbsActivitySummary = (
- pbs: PBSPlatformData | undefined,
-): PbsActivitySummary => {
+export const getPbsActivitySummary = (pbs: PBSPlatformData | undefined): PbsActivitySummary => {
const totalJobs = getPbsJobTotal(pbs);
const activeTaskCount = buildPbsActiveTasks(pbs).length;
if (activeTaskCount > 0) {
return {
label: `${formatInteger(activeTaskCount)} active`,
- detail:
- totalJobs > activeTaskCount ? `${formatInteger(totalJobs)} total` : null,
+ detail: totalJobs > activeTaskCount ? `${formatInteger(totalJobs)} total` : null,
activeTaskCount,
};
}
@@ -244,6 +248,141 @@ export const getPbsActivitySummary = (
};
};
+const normalizeEvidenceToken = (value?: string): string =>
+ (value || '').trim().toLowerCase().replace(/[_-]+/g, ' ').replace(/\s+/g, ' ');
+
+const formatPbsEvidenceFamily = (family?: string): string => {
+ const normalized = normalizeEvidenceToken(family);
+ if (normalized === 'backup') return 'Backup';
+ if (normalized === 'sync') return 'Sync';
+ if (normalized === 'verify') return 'Verify';
+ if (normalized === 'prune') return 'Prune';
+ if (normalized === 'garbage') return 'Garbage collection';
+ return normalized ? normalizeDelimitedLabel(normalized) : 'Job';
+};
+
+const formatPbsEvidenceSource = (evidence: PBSJobHealthEvidence): string => {
+ const source = normalizeEvidenceToken(evidence.evidenceSource);
+ const scope = normalizeEvidenceToken(evidence.evidenceScope);
+ const family = normalizeEvidenceToken(evidence.family);
+
+ if (family === 'backup' && (source.includes('task history') || scope.includes('task history'))) {
+ return 'Observed backup task history';
+ }
+ if (source.includes('task history') || scope.includes('task history')) {
+ return 'Observed task history';
+ }
+ if (scope === 'configured job' || source.includes('job config')) {
+ return 'Configured PBS job';
+ }
+ if (scope === 'partial read' || source.includes('partial read')) {
+ return 'Partial PBS read';
+ }
+ return source ? normalizeDelimitedLabel(source) : 'PBS evidence';
+};
+
+const formatUnixSeconds = (value?: number): string | null => {
+ if (!Number.isFinite(value)) return null;
+ return new Date((value ?? 0) * 1000).toISOString().replace('.000Z', 'Z');
+};
+
+const formatIsoTime = (value?: string): string | null => {
+ if (!value?.trim()) return null;
+ const parsed = Date.parse(value);
+ if (!Number.isFinite(parsed)) return value.trim();
+ return new Date(parsed).toISOString().replace('.000Z', 'Z');
+};
+
+const firstNonEmpty = (...values: Array<string | null | undefined>): string | null => {
+ for (const value of values) {
+ const trimmed = value?.trim();
+ if (trimmed) return trimmed;
+ }
+ return null;
+};
+
+const getPbsEvidenceStateLabel = (evidence: PBSJobHealthEvidence): string | null =>
+ firstNonEmpty(
+ evidence['last-run-state'],
+ evidence['task-status'],
+ evidence.freshness?.state,
+ evidence.posture,
+ );
+
+const buildPbsEvidenceBadges = (evidence: PBSJobHealthEvidence): PbsJobHealthEvidenceBadge[] => {
+ const confidence = normalizeEvidenceToken(evidence.confidence);
+ const scope = normalizeEvidenceToken(evidence.evidenceScope);
+ const source = normalizeEvidenceToken(evidence.evidenceSource);
+ const error = normalizeEvidenceToken(evidence.error);
+ const badges: PbsJobHealthEvidenceBadge[] = [];
+
+ if (scope === 'partial read' || source.includes('partial read')) {
+ badges.push({ label: 'Partial read', tone: 'warning' });
+ }
+ if (confidence.includes('permission') || error.includes('permission')) {
+ badges.push({ label: 'Permission gap', tone: 'danger' });
+ }
+ if (confidence.includes('truncated') || error.includes('truncated')) {
+ badges.push({ label: 'Task history truncated', tone: 'warning' });
+ }
+ if (confidence && badges.length === 0) {
+ badges.push({ label: normalizeDelimitedLabel(confidence), tone: 'info' });
+ }
+ if (normalizeEvidenceToken(evidence.posture) === 'healthy') {
+ badges.push({ label: 'Healthy', tone: 'success' });
+ }
+
+ return badges;
+};
+
+const buildPbsEvidenceContext = (evidence: PBSJobHealthEvidence): string | null =>
+ joinPbsTaskContext(
+ evidence.store,
+ evidence.remote ? `Remote ${evidence.remote}` : null,
+ evidence.namespace ? `Namespace ${evidence.namespace}` : null,
+ evidence['worker-id'] ? `Worker ${evidence['worker-id']}` : null,
+ );
+
+const buildPbsEvidenceFreshnessLabel = (evidence: PBSJobHealthEvidence): string | null => {
+ const freshness = evidence.freshness;
+ const observed = formatIsoTime(freshness?.observedAt);
+ const lastRun =
+ formatIsoTime(freshness?.lastRunEndTime) ?? formatUnixSeconds(evidence['last-run-endtime']);
+ const taskEnd = formatUnixSeconds(evidence['task-endtime']);
+ const nextRun = formatIsoTime(freshness?.nextRun) ?? formatUnixSeconds(evidence['next-run']);
+
+ if (lastRun) return `Last run ${lastRun}`;
+ if (taskEnd) return `Task ended ${taskEnd}`;
+ if (nextRun) return `Next run ${nextRun}`;
+ if (observed) return `Observed ${observed}`;
+ return null;
+};
+
+export const buildPbsJobHealthEvidenceModel = (
+ pbs: PBSPlatformData | undefined,
+): PbsJobHealthEvidenceModel => {
+ const evidence = pbs?.jobHealthEvidence ?? [];
+ const evidenceCount = Math.max(pbs?.jobHealthEvidenceCount ?? 0, evidence.length);
+
+ return {
+ evidenceCount,
+ visibleCount: evidence.length,
+ countLabel: evidenceCount > 0 ? formatCount(evidenceCount, 'evidence record') : null,
+ entries: evidence.map((entry) => ({
+ id: entry.id,
+ label: buildPbsTaskLabel(formatPbsEvidenceFamily(entry.family), entry.id),
+ sourceLabel: formatPbsEvidenceSource(entry),
+ context: buildPbsEvidenceContext(entry),
+ stateLabel: getPbsEvidenceStateLabel(entry),
+ freshnessLabel: buildPbsEvidenceFreshnessLabel(entry),
+ postureLabel: firstNonEmpty(entry.posture),
+ postureReason: firstNonEmpty(entry.postureReason),
+ error: firstNonEmpty(entry.error),
+ badges: buildPbsEvidenceBadges(entry),
+ })),
+ };
+};
+
export const getPmgQueueBacklog = (pmg: PMGPlatformData | undefined): number =>
!pmg ? 0 : (pmg.queueDeferred || 0) + (pmg.queueHold || 0);
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
index 4dc05cbb25..a27397c70e 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts
@@ -8,6 +8,7 @@ import type {
Node,
PBSBackupJob,
PBSGarbageJob,
+ PBSJobHealthEvidence,
PBSPruneJob,
PBSSyncJob,
PBSVerifyJob,
@@ -71,11 +72,13 @@ export type PBSPlatformData = {
verifyJobCount?: number;
pruneJobCount?: number;
garbageJobCount?: number;
+ jobHealthEvidenceCount?: number;
backupJobs?: PBSBackupJob[];
syncJobs?: PBSSyncJob[];
verifyJobs?: PBSVerifyJob[];
pruneJobs?: PBSPruneJob[];
garbageJobs?: PBSGarbageJob[];
+ jobHealthEvidence?: PBSJobHealthEvidence[];
connectionHealth?: string;
};
diff --git a/frontend-modern/src/types/api.ts b/frontend-modern/src/types/api.ts
index d4f1319dbd..723959a6c5 100644
--- a/frontend-modern/src/types/api.ts
+++ b/frontend-modern/src/types/api.ts
@@ -697,6 +697,7 @@ export interface PBSInstance {
verifyJobs: PBSVerifyJob[];
pruneJobs: PBSPruneJob[];
garbageJobs: PBSGarbageJob[];
+ jobHealthEvidence?: PBSJobHealthEvidence[];
connectionHealth: string;
lastSeen: string;
}
@@ -873,6 +874,42 @@ export interface PBSGarbageJob {
error: string;
}
+export interface PBSJobHealthFreshness {
+ observedAt: string;
+ lastRunEndTime?: string;
+ nextRun?: string;
+ ageSeconds?: number;
+ state?: string;
+}
+
+export interface PBSJobHealthEvidence {
+ id: string;
+ family: string;
+ store?: string;
+ remote?: string;
+ namespace?: string;
+ schedule?: string;
+ comment?: string;
+ enabled?: boolean;
+ 'last-run-state'?: string;
+ 'last-run-upid'?: string;
+ 'last-run-endtime'?: number;
+ 'next-run'?: number;
+ upid?: string;
+ 'worker-type'?: string;
+ 'worker-id'?: string;
+ 'task-status'?: string;
+ 'task-starttime'?: number;
+ 'task-endtime'?: number;
+ confidence: string;
+ evidenceSource?: string;
+ evidenceScope?: string;
+ freshness?: PBSJobHealthFreshness;
+ posture?: string;
+ postureReason?: string;
+ error?: string;
+}
+
export interface Memory {
total: number;
used: number;
diff --git a/frontend-modern/src/types/resource.ts b/frontend-modern/src/types/resource.ts
index fa531cfe61..c48cda3606 100644
--- a/frontend-modern/src/types/resource.ts
+++ b/frontend-modern/src/types/resource.ts
@@ -15,6 +15,7 @@ import type {
Memory,
PBSBackupJob,
PBSGarbageJob,
+ PBSJobHealthEvidence,
PBSPruneJob,
PBSSyncJob,
PBSVerifyJob,
@@ -337,11 +338,13 @@ export interface ResourcePBSMeta {
verifyJobCount?: number;
pruneJobCount?: number;
garbageJobCount?: number;
+ jobHealthEvidenceCount?: number;
backupJobs?: PBSBackupJob[];
syncJobs?: PBSSyncJob[];
verifyJobs?: PBSVerifyJob[];
pruneJobs?: PBSPruneJob[];
garbageJobs?: PBSGarbageJob[];
+ jobHealthEvidence?: PBSJobHealthEvidence[];
connectionHealth?: string;
affectedDatastoreCount?: number;
affectedDatastores?: string[];
diff --git a/tests/integration/tests/63-pbs-active-tasks.spec.ts b/tests/integration/tests/63-pbs-active-tasks.spec.ts
index a73087f838..00838cff59 100644
--- a/tests/integration/tests/63-pbs-active-tasks.spec.ts
+++ b/tests/integration/tests/63-pbs-active-tasks.spec.ts
@@ -6,9 +6,62 @@ import { expect, test as base } from '@playwright/test';
import { createAuthenticatedStorageState } from './helpers';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
-const ARTIFACTS_DIR = path.resolve(__dirname, '..', '..', 'tmp', 'pbs-active-tasks');
+const ARTIFACTS_DIR = path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'tmp',
+ 'pbs-active-tasks',
+);
const RESOURCE_ID = 'pbs-active';
const RESOURCE_ID_ENCODED = encodeURIComponent(RESOURCE_ID);
+const PBS_JOB_HEALTH_EVIDENCE = [
+ {
+ id: 'backup:task-history:fast:vm/100',
+ family: 'backup',
+ store: 'fast',
+ confidence: 'direct-task-match',
+ evidenceSource: 'pbs-task-history',
+ evidenceScope: 'task-history',
+ 'last-run-state': 'OK',
+ 'last-run-upid': 'UPID:backup:1',
+ 'last-run-endtime': 1776717000,
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'observed',
+ },
+ posture: 'healthy',
+ },
+ {
+ id: 'prune:partial',
+ family: 'prune',
+ store: 'archive',
+ confidence: 'partial-permission',
+ evidenceSource: 'pbs-partial-read',
+ evidenceScope: 'partial-read',
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'partial',
+ },
+ posture: 'unknown',
+ postureReason: 'PBS token cannot read prune job configuration.',
+ error: 'permission denied',
+ },
+ {
+ id: 'verify:task-history:fast:truncated',
+ family: 'verify',
+ store: 'fast',
+ confidence: 'bounded-task-history-truncated',
+ evidenceSource: 'pbs-task-history',
+ evidenceScope: 'partial-read',
+ freshness: {
+ observedAt: '2026-04-20T21:30:00Z',
+ state: 'partial',
+ },
+ posture: 'unknown',
+ error: 'bounded task history query was truncated',
+ },
+];
type WorkerFixtures = {
authStorageStatePath: string;
@@ -18,34 +71,88 @@ const test = base.extend<{}, WorkerFixtures>({
storageState: async ({ authStorageStatePath }, use) => {
await use(authStorageStatePath);
},
- authStorageStatePath: [async ({ browser }, use, workerInfo) => {
- const storageStatePath = path.resolve(
- __dirname,
- '..',
- '..',
- 'tmp',
- 'playwright-auth',
- `pbs-active-tasks-${workerInfo.project.name}.json`,
- );
- fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
- await createAuthenticatedStorageState(browser, storageStatePath);
- try {
- await use(storageStatePath);
- } finally {
- fs.rmSync(storageStatePath, { force: true });
- }
- }, { scope: 'worker' }],
+ authStorageStatePath: [
+ async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ '..',
+ '..',
+ 'tmp',
+ 'playwright-auth',
+ `pbs-active-tasks-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ },
+ { scope: 'worker' },
+ ],
});
+test.use({ serviceWorkers: 'block' });
+
test.describe('PBS active tasks', () => {
test.setTimeout(180_000);
test('surfaces running PBS tasks in the service table and shared detail drawer', async ({
page,
}, testInfo) => {
- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop runtime proof');
+ test.skip(
+ testInfo.project.name.startsWith('mobile-'),
+ 'Desktop runtime proof',
+ );
fs.mkdirSync(ARTIFACTS_DIR, { recursive: true });
+ await page.addInitScript(() => {
+ class FakeWebSocket {
+ static CONNECTING = 0;
+ static OPEN = 1;
+ static CLOSING = 2;
+ static CLOSED = 3;
+
+ readonly url: string;
+ readyState = FakeWebSocket.CLOSED;
+ onopen: ((event: Event) => void) | null = null;
+ onclose:
+ | ((event: {
+ code?: number;
+ reason?: string;
+ wasClean?: boolean;
+ }) => void)
+ | null = null;
+ onerror: ((event: Event) => void) | null = null;
+ onmessage: ((event: MessageEvent) => void) | null = null;
+
+ constructor(url: string) {
+ this.url = url;
+ queueMicrotask(() => {
+ this.onclose?.({
+ code: 1006,
+ reason: 'e2e websocket disabled',
+ wasClean: false,
+ });
+ });
+ }
+
+ close() {
+ this.readyState = FakeWebSocket.CLOSED;
+ }
+
+ send() {}
+
+ addEventListener() {}
+
+ removeEventListener() {}
+ }
+
+ // @ts-expect-error Playwright init script runs in the browser context.
+ window.WebSocket = FakeWebSocket;
+ });
+
await page.route('**/api/resources**', async (route) => {
const requestUrl = new URL(route.request().url());
@@ -80,6 +187,7 @@ test.describe('PBS active tasks', () => {
backupJobCount: 2,
syncJobCount: 1,
verifyJobCount: 1,
+ jobHealthEvidenceCount: 3,
backupJobs: [
{
id: 'backup-nightly',
@@ -123,6 +231,7 @@ test.describe('PBS active tasks', () => {
error: '',
},
],
+ jobHealthEvidence: PBS_JOB_HEALTH_EVIDENCE,
connectionHealth: 'online',
},
platformData: {
@@ -136,6 +245,7 @@ test.describe('PBS active tasks', () => {
backupJobCount: 2,
syncJobCount: 1,
verifyJobCount: 1,
+ jobHealthEvidenceCount: 3,
backupJobs: [
{
id: 'backup-nightly',
@@ -179,6 +289,7 @@ test.describe('PBS active tasks', () => {
error: '',
},
],
+ jobHealthEvidence: PBS_JOB_HEALTH_EVIDENCE,
connectionHealth: 'online',
},
},
@@ -195,7 +306,9 @@ test.describe('PBS active tasks', () => {
return;
}
- if (requestUrl.pathname === `/api/resources/${RESOURCE_ID_ENCODED}/facets`) {
+ if (
+ requestUrl.pathname === `/api/resources/${RESOURCE_ID_ENCODED}/facets`
+ ) {
await route.fulfill({
status: 200,
contentType: 'application/json',
@@ -227,7 +340,8 @@ test.describe('PBS active tasks', () => {
grade: 'A',
trend: 'stable',
factors: [],
- prediction: 'Pulse is surfacing active PBS backup activity through the shared infrastructure drawer.',
+ prediction:
+ 'Pulse is surfacing active PBS backup activity through the shared infrastructure drawer.',
},
dependencies: [],
dependents: [],
@@ -257,7 +371,9 @@ test.describe('PBS active tasks', () => {
const serviceSection = page.getByTestId('resource-service-details-section');
await expect(serviceSection).toContainText('2 datastores · 2 active tasks');
await serviceSection.getByRole('button', { name: 'Show service' }).click();
- await expect(serviceSection.getByText('Active tasks', { exact: true })).toBeVisible();
+ await expect(
+ serviceSection.getByText('Active tasks', { exact: true }),
+ ).toBeVisible();
await serviceSection.getByText('2', { exact: true }).first().waitFor();
await serviceSection.getByRole('button', { name: 'Show jobs' }).click();
@@ -270,9 +386,22 @@ test.describe('PBS active tasks', () => {
await expect(activeTasks.getByText('fast · Remote offsite')).toBeVisible();
await expect(activeTasks.getByText('Queued')).toBeVisible();
- await page.screenshot({
+ const evidence = page.getByTestId('pbs-job-health-evidence');
+ await expect(evidence).toBeVisible();
+ await expect(evidence.getByText('Job health evidence')).toBeVisible();
+ await expect(evidence.getByText('3 evidence records')).toBeVisible();
+ await expect(
+ evidence.getByText('Observed backup task history'),
+ ).toBeVisible();
+ await expect(evidence.getByText('Partial PBS read')).toBeVisible();
+ await expect(evidence.getByText('Partial read').first()).toBeVisible();
+ await expect(evidence.getByText('Permission gap')).toBeVisible();
+ await expect(evidence.getByText('Task history truncated')).toBeVisible();
+ await expect(evidence.getByText(/scheduled backup/i)).toHaveCount(0);
+
+ await evidence.scrollIntoViewIfNeeded();
+ await evidence.screenshot({
path: path.resolve(ARTIFACTS_DIR, 'pbs-active-tasks.png'),
- fullPage: true,
});
});
});