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
Collapse the container update ceremony to a single review
rcourtmanf73d4d4d9738
diff --git a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsxindex 5c645afe5b..f2ee72f6d0 100644--- a/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx+++ b/frontend-modern/src/components/shared/ContainerUpdateBadge.tsx@@ -221,7 +221,7 @@ export const UpdateButton: Component<UpdateButtonProps> = (props) => {<Match when={state.currentState() === 'error'}><XIcon class="w-3 h-3" /></Match>- <Match when={state.currentState() === 'idle' || state.currentState() === 'confirming'}>+ <Match when={state.currentState() === 'idle'}><UpdateArrowIcon class="w-3 h-3" /></Match></Switch>@@ -230,16 +230,6 @@ export const UpdateButton: Component<UpdateButtonProps> = (props) => {<span class={!state.settingsLoaded() ? 'opacity-50' : ''}>{state.buttonLabel()}</span></Show></button>- <Show when={state.settingsLoaded() && state.currentState() === 'confirming'}>- <button- type="button"- class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-surface-alt text-muted hover:bg-surface-hover transition-colors"- onClick={state.handleCancel}- title="Cancel"- >- <XIcon class="w-3 h-3" />- </button>- </Show><ActionReviewDialogdetail={state.reviewDetail()}onClose={state.handleReviewClosed}diff --git a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.tsindex 311b44902e..df385c90c6 100644--- a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts+++ b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov0717.test.ts@@ -234,15 +234,6 @@ describe('containerUpdateBadgeModel.branchcov', () => {});describe('getUpdateButtonClass', () => {- it('returns the amber "confirming" classes', () => {- expect(getUpdateButtonClass('confirming')).toBe(- [- BASE_CLASS,- 'bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300 cursor-pointer hover:bg-amber-200 dark:hover:bg-amber-900',- ].join(' '),- );- });-it('returns the blue cursor-wait "updating" classes', () => {expect(getUpdateButtonClass('updating')).toBe([@@ -291,7 +282,7 @@ describe('containerUpdateBadgeModel.branchcov', () => {describe('getUpdateButtonLabel', () => {describe('settingsLoaded = false (early-return arm: always "Update")', () => {- it.each<UpdateState>(['idle', 'confirming', 'updating', 'success', 'error'])(+ it.each<UpdateState>(['idle', 'updating', 'success', 'error'])('returns "Update" for state %s when settings are not loaded',(state) => {expect(getUpdateButtonLabel(state, false)).toBe('Update');@@ -304,10 +295,6 @@ describe('containerUpdateBadgeModel.branchcov', () => {expect(getUpdateButtonLabel('idle', true)).toBe('Update');});- it('returns "Confirm?" for the confirming arm', () => {- expect(getUpdateButtonLabel('confirming', true)).toBe('Confirm?');- });-it('returns "Updating..." for the updating arm', () => {expect(getUpdateButtonLabel('updating', true)).toBe('Updating...');});@@ -328,14 +315,6 @@ describe('containerUpdateBadgeModel.branchcov', () => {});describe('getUpdateButtonTooltip', () => {- describe('confirming state', () => {- it('returns the static confirm prompt', () => {- expect(getUpdateButtonTooltip({ state: 'confirming' })).toBe(- 'Click again to confirm update',- );- });- });-describe('success state', () => {it('returns the static success message', () => {expect(getUpdateButtonTooltip({ state: 'success' })).toBe(@@ -463,14 +442,14 @@ describe('containerUpdateBadgeModel.branchcov', () => {}),}),).toBe(- 'Click to update\nCurrent: sha256:01234...\nLatest: sha256:01234...',+ 'Click to review and update\nCurrent: sha256:01234...\nLatest: sha256:01234...',);});it('returns "unknown" previews when updateStatus is present but digests are absent', () => {expect(getUpdateButtonTooltip({ state: 'idle', updateStatus: makeStatus({}) }),- ).toBe('Click to update\nCurrent: unknown...\nLatest: unknown...');+ ).toBe('Click to review and update\nCurrent: unknown...\nLatest: unknown...');});it('routes an unknown state value (with no updateStatus) to the default early-return arm', () => {diff --git a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.tsindex 62d5958906..24736541aa 100644--- a/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts+++ b/frontend-modern/src/components/shared/__tests__/containerUpdateBadgeModel.branchcov2.test.ts@@ -104,12 +104,6 @@ describe('containerUpdateBadgeModel.branchcov2', () => {});describe('getUpdateButtonTooltip', () => {- it('returns the confirm prompt for the "confirming" state', () => {- expect(- getUpdateButtonTooltip({ state: 'confirming', now: 1000 }),- ).toBe('Click again to confirm update');- });-it('returns the success message for the "success" state', () => {expect(getUpdateButtonTooltip({ state: 'success', now: 1000 })).toBe('✓ Update completed successfully!',@@ -225,7 +219,7 @@ describe('containerUpdateBadgeModel.branchcov2', () => {}),});expect(result).toBe(- `Click to update\nCurrent: ${DIGEST_FIRST_12}...\nLatest: ${DIGEST_FIRST_12}...`,+ `Click to review and update\nCurrent: ${DIGEST_FIRST_12}...\nLatest: ${DIGEST_FIRST_12}...`,);});});@@ -233,7 +227,6 @@ describe('containerUpdateBadgeModel.branchcov2', () => {describe('getUpdateButtonLabel', () => {it('short-circuits to "Update" when settingsLoaded is false, regardless of state', () => {const states: UpdateState[] = [- 'confirming','updating','success','error',@@ -244,10 +237,6 @@ describe('containerUpdateBadgeModel.branchcov2', () => {}});- it('returns "Confirm?" for the confirming state', () => {- expect(getUpdateButtonLabel('confirming', true)).toBe('Confirm?');- });-it('returns "Updating..." for the updating state', () => {expect(getUpdateButtonLabel('updating', true)).toBe('Updating...');});@@ -266,12 +255,6 @@ describe('containerUpdateBadgeModel.branchcov2', () => {});describe('getUpdateButtonClass', () => {- it('returns the amber confirming classes with pointer hover', () => {- expect(getUpdateButtonClass('confirming')).toBe(- `${UPDATE_BUTTON_BASE_CLASS} bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300 cursor-pointer hover:bg-amber-200 dark:hover:bg-amber-900`,- );- });-it('returns the blue updating classes with cursor-wait', () => {expect(getUpdateButtonClass('updating')).toBe(`${UPDATE_BUTTON_BASE_CLASS} bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300 cursor-wait`,diff --git a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts b/frontend-modern/src/components/shared/containerUpdateBadgeModel.tsindex 1e22f7f40d..1e3f3c03ef 100644--- a/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts+++ b/frontend-modern/src/components/shared/containerUpdateBadgeModel.ts@@ -28,7 +28,9 @@ export interface UpdateButtonProps {externalState?: 'updating' | 'queued' | 'error';}-export type UpdateState = 'idle' | 'confirming' | 'updating' | 'success' | 'error';+// The update click plans a governed action and opens the review dialog, which+// is the confirmation surface; there is no separate in-row confirming state.+export type UpdateState = 'idle' | 'updating' | 'success' | 'error';export interface ContainerUpdateButtonStoreState {startedAt: number;@@ -86,12 +88,10 @@ export function getUpdateIconTooltip(updateStatus?: DockerContainerUpdateStatus)}export function getUpdateButtonClass(state: UpdateState, unavailable = false): string {- if (unavailable && (state === 'idle' || state === 'confirming')) {+ if (unavailable && state === 'idle') {return `${UPDATE_BUTTON_BASE_CLASS} bg-surface-alt text-muted cursor-not-allowed opacity-70`;}switch (state) {- case 'confirming':- return `${UPDATE_BUTTON_BASE_CLASS} bg-amber-100 text-amber-700 dark:bg-amber-900 dark:text-amber-300 cursor-pointer hover:bg-amber-200 dark:hover:bg-amber-900`;case 'updating':return `${UPDATE_BUTTON_BASE_CLASS} bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300 cursor-wait`;case 'success':@@ -107,8 +107,6 @@ export function getUpdateButtonLabel(state: UpdateState, settingsLoaded: booleanif (!settingsLoaded) return 'Update';switch (state) {- case 'confirming':- return 'Confirm?';case 'updating':return 'Updating...';case 'success':@@ -130,8 +128,6 @@ export function getUpdateButtonTooltip(options: {const now = options.now ?? Date.now();switch (options.state) {- case 'confirming':- return 'Click again to confirm update';case 'updating': {const elapsed = options.storeState? Math.round((now - options.storeState.startedAt) / 1000)@@ -151,7 +147,7 @@ export function getUpdateButtonTooltip(options: {const current = getDigestPreview(options.updateStatus.currentDigest, 12);const latest = getDigestPreview(options.updateStatus.latestDigest, 12);- return `Click to update\nCurrent: ${current}...\nLatest: ${latest}...`;+ return `Click to review and update\nCurrent: ${current}...\nLatest: ${latest}...`;}}diff --git a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts b/frontend-modern/src/components/shared/useContainerUpdateButtonState.tsindex c88b60f912..e8609b1ed9 100644--- a/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts+++ b/frontend-modern/src/components/shared/useContainerUpdateButtonState.ts@@ -1,7 +1,6 @@import { createEffect, createMemo, createSignal } from 'solid-js';import { ResourceActionsAPI } from '@/api/resourceActions';import {- clearContainerUpdateState,getContainerUpdateState,markContainerQueued,markContainerUpdateError,@@ -30,7 +29,7 @@ const newUpdateRequestId = (): string =>const ACTION_TERMINAL_STATES = ['completed', 'failed', 'rejected', 'expired'];export function useContainerUpdateButtonState(props: UpdateButtonProps) {- const [localState, setLocalState] = createSignal<'idle' | 'confirming' | 'planning'>('idle');+ const [localState, setLocalState] = createSignal<'idle' | 'planning'>('idle');const [errorMessage, setErrorMessage] = createSignal('');const [reviewDetail, setReviewDetail] = createSignal<ActionDetailResponse | null>(null);@@ -83,8 +82,7 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {// Only gates the actionable states; in-flight and settled states keep their// own presentation.const updateUnavailableReason = (): string | undefined => {- const state = currentState();- if (state !== 'idle' && state !== 'confirming') return undefined;+ if (currentState() !== 'idle') return undefined;return getActionReadinessRefusal(props.actionReadiness, 'update');};const isUpdateUnavailable = () => Boolean(updateUnavailableReason());@@ -104,7 +102,7 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {};const buttonLabel = () => getUpdateButtonLabel(currentState(), settingsLoaded());- // Updates run as audited actions: the confirming click plans an action for+ // Updates run as audited actions: the update click plans an action for// the container's update capability and opens the review dialog, which owns// approval and execution. The legacy direct-update endpoint is retired.const planUpdateReview = async () => {@@ -138,6 +136,8 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {}};+ // One click plans the governed action and opens the review dialog; the+ // dialog is the confirmation surface, so no in-row confirming hop exists.const handleClick = async (event: MouseEvent) => {event.stopPropagation();event.preventDefault();@@ -147,22 +147,10 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {if (isUpdateUnavailable()) return;if (state === 'idle') {- setLocalState('confirming');- return;- }-- if (state === 'confirming') {await planUpdateReview();}};- const handleCancel = (event: MouseEvent) => {- event.stopPropagation();- event.preventDefault();- setLocalState('idle');- clearContainerUpdateState(props.agentId, props.containerId);- };-const handleReviewClosed = () => {setReviewDetail(null);};@@ -190,7 +178,6 @@ export function useContainerUpdateButtonState(props: UpdateButtonProps) {buttonLabel,buttonTooltip,currentState,- handleCancel,handleClick,handleReviewChanged,handleReviewClosed,diff --git a/frontend-modern/src/features/actions/ActionDecisionPacket.tsx b/frontend-modern/src/features/actions/ActionDecisionPacket.tsxindex abdb6ccfac..3ff659670d 100644--- a/frontend-modern/src/features/actions/ActionDecisionPacket.tsx+++ b/frontend-modern/src/features/actions/ActionDecisionPacket.tsx@@ -26,6 +26,13 @@ export const ActionDecisionPacket: Component<{const value = new Date(props.audit.plan.expiresAt ?? '');return Number.isNaN(value.valueOf()) ? 'Not recorded' : value.toLocaleString();});+ // Prefer read-time names for blast-radius entries; fall back to the raw+ // plan IDs so nothing is hidden when a resource cannot be resolved.+ const blastRadiusEntries = createMemo(() => {+ const ids = props.audit.plan.predictedBlastRadius ?? [];+ const named = new Map((props.audit.blastRadius ?? []).map((entry) => [entry.id, entry.name]));+ return ids.map((id) => ({ id, name: named.get(id)?.trim() || '' }));+ });return (<div class="space-y-4" data-testid="action-decision-packet">@@ -71,12 +78,19 @@ export const ActionDecisionPacket: Component<{<dd>{props.audit.plan.rollbackAvailable ? 'Yes' : 'No'}</dd></div></dl>- <Show when={(props.audit.plan.predictedBlastRadius ?? []).length > 0}>+ <Show when={blastRadiusEntries().length > 0}><div class="mt-3"><div class="text-sm text-muted">Also affected</div><ul class="mt-1 list-disc pl-5 text-sm">- <For each={props.audit.plan.predictedBlastRadius}>- {(resource) => <li>{resource}</li>}+ <For each={blastRadiusEntries()}>+ {(entry) => (+ <li>+ <Show when={entry.name} fallback={<span class="break-all">{entry.id}</span>}>+ {entry.name}+ <span class="ml-1 break-all text-xs text-muted">({entry.id})</span>+ </Show>+ </li>+ )}</For></ul></div>diff --git a/frontend-modern/src/features/actions/ActionReviewDialog.tsx b/frontend-modern/src/features/actions/ActionReviewDialog.tsxindex 2175a7c8d0..3e40057480 100644--- a/frontend-modern/src/features/actions/ActionReviewDialog.tsx+++ b/frontend-modern/src/features/actions/ActionReviewDialog.tsx@@ -55,6 +55,12 @@ export const ActionReviewDialog: Component<{aptParametersValid() &&!isExpired() &&audit()?.state === 'pending_approval';+ // Low-risk capabilities (rollback-supported, routine) collapse the decision+ // to one confirmation: a single click records the approval and dispatches+ // execution. Both lifecycle records are still written server-side.+ const singleConfirmation = createMemo(+ () => audit()?.capabilityAutoAuthorization === 'low_risk',+ );const canExecute = () =>!readOnly() &&reviewedPlanHash() &&@@ -115,6 +121,41 @@ export const ActionReviewDialog: Component<{}};+ const approveAndRun = async () => {+ const action = audit();+ if (!action || busy()) return;+ setBusy(true);+ setError('');+ try {+ await ResourceActionsAPI.decideAction(+ action.id,+ 'approved',+ reviewedPlanHash(),+ 'Operator approved from Actions review.',+ );+ await ResourceActionsAPI.executeAction(+ action.id,+ reviewedPlanHash(),+ 'Operator confirmed execution from Actions review.',+ );+ await refresh();+ notificationStore.success(+ 'Action approved and dispatched. Review the recorded outcome below.',+ );+ } catch (cause) {+ const message =+ cause instanceof Error ? cause.message : 'The action could not be approved and run.';+ setError(message);+ try {+ await refresh();+ } catch {+ /* keep the actionable error; a refresh failure must not mask it */+ }+ } finally {+ setBusy(false);+ }+ };+const execute = async () => {const action = audit();if (!action || busy()) return;@@ -201,13 +242,26 @@ export const ActionReviewDialog: Component<{<Button variant="danger" disabled={busy()} onClick={() => void decide('rejected')}>Reject</Button>- <Button- variant="primary"- isLoading={busy()}- onClick={() => void decide('approved')}+ <Show+ when={singleConfirmation()}+ fallback={+ <Button+ variant="primary"+ isLoading={busy()}+ onClick={() => void decide('approved')}+ >+ Approve+ </Button>+ }>- Approve- </Button>+ <Button+ variant="primary"+ isLoading={busy()}+ onClick={() => void approveAndRun()}+ >+ Approve and run+ </Button>+ </Show></Show><Show when={canExecute()}><Button variant="primary" isLoading={busy()} onClick={() => void execute()}>diff --git a/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx b/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsxindex 55b092260b..7cde24423c 100644--- a/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx+++ b/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx@@ -210,6 +210,54 @@ describe('ActionReviewDialog trust gates', () => {);});+ it('collapses low-risk capabilities to a single Approve and run confirmation', async () => {+ const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');+ audit.capabilityAutoAuthorization = 'low_risk';+ vi.mocked(ResourceActionsAPI.decideAction).mockResolvedValue({+ actionId: audit.id,+ state: 'approved',+ approval: {+ actor: 'operator',+ method: 'api',+ timestamp: audit.updatedAt,+ outcome: 'approved',+ },+ audit: { ...audit, state: 'approved' },+ });+ vi.mocked(ResourceActionsAPI.executeAction).mockResolvedValue({+ actionId: audit.id,+ state: 'executing',+ audit: { ...audit, state: 'executing' },+ });+ vi.mocked(ResourceActionsAPI.getAction).mockResolvedValue(+ detail({ ...audit, state: 'executing' }),+ );+ render(() => <ActionReviewDialog detail={detail(audit)} onClose={vi.fn()} />);+ expect(screen.queryByRole('button', { name: 'Approve' })).toBeNull();+ expect(screen.getByRole('button', { name: 'Reject' })).toBeInTheDocument();+ fireEvent.click(screen.getByRole('button', { name: 'Approve and run' }));+ await waitFor(() => {+ expect(ResourceActionsAPI.decideAction).toHaveBeenCalledWith(+ 'action-1',+ 'approved',+ 'sha256:reviewed-plan',+ 'Operator approved from Actions review.',+ );+ expect(ResourceActionsAPI.executeAction).toHaveBeenCalledWith(+ 'action-1',+ 'sha256:reviewed-plan',+ 'Operator confirmed execution from Actions review.',+ );+ });+ });++ it('keeps the two-phase Approve for capabilities without the low-risk class', () => {+ const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');+ render(() => <ActionReviewDialog detail={detail(audit)} onClose={vi.fn()} />);+ expect(screen.getByRole('button', { name: 'Approve' })).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Approve and run' })).toBeNull();+ });+it('offers no action controls when the reviewed plan identity is missing', () => {const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');delete audit.plan.planHash;diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsxindex 025f351b6c..7b3847cfed 100644--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx@@ -716,9 +716,10 @@ describe('Docker native tables', () => {/>));- const updateButton = screen.getByRole('button', { name: /click to update/i });+ // One click plans the governed action; the review dialog is the+ // confirmation surface, so no second in-row confirm click exists.+ const updateButton = screen.getByRole('button', { name: /click to review and update/i });fireEvent.click(updateButton);- fireEvent.click(screen.getByRole('button', { name: /click again to confirm update/i }));await waitFor(() =>expect(ResourceActionsAPI.planAction).toHaveBeenCalledWith(diff --git a/frontend-modern/src/types/actionAudit.ts b/frontend-modern/src/types/actionAudit.tsindex b1d16ef26f..8f0f38b1ea 100644--- a/frontend-modern/src/types/actionAudit.ts+++ b/frontend-modern/src/types/actionAudit.ts@@ -265,6 +265,10 @@ export interface ActionAuditRecord {request: ActionAuditRequest;/** Read-time display metadata from the canonical resource API; never part of plan identity. */resource?: ActionResourceReference;+ /** Read-time auto-authorization class of the planned capability; presentation only. */+ capabilityAutoAuthorization?: 'never' | 'low_risk' | 'elevated';+ /** Read-time names for plan.predictedBlastRadius IDs; entries may carry an empty name. */+ blastRadius?: ActionResourceReference[];plan: ActionAuditPlan;origin?: ActionAuditOrigin;approvals?: ActionAuditApprovalRecord[];diff --git a/internal/actionplanner/planner.go b/internal/actionplanner/planner.goindex 2289a4f11d..63886ecca7 100644--- a/internal/actionplanner/planner.go+++ b/internal/actionplanner/planner.go@@ -126,7 +126,7 @@ func (p Planner) PlanWithPolicyFactors(req unified.ActionRequest, resource unifiApprovalPolicy: requirement.Floor,ApprovalRequirement: requirement,PredictedBlastRadius: predictedBlastRadius(resource),- RollbackAvailable: false,+ RollbackAvailable: capability.SupportsRollback,Message: planMessage(resource, capability, requirement.Floor),PlannedAt: plannedAt,ExpiresAt: plannedAt.Add(ttl),diff --git a/internal/actionplanner/planner_test.go b/internal/actionplanner/planner_test.goindex 23365fed40..5fdc2431b7 100644--- a/internal/actionplanner/planner_test.go+++ b/internal/actionplanner/planner_test.go@@ -356,3 +356,54 @@ func TestResourceVersionIgnoresRelationshipObservationTimestamps(t *testing.T) {t.Fatal("resource version ignored a real relationship change")}}++func TestPlannerCarriesCapabilityRollbackSupportIntoPlan(t *testing.T) {+ now := time.Date(2026, 7, 19, 10, 0, 0, 0, time.UTC)+ resource := unified.Resource{+ ID: "app-container:7",+ Type: unified.ResourceTypeAppContainer,+ Name: "heimdall",+ Status: unified.StatusOnline,+ Capabilities: []unified.ResourceCapability{+ {+ Name: "update",+ Type: unified.CapabilityTypeCommon,+ Description: "Update this Docker container",+ MinimumApprovalLevel: unified.ApprovalAdmin,+ SupportsRollback: true,+ InternalHandler: "docker.container.update",+ },+ {+ Name: "stop",+ Type: unified.CapabilityTypeCommon,+ Description: "Stop this Docker container",+ MinimumApprovalLevel: unified.ApprovalAdmin,+ InternalHandler: "docker.container.lifecycle",+ },+ },+ }+ actor := unified.ActionActor{SubjectID: "user:admin", Kind: unified.ActionActorUser, CredentialID: "session:test", OrgID: "default"}+ planner := Planner{Now: func() time.Time { return now }}++ withRollback, err := planner.Plan(unified.ActionRequest{+ RequestID: "req-update", ResourceID: "app-container:7", CapabilityName: "update",+ Reason: "Routine image update", Actor: actor,+ }, resource)+ if err != nil {+ t.Fatalf("Plan(update) error = %v", err)+ }+ if !withRollback.RollbackAvailable {+ t.Fatal("RollbackAvailable = false for a capability that declares rollback support")+ }++ withoutRollback, err := planner.Plan(unified.ActionRequest{+ RequestID: "req-stop", ResourceID: "app-container:7", CapabilityName: "stop",+ Reason: "Stop for maintenance", Actor: actor,+ }, resource)+ if err != nil {+ t.Fatalf("Plan(stop) error = %v", err)+ }+ if withoutRollback.RollbackAvailable {+ t.Fatal("RollbackAvailable = true for a capability with no declared rollback support")+ }+}diff --git a/internal/api/actions.go b/internal/api/actions.goindex 67aa182699..01897883a2 100644--- a/internal/api/actions.go+++ b/internal/api/actions.go@@ -82,6 +82,15 @@ type actionResourcePresentation struct {type actionAuditProjection struct {unified.ActionAuditRecordResource *actionResourcePresentation `json:"resource,omitempty"`+ // CapabilityAutoAuthorization is the read-time auto-authorization class of+ // the planned capability. It only shapes review presentation (e.g. a+ // single-confirmation control for low-risk capabilities); approval and+ // execution authority remain bound to the persisted plan.+ CapabilityAutoAuthorization unified.ActionAutoAuthorizationClass `json:"capabilityAutoAuthorization,omitempty"`+ // BlastRadius carries read-time presentation for the plan's predicted+ // blast-radius resource IDs so review surfaces can show names instead of+ // raw identifiers. Entries without a resolvable resource keep an empty name.+ BlastRadius []actionResourcePresentation `json:"blastRadius,omitempty"`}type pendingActionsResponse struct {@@ -589,13 +598,30 @@ func projectActionAudits(records []unified.ActionAuditRecord, registry *unified.func projectActionAudit(record unified.ActionAuditRecord, registry *unified.ResourceRegistry) actionAuditProjection {projection := actionAuditProjection{ActionAuditRecord: record}resource, ok := presentationResourceByID(registry, record.Request.ResourceID)- if !ok || resource == nil || strings.TrimSpace(resource.Name) == "" {- return projection+ if ok && resource != nil && strings.TrimSpace(resource.Name) != "" {+ projection.Resource = &actionResourcePresentation{+ ID: unified.CanonicalResourceID(resource.ID),+ Name: strings.TrimSpace(resource.Name),+ Type: resourceContractType(*resource),+ }+ for _, capability := range resource.Capabilities {+ if capability.Name == record.Request.CapabilityName {+ projection.CapabilityAutoAuthorization = capability.AutoAuthorization+ break+ }+ }}- projection.Resource = &actionResourcePresentation{- ID: unified.CanonicalResourceID(resource.ID),- Name: strings.TrimSpace(resource.Name),- Type: resourceContractType(*resource),+ if record.Plan.PredictedBlastRadius != nil {+ projection.BlastRadius = make([]actionResourcePresentation, 0, len(record.Plan.PredictedBlastRadius))+ for _, affectedID := range record.Plan.PredictedBlastRadius {+ entry := actionResourcePresentation{ID: affectedID}+ if affected, found := presentationResourceByID(registry, affectedID); found && affected != nil {+ entry.ID = unified.CanonicalResourceID(affected.ID)+ entry.Name = strings.TrimSpace(affected.Name)+ entry.Type = resourceContractType(*affected)+ }+ projection.BlastRadius = append(projection.BlastRadius, entry)+ }}return projection}diff --git a/internal/api/actions_projection_ceremony_test.go b/internal/api/actions_projection_ceremony_test.gonew file mode 100644index 0000000000..76d4f83133--- /dev/null+++ b/internal/api/actions_projection_ceremony_test.go@@ -0,0 +1,92 @@+package api++import (+ "encoding/json"+ "testing"++ unifiedresources "github.com/rcourtman/pulse-go-rewrite/internal/unifiedresources"+)++// The review dialog gates its single-confirmation control on the projected+// capability class and renders blast-radius names from the projection. Both+// are read-time presentation and must never enter the persisted plan identity.+func TestContract_ActionReadProjectionCarriesCapabilityClassAndBlastRadiusPresentation(t *testing.T) {+ projection := actionAuditProjection{+ ActionAuditRecord: unifiedresources.ActionAuditRecord{+ ID: "action-ceremony-contract",+ State: unifiedresources.ActionStatePending,+ Request: unifiedresources.ActionRequest{+ RequestID: "request-ceremony-contract",+ ResourceID: "app-container:7",+ CapabilityName: "update",+ Reason: "Routine image update",+ },+ Plan: unifiedresources.ActionPlan{+ ActionID: "action-ceremony-contract",+ PlanHash: "sha256:stable-plan-identity",+ PredictedBlastRadius: []string{"app-container:7", "agent:host-1"},+ },+ },+ CapabilityAutoAuthorization: unifiedresources.AutoAuthorizeLowRisk,+ BlastRadius: []actionResourcePresentation{+ {ID: "app-container:7", Name: "heimdall", Type: unifiedresources.ResourceTypeAppContainer},+ {ID: "agent:host-1"},+ },+ }++ encoded, err := json.Marshal(projection)+ if err != nil {+ t.Fatalf("marshal action read projection: %v", err)+ }+ var wire map[string]any+ if err := json.Unmarshal(encoded, &wire); err != nil {+ t.Fatalf("decode action read projection: %v", err)+ }+ if wire["capabilityAutoAuthorization"] != "low_risk" {+ t.Fatalf("capabilityAutoAuthorization = %#v", wire["capabilityAutoAuthorization"])+ }+ blast, ok := wire["blastRadius"].([]any)+ if !ok || len(blast) != 2 {+ t.Fatalf("blastRadius = %#v", wire["blastRadius"])+ }+ named, ok := blast[0].(map[string]any)+ if !ok || named["id"] != "app-container:7" || named["name"] != "heimdall" {+ t.Fatalf("named blast radius entry = %#v", blast[0])+ }+ plan, ok := wire["plan"].(map[string]any)+ if !ok || plan["planHash"] != "sha256:stable-plan-identity" {+ t.Fatalf("plan identity changed in read projection: %#v", wire["plan"])+ }+ radius, ok := plan["predictedBlastRadius"].([]any)+ if !ok || len(radius) != 2 || radius[0] != "app-container:7" {+ t.Fatalf("persisted blast radius IDs changed: %#v", plan["predictedBlastRadius"])+ }+}++// Without a registry the projection must still return every blast-radius ID+// so the review surface can fall back to raw identifiers.+func TestProjectActionAuditFallsBackToRawBlastRadiusIDsWithoutRegistry(t *testing.T) {+ record := unifiedresources.ActionAuditRecord{+ ID: "action-no-registry",+ Request: unifiedresources.ActionRequest{+ ResourceID: "app-container:7",+ CapabilityName: "update",+ },+ Plan: unifiedresources.ActionPlan{+ PredictedBlastRadius: []string{"app-container:7", "docker-network:9"},+ },+ }+ projection := projectActionAudit(record, nil)+ if projection.Resource != nil {+ t.Fatalf("resource presentation resolved without a registry: %#v", projection.Resource)+ }+ if projection.CapabilityAutoAuthorization != "" {+ t.Fatalf("capability class resolved without a registry: %q", projection.CapabilityAutoAuthorization)+ }+ if len(projection.BlastRadius) != 2 || projection.BlastRadius[0].ID != "app-container:7" || projection.BlastRadius[1].ID != "docker-network:9" {+ t.Fatalf("blast radius fallback = %#v", projection.BlastRadius)+ }+ if projection.BlastRadius[0].Name != "" {+ t.Fatalf("unresolvable entry gained a name: %#v", projection.BlastRadius[0])+ }+}diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.goindex 78ae1ac854..6a1929274f 100644--- a/internal/unifiedresources/adapters.go+++ b/internal/unifiedresources/adapters.go@@ -2308,7 +2308,8 @@ func dockerContainerUpdateCapability(runtime string) ResourceCapability {Type: CapabilityTypeCommon,Description: fmt.Sprintf("Update this %s container to its latest image through its reporting Pulse agent, with automatic backup and rollback.", displayRuntime),MinimumApprovalLevel: ApprovalAdmin,- AutoAuthorization: AutoAuthorizeNever,+ AutoAuthorization: AutoAuthorizeLowRisk,+ SupportsRollback: true,Platform: runtime,InternalHandler: "docker.container.update",}diff --git a/internal/unifiedresources/adapters_test.go b/internal/unifiedresources/adapters_test.goindex b070235bca..698130fe04 100644--- a/internal/unifiedresources/adapters_test.go+++ b/internal/unifiedresources/adapters_test.go@@ -1698,7 +1698,7 @@ func TestResourceFromDockerContainerAdvertisesUpdateCapabilityOnlyWithDigest(t *if capability.Name != "update" {continue}- if capability.InternalHandler != "docker.container.update" || capability.MinimumApprovalLevel != ApprovalAdmin || capability.AutoAuthorization != AutoAuthorizeNever {+ if capability.InternalHandler != "docker.container.update" || capability.MinimumApprovalLevel != ApprovalAdmin || capability.AutoAuthorization != AutoAuthorizeLowRisk || !capability.SupportsRollback {t.Fatalf("update capability contract = %+v", capability)}}diff --git a/internal/unifiedresources/capabilities.go b/internal/unifiedresources/capabilities.goindex 3716b31096..d3f556c13c 100644--- a/internal/unifiedresources/capabilities.go+++ b/internal/unifiedresources/capabilities.go@@ -67,6 +67,7 @@ type ResourceCapability struct {Description string `json:"description"`MinimumApprovalLevel ActionApprovalLevel `json:"minimumApprovalLevel"` // Policy may escalate thisAutoAuthorization ActionAutoAuthorizationClass `json:"autoAuthorization,omitempty"` // Missing/never stays human-authorized+ SupportsRollback bool `json:"supportsRollback,omitempty"` // True only when the executor declares a real recovery strategyPlatform string `json:"platform,omitempty"`InternalHandler string `json:"-"` // DO NOT expose execution plumbing to public surfacesParams []CapabilityParam `json:"params,omitempty"`