Skip to content

Commit e9b9285

Browse files
os-zhuangclaude
andauthored
fix(metadata-admin): drop policy client-validator (PolicySchema removed in spec 11.2.0) (#2098)
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: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 882fc0f commit e9b9285

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/app-shell/src/views/metadata-admin/clientValidation.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ type SchemaLoader = () => Promise<ZodLikeSchema | undefined>;
3838
// Types still falling through to server-only validation:
3939
// - `validation`: not a top-level metadata file; lives inside object. (DataValidationRuleSchema
4040
// exists but has empty shape, so it's not useful for client validation.)
41-
// - `profile`: spec ships no top-level ProfileSchema (7.1 confirmed).
41+
// - `policy`: spec 11.2.0 (PR #2078) removed the generic `PolicySchema` (the org-wide
42+
// password/network/session/audit policy) from `@objectstack/spec/security`, and the
43+
// canonical metadata-type→schema registry (spec kernel/metadata-type-schemas.ts) has
44+
// no `policy` entry — so there is no client schema. `RowLevelSecurityPolicySchema`
45+
// remains on /security but is a different shape (a per-object RLS rule), NOT the
46+
// `policy` metadata file, so it must not be substituted.
4247
// - `trigger`: no standalone TriggerSchema export at runtime (only
4348
// ConnectorTriggerSchema / WebhookEventSchema variants).
4449
// - `sharing_rule`: SharingRuleSchema is declared but has empty shape — server-only.
@@ -89,7 +94,8 @@ const LOADERS: Record<string, SchemaLoader> = {
8994
// packages/spec/src/kernel/metadata-type-schemas.ts for the canonical mapping.
9095
permission: async () => (await import('@objectstack/spec/security')).PermissionSetSchema as unknown as ZodLikeSchema,
9196
profile: async () => (await import('@objectstack/spec/security')).PermissionSetSchema as unknown as ZodLikeSchema,
92-
policy: async () => (await import('@objectstack/spec/security')).PolicySchema as unknown as ZodLikeSchema,
97+
// `policy` intentionally omitted — spec 11.2.0 dropped `PolicySchema` and the metadata-type
98+
// registry has no `policy` schema; drafts fall through to server-side validation (see top).
9399

94100
// identity
95101
role: async () => (await import('@objectstack/spec/identity')).RoleSchema as unknown as ZodLikeSchema,

0 commit comments

Comments
 (0)