Qualify stale protection readings above the TrueNAS Protection table (#5675)

**Qualify stale protection readings above the TrueNAS Protection table**

Show a filter-aware warning banner above the TrueNAS Protection table
whenever any displayed ZFS snapshot or replication event belongs to a
stale TrueNAS system, so operators on desktop and phones see immediately
that affected outcomes reflect the last successful TrueNAS poll and
newer runs or failures may be missing without opening an individual row
drawer. The banner hides when active status or search filters narrow to
current-only events, when zero rows match, on all-current views, or when
live reporting recovers, and coexists cleanly with refresh-failure
alerts while preserving all existing columns, row cues, filter chips,
and drawer notices.

Includes unit tests covering status filtering, search narrowing,
zero-match filtering, live recovery, all-current views, and coexistence
with refresh errors, plus the paired desktop-light (1440x900) and
phone-dark (390x900) browser verification receipt.

Contract-Neutral: Uses the existing TrueNAS protection staleness map,
TrueNASTableFrame notice slot, and shared InlineNotice primitive without
changing recovery API fields, access rules, classification, or table
contracts.

**Supply required kind and mode fields in TrueNAS Protection banner
test**

Pass required kind and mode properties to makePoint in the all-current
and refresh-error coexistence test inside
TrueNASProtectionTable.freshness.test.tsx
so tsc --noEmit passes cleanly.

Contract-Neutral: Test-only TypeScript fixture property fix in
TrueNASProtectionTable.freshness.test.tsx with no runtime, API, schema,
or contract changes.

**Replace semicolon in TrueNAS Protection stale-readings banner copy**

Split the stale-readings banner sentence in TrueNASProtectionTable.tsx
at the period instead of using a semicolon so frontend copy-style lint
(npm run lint:copy) passes, update the matching unit test assertion, and
refresh the paired browser verification receipt.

Contract-Neutral: Copy punctuation fix in TrueNASProtectionTable.tsx and
its unit test with no API, schema, routing, or behavioral contract
changes.

**Record browser receipt for TrueNAS Protection banner copy fix**

Bind fresh paired desktop-light (1440x900) and phone-dark (390x900)
Chromium verification receipt (839bb77464d7d781.json) to parent
899fd2f1ff and the final content of TrueNASProtectionTable.tsx.

Contract-Neutral: Browser verification receipt only with no runtime,
API, schema, or contract changes.

---
Fleet candidate `20261202T155526Z-web-product` from the `web-product`
lane. Reviewed tip `8a3bc26c0d42dd8b852cff16d701fd1c293e6dfb` on `main`.

[How Pulse handles
triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
pulse-triage[bot]
2026-12-02 17:27:25 +00:00
committed by GitHub
4 changed files with 301 additions and 20 deletions

View File

@@ -0,0 +1,39 @@
{
"version": 1,
"base_sha": "899fd2f1fffdcdfebd095d756f0a0a35157e1b1e",
"verified_at": "2026-12-02T16:17:10Z",
"result": "passed",
"changed_paths": [
"frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx"
],
"content_sha256": {
"frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx": "4cc78f60157710b8ee53d0e4f7f3534da3898cfe3f872c670130758dbd0afee9"
},
"routes": [
"/truenas/protection"
],
"viewports": [
{
"width": 1440,
"height": 900,
"theme": "light"
},
{
"width": 390,
"height": 900,
"theme": "dark"
}
],
"states": [
"Paired All view with stale TrueNAS system (nas-east: tank/archive Failed, tank/media Running, tank/billing Stale data) and current system (nas-west: vault/docs Healthy) showing updated two-sentence stale-readings banner",
"Paired Healthy/OK filter narrowing to current-only vault/docs hides stale banner",
"Paired Stale filter showing stale nas-east events keeps stale banner visible",
"Paired live WebSocket recovery when nas-east returns online clears stale banner and Stale filter chip",
"Paired all-current control view with zero stale systems renders no banner"
],
"interactions": [
"Clicked Healthy, Stale, and All filters on desktop light (1440x900); opened Filters disclosure and clicked OK, Stale, and All on phone dark (390x900); pushed live WebSocket recovery; verified 0 console/page/HTTP errors and 0px horizontal overflow",
"All 20 paired before (5a8b55bc23) / after (4cc78f6015) PNGs visually inspected natively with read_file"
],
"browser": "Playwright / Chromium via pulse-worker-browser"
}

View File

@@ -0,0 +1,39 @@
{
"version": 1,
"base_sha": "efbfd69780b17dc682c229aa5f6e7c5c2bfdc86b",
"verified_at": "2026-12-02T13:07:12Z",
"result": "passed",
"changed_paths": [
"frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx"
],
"content_sha256": {
"frontend-modern/src/features/truenas/TrueNASProtectionTable.tsx": "6fd3c77482a4a2b10ae92f42669ca77bdbe14e29fbd8857e8d24f9fc27986104"
},
"routes": [
"/truenas/protection"
],
"viewports": [
{
"width": 1440,
"height": 900,
"theme": "light"
},
{
"width": 390,
"height": 900,
"theme": "dark"
}
],
"states": [
"Paired All view with stale TrueNAS system (nas-east: tank/archive Failed, tank/billing Healthy->Stale data, tank/media Running) and current system (nas-west: vault/docs Healthy)",
"Paired Healthy filter narrowing to current-only vault/docs hides stale banner",
"Paired Stale filter showing stale nas-east events keeps stale banner visible",
"Paired live recovery when nas-east returns online clears stale banner and Stale filter chip",
"Paired all-current control view with zero stale systems renders no banner"
],
"interactions": [
"Clicked Healthy, Stale, and All filters on desktop light (1440x900); opened Filters disclosure and clicked OK/Healthy, Stale, and All on phone dark (390x900); triggered live system recovery; verified 0 console/page/request errors and 0px horizontal overflow",
"All 20 paired before/after PNGs visually inspected natively with read_file"
],
"browser": "Playwright / Chromium via pulse-worker-browser"
}

View File

@@ -383,6 +383,9 @@ export const TrueNASProtectionTable: Component<{
getTrueNASProtectionSortValue(point, key, staleNoticeByPointId().get(point.id)),
),
);
const hasStaleDisplayedRows = createMemo(() =>
sortedRows().some((point) => staleNoticeByPointId().has(point.id)),
);
return (
<Show
@@ -415,26 +418,39 @@ export const TrueNASProtectionTable: Component<{
precounted
rowNoun="events"
notice={
<Show when={props.error}>
<InlineNotice role="alert" tone="warning" aria-label="Protection refresh failed">
<p class="font-medium">Could not refresh TrueNAS protection.</p>
<p>
Showing previously loaded events. Outcomes and counts may be out of date. Newer
activity may be missing.
</p>
<Show when={props.onRefresh}>
<Button
size="sm"
class="mt-2"
disabled={props.loading}
aria-label="Refresh TrueNAS protection"
onClick={() => props.onRefresh?.()}
>
{props.loading ? 'Refreshing...' : 'Refresh'}
</Button>
</Show>
</InlineNotice>
</Show>
<>
<Show when={props.error}>
<InlineNotice role="alert" tone="warning" aria-label="Protection refresh failed">
<p class="font-medium">Could not refresh TrueNAS protection.</p>
<p>
Showing previously loaded events. Outcomes and counts may be out of date. Newer
activity may be missing.
</p>
<Show when={props.onRefresh}>
<Button
size="sm"
class="mt-2"
disabled={props.loading}
aria-label="Refresh TrueNAS protection"
onClick={() => props.onRefresh?.()}
>
{props.loading ? 'Refreshing...' : 'Refresh'}
</Button>
</Show>
</InlineNotice>
</Show>
<Show when={hasStaleDisplayedRows()}>
<InlineNotice
tone="warning"
role="status"
data-testid="truenas-protection-stale-banner"
>
<strong>Some TrueNAS protection readings are stale.</strong> Affected snapshot and
replication outcomes reflect the last successful TrueNAS poll. Newer runs or
failures may be missing.
</InlineNotice>
</Show>
</>
}
title="Snapshots & Replication"
actions={

View File

@@ -446,4 +446,191 @@ describe('TrueNASProtectionTable stale-reading UI', () => {
.closest('tr'),
).toHaveTextContent('Healthy');
});
it('shows a filter-aware stale banner above the table and clears it on filter narrowing or live recovery', async () => {
const staleNas = makeSystem({
id: 'truenas:agent:system:conn-east',
name: 'nas-east',
displayName: 'nas-east',
agent: { agentId: 'conn-east', hostname: 'nas-east' },
truenas: { hostname: 'nas-east' },
sourceStatus: { truenas: { status: 'stale', error: 'API connection refused' } },
health: {
verdict: 'stale',
reasons: [{ code: 'telemetry_stale', detail: '14m' }],
},
});
const freshNas = makeSystem({
id: 'truenas:agent:system:conn-west',
name: 'nas-west',
displayName: 'nas-west',
agent: { agentId: 'conn-west', hostname: 'nas-west' },
truenas: { hostname: 'nas-west' },
sourceStatus: { truenas: { status: 'online' } },
});
const points: RecoveryPoint[] = [
makePoint({
id: 'snap-east-ok',
kind: 'snapshot',
mode: 'snapshot',
outcome: 'success',
display: { itemLabel: 'tank/billing', nodeHostLabel: 'nas-east' },
details: {
connectionId: 'conn-east',
hostname: 'nas-east',
dataset: 'tank/billing',
snapshot: 'auto-20261127-1200',
},
}),
makePoint({
id: 'rep-east-failed',
kind: 'backup',
mode: 'remote',
outcome: 'failed',
display: { itemLabel: 'tank/archive', nodeHostLabel: 'nas-east' },
details: {
connectionId: 'conn-east',
hostname: 'nas-east',
taskName: 'replicate-archive',
lastState: 'FAILED',
},
}),
makePoint({
id: 'snap-west-ok',
kind: 'snapshot',
mode: 'snapshot',
outcome: 'success',
display: { itemLabel: 'vault/docs', nodeHostLabel: 'nas-west' },
details: {
connectionId: 'conn-west',
hostname: 'nas-west',
dataset: 'vault/docs',
snapshot: 'auto-20261127-1205',
},
}),
];
const [systems, setSystems] = createSignal<Resource[]>([staleNas, freshNas]);
renderInRouter(() => (
<TrueNASProtectionTable
points={points}
systems={systems()}
emptyIcon={<span />}
emptyTitle="No protection"
emptyDescription="No protection"
/>
));
// All view includes stale rows -> banner is visible with role="status"
const banner = screen.getByTestId('truenas-protection-stale-banner');
expect(banner).toHaveAttribute('role', 'status');
expect(banner).toHaveTextContent('Some TrueNAS protection readings are stale.');
expect(banner).toHaveTextContent(
'Affected snapshot and replication outcomes reflect the last successful TrueNAS poll. Newer runs or failures may be missing.',
);
// Narrowing to Healthy (current-only) hides the banner
await fireEvent.click(screen.getByRole('button', { name: 'Healthy, 1' }));
expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull();
// Switching to Stale or Failed restores the banner
await fireEvent.click(screen.getByRole('button', { name: 'Stale, 2' }));
expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument();
await fireEvent.click(screen.getByRole('button', { name: 'Failed, 1' }));
expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument();
// Returning to All and narrowing search to the fresh system hides the banner
await fireEvent.click(screen.getByRole('button', { name: 'All, 3' }));
expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument();
const searchInput = screen.getByPlaceholderText('Search snapshots or replication');
await fireEvent.input(searchInput, { target: { value: 'vault/docs' } });
expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull();
// Searching with no matches also hides the banner
await fireEvent.input(searchInput, { target: { value: 'nonexistent-dataset' } });
expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull();
// Clearing search restores the banner; live recovery clears it without reload
await fireEvent.input(searchInput, { target: { value: '' } });
expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument();
setSystems([
makeSystem({
...staleNas,
sourceStatus: { truenas: { status: 'online' } },
health: { verdict: 'ok', reasons: [] },
}),
freshNas,
]);
expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull();
});
it('omits the table stale banner when all systems are current and preserves refresh error coexistence', () => {
const freshNas = makeSystem({
id: 'truenas:agent:system:conn-west',
name: 'nas-west',
displayName: 'nas-west',
agent: { agentId: 'conn-west', hostname: 'nas-west' },
truenas: { hostname: 'nas-west' },
sourceStatus: { truenas: { status: 'online' } },
});
const staleNas = makeSystem({
id: 'truenas:agent:system:conn-east',
name: 'nas-east',
displayName: 'nas-east',
agent: { agentId: 'conn-east', hostname: 'nas-east' },
truenas: { hostname: 'nas-east' },
sourceStatus: { truenas: { status: 'stale' } },
});
const points: RecoveryPoint[] = [
makePoint({
id: 'snap-west-ok',
kind: 'snapshot',
mode: 'snapshot',
outcome: 'success',
display: { itemLabel: 'vault/docs', nodeHostLabel: 'nas-west' },
details: { connectionId: 'conn-west', hostname: 'nas-west', dataset: 'vault/docs' },
}),
makePoint({
id: 'snap-east-ok',
kind: 'snapshot',
mode: 'snapshot',
outcome: 'success',
display: { itemLabel: 'tank/billing', nodeHostLabel: 'nas-east' },
details: { connectionId: 'conn-east', hostname: 'nas-east', dataset: 'tank/billing' },
}),
];
const [systems, setSystems] = createSignal<Resource[]>([
freshNas,
makeSystem({ ...staleNas, sourceStatus: { truenas: { status: 'online' } } }),
]);
const [error, setError] = createSignal<Error | undefined>(undefined);
renderInRouter(() => (
<TrueNASProtectionTable
points={points}
systems={systems()}
error={error()}
emptyIcon={<span />}
emptyTitle="No protection"
emptyDescription="No protection"
/>
));
expect(screen.queryByTestId('truenas-protection-stale-banner')).toBeNull();
expect(screen.queryByRole('alert', { name: 'Protection refresh failed' })).toBeNull();
// Both refresh failure and stale TrueNAS source render together without suppressing either
setSystems([freshNas, staleNas]);
setError(new Error('503 Service Unavailable'));
expect(screen.getByRole('alert', { name: 'Protection refresh failed' })).toBeInTheDocument();
expect(screen.getByTestId('truenas-protection-stale-banner')).toBeInTheDocument();
});
});