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.

Canonicalize Patrol run-history badges

rcourtman94a2b7dc3782
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 4dda3c982a..b969d5e6f2 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -498,6 +498,10 @@ not a replacement status card, CTA band, or page-local nested card.
`OrganizationRoleBadge` and `OrganizationShareStatusBadge`, so role/status
tone mapping, pill shape, fit behavior, and whitespace handling do not drift
across organization overview, access, and sharing surfaces.
+ Patrol run-history resource, outcome, snapshot, and scoped-run chips must
+ also compose `MetadataBadge`; Patrol remains the label/count/semantics
+ owner, but the visible badge shell, sizing, tone vocabulary, and whitespace
+ behavior stay in the shared primitive and `shared-template-registry.json`.
Inline detail content belongs to the shared detail-section primitive family.
Feature surfaces may own the platform-specific rows, section labels, and
source model, but section row shaping, empty-row compaction, value tone
@@ -2359,6 +2363,10 @@ presentation for product surfaces that display state rather than toggle it.
Product components must compose `StatusIndicatorBadge` instead of calling
`getStatusIndicatorBadgeToneClasses` directly; low-level status utilities may
still expose the tone mapping for that primitive and utility-level tests.
+Patrol run-history status labels follow this state-badge boundary: Patrol may
+derive the status label and typed variant in `patrolRunPresentation.ts`, but
+`RunHistoryEntry.tsx` must render the visible state badge through
+`StatusIndicatorBadge` rather than `runStatus.badgeClass` or a local span.
The shared segmented selector now follows that same owner split.
`frontend-modern/src/components/shared/FilterButtonGroup.tsx` stays the render
shell, `frontend-modern/src/components/shared/useFilterButtonGroupState.ts`
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 3358b1d973..0e27e7455a 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -58,6 +58,12 @@ Patrol-specific presentation helpers.
1. Add or change Patrol page orchestration through `frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts`, keep `frontend-modern/src/features/patrol/patrolInvestigationContextModel.ts` as the canonical investigation-context derivation owner, keep `frontend-modern/src/features/patrol/PatrolIntelligenceSurface.tsx` as the feature shell, keep the Patrol-owned section files under `frontend-modern/src/features/patrol/` as the heavy render owners, keep `frontend-modern/src/pages/AIIntelligence.tsx` as the route shell, keep `frontend-modern/src/stores/aiIntelligenceSummaryModel.ts` as the canonical AI summary normalization owner, and update `frontend-modern/src/stores/aiIntelligence.ts` together
2. Add or change Patrol findings, approvals, investigation, or run-history presentation through `frontend-modern/src/components/AI/FindingsPanel.tsx` and `frontend-modern/src/components/patrol/`
+ Patrol owns run-history labels, counts, status variants, and domain copy, but
+ visible run-history status badges must compose the shared
+ `StatusIndicatorBadge`, and resource/outcome/snapshot/scoped-run metadata
+ chips must compose the shared `MetadataBadge`. If Patrol needs a new badge
+ shape or tone, extend the shared primitive and registry guard instead of
+ adding page-local rounded pill spans.
3. Keep remediation execution badge copy and severity styling aligned through `frontend-modern/src/components/patrol/RemediationStatus.tsx` and `frontend-modern/src/utils/remediationPresentation.ts`
4. Add or change Patrol header, summary, status runtime-state presentation, or runtime provider action presentation through `frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx`, `frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx`, `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`, `frontend-modern/src/utils/patrolRuntimePresentation.ts`, and `frontend-modern/src/utils/patrolRuntimeActions.ts`
Patrol summary presentation may show recent activity mix and trigger mode as
@@ -75,6 +81,7 @@ Patrol-specific presentation helpers.
1. Reintroducing Patrol finding, investigation, approval, or run-history copy directly inside page components when canonical Patrol presentation helpers already own it
2. Duplicating Patrol finding severity, lifecycle, alert-identity, or approval-risk derivation outside the governed Patrol presentation helpers
3. Letting the Patrol page, local store, and findings UI drift into separate shadow truths for the same Patrol status or finding lifecycle state
+4. Recreating Patrol run-history status or metadata badge shells locally instead of composing `StatusIndicatorBadge` and `MetadataBadge`
## Completion Obligations
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index e3d17c3401..b7dc15a014 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -543,7 +543,14 @@
},
"requiredConsumers": [
{ "path": "src/components/Settings/AgentProfilesPanel.tsx" },
- { "path": "src/components/Settings/DiagnosticsResultsPanel.tsx" }
+ { "path": "src/components/Settings/DiagnosticsResultsPanel.tsx" },
+ { "path": "src/components/patrol/RunHistoryEntry.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/components/patrol/RunHistoryEntry.tsx",
+ "patterns": ["runStatus.badgeClass"]
+ }
],
"proof": [
"src/components/shared/SharedPrimitives.guardrails.test.ts",
@@ -559,7 +566,19 @@
"path": "src/components/shared/MetadataBadge.tsx",
"export": "MetadataBadge"
},
- "requiredConsumers": [{ "path": "src/components/shared/OrganizationBadges.tsx" }],
+ "requiredConsumers": [
+ { "path": "src/components/shared/OrganizationBadges.tsx" },
+ { "path": "src/components/patrol/RunHistoryEntry.tsx" }
+ ],
+ "forbiddenPatterns": [
+ {
+ "path": "src/components/patrol/RunHistoryEntry.tsx",
+ "patterns": [
+ "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium",
+ "inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50"
+ ]
+ }
+ ],
"proof": [
"src/components/shared/SharedPrimitives.guardrails.test.ts",
"src/components/shared/MetadataBadge.test.tsx",
@@ -1198,6 +1217,26 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "patrol-run-metadata-badge-local-shell",
+ "category": "metadata-badge",
+ "summary": "Patrol run-history metadata chips must compose MetadataBadge instead of recreating local rounded resource or outcome pill spans.",
+ "canonical": {
+ "path": "src/components/shared/MetadataBadge.tsx",
+ "export": "MetadataBadge"
+ },
+ "scopes": ["src/components/patrol"],
+ "extensions": [".tsx"],
+ "allPatterns": ["inline-flex items-center gap-1", "rounded-full text-xs font-medium"],
+ "legacyReason": "Retired migration debt. Patrol run-history resource and outcome chips use MetadataBadge for shared shell, sizing, tone, and whitespace behavior.",
+ "allowedPaths": [],
+ "ignoredPaths": ["src/components/shared/SharedPrimitives.guardrails.test.ts"],
+ "proof": [
+ "src/components/shared/SharedPrimitives.guardrails.test.ts",
+ "src/components/shared/MetadataBadge.test.tsx",
+ "scripts/shared-template-audit.mjs"
+ ]
+ },
{
"id": "organization-role-badge-local-shell",
"category": "metadata-badge",
diff --git a/frontend-modern/src/components/patrol/RunHistoryEntry.tsx b/frontend-modern/src/components/patrol/RunHistoryEntry.tsx
index 2abc2788a2..72de5b3ce9 100644
--- a/frontend-modern/src/components/patrol/RunHistoryEntry.tsx
+++ b/frontend-modern/src/components/patrol/RunHistoryEntry.tsx
@@ -3,6 +3,8 @@ import type { Accessor } from 'solid-js';
import type { PatrolRunRecord } from '@/api/patrol';
import { FindingsPanel } from '@/components/AI/FindingsPanel';
import { renderMarkdown } from '@/components/AI/aiChatUtils';
+import { MetadataBadge } from '@/components/shared/MetadataBadge';
+import { StatusIndicatorBadge } from '@/components/shared/StatusIndicatorBadge';
import { buildPatrolRunAssistantHandoff } from '@/features/patrol/patrolInvestigationContextModel';
import { aiChatStore } from '@/stores/aiChat';
import { RunToolCallTrace } from './RunToolCallTrace';
@@ -108,10 +110,7 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
(props.patrolStream.resynced() || props.patrolStream.reconnectCount() > 0)
}
>
- <span
- title={resyncTitle()}
- class="inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300"
- >
+ <MetadataBadge title={resyncTitle()} tone="info" size="xs" shape="rounded">
<RefreshCwIcon class="w-3 h-3" />
<span>
{props.patrolStream.resynced()
@@ -120,7 +119,7 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
: 'Resynced'
: `Reconnected${props.patrolStream.reconnectCount() > 1 ? ` x${props.patrolStream.reconnectCount()}` : ''}`}
</span>
- </span>
+ </MetadataBadge>
</Show>
<Show when={hasError()}>
<ShieldAlertIcon class="w-3.5 h-3.5 text-red-500" />
@@ -130,9 +129,9 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
<span class="text-blue-700 dark:text-blue-300">{props.patrolStream.phase()}</span>
</Show>
<Show when={!hasError() && props.patrolStream.currentTool()}>
- <span class="font-mono text-[11px] bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded">
+ <MetadataBadge tone="info" size="xs" shape="rounded" class="font-mono">
{props.patrolStream.currentTool()}
- </span>
+ </MetadataBadge>
</Show>
<Show when={!hasError() && props.patrolStream.tokens() > 0}>
<span class="text-blue-500 dark:text-blue-400 ml-auto">
@@ -190,7 +189,12 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
<span class="text-base-content font-medium">
{formatRelativeTime(run.started_at, { compact: true })}
</span>
- <span class={`px-1.5 py-0.5 rounded ${runStatus.badgeClass}`}>{runStatus.label}</span>
+ <StatusIndicatorBadge
+ label={runStatus.label}
+ variant={runStatus.variant}
+ size="xs"
+ shape="rounded"
+ />
<span>{formatTriggerReason(run.trigger_reason)}</span>
<Show when={scopeSummary && !coverageSummary}>
<span>• {scopeSummary}</span>
@@ -337,54 +341,54 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
</div>
<div class="flex flex-wrap gap-1.5">
<Show when={run.nodes_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-50 text-blue-700 dark:bg-blue-900 dark:text-blue-300">
+ <MetadataBadge tone="neutral">
<ServerIcon class="w-3 h-3" /> {run.nodes_checked} node
{run.nodes_checked !== 1 ? 's' : ''}
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.guests_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-rose-50 text-rose-700 dark:bg-rose-900 dark:text-rose-300">
+ <MetadataBadge tone="neutral">
<MonitorIcon class="w-3 h-3" /> {run.guests_checked} VM
{run.guests_checked !== 1 ? 's' : ''}
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.docker_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-cyan-50 text-cyan-700 dark:bg-cyan-900 dark:text-cyan-300">
+ <MetadataBadge tone="neutral">
<BoxIcon class="w-3 h-3" /> {run.docker_checked} container
{run.docker_checked !== 1 ? 's' : ''}
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.storage_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-50 text-amber-700 dark:bg-amber-900 dark:text-amber-300">
+ <MetadataBadge tone="neutral">
<HardDriveIcon class="w-3 h-3" /> {run.storage_checked} storage
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.hosts_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-50 text-green-700 dark:bg-green-900 dark:text-green-300">
+ <MetadataBadge tone="neutral">
<GlobeIcon class="w-3 h-3" /> {run.hosts_checked} agent
{run.hosts_checked !== 1 ? 's' : ''}
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.truenas_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-teal-50 text-teal-700 dark:bg-teal-900 dark:text-teal-300">
+ <MetadataBadge tone="neutral">
<HardDriveIcon class="w-3 h-3" /> {run.truenas_checked} TrueNAS
{run.truenas_checked !== 1 ? ' systems' : ' system'}
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.pbs_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-indigo-50 text-indigo-700 dark:bg-indigo-900 dark:text-indigo-300">
+ <MetadataBadge tone="neutral">
<DatabaseIcon class="w-3 h-3" /> {run.pbs_checked} PBS
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.pmg_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-orange-50 text-orange-700 dark:bg-orange-900 dark:text-orange-300">
+ <MetadataBadge tone="neutral">
<MailIcon class="w-3 h-3" /> {run.pmg_checked} PMG
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.kubernetes_checked > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-sky-50 text-sky-700 dark:bg-sky-900 dark:text-sky-300">
+ <MetadataBadge tone="neutral">
<ActivityIcon class="w-3 h-3" /> {run.kubernetes_checked} K8s
- </span>
+ </MetadataBadge>
</Show>
</div>
</div>
@@ -400,36 +404,36 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
</div>
<div class="flex flex-wrap gap-1.5">
<Show when={run.new_findings > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300">
+ <MetadataBadge tone="warning">
<AlertTriangleIcon class="w-3 h-3" /> {run.new_findings} new
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.existing_findings > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-surface-hover ">
+ <MetadataBadge tone="muted">
<ActivityIcon class="w-3 h-3" /> {run.existing_findings} existing
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.resolved_findings > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300">
+ <MetadataBadge tone="success">
<CheckCircleIcon class="w-3 h-3" /> {run.resolved_findings} resolved
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.auto_fix_count > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300">
+ <MetadataBadge tone="info">
<WrenchIcon class="w-3 h-3" /> {run.auto_fix_count} remediated
- </span>
+ </MetadataBadge>
</Show>
<Show when={run.rejected_findings > 0}>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-surface-alt ">
+ <MetadataBadge tone="muted">
<FilterXIcon class="w-3 h-3" /> {run.rejected_findings} rejected
- </span>
+ </MetadataBadge>
</Show>
<Show
when={!hasFindingsSnapshot && run.new_findings === 0 && run.existing_findings === 0}
>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300">
+ <MetadataBadge tone="info">
<ActivityIcon class="w-3 h-3" /> Snapshot unavailable
- </span>
+ </MetadataBadge>
</Show>
<Show
when={
@@ -439,9 +443,9 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
run.existing_findings === 0
}
>
- <span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300">
+ <MetadataBadge tone="success">
<CheckCircleIcon class="w-3 h-3" /> All clear
- </span>
+ </MetadataBadge>
</Show>
</div>
</div>
@@ -477,9 +481,9 @@ export function RunHistoryEntry(props: RunHistoryEntryProps) {
</span>
</Show>
<Show when={run.type === 'scoped' && !coverageSummary}>
- <span class="inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50 text-blue-600 dark:bg-blue-900 dark:text-blue-400 text-[10px] font-medium">
+ <MetadataBadge tone="info" size="xs" shape="rounded">
{formatScope(run) || 'Scoped'}
- </span>
+ </MetadataBadge>
</Show>
</div>
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 86e2cdeb45..3ac26364fb 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -206,6 +206,7 @@ import resourcePickerSource from '@/components/Settings/ResourcePicker.tsx?raw';
import settingsPageShellSource from '@/components/Settings/SettingsPageShell.tsx?raw';
import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligenceHeader.tsx?raw';
import patrolIntelligenceWorkspaceSource from '@/features/patrol/PatrolIntelligenceWorkspace.tsx?raw';
+import runHistoryEntrySource from '@/components/patrol/RunHistoryEntry.tsx?raw';
import filterBarSource from '@/components/shared/FilterBar/FilterBar.tsx?raw';
import filterChipSource from '@/components/shared/FilterBar/FilterChip.tsx?raw';
import featureGateSectionSource from '@/components/shared/FeatureGateSection.tsx?raw';
@@ -1533,6 +1534,7 @@ describe('shared primitive guardrails', () => {
expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
'src/components/Settings/AgentProfilesPanel.tsx',
'src/components/Settings/DiagnosticsResultsPanel.tsx',
+ 'src/components/patrol/RunHistoryEntry.tsx',
]);
expect(registeredGuard?.canonical?.path).toBe('src/components/shared/StatusIndicatorBadge.tsx');
expect(registeredGuard?.canonical?.export).toBe('StatusIndicatorBadge');
@@ -1552,9 +1554,11 @@ describe('shared primitive guardrails', () => {
expect(diagnosticsResultsPanelSource).toContain('StatusIndicatorBadge');
expect(diagnosticsResultsPanelSource).not.toContain('const StatusBadge');
expect(diagnosticsResultsPanelSource).not.toContain('getStatusIndicatorBadgeToneClasses');
+ expect(runHistoryEntrySource).toContain('StatusIndicatorBadge');
+ expect(runHistoryEntrySource).not.toContain('runStatus.badgeClass');
});
- it('keeps organization metadata badges on shared badge wrappers', () => {
+ it('keeps metadata badges on shared badge primitives', () => {
const registry = JSON.parse(sharedTemplateRegistrySource) as {
rules?: Array<{
id: string;
@@ -1581,11 +1585,15 @@ describe('shared primitive guardrails', () => {
const localShareStatusGuard = registry.patternGuards?.find(
(guard) => guard.id === 'organization-share-status-badge-local-shell',
);
+ const patrolRunMetadataGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'patrol-run-metadata-badge-local-shell',
+ );
expect(metadataRule?.canonical?.path).toBe('src/components/shared/MetadataBadge.tsx');
expect(metadataRule?.canonical?.export).toBe('MetadataBadge');
expect(metadataRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([
'src/components/shared/OrganizationBadges.tsx',
+ 'src/components/patrol/RunHistoryEntry.tsx',
]);
expect(roleRule?.canonical?.path).toBe('src/components/shared/OrganizationBadges.tsx');
expect(roleRule?.canonical?.export).toBe('OrganizationRoleBadge');
@@ -1606,6 +1614,13 @@ describe('shared primitive guardrails', () => {
expect(localRoleGuard?.scopes).toEqual(['src/components/Settings']);
expect(localShareStatusGuard?.allPatterns).toEqual(['statusBadgeClass(']);
expect(localShareStatusGuard?.scopes).toEqual(['src/components/Settings']);
+ expect(patrolRunMetadataGuard?.canonical?.path).toBe('src/components/shared/MetadataBadge.tsx');
+ expect(patrolRunMetadataGuard?.canonical?.export).toBe('MetadataBadge');
+ expect(patrolRunMetadataGuard?.allPatterns).toEqual([
+ 'inline-flex items-center gap-1',
+ 'rounded-full text-xs font-medium',
+ ]);
+ expect(patrolRunMetadataGuard?.scopes).toEqual(['src/components/patrol']);
expect(metadataBadgeSource).toContain('METADATA_BADGE_TONE_CLASSES');
expect(metadataBadgeSource).toContain('getMetadataBadgeClass');
@@ -1635,6 +1650,14 @@ describe('shared primitive guardrails', () => {
'inline-flex w-fit rounded-full px-2 py-0.5 text-xs font-medium',
);
}
+
+ expect(runHistoryEntrySource).toContain('MetadataBadge');
+ expect(runHistoryEntrySource).not.toContain(
+ 'inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium',
+ );
+ expect(runHistoryEntrySource).not.toContain(
+ 'inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-blue-50',
+ );
});
it('keeps resource status dots on the shared StatusDot primitive', () => {
diff --git a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
index aa749b9e10..57085134c7 100644
--- a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
@@ -41,21 +41,25 @@ describe('patrolRunPresentation', () => {
it('maps critical and error runs to danger styling', () => {
expect(getPatrolRunStatusPresentation('critical').badgeClass).toContain('red-100');
expect(getPatrolRunStatusPresentation('error').badgeClass).toContain('red-100');
+ expect(getPatrolRunStatusPresentation('error').variant).toBe('danger');
});
it('maps issues found to warning styling', () => {
const presentation = getPatrolRunStatusPresentation('issues_found');
expect(presentation.badgeClass).toContain('amber-100');
+ expect(presentation.variant).toBe('warning');
expect(presentation.label).toBe('issues found');
});
it('maps healthy runs to success styling', () => {
expect(getPatrolRunStatusPresentation('healthy').badgeClass).toContain('green-100');
+ expect(getPatrolRunStatusPresentation('healthy').variant).toBe('success');
});
it('downgrades legacy healthy runs without findings snapshots to a neutral completed state', () => {
expect(getPatrolRunStatusPresentation('healthy', 0, false)).toEqual({
badgeClass: 'bg-surface-alt text-base-content',
+ variant: 'muted',
label: 'completed',
});
});
@@ -64,6 +68,7 @@ describe('patrolRunPresentation', () => {
const presentation = getPatrolRunStatusPresentation('healthy', 2);
expect(presentation.label).toBe('error');
expect(presentation.badgeClass).toContain('red-100');
+ expect(presentation.variant).toBe('danger');
});
it('treats only healthy runs without errors as healthy', () => {
@@ -104,6 +109,7 @@ describe('patrolRunPresentation', () => {
const presentation = getPatrolRunStatusPresentation(' Needs Review ');
expect(presentation.label).toBe('needs review');
expect(presentation.badgeClass).toContain('bg-surface-alt');
+ expect(presentation.variant).toBe('muted');
});
it('maps tool call success and failure to canonical colors', () => {
@@ -162,6 +168,7 @@ describe('patrolRunPresentation', () => {
kindLabel: 'Scoped run',
status: {
badgeClass: 'bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300',
+ variant: 'danger',
label: 'error',
},
timestamp: '2026-03-12T10:01:00Z',
diff --git a/frontend-modern/src/utils/patrolRunPresentation.ts b/frontend-modern/src/utils/patrolRunPresentation.ts
index 2ab499f832..617d63fc56 100644
--- a/frontend-modern/src/utils/patrolRunPresentation.ts
+++ b/frontend-modern/src/utils/patrolRunPresentation.ts
@@ -5,9 +5,11 @@ import {
getPatrolProviderSettingsAction,
type PatrolRuntimeActionPresentation,
} from '@/utils/patrolRuntimeActions';
+import type { StatusIndicatorVariant } from '@/utils/status';
export interface PatrolRunStatusPresentation {
badgeClass: string;
+ variant: StatusIndicatorVariant;
label: string;
}
@@ -109,27 +111,32 @@ export function getPatrolRunStatusPresentation(
case 'error':
return {
badgeClass: 'bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300',
+ variant: 'danger',
label: formatIdentifierLabel(normalized),
};
case 'issues_found':
return {
badgeClass: 'bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300',
+ variant: 'warning',
label: 'issues found',
};
case 'healthy':
if (!findingsSnapshotAvailable) {
return {
badgeClass: 'bg-surface-alt text-base-content',
+ variant: 'muted',
label: 'completed',
};
}
return {
badgeClass: 'bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300',
+ variant: 'success',
label: 'healthy',
};
default:
return {
badgeClass: 'bg-surface-alt text-base-content',
+ variant: 'muted',
label: formatIdentifierLabel(normalized, { fallback: 'unknown' }),
};
}