@@ -13,14 +13,14 @@ Based on the full audit of 139 `.zod.ts` files (43,746 LOC, 1,089 schemas), the
1313
1414### Key Metrics Baseline
1515
16- | Metric | Current | Phase 2 Target | Phase 4 Target |
16+ | Metric | Original | Current | Phase 4 Target |
1717| ---| ---| ---| ---|
18- | ` z.any() ` usages | 397 | < 100 | < 30 |
19- | ` z.unknown() ` usages | 8 | > 200 | > 350 |
20- | ` z.infer ` coverage | 93% (1,011/1,089) | 98% | 100% |
21- | ` .describe() ` annotations | 5,026 | 5,300 | 5,600 |
22- | Schema duplications | 13+ pairs | 3 | 0 |
23- | Runtime logic violations | 2 files | 0 | 0 |
18+ | ` z.any() ` usages | 397 | 8 | 8 (filter operators only) |
19+ | ` z.unknown() ` usages | 8 | 340 | > 350 |
20+ | ` z.infer ` coverage | 93% (1,011/1,089) | ~ 98% | 100% |
21+ | ` .describe() ` annotations | 5,026 | 5,300+ | 5,600 |
22+ | Schema duplications | 13+ pairs | 1 | 0 |
23+ | Runtime logic violations | 2 files | 2 files | 0 |
2424| Naming violations | 3 | 0 | 0 |
2525
2626---
@@ -120,14 +120,14 @@ error: z.object({
120120
121121| # | Task | File(s) | Status |
122122| ---| ---| ---| ---|
123- | 1.1 | Fix z.any() in handler union | ` data/hook.zod.ts ` | ⬜ |
124- | 1.2 | Fix ValidationRuleSchema type-safety | ` data/validation.zod.ts ` | ⬜ |
125- | 1.3 | Fix invalid computed key syntax | ` system/auth-config.zod.ts ` | ⬜ |
126- | 1.4 | Fix Mongo capabilities key names | ` data/driver/mongo.zod.ts ` | ⬜ |
127- | 1.5 | Fix DatasourceConfig alias | ` data/datasource.zod.ts ` | ⬜ |
128- | 1.6 | Replace z.instanceof(Error) | ` kernel/plugin-lifecycle-events.zod.ts ` , ` kernel/startup-orchestrator.zod.ts ` | ⬜ |
129- | 1.7 | Fix ` $exist ` → ` $exists ` typo | ` data/filter.zod.ts ` | ⬜ |
130- | 1.8 | Run full test suite, verify build | — | ⬜ |
123+ | 1.1 | Fix z.any() in handler union | ` data/hook.zod.ts ` | ✅ |
124+ | 1.2 | Fix ValidationRuleSchema type-safety | ` data/validation.zod.ts ` | ✅ |
125+ | 1.3 | Fix invalid computed key syntax | ` system/auth-config.zod.ts ` | ✅ |
126+ | 1.4 | Fix Mongo capabilities key names | ` data/driver/mongo.zod.ts ` | ✅ |
127+ | 1.5 | Fix DatasourceConfig alias | ` data/datasource.zod.ts ` | ✅ |
128+ | 1.6 | Replace z.instanceof(Error) | ` kernel/plugin-lifecycle-events.zod.ts ` , ` kernel/startup-orchestrator.zod.ts ` | ✅ |
129+ | 1.7 | Fix ` $exist ` → ` $exists ` typo | ` data/filter.zod.ts ` | ✅ |
130+ | 1.8 | Run full test suite, verify build | — | ✅ |
131131
132132---
133133
@@ -272,17 +272,17 @@ Replace `z.date()` with `z.string().datetime()` in serializable schemas:
272272
273273| # | Task | File(s) | Status |
274274| ---| ---| ---| ---|
275- | 2.1 | Create ` shared/enums.zod.ts ` + update consumers | 8+ files | ⬜ |
276- | 2.2 | Create ` shared/metadata-types.zod.ts ` | 3 files | ⬜ |
277- | 2.3 | Deduplicate security schemas | 4 files | ⬜ |
278- | 2.4 | Rename ` MetricType ` in license.zod.ts | ` hub/license.zod.ts ` | ⬜ |
279- | 2.5 | Unify SnakeCaseIdentifierSchema usage | 4 UI files | ⬜ |
280- | 2.6 | Fix snake_case property keys | ` system/metadata-persistence.zod.ts ` | ⬜ |
281- | 2.7 | Replace z.date() with z.string().datetime() | 6 files | ⬜ |
282- | 2.8 | Unify isolation level enum | ` data/driver.zod.ts ` | ⬜ |
283- | 2.9 | Rename system/service-registry.zod.ts | 1 file + index | ⬜ |
284- | 2.10 | Deduplicate Presence schemas (realtime/websocket) | 2 files | ⬜ |
285- | 2.11 | Run full test suite, update index.ts re-exports | — | ⬜ |
275+ | 2.1 | Create ` shared/enums.zod.ts ` + update consumers | 8+ files | ✅ |
276+ | 2.2 | Create ` shared/metadata-types.zod.ts ` | 3 files | ✅ |
277+ | 2.3 | Deduplicate security schemas | 4 files | ✅ (Kernel uses Kernel-prefixed variants) |
278+ | 2.4 | Rename ` MetricType ` in license.zod.ts | ` hub/license.zod.ts ` | ✅ |
279+ | 2.5 | Unify SnakeCaseIdentifierSchema usage | 4 UI files | ✅ |
280+ | 2.6 | Fix snake_case property keys | ` system/metadata-persistence.zod.ts ` | ✅ |
281+ | 2.7 | Replace z.date() with z.string().datetime() | 6 files | ✅ |
282+ | 2.8 | Unify isolation level enum | ` data/driver.zod.ts ` | ✅ |
283+ | 2.9 | Rename system/service-registry.zod.ts | 1 file + index | ✅ |
284+ | 2.10 | Deduplicate Presence schemas (realtime/websocket) | 2 files | ✅ |
285+ | 2.11 | Run full test suite, update index.ts re-exports | — | ✅ |
286286
287287---
288288
@@ -387,18 +387,20 @@ Already replaced by `locations` array. Remove the deprecated field.
387387
388388| # | Task | Scope | z.any() Reduction | Status |
389389| ---| ---| ---| ---| ---|
390- | 3.1 | Bulk metadata/config z.any() → z.unknown() | ~ 88 files | -140 | ⬜ |
391- | 3.2 | Tighten id fields | 2 files | -2 | ⬜ |
392- | 3.3a | Harden kernel/plugin.zod.ts | 1 file | -20 | ⬜ |
393- | 3.3b | Harden data/driver.zod.ts | 1 file | -10 | ⬜ |
394- | 3.3c | Harden data/data-engine.zod.ts | 1 file | -8 | ⬜ |
395- | 3.3d | Harden kernel/events.zod.ts | 1 file | -8 | ⬜ |
396- | 3.3e | Harden kernel/manifest.zod.ts | 1 file | -7 | ⬜ |
397- | 3.4 | Fix UI z.any() with proper imports | 4 files | -6 | ⬜ |
398- | 3.5 | Remove deprecated action.location | 1 file | -1 | ⬜ |
399- | 3.6 | Run full test suite | — | — | ⬜ |
400-
401- ** Expected total reduction:** 397 → ~ 95 (` z.any() ` )
390+ | 3.1 | Bulk metadata/config z.any() → z.unknown() | ~ 88 files | -140 | ✅ |
391+ | 3.2 | Tighten id fields | 2 files | -2 | ✅ |
392+ | 3.3a | Harden kernel/plugin.zod.ts | 1 file | -23 | ✅ |
393+ | 3.3b | Harden data/driver.zod.ts | 1 file | -10 | ✅ |
394+ | 3.3c | Harden data/data-engine.zod.ts | 1 file | -8 | ✅ |
395+ | 3.3d | Harden kernel/events.zod.ts | 1 file | -8 | ✅ |
396+ | 3.3e | Harden kernel/manifest.zod.ts | 1 file | -7 | ✅ |
397+ | 3.4 | Fix UI z.any() with proper imports | 4 files | -6 | ✅ |
398+ | 3.5 | Remove deprecated action.location | 1 file | -1 | ✅ |
399+ | 3.6 | Replace z.any() in api/protocol.zod.ts | 1 file | -28 | ✅ |
400+ | 3.7 | Replace z.any() in hook, core-services, widget | 3 files | -3 | ✅ |
401+ | 3.8 | Run full test suite | — | — | ✅ |
402+
403+ ** Actual total reduction:** 397 → 8 (` z.any() ` ) — remaining 8 are legitimate filter operators ($eq/$ne/$in/$nin)
402404
403405---
404406
@@ -513,7 +515,7 @@ formula: z.string().optional()
513515
514516| # | Task | Scope | Status |
515517| ---| ---| ---| ---|
516- | 4.1 | Add missing z.infer exports | 14 files | ⬜ |
518+ | 4.1 | Add missing z.infer exports | 14 files | ✅ (1 remaining: WidgetSource added) |
517519| 4.2 | Add z.input<> exports for transform schemas | ~ 20 files | ⬜ |
518520| 4.3 | Improve .describe() coverage | 9 files | ⬜ |
519521| 4.4 | Move runtime logic to core/runtime | 3 files | ⬜ |
0 commit comments