feat: Complete @objectstack/spec audit remediation (Phases 1–4)#540
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1.1 Replace z.any() with z.function() in hook handler union 1.2 Fix ValidationRuleSchema inferring as any with proper base type 1.3 Fix invalid computed key syntax in AuthConfigSchema with .catchall() 1.4 Fix MongoDriverSpec capability key mismatches 1.5 Fix DatasourceConfig type alias naming 1.6 Replace z.instanceof(Error) with JSON-serializable error shape 1.7 Fix filter operator typo $exist → $exists Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…vels to snake_case, dashboard name validation Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…chemas, rename realtime presence schemas Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
- 3.1: Replaced z.record(z.string(), z.any()) → z.record(z.string(), z.unknown()) across all .zod.ts files - 3.2: Tightened id fields in data-engine.zod.ts to z.union([z.string(), z.number()]) - 3.3a: Updated kernel/plugin.zod.ts metadata/events records (service methods kept as z.any()) - 3.3b: Replaced z.promise(z.any()) and z.function().args(z.any()) in data/driver.zod.ts - 3.3c: Replaced z.promise(z.any()) returns and z.record data patterns in data-engine.zod.ts - 3.3d: Replaced payload, handler, filter, transform z.any() in kernel/events.zod.ts - 3.3e: Replaced config-related z.any() in kernel/manifest.zod.ts - 3.4: Replaced z.array(z.any()) in UI schemas (component, app, view) - 3.5: Deprecated location field in ui/action.zod.ts with z.unknown() - Also migrated standalone z.any() for data fields across ai/, api/, system/, automation/, shared/ Final counts: z.any()=62 (down from 394), z.unknown()=340 Remaining z.any() are legitimate: service methods, filter operators, lifecycle hooks All 3073 tests pass, build succeeds Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ard fields Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR applies a broad Zod-schema audit remediation across the @objectstack/spec package, hardening schema safety (reducing z.any() usage), improving JSON-schema generation quality, and adding missing type exports to make the protocol definitions more reliable for downstream tooling (CLI/IDE/schema-gen).
Changes:
- Replaced many
z.any()/record<string, any>usages withz.unknown()and tightened identifier validation via shared identifier helpers. - Added/updated protocol fields (e.g., UI emptyState/refreshInterval, object recordTypes/sharingModel) and improved
.describe()coverage. - Generated/updated corresponding JSON Schema artifacts and adjusted tests for updated validations/serializable error shapes.
Reviewed changes
Copilot reviewed 202 out of 202 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/ui/widget.zod.ts | Switch payload/default/validation/value/options to z.unknown(); use SnakeCaseIdentifierSchema for name. |
| packages/spec/src/ui/view.zod.ts | Replace filter item type to z.unknown(); add emptyState config. |
| packages/spec/src/ui/theme.zod.ts | Use shared SnakeCaseIdentifierSchema for theme name. |
| packages/spec/src/ui/report.zod.ts | Use shared SnakeCaseIdentifierSchema for report name. |
| packages/spec/src/ui/page.zod.ts | Replace properties/defaultValue with z.unknown(); export PageVariable type. |
| packages/spec/src/ui/dashboard.zod.ts | Use SnakeCaseIdentifierSchema; change options to z.unknown(); add refreshInterval; export DashboardInput. |
| packages/spec/src/ui/dashboard.test.ts | Update snake_case name tests to reflect stricter identifier rules. |
| packages/spec/src/ui/component.zod.ts | Replace child slot arrays from any to unknown. |
| packages/spec/src/ui/chart.zod.ts | Export missing inferred types for annotation/interaction. |
| packages/spec/src/ui/app.zod.ts | Replace params/objects/apis any with unknown; refactor App helper; export AppInput. |
| packages/spec/src/ui/action.zod.ts | Deprecate legacy location and harden to z.unknown(); export ActionInput. |
| packages/spec/src/system/worker.zod.ts | Replace payload/result/items any with unknown. |
| packages/spec/src/system/translation.zod.ts | Improve .describe() coverage for translation structures. |
| packages/spec/src/system/tracing.zod.ts | Replace condition/attributes maps from any to unknown. |
| packages/spec/src/system/object-storage.zod.ts | Convert lastModified to ISO datetime string; options to unknown. |
| packages/spec/src/system/object-storage.test.ts | Update tests for ISO datetime string. |
| packages/spec/src/system/notification.zod.ts | Replace push notification data map values with unknown. |
| packages/spec/src/system/migration.zod.ts | Add .describe() to operations and dependency fields. |
| packages/spec/src/system/metrics.zod.ts | Replace filters/config maps from any to unknown. |
| packages/spec/src/system/metadata-persistence.zod.ts | Rename audit/id fields; convert dates to ISO datetime strings; harden metadata/data/watchOptions types. |
| packages/spec/src/system/logging.zod.ts | Replace context/error/details/metadata maps from any to unknown. |
| packages/spec/src/system/index.ts | Switch export from service-registry to core-services; remove duplicate exports. |
| packages/spec/src/system/http-server.zod.ts | Replace middleware config/event data maps to unknown. |
| packages/spec/src/system/encryption.zod.ts | Add richer .describe() coverage for encryption config fields. |
| packages/spec/src/system/core-services.zod.ts | Replace options record values with unknown. |
| packages/spec/src/system/collaboration.zod.ts | Replace various metadata/value payloads from any to unknown. |
| packages/spec/src/system/cache.zod.ts | Add .describe() coverage across cache schemas. |
| packages/spec/src/system/auth-config.zod.ts | Fix invalid computed key usage via .catchall(z.unknown()); add missing type exports. |
| packages/spec/src/system/audit.zod.ts | Replace metadata/oldValue/newValue/etc. from any to unknown. |
| packages/spec/src/stack.zod.ts | Replace plugins array item type from any to unknown. |
| packages/spec/src/shared/metadata-types.zod.ts | Add shared MetadataFormatSchema and BaseMetadataRecordSchema. |
| packages/spec/src/shared/mapping.zod.ts | Replace transform values/mappings/defaultValue from any to unknown. |
| packages/spec/src/shared/index.ts | Re-export new shared enums/metadata types. |
| packages/spec/src/shared/enums.zod.ts | Add shared enums for aggregation/sort/mutation/isolation/cache strategy. |
| packages/spec/src/security/rls.zod.ts | Replace user context attributes map values with unknown. |
| packages/spec/src/security/permission.zod.ts | Replace contextVariables map values with unknown. |
| packages/spec/src/kernel/startup-orchestrator.zod.ts | Replace context/details maps with unknown; make error JSON-serializable. |
| packages/spec/src/kernel/startup-orchestrator.test.ts | Update tests to use serializable error object. |
| packages/spec/src/kernel/service-registry.zod.ts | Replace metadata maps from any to unknown. |
| packages/spec/src/kernel/plugin.zod.ts | Clarify comment; switch metadata/events maps to unknown; deprecate definePlugin. |
| packages/spec/src/kernel/plugin-structure.zod.ts | Add .describe() and missing inferred type exports. |
| packages/spec/src/kernel/plugin-security-advanced.zod.ts | Prefix kernel security schemas to avoid collisions; update internal references and exports. |
| packages/spec/src/kernel/plugin-security-advanced.test.ts | Update imports/usages to new KernelSecurity* names. |
| packages/spec/src/kernel/plugin-loading.zod.ts | Replace metadata map values with unknown. |
| packages/spec/src/kernel/plugin-lifecycle-events.zod.ts | Make error JSON-serializable; switch args array items to unknown. |
| packages/spec/src/kernel/plugin-lifecycle-events.test.ts | Update tests to use serializable error object. |
| packages/spec/src/kernel/plugin-lifecycle-advanced.zod.ts | Replace state/data/customConfig maps from any to unknown. |
| packages/spec/src/kernel/plugin-capability.zod.ts | Replace metadata map values with unknown. |
| packages/spec/src/kernel/package-registry.zod.ts | Replace settings map values with unknown. |
| packages/spec/src/kernel/metadata-loader.zod.ts | Convert date fields to ISO datetime strings; harden metadata/data fields to unknown. |
| packages/spec/src/kernel/metadata-loader.test.ts | Update tests to use ISO datetime strings. |
| packages/spec/src/kernel/manifest.zod.ts | Replace default/input/output/extensions with unknown; export input type. |
| packages/spec/src/kernel/events.zod.ts | Replace schema/payload/handlers/transforms/filters/options with unknown. |
| packages/spec/src/integration/connector/message-queue.zod.ts | Replace filter attributes map values with unknown. |
| packages/spec/src/integration/connector/database.zod.ts | Replace options map values with unknown. |
| packages/spec/src/integration/connector.zod.ts | Replace params/filters/schemas/metadata map values with unknown. |
| packages/spec/src/identity/scim.zod.ts | Replace custom resource/value types with unknown. |
| packages/spec/src/identity/organization.zod.ts | Convert date fields to ISO datetime strings; metadata to unknown. |
| packages/spec/src/identity/identity.zod.ts | Convert date fields to ISO datetime strings. |
| packages/spec/src/hub/tenant.zod.ts | Replace customizations map values with unknown. |
| packages/spec/src/hub/registry-config.zod.ts | Replace credentials map values with unknown. |
| packages/spec/src/hub/plugin-registry.zod.ts | Replace config map values with unknown. |
| packages/spec/src/hub/license.zod.ts | Rename MetricType to LicenseMetricType and export inferred type. |
| packages/spec/src/hub/composer.zod.ts | Replace configuration map values with unknown. |
| packages/spec/src/data/validation.zod.ts | Replace schema/params maps with unknown; add explicit base interface for lazy rule typing. |
| packages/spec/src/data/query.zod.ts | Replace cursor map values with unknown. |
| packages/spec/src/data/object.zod.ts | Deprecate stateMachine; add recordTypes and sharingModel; export input type for base. |
| packages/spec/src/data/mapping.zod.ts | Replace params value/valueMap types with unknown. |
| packages/spec/src/data/hook.zod.ts | Fix handler union to use z.function(); replace context fields with unknown. |
| packages/spec/src/data/filter.zod.ts | Rename $exist to $exists; harden recursive record values to unknown. |
| packages/spec/src/data/filter.test.ts | Update tests for $exists. |
| packages/spec/src/data/field.zod.ts | Replace defaultValue with unknown; deprecate formula; add sortable/inlineHelpText. |
| packages/spec/src/data/external-lookup.zod.ts | Replace config/parameters/defaultValue with unknown. |
| packages/spec/src/data/driver/mongo.zod.ts | Replace options map values with unknown; align capabilities keys. |
| packages/spec/src/data/driver.zod.ts | Replace transaction/driver interface IO with unknown; unify isolation levels via shared enum. |
| packages/spec/src/data/driver-sql.test.ts | Update isolationLevels values to snake_case. |
| packages/spec/src/data/driver-nosql.zod.ts | Replace jsonSchema/options/partialFilterExpression with unknown. |
| packages/spec/src/data/document.zod.ts | Replace metadata map values with unknown. |
| packages/spec/src/data/datasource.zod.ts | Replace config/configSchema/readReplica values with unknown; rename exported capabilities type. |
| packages/spec/src/data/datasource.test.ts | Update imports for renamed type. |
| packages/spec/src/data/dataset.zod.ts | Replace record field values with unknown. |
| packages/spec/src/data/data-engine.zod.ts | Harden request/contract types to unknown; narrow id to string |
| packages/spec/src/data/analytics.zod.ts | Export missing inferred type(s). |
| packages/spec/src/automation/workflow.zod.ts | Replace action values/input/additionalFields/data/context to unknown. |
| packages/spec/src/automation/webhook.zod.ts | Replace body type with unknown. |
| packages/spec/src/automation/trigger-registry.zod.ts | Replace defaults/validation/output/sample/config/metadata/credentials with unknown. |
| packages/spec/src/automation/sync.zod.ts | Replace filters/metadata with unknown. |
| packages/spec/src/automation/state-machine.zod.ts | Replace params/contextSchema/schema maps with unknown. |
| packages/spec/src/automation/flow.zod.ts | Replace config/input map values with unknown. |
| packages/spec/src/automation/etl.zod.ts | Replace config/cursorValue/metadata/details with unknown. |
| packages/spec/src/automation/approval.zod.ts | Replace action config map values with unknown. |
| packages/spec/src/api/websocket.zod.ts | Replace filter/event/presence payload metadata with unknown. |
| packages/spec/src/api/registry.zod.ts | Replace static schema/example/config/custom with unknown. |
| packages/spec/src/api/realtime.zod.ts | Rename presence schemas to RealtimePresence*; replace payload/metadata with unknown. |
| packages/spec/src/api/realtime.test.ts | Update tests to renamed presence schemas/types. |
| packages/spec/src/api/protocol.zod.ts | Harden various payload/record/maps to unknown. |
| packages/spec/src/api/odata.zod.ts | Replace response/value/inner error types with unknown. |
| packages/spec/src/api/hub.zod.ts | Harden install config/data to unknown. |
| packages/spec/src/api/http-cache.zod.ts | Replace response data type with unknown. |
| packages/spec/src/api/graphql.zod.ts | Replace directive args/defaultValue with unknown. |
| packages/spec/src/api/errors.zod.ts | Replace value/constraint/details with unknown; deprecate runtime helpers. |
| packages/spec/src/api/documentation.zod.ts | Replace OAuth flows/spec paths/components/body/vars with unknown. |
| packages/spec/src/api/contract.zod.ts | Replace record maps/details/data with unknown; add missing inferred type exports. |
| packages/spec/src/api/auth.zod.ts | Convert session-related date fields to ISO datetime strings. |
| packages/spec/src/api/analytics.zod.ts | Harden result rows/params to unknown; add missing inferred type exports. |
| packages/spec/src/ai/runtime-ops.zod.ts | Replace parameter/context/config maps with unknown. |
| packages/spec/src/ai/rag-pipeline.zod.ts | Replace custom metadata/config/filters with unknown. |
| packages/spec/src/ai/predictive.zod.ts | Replace defaults/custom/inputData/prediction/explanation value with unknown. |
| packages/spec/src/ai/plugin-development.zod.ts | Replace template defaults/configuration/config with unknown. |
| packages/spec/src/ai/orchestration.zod.ts | Replace schemas/contexts/fallback/output/conditions/config with unknown. |
| packages/spec/src/ai/nlq.zod.ts | Replace entity value/AST/results with unknown. |
| packages/spec/src/ai/model-registry.zod.ts | Replace prompt defaults/enum/examples input with unknown. |
| packages/spec/src/ai/devops-agent.zod.ts | Replace lint/format/additional configs with unknown. |
| packages/spec/src/ai/cost.zod.ts | Replace metadata maps with unknown. |
| packages/spec/src/ai/conversation.zod.ts | Replace metadata/scope maps with unknown. |
| packages/spec/src/ai/agent-action.zod.ts | Replace filters/fieldValues/fieldValue/taskData/contextData/content/data/details/default with unknown. |
| packages/spec/json-schema/ui/WidgetManifest.json | Regenerated schema reflecting stricter snake_case identifier constraints. |
| packages/spec/json-schema/ui/View.json | Regenerated schema for filter items + emptyState. |
| packages/spec/json-schema/ui/Theme.json | Regenerated schema reflecting shared identifier constraints. |
| packages/spec/json-schema/ui/Report.json | Regenerated schema reflecting shared identifier constraints. |
| packages/spec/json-schema/ui/PageTabsProps.json | Regenerated schema for children item typing. |
| packages/spec/json-schema/ui/PageCardProps.json | Regenerated schema for slot arrays. |
| packages/spec/json-schema/ui/ListView.json | Regenerated schema for filter items + emptyState. |
| packages/spec/json-schema/ui/FieldWidgetProps.json | Regenerated schema reflecting field deprecations/encryption docs/sortable/help text. |
| packages/spec/json-schema/ui/Dashboard.json | Regenerated schema for identifier constraints + refreshInterval. |
| packages/spec/json-schema/ui/App.json | Regenerated schema for objects/apis array item typing. |
| packages/spec/json-schema/ui/Action.json | Regenerated schema for deprecated location description. |
| packages/spec/json-schema/system/TranslationData.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/TranslationBundle.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/RenameObjectOperation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/RemoveFieldOperation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/ModifyFieldOperation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/MigrationDependency.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/MetadataRecord.json | Regenerated schema reflecting field renames and datetime string usage. |
| packages/spec/json-schema/system/MetadataManagerConfig.json | Regenerated schema for loaders item typing. |
| packages/spec/json-schema/system/KeyRotationPolicy.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/FieldEncryption.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/ExecuteSqlOperation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/EncryptionConfig.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/DeleteObjectOperation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/CreateObjectOperation.json | Regenerated schema reflecting object additions/deprecations/descriptions. |
| packages/spec/json-schema/system/CacheTier.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/CacheInvalidation.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/CacheConfig.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/system/BatchTask.json | Regenerated schema for items item typing. |
| packages/spec/json-schema/system/AuthConfig.json | Regenerated schema to reflect catchall additionalProperties behavior. |
| packages/spec/json-schema/system/AddFieldOperation.json | Regenerated schema reflecting richer descriptions + field additions/deprecations. |
| packages/spec/json-schema/shared/SortDirectionEnum.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/shared/MutationEventEnum.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/shared/MetadataFormat.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/shared/IsolationLevelEnum.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/shared/CacheStrategyEnum.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/shared/BaseMetadataRecord.json | New generated JSON schema for shared base record. |
| packages/spec/json-schema/shared/AggregationFunctionEnum.json | New generated JSON schema for shared enum. |
| packages/spec/json-schema/kernel/StartupOrchestrationResult.json | Regenerated schema for serializable error shape. |
| packages/spec/json-schema/kernel/PluginStartupResult.json | Regenerated schema for serializable error shape. |
| packages/spec/json-schema/kernel/PluginErrorEvent.json | Regenerated schema for serializable error shape. |
| packages/spec/json-schema/kernel/OpsPluginStructure.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/kernel/OpsDomainModule.json | Regenerated schema reflecting richer descriptions. |
| packages/spec/json-schema/kernel/KernelSecurityVulnerability.json | Regenerated schema reflecting kernel-prefixed renames. |
| packages/spec/json-schema/kernel/KernelSecurityScanResult.json | Regenerated schema reflecting kernel-prefixed renames. |
| packages/spec/json-schema/kernel/KernelSecurityPolicy.json | Regenerated schema reflecting kernel-prefixed renames. |
| packages/spec/json-schema/kernel/HookTriggeredEvent.json | Regenerated schema for args items typing. |
| packages/spec/json-schema/hub/LicenseMetricType.json | New/updated schema reflecting renamed enum and description. |
| packages/spec/json-schema/hub/Feature.json | Regenerated schema reflecting renamed metric type. |
| packages/spec/json-schema/data/SpecialOperator.json | Regenerated schema reflecting $exists rename. |
| packages/spec/json-schema/data/SQLDriverConfig.json | Regenerated schema reflecting isolation level enum unification. |
| packages/spec/json-schema/data/ObjectExtension.json | Regenerated schema reflecting object/field additions and deprecations. |
| packages/spec/json-schema/data/Object.json | Regenerated schema reflecting object/field additions and deprecations. |
| packages/spec/json-schema/data/NormalizedFilter.json | Regenerated schema reflecting $exists rename. |
| packages/spec/json-schema/data/NoSQLDriverConfig.json | Regenerated schema reflecting isolation level enum unification. |
| packages/spec/json-schema/data/Hook.json | Regenerated schema reflecting handler union change. |
| packages/spec/json-schema/data/FieldOperators.json | Regenerated schema reflecting $exists rename. |
| packages/spec/json-schema/data/Field.json | Regenerated schema reflecting field additions and deprecations. |
| packages/spec/json-schema/data/DriverInterface.json | Regenerated schema reflecting isolation level enum unification. |
| packages/spec/json-schema/data/DriverConfig.json | Regenerated schema reflecting isolation level enum unification. |
| packages/spec/json-schema/data/DriverCapabilities.json | Regenerated schema reflecting isolation level enum unification. |
| packages/spec/json-schema/data/DataEngineUpdateRequest.json | Regenerated schema reflecting id narrowing to string |
| packages/spec/json-schema/data/DataEngineRequest.json | Regenerated schema reflecting id narrowing to string |
| packages/spec/json-schema/data/DataEngineDeleteRequest.json | Regenerated schema reflecting id narrowing to string |
| packages/spec/json-schema/data/DataEngineBatchRequest.json | Regenerated schema reflecting id narrowing to string |
| packages/spec/json-schema/api/RealtimePresenceStatus.json | Regenerated schema reflecting renamed presence enum. |
| packages/spec/json-schema/api/RealtimePresence.json | Regenerated schema reflecting renamed presence schema. |
| packages/spec/json-schema/api/ObjectDefinitionResponse.json | Regenerated schema reflecting object/field additions and deprecations. |
| packages/spec/json-schema/api/GetUiViewResponse.json | Regenerated schema reflecting view emptyState and filter typing. |
| packages/spec/json-schema/api/GetMetaItemsResponse.json | Regenerated schema reflecting items array item typing. |
| packages/spec/json-schema/api/AppDefinitionResponse.json | Regenerated schema reflecting objects/apis items typing. |
| packages/spec/json-schema/api/ApiRegistryEntry.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/api/ApiRegistry.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/api/ApiParameter.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/api/ApiEndpointRegistration.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/api/ApiDiscoveryResponse.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/api/AnalyticsSqlResponse.json | Regenerated schema reflecting params items typing. |
| packages/spec/json-schema/ai/PromptVariable.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/ai/PromptTemplate.json | Regenerated schema reflecting enum array item typing. |
| packages/spec/json-schema/ai/ModelRegistry.json | Regenerated schema reflecting enum array item typing. |
Comments suppressed due to low confidence (1)
packages/spec/src/data/datasource.zod.ts:142
DatasourceConfigtype export was removed/renamed toDatasourceCapabilitiesType. Since this is a public spec package, dropping/renaming an exported type is a breaking change for downstream consumers. Consider re-exportingDatasourceConfigas a deprecated alias (pointing to the corrected type), or introduce a clearly namedDatasourceCapabilitiestype while keeping the old name for compatibility during the deprecation window.
| /** Record Types */ | ||
| recordTypes: z.array(z.string()).optional().describe('Record type names for this object'), | ||
|
|
||
| /** Sharing Model */ | ||
| sharingModel: z.enum(['private', 'read', 'read_write', 'full']).optional().describe('Default sharing model'), |
There was a problem hiding this comment.
sharingModel introduces a new enum ('private' | 'read' | 'read_write' | 'full') that overlaps conceptually with existing sharing/OWD concepts in security/sharing.zod.ts (e.g., OWDModel uses private, public_read, public_read_write, controlled_by_parent). Having two different value sets for the same concept will create interoperability issues across the spec. Consider reusing OWDModel here (or aligning the allowed values/naming) so object-level sharing is represented consistently across modules.
Systematic resolution of all issues identified in the ZOD_SCHEMA_AUDIT_REPORT across 139
.zod.tsfiles. Reducesz.any()from 394→62, increasesz.unknown()from 8→340, adds 25 missing type exports, and fixes 7 P0 bugs. All 3,073 tests pass.Phase 1: Critical Bug Fixes
data/hook.zod.ts—z.union([z.string(), z.any()])→z.union([z.string(), z.function()])(z.any() swallowed the union)data/validation.zod.ts—ValidationRuleSchema: z.ZodType<any>→ explicitBaseValidationRuleShapeinterface for the lazy recursive typesystem/auth-config.zod.ts— Invalid computed key[z.string().regex(...).toString()]: z.any()→.catchall(z.unknown())data/driver/mongo.zod.ts— Capability keys (aggregation,mutableSchema) silently stripped byparse()→ aligned withDatasourceCapabilitiesschemadata/datasource.zod.ts—DatasourceConfigtype alias pointed at wrong schema →DatasourceCapabilitiesTypekernel/plugin-lifecycle-events.zod.ts,kernel/startup-orchestrator.zod.ts—z.instanceof(Error)(not JSON-serializable) → structured error shapedata/filter.zod.ts—$exist→$exists(MongoDB standard)Phase 2: Deduplication & Naming
shared/enums.zod.ts(AggregationFunction, SortDirection, MutationEvent, IsolationLevel, CacheStrategy)shared/metadata-types.zod.ts(MetadataFormat, BaseMetadataRecord)Kernelprefix to resolve collisions with hub versionsMetricType→LicenseMetricTypeinhub/license.zod.ts/^[a-z_][a-z0-9_]*$/regex withSnakeCaseIdentifierSchemain 4 UI files_id/created_by/created_at→id/createdBy/createdAtin metadata-persistencez.date()→z.string().datetime()across 6 files (29 occurrences)service-registry.zod.ts→core-services.zod.tsPresenceSchema→RealtimePresenceSchemato disambiguate from WebSocket versionPhase 3: Type Safety Hardening
z.record(z.string(), z.any())→z.record(z.string(), z.unknown())for metadata/config/options/params fields (~200 occurrences)z.any()→z.unknown()for payload/context/data fields (~130 occurrences)id: z.any()→z.union([z.string(), z.number()])in data-engine request schemaskernel/plugin.zod.ts,data/driver.zod.ts,data/data-engine.zod.ts,kernel/events.zod.tsz.array(z.any())→z.array(z.unknown())in UI schemaslocationfield inaction.zod.tswith migration noticePhase 4: Completeness & Polish
z.infer<>type exports across 7 filesz.input<>exports for schemas with.default()(action, app, dashboard, object, manifest).describe()coverage in 5 under-documented files@deprecated(definePlugin,createErrorResponse,getHttpStatusForCategory)Object.assign(Schema, { create })→{ create } as constinapp.zod.tssortable,inlineHelpText,recordTypes,sharingModel,emptyState,refreshIntervalformula→expression,stateMachine→stateMachines💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.