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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep unreadable replication sync times unknown
pulse-triage[bot]816f2a7b33b9
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d02ffbf2e9..4455c8acf6 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -20,6 +20,22 @@## Purpose+### Replication sync chronology stays unknown when unreadable++The existing Replication table and disclosure validate sync instants before+passing them to shared age formatting or building a countdown. Impossible dates,+timezone-less strings, out-of-range numbers and future last-sync values do not+become repaired dates, overdue schedules or just-now successes. Unknown remains+visible and distinct from unreported/zero values; the latter are not proof that+a job never ran. Narrow cells use a question mark with a full accessible+name/title, while Schedule details and the summary retain full wording. The+existing Unix companion precedence, supported numeric forms, provider status,+shared aging clock, disclosure controls and read/retry behaviour remain intact.+`ProxmoxReplicationTable.test.tsx` consumes parsed raw inventory for unknown,+future, unreported and valid controls; desktop/narrow browser interactions and+pixel inspection cover the same producer-to-consumer path. This changes no+shared formatter or primitive and does not establish native job/guest recovery.+### Withdrawn backup evidence retains keyboard positionWhen polling removes a focused restore-point disclosure/detail, filtered Coveragediff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 1863972dff..9820a1ec25 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1852,6 +1852,23 @@ the whole read with a fixed safe format error; it is never a successful emptyinventory, a partially filtered list or a truthy health flag. Additional fieldsand unfamiliar status strings remain readable. Native job IDs may repeat acrossindependent connections. The parser changes no status or timestamp semantics.+Replication timestamp presentation separately requires a calendar-valid,+explicit-zone RFC3339 string or a finite, positive, Date-representable numeric+instant. It retains existing Unix-second companion precedence and numeric+seconds/milliseconds compatibility; an invalid nonzero companion is unknown,+not permission to select a more reassuring fallback. A future last sync is+unknown rather than a just-now success. Next sync may legitimately be future+and still turns overdue on the shared clock. Missing/zero values stay distinct+from malformed chronology: the drawer says no last sync was reported, never+that a job has not run. Unknown times remain visible in cells and Schedule+details without removing the job or altering the provider-owned status. Phone+cells use a compact question mark with a full accessible name/title and the+same full drawer explanation. Normal-suite `ProxmoxReplicationTable.test.tsx`+covers supported formats, calendar/timezone/bounds failures, precedence, future+last-sync rejection and parsed-inventory cell/drawer consumption; its existing+clock-aging controls remain. Desktop/narrow consuming browser proof inspects+these states and ordinary read/retry with pixels. This is truthful chronology,+not original Pending-job, scheduler, guest-thaw or installed recovery.First-read failure keeps a direct Replication link on the existing error/Refresh;a failed poll keeps prior presence for navigation but the table displays theerror, not old job health. Only a validated full retry replaces the observation.diff --git a/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsxindex f663e71733..cbba52f081 100644--- a/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx+++ b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx@@ -21,7 +21,6 @@ import {PlatformTableDurationValue,formatPlatformTableDurationValue,formatPlatformTableRelativeTimeValue,- PlatformTableRelativeTimeValue,getPlatformTableCellClassForKind,getPlatformTableContainerLayout,getPlatformTableHeadClassForKind,@@ -48,6 +47,7 @@ import {import { buildPlatformSearchSuggestions } from '@/features/platformPage/platformSearchSuggestions';import { matchesSearchTermSplit, splitSearchExclusions } from '@/utils/searchQuery';import { buildProxmoxGuestNativeId } from '@/utils/workloads';+import { parseBackupTimestampMs } from '@/utils/backupTimestamp';// Replication is a Proxmox-specific concept (zfs send/receive scheduled// between PVE nodes), so this table is bespoke rather than a filtered@@ -231,20 +231,55 @@ export function formatMobileReplicationGuestLabel(job: ReplicationJob): string {return formatGuestLabel(job);}-function syncTimeValue(job: ReplicationJob): number | string | undefined {- if (job.lastSyncUnix && job.lastSyncUnix > 0) {- return job.lastSyncUnix * 1000;+type ReplicationSyncTime =+ { state: 'known'; ms: number } | { state: 'missing' } | { state: 'invalid' };++// Keep the existing Unix companion precedence and numeric seconds/milliseconds+// compatibility. Never let Date.parse repair an impossible calendar date or+// assign the browser's timezone to a provider time. A malformed nonzero Unix+// companion cannot be replaced with a more reassuring fallback.+export function readReplicationSyncTime(+ time: ReplicationJob['lastSyncTime'],+ unix: number | undefined,+ notAfter?: number,+): ReplicationSyncTime {+ let ms: number | undefined;+ if (unix !== undefined && unix !== 0) {+ ms = unix * 1000;+ } else if (time === undefined || time === '' || time === 0) {+ return { state: 'missing' };+ } else {+ ms =+ typeof time === 'number' ? (time > 1e12 ? time : time * 1000) : parseBackupTimestampMs(time);+ }+ if (+ ms === undefined ||+ !Number.isFinite(ms) ||+ ms <= 0 ||+ !Number.isFinite(new Date(ms).getTime()) ||+ (notAfter !== undefined && ms > notAfter)+ ) {+ return { state: 'invalid' };}- return job.lastSyncTime;+ return { state: 'known', ms };+}++function lastSyncFor(job: ReplicationJob, now: number) {+ const time = readReplicationSyncTime(job.lastSyncTime, job.lastSyncUnix, now);+ if (time.state === 'missing') return { text: '—', summary: 'No last sync reported' };+ if (time.state === 'invalid') return { text: 'Unknown', summary: 'Last sync time unknown' };+ const text = formatPlatformTableRelativeTimeValue(new Date(time.ms), { now });+ return { text, summary: `Last synced ${text}` };}-type NextSyncTone = 'overdue' | 'imminent' | 'normal' | 'muted';+type NextSyncTone = 'overdue' | 'imminent' | 'normal' | 'muted' | 'unknown';const NEXT_SYNC_TONE_CLASS: Record<NextSyncTone, string> = {overdue: 'text-red-600 dark:text-red-300 font-semibold',imminent: 'text-amber-600 dark:text-amber-300',normal: '',muted: 'text-muted',+ unknown: 'text-muted',};// An overdue next-sync is the one signal that catches a stalled pvesr@@ -255,16 +290,10 @@ const NEXT_SYNC_TONE_CLASS: Record<NextSyncTone, string> = {// render would sit at "in 3m" and never turn overdue.function nextSyncFor(job: ReplicationJob, now: number): { text: string; tone: NextSyncTone } {if (!job.enabled) return { text: '—', tone: 'muted' };- let target = 0;- if (job.nextSyncUnix && job.nextSyncUnix > 0) {- target = job.nextSyncUnix * 1000;- } else if (job.nextSyncTime) {- const raw = job.nextSyncTime;- const parsed = typeof raw === 'number' ? (raw > 1e12 ? raw : raw * 1000) : Date.parse(raw);- if (Number.isFinite(parsed)) target = parsed;- }- if (!target) return { text: '—', tone: 'muted' };- const minutes = Math.floor((target - now) / 60_000);+ const time = readReplicationSyncTime(job.nextSyncTime, job.nextSyncUnix);+ if (time.state === 'missing') return { text: '—', tone: 'muted' };+ if (time.state === 'invalid') return { text: 'Unknown', tone: 'unknown' };+ const minutes = Math.floor((time.ms - now) / 60_000);if (minutes < 0) {const overdue = Math.abs(minutes);const text = overdue < 60 ? `${overdue}m overdue` : `${Math.floor(overdue / 60)}h overdue`;@@ -284,6 +313,7 @@ const NEXT_SYNC_DETAIL_TONE: Record<NextSyncTone, DetailValueTone | undefined> =imminent: 'warning',normal: undefined,muted: 'muted',+ unknown: 'muted',};// The detail row id follows the job, not its place in the filtered list, so a@@ -307,11 +337,15 @@ const replicationJobGuestSubject = (job: ReplicationJob) => {};const replicationJobSummary = (job: ReplicationJob, now: number): string => {- const last = formatPlatformTableRelativeTimeValue(syncTimeValue(job), { now, emptyText: '' });+ const last = lastSyncFor(job, now);const next = nextSyncFor(job, now);return [- last ? `Last synced ${last}` : 'Not synced yet',- next.tone === 'muted' ? '' : `next sync ${next.text}`,+ last.summary,+ next.tone === 'muted'+ ? ''+ : next.tone === 'unknown'+ ? 'next sync time unknown'+ : `next sync ${next.text}`,].filter(Boolean).join(' · ');@@ -324,6 +358,7 @@ const buildReplicationJobSections = (now: number,): DetailSection[] => {const errorText = (job.error ?? '').trim();+ const last = lastSyncFor(job, now);const next = nextSyncFor(job, now);const failCount = job.failCount ?? 0;return compactDetailSections([@@ -363,10 +398,7 @@ const buildReplicationJobSections = (label: 'Schedule',rows: compactDetailRows([makeDetailRow('Schedule', job.schedule),- makeDetailRow(- 'Last sync',- formatPlatformTableRelativeTimeValue(syncTimeValue(job), { now, emptyText: '' }),- ),+ makeDetailRow('Last sync', last.text === '—' ? 'Not reported' : last.text),makeDetailRow('Next sync', next.tone === 'muted' ? '' : next.text, {tone: NEXT_SYNC_DETAIL_TONE[next.tone],}),@@ -672,6 +704,7 @@ export const ProxmoxReplicationTable: Component<{{(job, index) => {const classification = classifyJob(job);const ind = indicatorFor(classification);+ const last = () => lastSyncFor(job, now());const next = () => nextSyncFor(job, now());const sourceNode = (job.sourceNode ?? '').trim() || '—';const targetNode = (job.targetNode ?? '').trim() || '—';@@ -769,18 +802,21 @@ export const ProxmoxReplicationTable: Component<{<TableCellclass={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content ${mobilePaddingClass()} ${mobileLastSyncClass()}`}>- <Show- when={isCompact()}- fallback={- <PlatformTableRelativeTimeValue value={syncTimeValue(job)} />+ <span+ class={`tabular-nums ${isCompact() ? 'text-[10px]' : ''}`}+ aria-label={+ last().text === 'Unknown' ? 'Last sync time unknown' : undefined+ }+ title={+ last().text === 'Unknown' ? 'Last sync time unknown' : undefined}>- <span class="tabular-nums text-[10px]">- {formatPlatformTableRelativeTimeValue(syncTimeValue(job), {- now: now(),- }).replace(/ ago$/, '')}- </span>- </Show>+ {isCompact()+ ? last().text === 'Unknown'+ ? '?'+ : last().text.replace(/ ago$/, '')+ : last().text}+ </span></TableCell><Show when={showNext()}><TableCell@@ -788,9 +824,21 @@ export const ProxmoxReplicationTable: Component<{><spanclass={`${NEXT_SYNC_TONE_CLASS[next().tone]} ${isCompact() ? 'text-[10px]' : ''}`}+ aria-label={+ next().tone === 'unknown'+ ? 'Next sync time unknown'+ : undefined+ }+ title={+ next().tone === 'unknown'+ ? 'Next sync time unknown'+ : undefined+ }>{isCompact()- ? compactReplicationNextSyncText(next().text, next().tone)+ ? next().tone === 'unknown'+ ? '?'+ : compactReplicationNextSyncText(next().text, next().tone): next().text}</span></TableCell>diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsxindex 76836031c1..242b49cdd5 100644--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx@@ -11,9 +11,13 @@ import {compactReplicationNextSyncText,fetchReplicationJobs,formatMobileReplicationGuestLabel,+ readReplicationSyncTime,} from '../ProxmoxReplicationTable';import replicationTableSource from '../ProxmoxReplicationTable.tsx?raw';-import { ReplicationInventoryFormatError } from '../proxmoxReplicationInventory';+import {+ ReplicationInventoryFormatError,+ parseReplicationInventory,+} from '../proxmoxReplicationInventory';// Record drawers link to the object they are about, which needs a router.const renderInRouter = (component: () => JSX.Element) =>@@ -46,6 +50,128 @@ afterEach(() => {});describe('ProxmoxReplicationTable', () => {+ it.each([+ ['2026-10-30T10:00:00Z', Date.parse('2026-10-30T10:00:00Z')],+ ['2026-10-30T11:00:00+01:00', Date.parse('2026-10-30T10:00:00Z')],+ ['2024-02-29T10:00:00.123456789Z', Date.parse('2024-02-29T10:00:00.123Z')],+ [1_793_354_400, 1_793_354_400_000],+ [1_793_354_400_000, 1_793_354_400_000],+ ])('preserves supported explicit-zone and numeric sync times (%s)', (time, ms) => {+ expect(readReplicationSyncTime(time, undefined)).toEqual({ state: 'known', ms });+ });++ it.each([+ '2026-02-30T10:00:00Z',+ '2026-10-30T10:00:00',+ '2026-10-30',+ 'October 30, 2026 10:00:00 GMT',+ '2026-10-30T24:00:00Z',+ '2026-10-30T10:00:00+25:00',+ 'unreadable',+ ' ',+ -1,+ NaN,+ Infinity,+ 8_640_000_000_000_001,+ ])('keeps unreadable chronology unknown (%s)', (time) => {+ expect(readReplicationSyncTime(time, undefined)).toEqual({ state: 'invalid' });+ });++ it('keeps absent/zero fields distinct and retains Unix companion precedence', () => {+ for (const time of [undefined, '', 0]) {+ expect(readReplicationSyncTime(time, 0)).toEqual({ state: 'missing' });+ }+ expect(readReplicationSyncTime('unreadable', 1_793_354_400)).toEqual({+ state: 'known',+ ms: 1_793_354_400_000,+ });+ for (const unix of [-1, NaN, Infinity, 8_640_000_000_001]) {+ expect(readReplicationSyncTime('2026-10-30T10:00:00Z', unix)).toEqual({ state: 'invalid' });+ }+ expect(readReplicationSyncTime('2026-10-30T10:00:00Z', 0)).toEqual({+ state: 'known',+ ms: 1_793_354_400_000,+ });+ });++ it.each(['2026-02-30T10:00:00Z', '2026-10-30T10:00:00', 'unreadable', -1, 8_640_000_000_000_001])(+ 'renders invalid parsed inventory dates as unknown in cells and disclosure (%s)',+ async (time) => {+ vi.spyOn(Date, 'now').mockReturnValue(Date.parse('2026-10-30T11:00:00Z'));+ const data = [replicationJob({ lastSyncUnix: 0, lastSyncTime: time, nextSyncTime: time })];+ const jobs = parseReplicationInventory({ data, meta: { total: 1 } });+ renderInRouter(() => (+ <ProxmoxReplicationTable+ jobs={jobs}+ error={undefined}+ onRetry={() => undefined}+ emptyIcon={<span />}+ emptyTitle="No replication jobs"+ emptyDescription="Replication jobs appear here."+ />+ ));+ expect(screen.getByLabelText('Last sync time unknown')).toBeInTheDocument();+ expect(screen.getByLabelText('Next sync time unknown')).toBeInTheDocument();+ // Chronology does not erase the job or reclassify the provider's status.+ expect(screen.getByText('100 (web)')).toBeInTheDocument();+ await fireEvent.click(+ screen.getByRole('button', { name: 'Expand details for replication job 100-0' }),+ );+ const panel = screen.getByTestId('replication-job-detail');+ expect(+ within(panel).getByText('Last sync time unknown · next sync time unknown'),+ ).toBeInTheDocument();+ expect(+ within(panel).queryByText(/Not synced yet|Last synced|overdue|just now/),+ ).not.toBeInTheDocument();+ expect(within(panel).getAllByText('Unknown')).toHaveLength(2);+ expect(within(panel).getByText('Healthy')).toBeInTheDocument();+ },+ );++ it('does not turn a future last sync into a just-now success or suppress a valid next sync', async () => {+ const now = Date.parse('2026-10-30T11:00:00Z');+ vi.spyOn(Date, 'now').mockReturnValue(now);+ const future = (now + 10 * 60_000) / 1000;+ const jobs = [replicationJob({ lastSyncUnix: future, nextSyncUnix: future })];+ renderInRouter(() => (+ <ProxmoxReplicationTable+ jobs={jobs}+ error={undefined}+ onRetry={() => undefined}+ emptyIcon={<span />}+ emptyTitle="No replication jobs"+ emptyDescription="Replication jobs appear here."+ />+ ));+ expect(screen.getByLabelText('Last sync time unknown')).toBeInTheDocument();+ expect(screen.queryByText('just now')).not.toBeInTheDocument();+ await fireEvent.click(+ screen.getByRole('button', { name: 'Expand details for replication job 100-0' }),+ );+ expect(screen.getByText('Last sync time unknown · next sync in 10m')).toBeInTheDocument();+ });++ it('describes omitted last-sync evidence as unreported, not as proof a job never ran', async () => {+ renderInRouter(() => (+ <ProxmoxReplicationTable+ jobs={[replicationJob({ lastSyncUnix: 0 })]}+ error={undefined}+ onRetry={() => undefined}+ emptyIcon={<span />}+ emptyTitle="No replication jobs"+ emptyDescription="Replication jobs appear here."+ />+ ));+ await fireEvent.click(+ screen.getByRole('button', { name: 'Expand details for replication job 100-0' }),+ );+ const panel = screen.getByTestId('replication-job-detail');+ expect(within(panel).getByText('No last sync reported')).toBeInTheDocument();+ expect(within(panel).getByText('Not reported')).toBeInTheDocument();+ expect(within(panel).queryByText('Not synced yet')).not.toBeInTheDocument();+ });+it('uses five readable columns and compact time direction across phone widths', () => {expect(REPLICATION_MOBILE_COLUMNS).toEqual(['guest',