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.

Centralize policy routing row presentation

rcourtman7f1d038b0e14
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index 43d439fb0b..c1c09fdee2 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -115,6 +115,9 @@ uses for export boundaries instead of rebuilding privacy posture locally.
The same shared policy presenter also owns the `Allowed`/`Blocked` routing
decision labels shown in the resource drawer, so the policy state wording
stays canonical instead of being rendered inline by the consumer.
+That same presenter also owns the drawer's `Cloud Summary` and `Raw Signals`
+routing rows, so the AI-facing resource policy view does not rebuild the row
+layout or decision labels locally.
That same policy boundary now applies to chat structured-mention prefetch and
resource-summary formatting: mention resolution must consume canonical
unified-resource policy metadata, skip discovery fan-out when governed
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 0a3f878b78..ae3414640c 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -126,6 +126,9 @@ The same policy presenter now also owns the `Allowed`/`Blocked` routing
decision labels shown in the resource detail drawer, so routing-state wording
stays canonical with the rest of the policy surface instead of being
rendered inline by the drawer.
+That same helper also owns the drawer's `Cloud Summary` and `Raw Signals`
+routing rows, so the detail view no longer reconstructs the row structure or
+decision labels locally.
The backend AI and Patrol graph context renderers now derive their canonical
relationship labels, direction, provenance, freshness, and metadata flags
from `internal/unifiedresources/relationship_presentation.go`, so the graph
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
index 12a2b0013e..26d84901d8 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawer.tsx
@@ -48,7 +48,7 @@ import { ResourceAPI } from '@/api/resources';
import {
getResourcePolicyBadges,
getResourcePolicyRedactionLabels,
- getResourcePolicyRoutingDecisionLabel,
+ getResourcePolicyRoutingDecisionSummaries,
getResourceRoutingScopeLabel,
getResourceSensitivityLabel,
} from '@/utils/resourcePolicyPresentation';
@@ -149,6 +149,9 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
const hasUnifiedSources = createMemo(() => unifiedSourceBadges().length > 0);
const policyBadges = createMemo(() => getResourcePolicyBadges(props.resource.policy));
const policyRedactions = createMemo(() => getResourcePolicyRedactionLabels(props.resource.policy));
+ const policyRoutingDecisions = createMemo(() =>
+ getResourcePolicyRoutingDecisionSummaries(props.resource.policy),
+ );
const hasGovernanceData = createMemo(
() => policyBadges().length > 0 || Boolean(props.resource.aiSafeSummary),
);
@@ -1061,22 +1064,14 @@ const DrawerContent: Component<ResourceDetailDrawerProps> = (props) => {
{getResourceRoutingScopeLabel(props.resource.policy?.routing.scope)}
</span>
</div>
- <div class="flex items-center justify-between gap-2">
- <span class="text-muted">Cloud Summary</span>
- <span class="font-medium text-base-content">
- {getResourcePolicyRoutingDecisionLabel(
- props.resource.policy?.routing.allowCloudSummary,
- )}
- </span>
- </div>
- <div class="flex items-center justify-between gap-2">
- <span class="text-muted">Raw Signals</span>
- <span class="font-medium text-base-content">
- {getResourcePolicyRoutingDecisionLabel(
- props.resource.policy?.routing.allowCloudRawSignals,
- )}
- </span>
- </div>
+ <For each={policyRoutingDecisions()}>
+ {(decision) => (
+ <div class="flex items-center justify-between gap-2">
+ <span class="text-muted">{decision.label}</span>
+ <span class="font-medium text-base-content">{decision.value}</span>
+ </div>
+ )}
+ </For>
</Show>
<Show when={policyRedactions().length > 0}>
<div class="flex flex-col gap-1">
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 3dd78c105b..5071ebba81 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -1897,7 +1897,7 @@ describe('frontend resource type boundaries', () => {
expect(resourceDetailDrawerSource).toContain('getResourceChangeKindPresentation');
expect(resourceDetailDrawerSource).toContain('getResourceChangeSourceTypePresentation');
expect(resourceDetailDrawerSource).toContain('getResourceChangeSourceAdapterPresentation');
- expect(resourceDetailDrawerSource).toContain('getResourcePolicyRoutingDecisionLabel');
+ expect(resourceDetailDrawerSource).toContain('getResourcePolicyRoutingDecisionSummaries');
expect(resourceChangeSummarySource).toContain('getResourceChangeKindPresentation');
expect(resourceChangeSummarySource).toContain('getResourceChangeSourceTypePresentation');
expect(resourceChangeSummarySource).toContain(
diff --git a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
index 800c674e41..e2bc354e95 100644
--- a/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/resourcePolicyPresentation.test.ts
@@ -9,6 +9,7 @@ import {
getResourcePolicySensitivitySummaries,
getResourcePolicyRedactionLabels,
getResourcePolicyRoutingDecisionLabel,
+ getResourcePolicyRoutingDecisionSummaries,
getResourceRedactionHintLabel,
getResourceRoutingScopeLabel,
getResourceSensitivityLabel,
@@ -37,6 +38,23 @@ describe('resourcePolicyPresentation utils', () => {
).toEqual(['Hostname', 'IP Address']);
});
+ it('formats canonical policy routing decision summaries', () => {
+ expect(
+ getResourcePolicyRoutingDecisionSummaries({
+ sensitivity: 'sensitive',
+ routing: {
+ scope: 'local-first',
+ allowCloudSummary: true,
+ allowCloudRawSignals: false,
+ redact: [],
+ },
+ }),
+ ).toEqual([
+ { label: 'Cloud Summary', value: 'Allowed' },
+ { label: 'Raw Signals', value: 'Blocked' },
+ ]);
+ });
+
it('formats canonical policy count summaries', () => {
expect(
getResourcePolicySensitivitySummaries({
diff --git a/frontend-modern/src/utils/resourcePolicyPresentation.ts b/frontend-modern/src/utils/resourcePolicyPresentation.ts
index c5ec46ff91..13ed50fff5 100644
--- a/frontend-modern/src/utils/resourcePolicyPresentation.ts
+++ b/frontend-modern/src/utils/resourcePolicyPresentation.ts
@@ -12,6 +12,11 @@ type PolicyBadgePresentation = {
className: string;
};
+export type ResourcePolicyRoutingDecisionPresentation = {
+ label: string;
+ value: string;
+};
+
export type ResourcePolicyCountSummary = {
label: string;
count: number;
@@ -110,6 +115,25 @@ export const getResourceRoutingScopeLabel = (scope?: ResourceRoutingScope): stri
export const getResourcePolicyRoutingDecisionLabel = (allowed?: boolean): string =>
allowed ? 'Allowed' : 'Blocked';
+export const getResourcePolicyRoutingDecisionSummaries = (
+ policy?: ResourcePolicy,
+): ResourcePolicyRoutingDecisionPresentation[] => {
+ if (!policy) {
+ return [];
+ }
+
+ return [
+ {
+ label: 'Cloud Summary',
+ value: getResourcePolicyRoutingDecisionLabel(policy.routing.allowCloudSummary),
+ },
+ {
+ label: 'Raw Signals',
+ value: getResourcePolicyRoutingDecisionLabel(policy.routing.allowCloudRawSignals),
+ },
+ ];
+};
+
export const getResourceRedactionHintLabel = (hint?: ResourceRedactionHint): string =>
hint ? redactionLabels[hint] ?? hint : 'Unclassified';