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
Link the action review to the resource it acts on
rcourtman9fbff10da5b8
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 5af7bd6dc9..e6b1574c43 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -604,6 +604,12 @@ presented as interchangeable totals.type hint, so both fields must keep naming the subject the alert or findingis about (an alert's `unifiedAlertType` display words are accepted as hints).+Governed action audits are read the same way: the browser resolves+`request.resourceId` through `GET /api/resources/{id}` for the action+review's `Open resource` link and falls back to the audit's recorded+`resource` name and type, so both must keep naming the resource the action+acts on.+The same resolution picks the thresholds tab and search behind the alert-onlyguidance link, so the registry resource's display label must stay the labelthe thresholds rows are built from (`getAlertResourceDisplayLabel`).diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 3a76dcb893..ed26510c7b 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -8872,6 +8872,16 @@ own. `ProxmoxPageSurface` passes `routeActive` to the Storage surface it keepsmounted behind its other tabs, so a guest tab's `?resource=` link is not readas a storage deep link.+### Record-to-resource links resolve through one hook++A surface that links a record (a Patrol item, a governed action) to its+resource's page resolves the id with `useResolvedResource` and builds the+link with `buildResourcePagePath`, rather than issuing its own+`ResourceAPI.getResource` call. The action review's `Open resource` and+`Open Patrol` links share one wrapping row whose links keep 44px targets on+phones. A dialog offers a link away only when its host keeps the dialog in+the address, so Back returns to it (`showResourceLink`).+### Thresholds search is a route searchThe thresholds resource search writes `?q=` through `navigate(..., { replace:diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 1506f9060c..c57eaea0db 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -2828,6 +2828,14 @@ the owning tab. A subject that names no platform hides the link rather thanopening a page without it (`resourcePagePath.test.ts`,`PatrolAttentionWorkbench.test.tsx`).+### Registry lookups for page links share one hook++The attention detail resolves `subjectResourceId` through+`useResolvedResource`, the abortable registry lookup the action review also+uses, so an answer for an earlier item is never applied to the current one+(`useResolvedResource.test.ts`). `Open resource` and the alert-only+thresholds link read the same resolved resource as before.+### Alert-only guidance links to the subject's thresholdsA decision about a bare alert tells the operator to adjust when the alertdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 4521760371..b64b70918f 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -7835,6 +7835,24 @@ presentation only: the action audit list, approval counts, review dialog,routing and every recorded action outcome are read and rendered exactly asbefore, and no resource or action identity changes.+### Action review links to the resource it acts on++The governed action review tells the operator to check the actual resource+before approving, retrying or closing an action whose outcome is unknown, but+linked only back to Patrol. With `showResourceLink`, `ActionReviewDialog`+resolves `audit.request.resourceId` through `useResolvedResource`+(`frontend-modern/src/features/platformNavigation/useResolvedResource.ts`)+and shows `Open resource` from `buildResourcePagePath`, with the audit's+recorded resource name and type as the fallback while the registry answers or+when it cannot resolve the id. Only the Actions page passes it: it keeps the+review in `?action=`, so Back from the resource reopens the same review.+Patrol holds its review in memory and already links the subject, and the+Docker container controls open the review from the resource itself, so they+get no link and no lookup. It is a link only: the action ledger, plan,+decision and every recorded outcome are read and rendered as before, and no+resource or action identity changes (`ActionReviewDialog.test.tsx`,+`Actions.requestOwnership.test.tsx`).+### vSphere Overview leads with vCenter health signalsThe vSphere Overview answers "is anything in trouble?" before inventory, asdiff --git a/frontend-modern/.bundlesize.json b/frontend-modern/.bundlesize.jsonindex a6d9cc791b..bbcd6b8883 100644--- a/frontend-modern/.bundlesize.json+++ b/frontend-modern/.bundlesize.json@@ -89,7 +89,7 @@"baselineGzip": 7595},"ActionReviewDialog": {- "baselineGzip": 8453+ "baselineGzip": 10414},"DrawerDiskListCard": {"baselineGzip": 6035diff --git a/frontend-modern/browser-verification/4d428feb9c21948d.json b/frontend-modern/browser-verification/4d428feb9c21948d.jsonnew file mode 100644index 0000000000..9e1d0c83a0--- /dev/null+++ b/frontend-modern/browser-verification/4d428feb9c21948d.json@@ -0,0 +1,48 @@+{+ "version": 1,+ "base_sha": "e669e825d4a34f8979d60eec7962561bd6927bef",+ "verified_at": "2026-10-15T10:08:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/actions/ActionReviewDialog.tsx",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx",+ "frontend-modern/src/features/platformNavigation/useResolvedResource.ts",+ "frontend-modern/src/pages/Actions.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/features/actions/ActionReviewDialog.tsx": "30a59e74b00cc64f2803515127b0366a775c2c99c1d80a5017cfc1195c6dc6a2",+ "frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx": "0a6f7d6b4f5e3c2745113cbf58929f362b5f9aee4cc63edf4afdb5e4757cb7e2",+ "frontend-modern/src/features/platformNavigation/useResolvedResource.ts": "c9cf25765b1c0257a28eb5f45eb939d29d8afbe3df55623aa5414a4144100fa9",+ "frontend-modern/src/pages/Actions.tsx": "fc382d036d951008cd8a0161acb16916216eba2196c885eb1b78b99a08a563a5"+ },+ "routes": [+ "/actions",+ "/patrol",+ "/docker/overview",+ "/proxmox/overview",+ "/standalone/machines"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 800+ },+ {+ "width": 375,+ "height": 812+ }+ ],+ "states": [+ "Before (main): the action review header offered only Open Patrol; the resource it acts on (Apollo-114, analytics-batch-01, backup-coordinator) was plain text",+ "After: each review shows Open resource beside Open Patrol: the agent opens Machines filtered to Apollo-114, the VM opens Proxmox overview with analytics-batch-01 expanded, the container opens Docker overview filtered to backup-coordinator (1 of 21 containers)",+ "Patrol attention detail links are unchanged after moving its registry lookup into the shared hook",+ "At 375px both links sit on one row as 44px targets with no horizontal overflow",+ "The link is opt-in: reviews hosted by Patrol and the Docker container controls show no resource link"+ ],+ "interactions": [+ "Opened each of the three demo action reviews via ?action= and read the header links",+ "Clicked Open resource for the container, confirmed the filtered Docker list, then Back reopened the same review",+ "Followed the VM and agent destinations and confirmed the resource row",+ "Opened five Patrol decisions and read their Open resource and thresholds hrefs"+ ]+}diff --git a/frontend-modern/src/features/actions/ActionReviewDialog.tsx b/frontend-modern/src/features/actions/ActionReviewDialog.tsxindex 9d5e180bab..9702b1e3ac 100644--- a/frontend-modern/src/features/actions/ActionReviewDialog.tsx+++ b/frontend-modern/src/features/actions/ActionReviewDialog.tsx@@ -10,6 +10,8 @@ import { MetadataBadge } from '@/components/shared/MetadataBadge';import { notificationStore } from '@/stores/notifications';import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy';import type { ActionDetailResponse } from '@/types/actionAudit';+import { buildResourcePagePath } from '@/features/platformNavigation/resourcePagePath';+import { useResolvedResource } from '@/features/platformNavigation/useResolvedResource';import { ActionDecisionPacket } from './ActionDecisionPacket';import {formatActionName,@@ -40,6 +42,13 @@ export const ActionReviewDialog: Component<{detail: ActionDetailResponse | null;onClose: () => void;onChanged?: (detail: ActionDetailResponse) => void | Promise<void>;+ /**+ * Link the resource the action acts on. Only a host that keeps the review+ * in the address (the Actions page's `?action=`) should ask: leaving for+ * the resource and pressing Back must return to the same review, and a+ * review opened from the resource itself has nowhere new to go.+ */+ showResourceLink?: boolean;}> = (props) => {const [busy, setBusy] = createSignal(false);const [error, setError] = createSignal('');@@ -59,6 +68,21 @@ export const ActionReviewDialog: Component<{? getActionResourcePresentation(record.request.resourceId, record.resource): { label: '', detail: '' };});+ // The review asks the operator to check the resource before approving or+ // retrying, so it links to the page that shows it.+ const registryResource = useResolvedResource(() =>+ props.showResourceLink ? audit()?.request.resourceId : undefined,+ );+ const resourceHref = createMemo(() => {+ const record = audit();+ if (!record || !props.showResourceLink) return null;+ return buildResourcePagePath({+ id: record.request.resourceId,+ name: record.resource?.name,+ type: record.resource?.type,+ resource: registryResource(),+ });+ });const readOnly = createMemo(() => props.detail?.readOnly === true || presentationPolicyIsReadOnly(),);@@ -402,18 +426,35 @@ export const ActionReviewDialog: Component<{{resource().label}<Show when={resource().detail}> · {resource().detail}</Show></p>- <Show when={originDestination()}>- {(destination) => (- <ButtonLink- href={destination().href}- variant="ghost"- size="xs"- class="mt-2 -ml-2.5 gap-1.5"- >- {destination().exact ? 'Open Patrol record' : 'Open Patrol'}- <ArrowUpRightIcon class="h-3.5 w-3.5" aria-hidden="true" />- </ButtonLink>- )}+ <Show when={resourceHref() || originDestination()}>+ <div class="mt-2 -ml-2.5 flex flex-wrap items-center gap-1">+ <Show when={resourceHref()}>+ {(href) => (+ <ButtonLink+ href={href()}+ variant="ghost"+ size="xs"+ class="min-h-11 gap-1.5 sm:min-h-0"+ >+ Open resource+ <ArrowUpRightIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </ButtonLink>+ )}+ </Show>+ <Show when={originDestination()}>+ {(destination) => (+ <ButtonLink+ href={destination().href}+ variant="ghost"+ size="xs"+ class="min-h-11 gap-1.5 sm:min-h-0"+ >+ {destination().exact ? 'Open Patrol record' : 'Open Patrol'}+ <ArrowUpRightIcon class="h-3.5 w-3.5" aria-hidden="true" />+ </ButtonLink>+ )}+ </Show>+ </div></Show></div><Buttondiff --git a/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx b/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsxindex 84a8b69d8c..957d490be3 100644--- a/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx+++ b/frontend-modern/src/features/actions/__tests__/ActionReviewDialog.test.tsx@@ -19,11 +19,14 @@ vi.mock('@/api/resourceActions', () => ({},}));vi.mock('@/api/security', () => ({ SecurityAPI: { getStatus: vi.fn() } }));+const getResource = vi.hoisted(() => vi.fn());+vi.mock('@/api/resources', () => ({ ResourceAPI: { getResource } }));vi.mock('@/stores/notifications', () => ({notificationStore: { success: vi.fn(), error: vi.fn(), warning: vi.fn() },}));beforeEach(() => {+ getResource.mockRejectedValue(new Error('Resource not found'));vi.mocked(SecurityAPI.getStatus).mockResolvedValue({hasAuthentication: true,requiresAuth: true,@@ -341,6 +344,78 @@ describe('ActionReviewDialog trust gates', () => {expect(screen.queryByRole('link', { name: 'Open Patrol record' })).not.toBeInTheDocument();});+ // The review tells the operator to check the resource before approving or+ // retrying; it linked only back to Patrol, never to the resource itself.+ it('links the action resource to the page that shows it', async () => {+ const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');+ audit.request.resourceId = 'agent-acdf';+ audit.resource = { id: 'agent-acdf', name: 'Apollo-114', type: 'agent' };+ getResource.mockResolvedValue({+ id: 'agent-acdf',+ name: 'Apollo-114',+ type: 'agent',+ status: 'online',+ platformScopes: ['agent'],+ });+ render(() => (+ <Router>+ <Route+ path="*"+ component={() => (+ <ActionReviewDialog detail={detail(audit)} onClose={vi.fn()} showResourceLink />+ )}+ />+ </Router>+ ));+ await waitFor(() =>+ expect(screen.getByRole('link', { name: 'Open resource' })).toHaveAttribute(+ 'href',+ '/standalone/machines?q=Apollo-114',+ ),+ );+ expect(getResource).toHaveBeenCalledWith('agent-acdf', expect.anything());+ });++ it('links the action resource by its recorded type when the registry cannot resolve it', async () => {+ const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');+ audit.request.resourceId = 'pve:vm:101';+ audit.resource = { id: 'pve:vm:101', name: 'analytics-batch-01', type: 'vm' };+ render(() => (+ <Router>+ <Route+ path="*"+ component={() => (+ <ActionReviewDialog detail={detail(audit)} onClose={vi.fn()} showResourceLink />+ )}+ />+ </Router>+ ));+ await waitFor(() => expect(getResource).toHaveBeenCalled());+ expect(screen.getByRole('link', { name: 'Open resource' })).toHaveAttribute(+ 'href',+ '/proxmox/overview?resource=pve%3Avm%3A101',+ );+ });++ // Patrol and the Docker container controls open the review over the+ // resource itself and keep it only in memory, so they get no resource link.+ it('offers no resource link unless the host asks for one', async () => {+ const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');+ audit.request.resourceId = 'pve:vm:101';+ audit.resource = { id: 'pve:vm:101', name: 'analytics-batch-01', type: 'vm' };+ render(() => (+ <Router>+ <Route+ path="*"+ component={() => <ActionReviewDialog detail={detail(audit)} onClose={vi.fn()} />}+ />+ </Router>+ ));+ expect(await screen.findByRole('heading', { name: 'Restart' })).toBeVisible();+ expect(screen.queryByRole('link', { name: 'Open resource' })).not.toBeInTheDocument();+ expect(getResource).not.toHaveBeenCalled();+ });+it('does not treat another origin surface as Patrol even when it carries a record id', () => {const audit = makeAudit('resolved', '2099-01-01T00:00:00Z');audit.origin = {diff --git a/frontend-modern/src/features/actions/__tests__/Actions.requestOwnership.test.tsx b/frontend-modern/src/features/actions/__tests__/Actions.requestOwnership.test.tsxindex 6b9adf2b8b..d55e77437b 100644--- a/frontend-modern/src/features/actions/__tests__/Actions.requestOwnership.test.tsx+++ b/frontend-modern/src/features/actions/__tests__/Actions.requestOwnership.test.tsx@@ -11,6 +11,8 @@ vi.mock('@/api/resourceActions', () => ({}));vi.mock('@/api/security', () => ({ SecurityAPI: { getStatus: vi.fn() } }));vi.mock('@/api/patrol', () => ({ getPatrolAutonomySettings: vi.fn().mockResolvedValue({}) }));+const getResource = vi.hoisted(() => vi.fn());+vi.mock('@/api/resources', () => ({ ResourceAPI: { getResource } }));const deferred = <T,>() => {let resolve!: (value: T) => void;@@ -74,6 +76,7 @@ const renderActions = () =>));beforeEach(() => {+ getResource.mockRejectedValue(new Error('Resource not found'));window.history.replaceState(null, '', '/');vi.mocked(ResourceActionsAPI.listActions).mockResolvedValue({actions: [audit('edge-a'), audit('edge-b')],@@ -186,4 +189,25 @@ describe('Actions request ownership', () => {await waitFor(() => expect(window.location.pathname).toBe('/actions'));await waitFor(() => expect(ResourceActionsAPI.listActions).toHaveBeenLastCalledWith('pending'));});++ // The page keeps the review in ?action=, so Back from the resource returns+ // to it; that is why the Actions page is the host that links the resource.+ it('links the reviewed action to its resource page', async () => {+ const withResource = detail('edge-a');+ withResource.audit.resource = {+ id: 'docker:container:edge-a',+ name: 'edge-a',+ type: 'app-container',+ };+ vi.mocked(ResourceActionsAPI.getAction).mockResolvedValue(withResource);+ renderActions();+ fireEvent.click(+ await screen.findByRole('button', { name: /Review Update on docker:container:edge-a/ }),+ );+ expect(await screen.findByRole('link', { name: 'Open resource' })).toHaveAttribute(+ 'href',+ '/docker/overview?q=edge-a',+ );+ expect(window.location.search).toBe('?action=edge-a');+ });});diff --git a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsxindex 9bbb07decf..4044b450cd 100644--- a/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx+++ b/frontend-modern/src/features/patrol/PatrolAttentionWorkbench.tsx@@ -59,13 +59,12 @@ import {buildPatrolAttentionPath,parsePatrolAttentionItemId,} from '@/routing/resourceLinks';-import { ResourceAPI } from '@/api/resources';import {buildResourcePagePath,buildResourceThresholdsPath,type ResourcePageSubject,} from '@/features/platformNavigation/resourcePagePath';-import type { Resource } from '@/types/resource';+import { useResolvedResource } from '@/features/platformNavigation/useResolvedResource';import type { EvidenceEnvelope } from '@/types/operationalTrust';import type { ActionDetailResponse } from '@/types/actionAudit';import { getAlertResourceIncidentAcknowledgedByLabel } from '@/utils/alertIncidentPresentation';@@ -915,32 +914,15 @@ function AttentionDetail(props: {const olderEvidence = createMemo(() => orderedEvidence().slice(PRIMARY_EVIDENCE_LIMIT));// The registry knows which platform shows the subject; until it answers,// or when it cannot resolve the record's id, the item's own type decides.- const [resolvedSubject, setResolvedSubject] = createSignal<{- id: string;- resource: Resource | null;- } | null>(null);- createEffect(() => {- const id = item()?.subjectResourceId?.trim();- if (!id) return;- const controller = new AbortController();- void ResourceAPI.getResource(id, { signal: controller.signal })- .then((resource) => {- if (!controller.signal.aborted) setResolvedSubject({ id, resource });- })- .catch(() => {- if (!controller.signal.aborted) setResolvedSubject({ id, resource: null });- });- onCleanup(() => controller.abort());- });+ const resolvedSubject = useResolvedResource(() => item()?.subjectResourceId);const pageSubject = (): ResourcePageSubject | null => {const value = item();if (!value) return null;- const resolved = resolvedSubject();return {id: value.subjectResourceId,name: value.subjectResourceName,type: value.subjectResourceType,- resource: resolved?.id === value.subjectResourceId.trim() ? resolved.resource : null,+ resource: resolvedSubject(),};};const resourceHref = () => {diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsxindex 5c1f09149c..d5ae3d2016 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx+++ b/frontend-modern/src/features/patrol/__tests__/PatrolAttentionWorkbench.test.tsx@@ -77,10 +77,15 @@ vi.mock('@/features/actions/ActionReviewDialog', async () => {detail: { audit?: { id?: string } } | null;onClose: () => void;onChanged: (next: { audit?: { id?: string } }) => Promise<void> | void;+ showResourceLink?: boolean;}) => (<Show when={props.detail}>{(value) => (- <div role="dialog" aria-label="Governed action review">+ <div+ role="dialog"+ aria-label="Governed action review"+ data-resource-link={props.showResourceLink ? 'shown' : 'hidden'}+ ><span>{value().audit?.id}</span><button type="button" onClick={() => void props.onChanged(value())}>Complete action@@ -1496,9 +1501,12 @@ describe('PatrolAttentionWorkbench', () => {expect(apiMocks.planAction).toHaveBeenCalledWith('record-1', 'restart');expect(apiMocks.getAction).toHaveBeenCalledWith('act-attention-restart');});- expect(- await screen.findByRole('dialog', { name: 'Governed action review' }),- ).toBeInTheDocument();+ // Patrol holds this review in memory and already links its subject, so+ // the review must not offer a resource link that Back could not return from.+ expect(await screen.findByRole('dialog', { name: 'Governed action review' })).toHaveAttribute(+ 'data-resource-link',+ 'hidden',+ );fireEvent.click(screen.getByRole('button', { name: 'Complete action' }));const currentTrigger = await screen.findByRole('button', { name: 'Review action' });diff --git a/frontend-modern/src/features/platformNavigation/__tests__/useResolvedResource.test.ts b/frontend-modern/src/features/platformNavigation/__tests__/useResolvedResource.test.tsnew file mode 100644index 0000000000..6e0c1efea0--- /dev/null+++ b/frontend-modern/src/features/platformNavigation/__tests__/useResolvedResource.test.ts@@ -0,0 +1,60 @@+import { createRoot, createSignal } from 'solid-js';+import { afterEach, describe, expect, it, vi } from 'vitest';+import type { Resource } from '@/types/resource';+import { useResolvedResource } from '../useResolvedResource';++const getResource = vi.hoisted(() => vi.fn());+vi.mock('@/api/resources', () => ({ ResourceAPI: { getResource } }));++const flush = () => new Promise((resolve) => setTimeout(resolve, 0));++afterEach(() => {+ getResource.mockReset();+});++describe('useResolvedResource', () => {+ it('returns the registry resource for the current id and null when it cannot resolve', async () => {+ const vm = { id: 'vm-1', name: 'web', type: 'vm' } as Resource;+ getResource.mockImplementation((id: string) =>+ id === 'vm-1' ? Promise.resolve(vm) : Promise.reject(new Error('not found')),+ );+ await createRoot(async (dispose) => {+ const [id, setId] = createSignal<string | undefined>(' vm-1 ');+ const resolved = useResolvedResource(id);+ expect(resolved()).toBeNull();+ await flush();+ expect(resolved()).toBe(vm);+ expect(getResource).toHaveBeenCalledWith('vm-1', expect.anything());++ setId('missing');+ expect(resolved()).toBeNull();+ await flush();+ expect(resolved()).toBeNull();+ dispose();+ });+ });++ // Switching records while a lookup is in flight must not show the earlier+ // record's resource for the new one.+ it('never returns an answer for an earlier id', async () => {+ let finishFirst: (resource: Resource) => void = () => undefined;+ getResource.mockImplementation((id: string) =>+ id === 'first'+ ? new Promise<Resource>((resolve) => {+ finishFirst = resolve;+ })+ : new Promise<Resource>(() => undefined),+ );+ await createRoot(async (dispose) => {+ const [id, setId] = createSignal<string | undefined>('first');+ const resolved = useResolvedResource(id);+ await flush();+ expect(getResource).toHaveBeenCalledWith('first', expect.anything());+ setId('second');+ finishFirst({ id: 'first', name: 'old', type: 'vm' } as Resource);+ await flush();+ expect(resolved()).toBeNull();+ dispose();+ });+ });+});diff --git a/frontend-modern/src/features/platformNavigation/useResolvedResource.ts b/frontend-modern/src/features/platformNavigation/useResolvedResource.tsnew file mode 100644index 0000000000..c8ab34d587--- /dev/null+++ b/frontend-modern/src/features/platformNavigation/useResolvedResource.ts@@ -0,0 +1,35 @@+import { createEffect, createSignal, onCleanup, type Accessor } from 'solid-js';+import { ResourceAPI } from '@/api/resources';+import type { Resource } from '@/types/resource';++/**+ * The registry resource a record names, for `buildResourcePagePath` and its+ * siblings. One abortable lookup runs per id; until it answers, and when the+ * registry cannot resolve the id, the accessor returns null so callers fall+ * back to the record's own name and type. An answer for an earlier id is+ * never returned for the current one.+ */+export function useResolvedResource(+ id: Accessor<string | null | undefined>,+): Accessor<Resource | null> {+ const [resolved, setResolved] = createSignal<{ id: string; resource: Resource | null } | null>(+ null,+ );+ createEffect(() => {+ const current = id()?.trim();+ if (!current) return;+ const controller = new AbortController();+ void ResourceAPI.getResource(current, { signal: controller.signal })+ .then((resource) => {+ if (!controller.signal.aborted) setResolved({ id: current, resource });+ })+ .catch(() => {+ if (!controller.signal.aborted) setResolved({ id: current, resource: null });+ });+ onCleanup(() => controller.abort());+ });+ return () => {+ const value = resolved();+ return value && value.id === id()?.trim() ? value.resource : null;+ };+}diff --git a/frontend-modern/src/pages/Actions.tsx b/frontend-modern/src/pages/Actions.tsxindex efa47b51d6..04c63f2949 100644--- a/frontend-modern/src/pages/Actions.tsx+++ b/frontend-modern/src/pages/Actions.tsx@@ -367,6 +367,7 @@ export function Actions() {</Show><ActionReviewDialogdetail={selected()}+ showResourceLinkonClose={closeAction}onChanged={async (detail) => {// A read or mutation started in an earlier review must not replace