mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-04 01:16:35 +00:00
Qualify stale and non-fresh Docker application service checks (#5783)
Update EndpointResult in DockerApplications so attached Service checks never show a green status dot or emerald result text when their latest probe reading is stale, lacks a poll interval or validity window (freshness unknown), or reports an indeterminate, degraded, or disagreed probe outcome. Keep red and amber outcome failures ahead of staleness, preserve last measured latency and failure pills with hover detail titles, display amber Stale reading and Freshness unknown cues, and leave fresh passing, unchecked, and disabled controls unchanged. Contract-Neutral: Presentation-only truthfulness fix in Docker Compose application service checks with no route, API, schema, telemetry, or subsystem contract changes. --- Fleet candidate `20261203T084432Z-web-product` from the `web-product` lane. Reviewed tip `23bf6d8b9362a8a83de5d487f050a1a91cd54d6f` on `main`. [How Pulse handles triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"version": 1,
|
||||
"base_sha": "de9e483c2dec46884b9388c04718e7a2d70c2f43",
|
||||
"verified_at": "2026-12-03T09:09:14Z",
|
||||
"result": "passed",
|
||||
"changed_paths": [
|
||||
"frontend-modern/src/features/docker/DockerApplications.tsx"
|
||||
],
|
||||
"content_sha256": {
|
||||
"frontend-modern/src/features/docker/DockerApplications.tsx": "4eb48da4bcd9ffe4e3e4995e1247892e2f8b985fbf06b532238f2dc5d5375f48"
|
||||
},
|
||||
"routes": [
|
||||
"/docker/applications?runtime=host-prod-01&project=document-ingest",
|
||||
"/docker/applications"
|
||||
],
|
||||
"viewports": [
|
||||
{
|
||||
"width": 1440,
|
||||
"height": 900
|
||||
},
|
||||
{
|
||||
"width": 390,
|
||||
"height": 900
|
||||
}
|
||||
],
|
||||
"states": [
|
||||
"Paired before/after production build of /docker/applications?runtime=host-prod-01&project=document-ingest captured via pulse-worker-browser Chromium at 1440x900 light and 390x900 dark with identical deterministic fixtures and frozen clock (2026-12-03T12:00:00Z).",
|
||||
"Stale passing check (API health, 18m old) switches from green dot and muted Stale reading to amber dot, amber preserved latency (/health: 24 ms - checked 18 mins ago), and amber Stale reading cue.",
|
||||
"Freshness-unknown prior check (Worker metrics, 8m old) switches from green dot and emerald latency with no cue to amber dot, amber preserved latency (/metrics: 11 ms - checked 8 mins ago), and amber Freshness unknown cue.",
|
||||
"Indeterminate UDP probe (Syslog ingest, open or filtered) switches from green dot to amber dot and amber warning pill while keeping 514: open or filtered - checked 25s ago.",
|
||||
"Stale failing check (Queue gateway, HTTP 503, 20m old) keeps its red dot and red 503 pill ahead of staleness with amber Stale reading cue; fresh healthy control (Webhook listener) keeps green dot and emerald 18 ms latency; disabled control (Admin endpoint) keeps muted dot and Disabled.",
|
||||
"Zero horizontal overflow (overflowX=0) and zero page or console errors across both desktop light and phone dark captures; all 6 Service checks rows remain visible in the initial 390x900 dark phone viewport."
|
||||
],
|
||||
"interactions": [
|
||||
"Clicked All applications link from Compose application detail back to /docker/applications list view.",
|
||||
"Clicked document-ingest link in Compose applications table to reopen detail view and verified Service checks rows rendered.",
|
||||
"Visually inspected all 4 paired before/after PNG screenshots (before-desktop.png, after-desktop.png, before-phone.png, after-phone.png)."
|
||||
]
|
||||
}
|
||||
@@ -94,20 +94,72 @@ function attachedChecks(container: Resource) {
|
||||
return checks.filter((check) => check.correlationState === 'attached');
|
||||
}
|
||||
|
||||
function endpointVariant(
|
||||
type EndpointCheckAttentionCue = {
|
||||
kind: 'stale' | 'freshness-unknown';
|
||||
label: string;
|
||||
title: string;
|
||||
};
|
||||
|
||||
function endpointOutcomeVariant(
|
||||
check: ResourceAvailabilityMeta,
|
||||
): 'success' | 'warning' | 'danger' | 'muted' {
|
||||
if (check.enabled === false) return 'muted';
|
||||
if (check.available === false || check.applicationOutcome === 'failed') return 'danger';
|
||||
if (
|
||||
check.available === false ||
|
||||
check.applicationOutcome === 'failed' ||
|
||||
check.aggregateState === 'unavailable'
|
||||
) {
|
||||
return 'danger';
|
||||
}
|
||||
const code = check.applicationStatusCode;
|
||||
if (typeof code === 'number') {
|
||||
if (code >= 500) return 'danger';
|
||||
if (code >= 400) return 'warning';
|
||||
}
|
||||
if (
|
||||
check.probeOutcome === 'indeterminate' ||
|
||||
check.aggregateState === 'degraded' ||
|
||||
check.disagreement === true
|
||||
) {
|
||||
return 'warning';
|
||||
}
|
||||
if (check.available === true) return 'success';
|
||||
return 'muted';
|
||||
}
|
||||
|
||||
function endpointAttentionCue(
|
||||
check: ResourceAvailabilityMeta,
|
||||
presentation: ReturnType<typeof getAvailabilityProbePresentation>,
|
||||
): EndpointCheckAttentionCue | null {
|
||||
if (check.enabled === false || !presentation) return null;
|
||||
if (presentation.freshnessLabel === 'stale') {
|
||||
return {
|
||||
kind: 'stale',
|
||||
label: 'Stale reading',
|
||||
title: presentation.detailLabel,
|
||||
};
|
||||
}
|
||||
if (presentation.freshnessLabel === 'freshness unknown' && Boolean(check.lastChecked)) {
|
||||
return {
|
||||
kind: 'freshness-unknown',
|
||||
label: 'Freshness unknown',
|
||||
title: presentation.detailLabel,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function endpointVariant(
|
||||
check: ResourceAvailabilityMeta,
|
||||
attentionCue: EndpointCheckAttentionCue | null,
|
||||
): 'success' | 'warning' | 'danger' | 'muted' {
|
||||
const outcome = endpointOutcomeVariant(check);
|
||||
if (check.enabled === false) return 'muted';
|
||||
if (outcome === 'danger' || outcome === 'warning') return outcome;
|
||||
if (attentionCue) return 'warning';
|
||||
return outcome;
|
||||
}
|
||||
|
||||
function EndpointResult(props: { check: ResourceAvailabilityMeta; container: Resource }) {
|
||||
const now = useRelativeTimeNow();
|
||||
const presentation = createMemo(() =>
|
||||
@@ -121,36 +173,56 @@ function EndpointResult(props: { check: ResourceAvailabilityMeta; container: Res
|
||||
new Date(now()),
|
||||
),
|
||||
);
|
||||
const variant = () => endpointVariant(props.check);
|
||||
const isFailing = () => variant() === 'danger' || variant() === 'warning';
|
||||
const outcome = () => endpointOutcomeVariant(props.check);
|
||||
const attentionCue = () => endpointAttentionCue(props.check, presentation());
|
||||
const variant = () => endpointVariant(props.check, attentionCue());
|
||||
const isOutcomeAttention = () => outcome() === 'danger' || outcome() === 'warning';
|
||||
const dotTitle = () =>
|
||||
props.check.enabled === false
|
||||
? 'Disabled'
|
||||
: attentionCue()?.title || presentation()?.detailLabel || undefined;
|
||||
return (
|
||||
<li class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-border py-2 last:border-0">
|
||||
<li
|
||||
class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-border py-2 last:border-0"
|
||||
data-endpoint-check-row={props.check.targetId || props.check.name || props.container.id}
|
||||
>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<StatusDot size="sm" variant={variant()} ariaHidden />
|
||||
<StatusDot size="sm" variant={variant()} title={dotTitle()} ariaHidden />
|
||||
<span class="font-medium text-base-content">
|
||||
{props.check.name || props.container.name}
|
||||
</span>
|
||||
<span class="break-all text-muted">{getAvailabilityProbeEndpointLabel(props.check)}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex flex-wrap items-center gap-x-2 gap-y-1">
|
||||
<span
|
||||
class={
|
||||
props.check.enabled === false
|
||||
? 'text-xs text-muted'
|
||||
: isFailing()
|
||||
: isOutcomeAttention()
|
||||
? `inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${
|
||||
variant() === 'danger'
|
||||
outcome() === 'danger'
|
||||
? 'bg-red-100 text-red-700 dark:bg-red-950/50 dark:text-red-300'
|
||||
: 'bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-300'
|
||||
}`
|
||||
: `text-xs font-medium ${presentation()?.toneClassName ?? 'text-base-content'}`
|
||||
: attentionCue()
|
||||
? 'text-xs font-medium text-amber-700 dark:text-amber-300'
|
||||
: `text-xs font-medium ${presentation()?.toneClassName ?? 'text-base-content'}`
|
||||
}
|
||||
title={props.check.enabled === false ? 'Disabled' : presentation()?.detailLabel}
|
||||
data-endpoint-check-result
|
||||
>
|
||||
{props.check.enabled === false ? 'Disabled' : presentation()?.rowLabel}
|
||||
</span>
|
||||
<Show when={props.check.enabled !== false && presentation()?.freshnessLabel === 'stale'}>
|
||||
<span class="text-xs text-muted">Stale reading</span>
|
||||
<Show when={attentionCue()}>
|
||||
{(cue) => (
|
||||
<span
|
||||
class="text-xs font-medium text-amber-700 dark:text-amber-300"
|
||||
title={cue().title}
|
||||
data-endpoint-check-attention-cue={cue().kind}
|
||||
>
|
||||
{cue().label}
|
||||
</span>
|
||||
)}
|
||||
</Show>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -453,4 +453,212 @@ describe('DockerApplications', () => {
|
||||
setHosts([freshHost]);
|
||||
expect(screen.queryByTestId('docker-applications-stale-notice')).toBeNull();
|
||||
});
|
||||
|
||||
it('qualifies stale, freshness-unknown, and indeterminate service checks without false green and clears on recovery', () => {
|
||||
const fixedNowMs = Date.parse('2026-12-03T12:00:00Z');
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(fixedNowMs);
|
||||
try {
|
||||
window.history.replaceState(
|
||||
{},
|
||||
'',
|
||||
'/docker/applications?runtime=host-1&project=document-ingest',
|
||||
);
|
||||
const hosts = [makeHost('host-1', 'ops-services-01')];
|
||||
const [containers, setContainers] = createSignal<Resource[]>([
|
||||
makeContainer({
|
||||
id: 'c-1',
|
||||
name: 'ingest-api',
|
||||
status: 'online',
|
||||
availabilityChecks: [
|
||||
{
|
||||
targetId: 'chk-stale-pass',
|
||||
name: 'API health',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-api.local:8080',
|
||||
path: '/health',
|
||||
enabled: true,
|
||||
available: true,
|
||||
latencyMillis: 24,
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:42:00Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-unknown-freshness',
|
||||
name: 'Worker metrics',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-worker.local:9090',
|
||||
path: '/metrics',
|
||||
enabled: true,
|
||||
available: true,
|
||||
latencyMillis: 11,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:52:00Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-indeterminate',
|
||||
name: 'Syslog ingest',
|
||||
protocol: 'udp',
|
||||
address: 'syslog.local',
|
||||
port: 514,
|
||||
enabled: true,
|
||||
available: true,
|
||||
probeOutcome: 'indeterminate',
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:59:35Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-disagreed',
|
||||
name: 'Multi-region edge',
|
||||
protocol: 'http',
|
||||
address: 'http://edge.local',
|
||||
path: '/ready',
|
||||
enabled: true,
|
||||
available: true,
|
||||
aggregateState: 'degraded',
|
||||
disagreement: true,
|
||||
latencyMillis: 31,
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:59:40Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-stale-fail',
|
||||
name: 'Queue gateway',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-queue.local',
|
||||
path: '/ready',
|
||||
enabled: true,
|
||||
available: false,
|
||||
applicationOutcome: 'failed',
|
||||
applicationStatusCode: 503,
|
||||
lastError: 'HTTP 503 Service Unavailable',
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:40:00Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-fresh-pass',
|
||||
name: 'Webhook listener',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-hook.local',
|
||||
path: '/ping',
|
||||
enabled: true,
|
||||
available: true,
|
||||
latencyMillis: 18,
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:59:38Z',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-unchecked',
|
||||
name: 'Pending endpoint',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-pending.local',
|
||||
path: '/status',
|
||||
enabled: true,
|
||||
correlationState: 'attached',
|
||||
},
|
||||
{
|
||||
targetId: 'chk-disabled',
|
||||
name: 'Admin endpoint',
|
||||
protocol: 'http',
|
||||
address: 'http://ingest-admin.local',
|
||||
path: '/status',
|
||||
enabled: false,
|
||||
available: true,
|
||||
pollIntervalSeconds: 60,
|
||||
correlationState: 'attached',
|
||||
lastChecked: '2026-12-03T11:30:00Z',
|
||||
},
|
||||
],
|
||||
}),
|
||||
]);
|
||||
|
||||
render(() => (
|
||||
<DockerHostIdentitiesProvider value={() => buildDockerHostIdentities(hosts)}>
|
||||
<Router>
|
||||
<Route
|
||||
path="*"
|
||||
component={() => (
|
||||
<DockerApplications hosts={hosts} containers={containers()} refresh={vi.fn()} />
|
||||
)}
|
||||
/>
|
||||
</Router>
|
||||
</DockerHostIdentitiesProvider>
|
||||
));
|
||||
|
||||
const row = (id: string) => document.querySelector(`[data-endpoint-check-row="${id}"]`)!;
|
||||
const dot = (id: string) => row(id).querySelector('span[aria-hidden="true"]')!;
|
||||
const result = (id: string) => row(id).querySelector('[data-endpoint-check-result]')!;
|
||||
const cue = (id: string) => row(id).querySelector('[data-endpoint-check-attention-cue]');
|
||||
|
||||
// Stale passing check: amber dot + amber latency (not green) + amber Stale reading cue.
|
||||
expect(dot('chk-stale-pass').className).toContain('bg-amber-500');
|
||||
expect(dot('chk-stale-pass').className).not.toContain('bg-emerald-500');
|
||||
expect(result('chk-stale-pass')).toHaveTextContent('/health: 24 ms');
|
||||
expect(result('chk-stale-pass').className).toContain('text-amber-700');
|
||||
expect(cue('chk-stale-pass')).toHaveAttribute('data-endpoint-check-attention-cue', 'stale');
|
||||
expect(cue('chk-stale-pass')).toHaveTextContent('Stale reading');
|
||||
expect(cue('chk-stale-pass')?.className).toContain('text-amber-700');
|
||||
|
||||
// Freshness-unknown prior check: amber dot + amber latency (not emerald) + Freshness unknown cue.
|
||||
expect(dot('chk-unknown-freshness').className).toContain('bg-amber-500');
|
||||
expect(result('chk-unknown-freshness')).toHaveTextContent('/metrics: 11 ms');
|
||||
expect(result('chk-unknown-freshness').className).toContain('text-amber-700');
|
||||
expect(result('chk-unknown-freshness').className).not.toContain('text-emerald-600');
|
||||
expect(cue('chk-unknown-freshness')).toHaveAttribute(
|
||||
'data-endpoint-check-attention-cue',
|
||||
'freshness-unknown',
|
||||
);
|
||||
expect(cue('chk-unknown-freshness')).toHaveTextContent('Freshness unknown');
|
||||
|
||||
// Indeterminate UDP probe and degraded multi-location check: amber dot + amber pill.
|
||||
expect(dot('chk-indeterminate').className).toContain('bg-amber-500');
|
||||
expect(result('chk-indeterminate')).toHaveTextContent('open or filtered');
|
||||
expect(result('chk-indeterminate').className).toContain('bg-amber-100');
|
||||
expect(cue('chk-indeterminate')).toBeNull();
|
||||
|
||||
expect(dot('chk-disagreed').className).toContain('bg-amber-500');
|
||||
expect(result('chk-disagreed').className).toContain('bg-amber-100');
|
||||
|
||||
// Stale failing check: danger stays ahead of staleness while keeping the Stale reading cue.
|
||||
expect(dot('chk-stale-fail').className).toContain('bg-red-500');
|
||||
expect(result('chk-stale-fail').className).toContain('bg-red-100');
|
||||
expect(cue('chk-stale-fail')).toHaveTextContent('Stale reading');
|
||||
|
||||
// Fresh passing control: stays green with no cue.
|
||||
expect(dot('chk-fresh-pass').className).toContain('bg-emerald-500');
|
||||
expect(result('chk-fresh-pass').className).toContain('text-emerald-600');
|
||||
expect(cue('chk-fresh-pass')).toBeNull();
|
||||
|
||||
// Unchecked and disabled controls: stay muted with no cue.
|
||||
expect(dot('chk-unchecked').className).toContain('bg-slate-400');
|
||||
expect(result('chk-unchecked')).toHaveTextContent('not checked');
|
||||
expect(cue('chk-unchecked')).toBeNull();
|
||||
|
||||
expect(dot('chk-disabled').className).toContain('bg-slate-400');
|
||||
expect(result('chk-disabled')).toHaveTextContent('Disabled');
|
||||
expect(cue('chk-disabled')).toBeNull();
|
||||
|
||||
// Live recovery: updating lastChecked clears the stale cue and restores green.
|
||||
setContainers((current) =>
|
||||
current.map((container) => ({
|
||||
...container,
|
||||
availabilityChecks: container.availabilityChecks?.map((check) =>
|
||||
check.targetId === 'chk-stale-pass'
|
||||
? { ...check, lastChecked: '2026-12-03T11:59:45Z' }
|
||||
: check,
|
||||
),
|
||||
})),
|
||||
);
|
||||
expect(dot('chk-stale-pass').className).toContain('bg-emerald-500');
|
||||
expect(result('chk-stale-pass').className).toContain('text-emerald-600');
|
||||
expect(cue('chk-stale-pass')).toBeNull();
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user