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.

Trust canonical unified resource policy metadata

rcourtman86bcf1c0e9aa
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index a37aa91621..9d97a9ecff 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -725,8 +725,11 @@ That same shared `internal/api/` resource boundary now also carries governed
policy-aware metadata. Storage and recovery consumers that read canonical
resource payloads must preserve backend-derived `policy` and `aiSafeSummary`
fields for storage, backup, and data-bearing resources instead of rebuilding
-their own sensitivity or routing guesses in page-local presentation code. That
-same boundary now also owns the backend facet-bundle route for capability,
+their own sensitivity or routing guesses in page-local presentation code. The
+shared `frontend-modern/src/hooks/useUnifiedResources.ts` decode path now
+trusts the backend canonical metadata directly instead of re-normalizing it
+locally, so storage and recovery views see the same policy posture the API
+publishes. That same boundary now also owns the backend facet-bundle route for capability,
relationship, and timeline history reads, so storage and recovery surfaces
must continue to consume the shared bundle rather than issuing separate local
resource-detail fetches.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index dd5657a69d..f5fe73be44 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -522,11 +522,9 @@ rebuilding resource-change labels locally.
That frontend consumer rule now applies on the canonical decode path too:
`frontend-modern/src/hooks/useUnifiedResources.ts` must preserve backend-owned
-policy metadata and AI-safe summaries as first-class `Resource` fields, and
-it now delegates policy string and redaction normalization to the shared
-`frontend-modern/src/utils/resourcePolicyNormalization.ts` helper so the
-canonical frontend decode path does not reimplement sensitivity, routing, or
-redaction parsing locally.
+policy metadata and AI-safe summaries as first-class `Resource` fields, and it
+must treat the backend refresh path as the source of truth instead of
+re-normalizing policy strings or AI-safe summaries locally.
Shared infrastructure consumers such as the unified resource table and detail
drawer must present that owned metadata through shared helpers instead of
reconstructing privacy posture from display names, source types, or other
diff --git a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
index fd8361f9e8..1a3e7ae492 100644
--- a/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useUnifiedResources.test.ts
@@ -264,7 +264,7 @@ describe('useUnifiedResources', () => {
dispose();
});
- it('maps canonical policy metadata and aiSafeSummary into unified resources', async () => {
+ it('passes canonical policy metadata and aiSafeSummary through unchanged', async () => {
apiFetchMock.mockResolvedValueOnce({
ok: true,
json: async () => ({
@@ -272,15 +272,15 @@ describe('useUnifiedResources', () => {
{
...v2Resource,
policy: {
- sensitivity: ' ReStRiCtEd ',
+ sensitivity: 'restricted',
routing: {
- scope: 'LOCAL-ONLY',
+ scope: 'local-only',
allowCloudSummary: false,
allowCloudRawSignals: false,
- redact: ['HOSTNAME', ' ip-address ', 'Platform-ID', 'ALIAS'],
+ redact: ['hostname', 'ip-address', 'platform-id', 'alias'],
},
},
- aiSafeSummary: ' resource summary safe for remote AI use ',
+ aiSafeSummary: 'resource summary safe for remote AI use',
},
],
}),
diff --git a/frontend-modern/src/hooks/useUnifiedResources.ts b/frontend-modern/src/hooks/useUnifiedResources.ts
index 35812cce98..566d30a8d6 100644
--- a/frontend-modern/src/hooks/useUnifiedResources.ts
+++ b/frontend-modern/src/hooks/useUnifiedResources.ts
@@ -22,10 +22,6 @@ import { logger } from '@/utils/logger';
import { eventBus } from '@/stores/events';
import { canonicalDiscoveryResourceType } from '@/utils/discoveryTarget';
import { getPreferredNormalizedPlatformId } from '@/utils/resourceIdentity';
-import {
- normalizeResourcePolicy,
- normalizeResourcePolicyAISafeSummary,
-} from '@/utils/resourcePolicyNormalization';
import {
resolvePlatformTypeFromSources,
resolveSourceTypeFromSources,
@@ -565,9 +561,6 @@ const toResource = (v2: APIResource): Resource => {
: undefined;
const metricsTarget = resolveMetricsTarget(v2.type, v2.metricsTarget);
- const policy = normalizeResourcePolicy(v2.policy);
- const aiSafeSummary = normalizeResourcePolicyAISafeSummary(v2.aiSafeSummary);
-
return {
id: v2.id,
type: resolveType(v2.type),
@@ -647,8 +640,8 @@ const toResource = (v2: APIResource): Resource => {
discoveryTarget,
metricsTarget,
canonicalIdentity: v2.canonicalIdentity,
- policy,
- aiSafeSummary,
+ policy: v2.policy as Resource['policy'],
+ aiSafeSummary: v2.aiSafeSummary as Resource['aiSafeSummary'],
capabilities: v2.capabilities,
relationships: v2.relationships,
recentChanges: v2.recentChanges,
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 2983f8b144..8fac7c14c0 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -1905,11 +1905,11 @@ describe('frontend resource type boundaries', () => {
expect(patrolRunPresentationSource).toContain('formatIdentifierLabel');
expect(patrolRunPresentationSource).not.toContain("normalized.replace(/_/g, ' ')");
expect(patrolRunPresentationSource).not.toContain("normalized ? normalized.replace(/_/g, ' ') : 'unknown'");
- expect(useUnifiedResourcesSource).toContain('normalizeResourcePolicyAISafeSummary(');
+ expect(useUnifiedResourcesSource).not.toContain('normalizeResourcePolicyAISafeSummary(');
expect(resourcePolicyNormalizationSource).toContain(
'normalizeResourcePolicyAISafeSummary',
);
- expect(useUnifiedResourcesSource).toContain('normalizeResourcePolicy(');
+ expect(useUnifiedResourcesSource).not.toContain('normalizeResourcePolicy(');
expect(useUnifiedResourcesSource).not.toContain('const resolvePolicySensitivity =');
expect(useUnifiedResourcesSource).not.toContain('const resolvePolicyRoutingScope =');
expect(useUnifiedResourcesSource).not.toContain('const resolvePolicyRedactionHints =');