From 3526bb3e7efd698e00c4bab7e4eeb3f22068863b Mon Sep 17 00:00:00 2001 From: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Date: Mon, 29 Jun 2026 22:00:07 +0800 Subject: [PATCH] fix(metadata-admin): drop policy client-validator (PolicySchema removed in spec 11.2.0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spec 11.2.0 (#2078) removed the generic `PolicySchema` family (org-wide password/network/session/audit policy) from `@objectstack/spec/security`, breaking `tsc` for @object-ui/app-shell — the Bundle Analysis CI check (Build & E2E / Test use vite/esbuild and don't catch it). The `policy` metadata type has no entry in the spec's canonical metadata-type→schema registry (kernel/metadata-type-schemas.ts), and `RowLevelSecurityPolicySchema` is a different shape (a per-object RLS rule), so it must not be substituted. Remove the loader; `policy` drafts fall through to server-side validation like other unschematized types. Also corrected a stale comment claiming `profile` falls through (it maps to PermissionSetSchema). Co-Authored-By: Claude Opus 4.8 --- .../src/views/metadata-admin/clientValidation.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/app-shell/src/views/metadata-admin/clientValidation.ts b/packages/app-shell/src/views/metadata-admin/clientValidation.ts index 3a8a103f27..a012df8b14 100644 --- a/packages/app-shell/src/views/metadata-admin/clientValidation.ts +++ b/packages/app-shell/src/views/metadata-admin/clientValidation.ts @@ -38,7 +38,12 @@ type SchemaLoader = () => Promise; // Types still falling through to server-only validation: // - `validation`: not a top-level metadata file; lives inside object. (DataValidationRuleSchema // exists but has empty shape, so it's not useful for client validation.) -// - `profile`: spec ships no top-level ProfileSchema (7.1 confirmed). +// - `policy`: spec 11.2.0 (PR #2078) removed the generic `PolicySchema` (the org-wide +// password/network/session/audit policy) from `@objectstack/spec/security`, and the +// canonical metadata-type→schema registry (spec kernel/metadata-type-schemas.ts) has +// no `policy` entry — so there is no client schema. `RowLevelSecurityPolicySchema` +// remains on /security but is a different shape (a per-object RLS rule), NOT the +// `policy` metadata file, so it must not be substituted. // - `trigger`: no standalone TriggerSchema export at runtime (only // ConnectorTriggerSchema / WebhookEventSchema variants). // - `sharing_rule`: SharingRuleSchema is declared but has empty shape — server-only. @@ -89,7 +94,8 @@ const LOADERS: Record = { // packages/spec/src/kernel/metadata-type-schemas.ts for the canonical mapping. permission: async () => (await import('@objectstack/spec/security')).PermissionSetSchema as unknown as ZodLikeSchema, profile: async () => (await import('@objectstack/spec/security')).PermissionSetSchema as unknown as ZodLikeSchema, - policy: async () => (await import('@objectstack/spec/security')).PolicySchema as unknown as ZodLikeSchema, + // `policy` intentionally omitted — spec 11.2.0 dropped `PolicySchema` and the metadata-type + // registry has no `policy` schema; drafts fall through to server-side validation (see top). // identity role: async () => (await import('@objectstack/spec/identity')).RoleSchema as unknown as ZodLikeSchema,