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
Improve action audit refusal presentation
rcourtmancbe595572b43
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 99eab08bf1..d47a89f68a 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -1016,6 +1016,12 @@ the canonical monitored-system blocked payload.When `ran=false` (no derivable check, or feature disabled for theaction class) nothing must be rendered, matching the no-fabricationrule.+ The action audit `verificationOutcome` field carries the bounded+ operator-facing verification status and evidence summary. Frontend+ consumers must map `verified`, `unverified`, `failed`, and `unknown`+ through shared action-audit presentation helpers, preserving+ `evidenceSummary` as audit evidence while avoiding route-local+ wording or raw status-token-first copy.The patrol-status response (`PatrolStatusResponse`) carries anoptional `trust` block of type `ai.FindingsTrustSummary` thatsurfaces the trust-metrics snapshot for the Patrol page. The block@@ -1414,7 +1420,8 @@ detail stays behind `/api/approvals/{id}`, the event is adoorbell),`action.completed` when an action audit reaches a terminal state —Completed, runtime-Failed, or refused-before-dispatch (refusals-carry the stable error-token prefix `plan_drift:` or+carry stable error-token prefixes such as `plan_drift:`,+`action_plan_expired:`, `action_dry_run_only:`, or`resource_remediation_locked:` verbatim on `errorMessage` so agentsbranch on the prefix rather than parsing human text; successfuldispatches carry a `verification` block — the agent-stable@@ -1476,8 +1483,9 @@ package. API-owned execution installs `ResourceHandlers` on thesame `PublishActionCompletedRecord` projector so direct`/api/actions/{id}/execute` completions and stale-plan refusalsemit the identical payload shape. `action.completed` payloads preserve the canonical-refusal-token prefixes (`plan_drift:`, `resource_remediation_locked:`)-on `errorMessage` verbatim so agents branch on the stable code+refusal-token prefixes (`plan_drift:`, `action_plan_expired:`,+`action_dry_run_only:`, `resource_remediation_locked:`) on+`errorMessage` verbatim so agents branch on the stable codewithout parsing human messages.`/api/agent/capabilities` is the discovery document for Pulse'sdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 71865accc1..012fefa045 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -585,6 +585,17 @@ AI-only summary payloads, or page-local heuristics.nothing is rendered —operators must not see fabricated "verified" claims for actionswhere Pulse cannot read back.+24. Keep resource action-history refusal and verification-outcome+ presentation shared. Refused action results may preserve stable+ backend prefixes for agent branching (`plan_drift:`,+ `action_plan_expired:`, `action_dry_run_only:`, and+ `resource_remediation_locked:`), but the drawer must render+ operator-safe labels and details through+ `frontend-modern/src/utils/actionAuditPresentation.ts` rather than+ prefix-first result copy or route-local parsing. The same helper owns+ `verificationOutcome.status` presentation for `verified`,+ `unverified`, `failed`, and `unknown` so resource history, future+ action audit consumers, and tests share one bounded vocabulary.## Current Statediff --git a/frontend-modern/src/api/__tests__/actionAudit.test.ts b/frontend-modern/src/api/__tests__/actionAudit.test.tsindex bc4142def6..3b1fe0d07b 100644--- a/frontend-modern/src/api/__tests__/actionAudit.test.ts+++ b/frontend-modern/src/api/__tests__/actionAudit.test.ts@@ -158,6 +158,53 @@ describe('ActionAuditAPI', () => {expect(response.audits[0].result?.verification).toEqual({ ran: false, success: false });});+ it('round-trips verification outcome evidence and refused execution results', async () => {+ apiFetchJSONMock.mockResolvedValueOnce({+ audits: [+ {+ id: 'action-refused',+ createdAt: '2026-04-29T12:00:00Z',+ updatedAt: '2026-04-29T12:00:30Z',+ state: 'failed',+ request: {+ requestId: 'req-refused',+ resourceId: 'vm:42',+ capabilityName: 'restart_service',+ reason: 'restart workload after backup',+ requestedBy: 'pulse_patrol',+ },+ plan: {+ actionId: 'action-refused',+ requestId: 'req-refused',+ allowed: true,+ requiresApproval: true,+ approvalPolicy: 'admin',+ rollbackAvailable: false,+ },+ result: {+ success: false,+ errorMessage: 'resource_remediation_locked: operator lock is active',+ },+ verificationOutcome: {+ status: 'unverified',+ evidenceSummary: 'No dispatch occurred, so no verification probe ran.',+ },+ },+ ],+ count: 1,+ } as any);++ const response = await ActionAuditAPI.listActionAudits({ resourceId: 'vm:42' });+ expect(response.audits[0].result?.errorMessage).toBe(+ 'resource_remediation_locked: operator lock is active',+ );+ expect(response.audits[0].verificationOutcome).toEqual({+ status: 'unverified',+ evidenceSummary: 'No dispatch occurred, so no verification probe ran.',+ });+ expect(response.audits[0].verification).toBeUndefined();+ });+it('treats gated action audit endpoints as unavailable instead of throwing', async () => {apiFetchJSONMock.mockRejectedValueOnce(Object.assign(new Error('Payment Required'), { status: 402 }),diff --git a/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx b/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsxindex fc5839d848..ddaf3fff85 100644--- a/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceActionHistory.tsx@@ -5,8 +5,10 @@ import { formatRelativeTime } from '@/utils/format';import {formatActionApprovalPolicyLabel,formatActionCapabilityLabel,+ getActionAuditRecordStatePresentation,+ getActionAuditResultPresentation,getActionAuditVerification,- getActionAuditStatePresentation,+ getActionAuditVerificationOutcomePresentation,shouldRenderActionAuditVerification,} from '@/utils/actionAuditPresentation';@@ -19,9 +21,10 @@ interface ResourceActionHistoryProps {}const ActionHistoryRow: Component<{ audit: ActionAuditRecord }> = (props) => {- const state = () => getActionAuditStatePresentation(props.audit.state);+ const state = () => getActionAuditRecordStatePresentation(props.audit);const preflight = () => props.audit.plan?.preflight;- const result = () => props.audit.result;+ const resultPresentation = () => getActionAuditResultPresentation(props.audit);+ const verificationOutcome = () => getActionAuditVerificationOutcomePresentation(props.audit);const verification = () => getActionAuditVerification(props.audit);return (@@ -80,15 +83,47 @@ const ActionHistoryRow: Component<{ audit: ActionAuditRecord }> = (props) => {</ul></div></Show>- <Show when={result()}>- <div class="rounded border border-border bg-surface px-2 py-1 text-[10px]">- <div class="font-medium text-base-content">- {result()?.success ? 'Result' : 'Failure'}- </div>- <Show when={result()?.output || result()?.errorMessage}>- <div class="mt-0.5 text-muted">{result()?.output || result()?.errorMessage}</div>- </Show>- </div>+ <Show when={resultPresentation()}>+ {(() => {+ const presentation = resultPresentation()!;+ return (+ <div class={`rounded border px-2 py-1 text-[10px] ${presentation.className}`}>+ <div class="font-medium">{presentation.label}</div>+ <Show when={presentation.kind === 'refusal'}>+ <div class="mt-0.5 font-medium">Refused before dispatch</div>+ </Show>+ <Show when={presentation.reasonLabel}>+ <div class="mt-0.5 font-medium">{presentation.reasonLabel}</div>+ </Show>+ <Show when={presentation.detail}>+ <div class="mt-0.5 opacity-80">{presentation.detail}</div>+ </Show>+ <Show when={presentation.recordedDetail}>+ <div class="mt-0.5 opacity-80">+ <span class="font-medium">Recorded detail: </span>+ {presentation.recordedDetail}+ </div>+ </Show>+ </div>+ );+ })()}+ </Show>+ <Show when={verificationOutcome()}>+ {(() => {+ const outcome = verificationOutcome()!;+ return (+ <div class={`rounded border px-2 py-1 text-[10px] ${outcome.className}`}>+ <div class="font-medium">{outcome.label}</div>+ <div class="mt-0.5 opacity-80">{outcome.detail}</div>+ <Show when={outcome.evidenceSummary}>+ <div class="mt-0.5 opacity-80">+ <span class="font-medium">Evidence: </span>+ {outcome.evidenceSummary}+ </div>+ </Show>+ </div>+ );+ })()}</Show><Show when={shouldRenderActionAuditVerification(props.audit)}>{(() => {diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex 64b34a4f5e..8f73263ad5 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -192,7 +192,11 @@ describe('ResourceDetailDrawer change history section', () => {expect(resourceDetailDrawerHistoryStateSource).toContain('resourceFacetRelationships');expect(resourceDetailDrawerDerivedStateSource).toContain('options.resourceRelationships?.()');expect(resourceDetailDrawerDerivedStateSource).toContain('resource.relationships ?? []');- expect(resourceActionHistorySource).toContain('getActionAuditStatePresentation');+ expect(resourceActionHistorySource).toContain('getActionAuditRecordStatePresentation');+ expect(resourceActionHistorySource).toContain('getActionAuditResultPresentation');+ expect(resourceActionHistorySource).toContain(+ 'getActionAuditVerificationOutcomePresentation',+ );expect(resourceActionHistorySource).toContain('formatActionApprovalPolicyLabel');// The audit history must surface the broker's read-after-write// verification outcome alongside the dispatch result, not silently@@ -203,6 +207,8 @@ describe('ResourceDetailDrawer change history section', () => {);expect(resourceActionHistorySource).toContain('Verified');expect(resourceActionHistorySource).toContain('Verification failed');+ expect(actionAuditPresentationSource).toContain('resource_remediation_locked:');+ expect(actionAuditPresentationSource).toContain('Verification confirmed');expect(actionAuditApiSource).toContain('/api/audit/actions');expect(actionAuditApiSource).toContain('ACTION_AUDIT_UNAVAILABLE_STATUSES');expect(actionAuditPresentationSource).toContain('pending_approval');@@ -746,7 +752,7 @@ describe('ResourceDetailDrawer change history section', () => {it('surfaces resource-scoped action history from the canonical action audit API', async () => {actionAuditMock.listActionAudits.mockResolvedValueOnce({available: true,- count: 1,+ count: 2,resourceId: 'vm:action-42',audits: [{@@ -790,6 +796,39 @@ describe('ResourceDetailDrawer change history section', () => {success: true,ranAt: '2026-04-29T12:05:20Z',},+ verificationOutcome: {+ status: 'verified',+ evidenceSummary: 'Readback reported nginx active.',+ },+ },+ {+ id: 'action-refused',+ createdAt: '2026-04-29T12:10:00Z',+ updatedAt: '2026-04-29T12:10:30Z',+ state: 'failed',+ request: {+ requestId: 'req-refused',+ resourceId: 'vm:action-42',+ capabilityName: 'lock_remediation',+ reason: 'Patrol proposed remediation while remediation was locked',+ requestedBy: 'pulse_patrol',+ },+ plan: {+ actionId: 'action-refused',+ requestId: 'req-refused',+ allowed: true,+ requiresApproval: true,+ approvalPolicy: 'mfa',+ rollbackAvailable: false,+ },+ result: {+ success: false,+ errorMessage: 'resource_remediation_locked: operator lock is active',+ },+ verificationOutcome: {+ status: 'unverified',+ evidenceSummary: 'No dispatch occurred, so no verification probe ran.',+ },},],});@@ -813,14 +852,15 @@ describe('ResourceDetailDrawer change history section', () => {/>));- const actionHistory = within(await screen.findByTestId('resource-action-history-section'));+ const actionHistoryNode = await screen.findByTestId('resource-action-history-section');+ const actionHistory = within(actionHistoryNode);expect(actionAuditMock.listActionAudits).toHaveBeenCalledWith({resourceId: 'vm:action-42',limit: 5,});expect(actionHistory.getByText('Action history')).toBeInTheDocument();- expect(actionHistory.getByText('Actions 1')).toBeInTheDocument();+ expect(actionHistory.getByText('Actions 2')).toBeInTheDocument();expect(actionHistory.getByText('Actions loaded')).toBeInTheDocument();expect(actionHistory.getByText('Restart Service')).toBeInTheDocument();expect(actionHistory.getByText('Completed')).toBeInTheDocument();@@ -831,9 +871,32 @@ describe('ResourceDetailDrawer change history section', () => {expect(actionHistory.getByText('Restart nginx')).toBeInTheDocument();expect(actionHistory.getByText('Approval scoped to this resource.')).toBeInTheDocument();expect(actionHistory.getByText('nginx restarted')).toBeInTheDocument();+ expect(actionHistory.getByText('Verification confirmed')).toBeInTheDocument();+ expect(actionHistory.getByText('Readback reported nginx active.')).toBeInTheDocument();expect(actionHistory.getByText('Verified')).toBeInTheDocument();expect(actionHistory.getByText("systemctl is-active 'nginx'")).toBeInTheDocument();expect(actionHistory.getByText('active')).toBeInTheDocument();+ expect(actionHistory.getByText('Refused')).toBeInTheDocument();+ expect(actionHistory.getByText('Execution refused')).toBeInTheDocument();+ expect(actionHistory.getByText('Refused before dispatch')).toBeInTheDocument();+ expect(actionHistory.getByText('Resource remediation locked')).toBeInTheDocument();+ expect(+ actionHistory.getByText(+ 'Pulse refused the action before dispatch because this resource is locked against automatic remediation.',+ ),+ ).toBeInTheDocument();+ expect(actionHistory.getByText('Recorded detail:')).toBeInTheDocument();+ expect(actionHistory.getByText('operator lock is active')).toBeInTheDocument();+ expect(actionHistory.getByText('Verification not confirmed')).toBeInTheDocument();+ expect(+ actionHistory.getByText(+ 'Pulse did not receive verification evidence that confirmed the intended state.',+ ),+ ).toBeInTheDocument();+ expect(+ actionHistory.getByText('No dispatch occurred, so no verification probe ran.'),+ ).toBeInTheDocument();+ expect(actionHistoryNode.textContent).not.toContain('resource_remediation_locked:');});it('keeps service details summary-first until the service-local reveal is opened', () => {diff --git a/frontend-modern/src/types/actionAudit.ts b/frontend-modern/src/types/actionAudit.tsindex 262267d39b..2232e79592 100644--- a/frontend-modern/src/types/actionAudit.ts+++ b/frontend-modern/src/types/actionAudit.ts@@ -76,6 +76,12 @@ export interface ActionAuditExecutionResult {export type ActionVerificationStatus = 'unknown' | 'verified' | 'unverified' | 'failed' | string;+export type ActionAuditRefusalPrefix =+ | 'plan_drift:'+ | 'action_plan_expired:'+ | 'action_dry_run_only:'+ | 'resource_remediation_locked:';+export interface ActionVerificationOutcome {status: ActionVerificationStatus;evidenceSummary?: string;diff --git a/frontend-modern/src/utils/__tests__/actionAuditPresentation.test.ts b/frontend-modern/src/utils/__tests__/actionAuditPresentation.test.tsindex 8e43ce411b..551ae9978d 100644--- a/frontend-modern/src/utils/__tests__/actionAuditPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/actionAuditPresentation.test.ts@@ -3,7 +3,11 @@ import { describe, expect, it } from 'vitest';import {formatActionApprovalPolicyLabel,formatActionCapabilityLabel,+ getActionAuditRecordStatePresentation,+ getActionAuditRefusalPresentation,+ getActionAuditResultPresentation,getActionAuditVerification,+ getActionAuditVerificationOutcomePresentation,getActionAuditStatePresentation,shouldRenderActionAuditVerification,} from '@/utils/actionAuditPresentation';@@ -16,6 +20,15 @@ describe('actionAuditPresentation', () => {expect(getActionAuditStatePresentation('completed')).toMatchObject({ label: 'Completed' });expect(getActionAuditStatePresentation('failed')).toMatchObject({ label: 'Failed' });expect(getActionAuditStatePresentation('unknown')).toMatchObject({ label: 'Unknown' });+ expect(+ getActionAuditRecordStatePresentation({+ state: 'failed',+ result: {+ success: false,+ errorMessage: 'plan_drift: resource policy changed',+ },+ }),+ ).toMatchObject({ label: 'Refused' });});it('formats capability and approval policy labels for operator history', () => {@@ -65,4 +78,117 @@ describe('actionAuditPresentation', () => {}),).toBe(false);});++ it('formats refused action result prefixes without prefix-first operator copy', () => {+ expect(+ getActionAuditRefusalPresentation({+ result: {+ success: false,+ errorMessage: 'plan_drift: policy version changed',+ },+ }),+ ).toMatchObject({+ prefix: 'plan_drift:',+ label: 'Plan changed',+ recordedDetail: 'policy version changed',+ });+ expect(+ getActionAuditRefusalPresentation({+ result: {+ success: false,+ errorMessage: 'action_plan_expired: approval expired at 12:00Z',+ },+ }),+ ).toMatchObject({ label: 'Approval expired' });+ expect(+ getActionAuditRefusalPresentation({+ result: {+ success: false,+ errorMessage: 'action_dry_run_only: execute was requested for dry-run evidence',+ },+ }),+ ).toMatchObject({ label: 'Dry-run only' });+ expect(+ getActionAuditRefusalPresentation({+ result: {+ success: false,+ errorMessage: 'resource_remediation_locked: operator lock is active',+ },+ }),+ ).toMatchObject({ label: 'Resource remediation locked' });++ const presentation = getActionAuditResultPresentation({+ result: {+ success: false,+ errorMessage: 'resource_remediation_locked: operator lock is active',+ },+ });+ expect(presentation).toMatchObject({+ kind: 'refusal',+ label: 'Execution refused',+ reasonLabel: 'Resource remediation locked',+ recordedDetail: 'operator lock is active',+ });+ expect(presentation?.detail).not.toContain('resource_remediation_locked:');+ });++ it('keeps ordinary execution failures distinct from refused dispatches', () => {+ expect(+ getActionAuditResultPresentation({+ result: {+ success: false,+ errorMessage: 'executor exited with code 1',+ },+ }),+ ).toMatchObject({+ kind: 'failure',+ label: 'Execution failed',+ detail: 'executor exited with code 1',+ });+ });++ it('formats verification outcome statuses with bounded operator copy', () => {+ expect(+ getActionAuditVerificationOutcomePresentation({+ verificationOutcome: {+ status: 'verified',+ evidenceSummary: 'Readback matched the intended running state.',+ },+ }),+ ).toMatchObject({+ label: 'Verification confirmed',+ evidenceSummary: 'Readback matched the intended running state.',+ });+ expect(+ getActionAuditVerificationOutcomePresentation({+ verificationOutcome: {+ status: 'unverified',+ },+ }),+ ).toMatchObject({+ label: 'Verification not confirmed',+ detail: 'Pulse did not receive verification evidence that confirmed the intended state.',+ });+ expect(+ getActionAuditVerificationOutcomePresentation({+ verificationOutcome: {+ status: 'failed',+ },+ }),+ ).toMatchObject({ label: 'Verification failed' });+ expect(+ getActionAuditVerificationOutcomePresentation({+ verificationOutcome: {+ status: 'unknown',+ },+ }),+ ).toMatchObject({ label: 'Verification unknown' });+ expect(+ getActionAuditVerificationOutcomePresentation({+ verificationOutcome: {+ status: 'needs_review',+ },+ }),+ ).toMatchObject({ label: 'Verification outcome recorded' });+ });});diff --git a/frontend-modern/src/utils/actionAuditPresentation.ts b/frontend-modern/src/utils/actionAuditPresentation.tsindex c6fefadb9b..8cef7a57e6 100644--- a/frontend-modern/src/utils/actionAuditPresentation.ts+++ b/frontend-modern/src/utils/actionAuditPresentation.ts@@ -1,6 +1,8 @@import type {+ ActionAuditRefusalPrefix,ActionAuditRecord,ActionAuditState,+ ActionVerificationOutcome,ActionVerificationResult,} from '@/types/actionAudit';@@ -9,6 +11,30 @@ export interface ActionAuditStatePresentation {className: string;}+export interface ActionAuditRefusalPresentation {+ prefix: ActionAuditRefusalPrefix;+ label: string;+ detail: string;+ recordedDetail?: string;+ className: string;+}++export interface ActionAuditResultPresentation {+ kind: 'success' | 'failure' | 'refusal';+ label: string;+ reasonLabel?: string;+ detail?: string;+ recordedDetail?: string;+ className: string;+}++export interface ActionAuditVerificationOutcomePresentation {+ label: string;+ detail: string;+ evidenceSummary?: string;+ className: string;+}+const ACTION_STATE_PRESENTATION: Record<ActionAuditState, ActionAuditStatePresentation> = {planned: {label: 'Planned',@@ -46,6 +72,80 @@ const ACTION_STATE_PRESENTATION: Record<ActionAuditState, ActionAuditStatePresen},};+const REFUSED_ACTION_STATE_PRESENTATION: ActionAuditStatePresentation = {+ label: 'Refused',+ className:+ 'bg-rose-100 text-rose-800 border-rose-200 dark:bg-rose-900 dark:text-rose-200 dark:border-rose-700',+};++const ACTION_REFUSAL_PRESENTATION: Record<+ ActionAuditRefusalPrefix,+ Omit<ActionAuditRefusalPresentation, 'prefix' | 'recordedDetail'>+> = {+ 'plan_drift:': {+ label: 'Plan changed',+ detail:+ 'Pulse refused the action before dispatch because the approved plan no longer matched the current resource or policy state.',+ className:+ 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-800 dark:bg-rose-950/40 dark:text-rose-300',+ },+ 'action_plan_expired:': {+ label: 'Approval expired',+ detail:+ 'Pulse refused the action before dispatch because the approved execution window had expired.',+ className:+ 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300',+ },+ 'action_dry_run_only:': {+ label: 'Dry-run only',+ detail:+ 'Pulse refused to dispatch this action because the plan is limited to dry-run evidence.',+ className:+ 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300',+ },+ 'resource_remediation_locked:': {+ label: 'Resource remediation locked',+ detail:+ 'Pulse refused the action before dispatch because this resource is locked against automatic remediation.',+ className:+ 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-800 dark:bg-rose-950/40 dark:text-rose-300',+ },+};++const ACTION_REFUSAL_PREFIXES = Object.keys(+ ACTION_REFUSAL_PRESENTATION,+) as ActionAuditRefusalPrefix[];++const VERIFICATION_OUTCOME_PRESENTATION: Record<+ 'unknown' | 'verified' | 'unverified' | 'failed',+ Omit<ActionAuditVerificationOutcomePresentation, 'evidenceSummary'>+> = {+ unknown: {+ label: 'Verification unknown',+ detail: 'Pulse does not have conclusive verification evidence for this action.',+ className: 'border-border bg-surface text-base-content',+ },+ verified: {+ label: 'Verification confirmed',+ detail: 'Pulse confirmed the intended state after execution.',+ className:+ 'border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-300',+ },+ unverified: {+ label: 'Verification not confirmed',+ detail:+ 'Pulse did not receive verification evidence that confirmed the intended state.',+ className:+ 'border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-800 dark:bg-amber-950/40 dark:text-amber-300',+ },+ failed: {+ label: 'Verification failed',+ detail: 'Pulse could not complete the verification check after execution.',+ className:+ 'border-rose-200 bg-rose-50 text-rose-800 dark:border-rose-800 dark:bg-rose-950/40 dark:text-rose-300',+ },+};+export const getActionAuditStatePresentation = (state: ActionAuditState | string | undefined,): ActionAuditStatePresentation =>@@ -81,6 +181,99 @@ export const formatActionApprovalPolicyLabel = (policy: string | undefined): str}};+const getActionAuditResultMessage = (+ result: Pick<NonNullable<ActionAuditRecord['result']>, 'errorMessage' | 'output'> | undefined,+): string => (result?.errorMessage || result?.output || '').trim();++export const getActionAuditRefusalPresentation = (+ audit: Pick<ActionAuditRecord, 'result'>,+): ActionAuditRefusalPresentation | undefined => {+ if (!audit.result || audit.result.success) return undefined;++ const message = getActionAuditResultMessage(audit.result);+ const normalizedMessage = message.toLowerCase();+ const prefix = ACTION_REFUSAL_PREFIXES.find((candidate) =>+ normalizedMessage.startsWith(candidate),+ );+ if (!prefix) return undefined;++ const recordedDetail = message.slice(prefix.length).trim();+ const presentation = ACTION_REFUSAL_PRESENTATION[prefix];+ return {+ prefix,+ ...presentation,+ recordedDetail: recordedDetail || undefined,+ };+};++export const getActionAuditRecordStatePresentation = (+ audit: Pick<ActionAuditRecord, 'state' | 'result'>,+): ActionAuditStatePresentation => {+ if (audit.state === 'failed' && getActionAuditRefusalPresentation(audit)) {+ return REFUSED_ACTION_STATE_PRESENTATION;+ }+ return getActionAuditStatePresentation(audit.state);+};++export const getActionAuditResultPresentation = (+ audit: Pick<ActionAuditRecord, 'result'>,+): ActionAuditResultPresentation | undefined => {+ const result = audit.result;+ if (!result) return undefined;++ const refusal = getActionAuditRefusalPresentation(audit);+ if (refusal) {+ return {+ kind: 'refusal',+ label: 'Execution refused',+ reasonLabel: refusal.label,+ detail: refusal.detail,+ recordedDetail: refusal.recordedDetail,+ className: refusal.className,+ };+ }++ if (result.success) {+ return {+ kind: 'success',+ label: 'Result',+ detail: result.output?.trim() || undefined,+ className: 'border-border bg-surface text-base-content',+ };+ }++ return {+ kind: 'failure',+ label: 'Execution failed',+ detail: getActionAuditResultMessage(result) || undefined,+ className:+ 'border-red-200 bg-red-50 text-red-800 dark:border-red-800 dark:bg-red-950/40 dark:text-red-300',+ };+};++export const getActionAuditVerificationOutcomePresentation = (+ audit: Pick<ActionAuditRecord, 'verificationOutcome'>,+): ActionAuditVerificationOutcomePresentation | undefined => {+ const outcome: ActionVerificationOutcome | undefined = audit.verificationOutcome;+ const status = (outcome?.status || '').trim().toLowerCase();+ if (!status) return undefined;++ const presentation =+ VERIFICATION_OUTCOME_PRESENTATION[+ status as keyof typeof VERIFICATION_OUTCOME_PRESENTATION+ ] ?? {+ label: 'Verification outcome recorded',+ detail: 'Pulse recorded a bounded verification status that this client does not classify.',+ className: 'border-border bg-surface text-base-content',+ };++ const evidenceSummary = outcome?.evidenceSummary?.trim();+ return {+ ...presentation,+ evidenceSummary: evidenceSummary || undefined,+ };+};+export const getActionAuditVerification = (audit: Pick<ActionAuditRecord, 'verification' | 'result'>,): ActionVerificationResult | undefined => audit.verification ?? audit.result?.verification;diff --git a/tests/integration/tests/37-vmware-resource-history-drawer.spec.ts b/tests/integration/tests/37-vmware-resource-history-drawer.spec.tsindex 807125a9ec..1744893543 100644--- a/tests/integration/tests/37-vmware-resource-history-drawer.spec.ts+++ b/tests/integration/tests/37-vmware-resource-history-drawer.spec.ts@@ -104,6 +104,72 @@ const filteredFacetBundle = {},};+const actionAuditBundle = {+ available: true,+ count: 2,+ resourceId: RESOURCE_ID,+ audits: [+ {+ id: 'vmware-action-verified',+ createdAt: '2026-03-30T18:10:00Z',+ updatedAt: '2026-03-30T18:12:00Z',+ state: 'completed',+ request: {+ requestId: 'vmware-req-verified',+ resourceId: RESOURCE_ID,+ capabilityName: 'enter_maintenance_mode',+ reason: 'Place host in maintenance after alarm review',+ requestedBy: 'pulse_patrol',+ },+ plan: {+ actionId: 'vmware-action-verified',+ requestId: 'vmware-req-verified',+ allowed: true,+ requiresApproval: true,+ approvalPolicy: 'admin',+ rollbackAvailable: true,+ },+ result: {+ success: true,+ output: 'Maintenance mode requested',+ },+ verificationOutcome: {+ status: 'verified',+ evidenceSummary: 'vCenter reported the host entering maintenance mode.',+ },+ },+ {+ id: 'vmware-action-refused',+ createdAt: '2026-03-30T18:13:00Z',+ updatedAt: '2026-03-30T18:13:15Z',+ state: 'failed',+ request: {+ requestId: 'vmware-req-refused',+ resourceId: RESOURCE_ID,+ capabilityName: 'restart_host_agent',+ reason: 'Patrol proposed remediation while the host was locked',+ requestedBy: 'pulse_patrol',+ },+ plan: {+ actionId: 'vmware-action-refused',+ requestId: 'vmware-req-refused',+ allowed: true,+ requiresApproval: true,+ approvalPolicy: 'admin',+ rollbackAvailable: false,+ },+ result: {+ success: false,+ errorMessage: 'resource_remediation_locked: operator lock is active',+ },+ verificationOutcome: {+ status: 'unverified',+ evidenceSummary: 'No dispatch occurred, so no verification probe ran.',+ },+ },+ ],+};+test.describe('VMware resource history drawer', () => {test.setTimeout(180_000);@@ -111,6 +177,7 @@ test.describe('VMware resource history drawer', () => {page,}) => {const facetRequestUrls: string[] = [];+ const actionAuditRequestUrls: string[] = [];let unexpectedVmwareApiCall: string | null = null;await page.route('**/api/vmware/**', async (route) => {@@ -194,6 +261,21 @@ test.describe('VMware resource history drawer', () => {await route.continue();});+ await page.route('**/api/audit/actions**', async (route) => {+ const requestUrl = new URL(route.request().url());+ actionAuditRequestUrls.push(requestUrl.toString());++ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(+ requestUrl.searchParams.get('resourceId') === RESOURCE_ID+ ? actionAuditBundle+ : { available: true, count: 0, audits: [] },+ ),+ });+ });+await page.route('**/api/ai/intelligence**', async (route) => {const requestUrl = new URL(route.request().url());if (requestUrl.searchParams.get('resource_id') !== RESOURCE_ID) {@@ -277,6 +359,24 @@ test.describe('VMware resource history drawer', () => {await expect(historySection.getByText('Activity', { exact: true })).toBeVisible();await expect(historySection.getByText('VMware adapter', { exact: true })).toBeVisible();+ const actionHistorySection = page.getByTestId('resource-action-history-section');+ await expect(actionHistorySection).toBeVisible();+ await expect(actionHistorySection.getByText('Actions 2')).toBeVisible();+ await expect(actionHistorySection.getByText('Verification confirmed')).toBeVisible();+ await expect(+ actionHistorySection.getByText('vCenter reported the host entering maintenance mode.'),+ ).toBeVisible();+ await expect(actionHistorySection.getByText('Refused', { exact: true })).toBeVisible();+ await expect(actionHistorySection.getByText('Execution refused')).toBeVisible();+ await expect(actionHistorySection.getByText('Resource remediation locked')).toBeVisible();+ await expect(+ actionHistorySection.getByText(+ 'Pulse refused the action before dispatch because this resource is locked against automatic remediation.',+ ),+ ).toBeVisible();+ await expect(actionHistorySection.getByText('Verification not confirmed')).toBeVisible();+ await expect(actionHistorySection.getByText('resource_remediation_locked:')).toHaveCount(0);+await historySection.getByRole('button', { name: 'Filter history' }).click();await historySection.getByLabel('Change kind').selectOption({ label: 'Activity' });await historySection.getByLabel('Source adapter').selectOption({ label: 'VMware adapter' });@@ -303,6 +403,18 @@ test.describe('VMware resource history drawer', () => {.toBe(true);expect(unexpectedVmwareApiCall).toBeNull();+ await expect+ .poll(() =>+ actionAuditRequestUrls.some((url) => {+ const parsed = new URL(url);+ return (+ parsed.pathname === '/api/audit/actions' &&+ parsed.searchParams.get('resourceId') === RESOURCE_ID &&+ parsed.searchParams.get('limit') === '5'+ );+ }),+ )+ .toBe(true);await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });});