chore(deps): zod 4 — one validation major across the fleet's flagship - #857
Merged
Conversation
The fleet audit found the core validation library split across a breaking major: FleetCrown on zod 4, this repo (whose validation.ts is the SSOT the whole entity system parses through) on 3. This closes the split, plus the audit's small stragglers: dotenv 17, framer-motion 13, @playwright/test aligned to the playwright already installed, zod-to-openapi ^9 (the ^7 line is zod-3-only and threw on every schema at spec generation). The migration surface, all mechanical: - ZodError's .errors alias is gone: 35 files move to .issues (including the ZodLikeError shape in standardResponse and the jest suites) - required_error / invalid_type_error / errorMap params are gone: replaced with v4 error callbacks in finance, projects, and the social routes - single-argument z.record(V) is gone: ten files gain the explicit z.record(z.string(), V) key type - .refine's function-form second argument is gone: usernameSchema and the phone validator move the message into an error callback - ZodType<T, ZodTypeDef, unknown> generics: v4 dropped ZodTypeDef - .uuid() is RFC-strict in v4 (variant nibble must be 8/9/a/b) while our ids are whatever Postgres was handed — demo rows included — so all 67 id validations move to .guid(), which is v3's exact behavior. Strictness for ids we mint is the DB's job, not the parser's. - the schema-drift audit test re-learns v4 internals (_zod.def, checks not wrappers, catchall-based passthrough) Also: both CLAUDE.md stack tables stop claiming Tailwind 3.3 / TS 5.8 — main has been on Tailwind 4 for months and the stale table has actively misled agents (this audit included, until measured). type-check clean; lint clean; 282 suites / 2645 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fleet currency arc, Wave 3 (first of two OC PRs; the jest→Vitest conversion follows separately). FleetCrown runs zod 4; this repo — whose validation.ts is the SSOT the whole entity system parses through — ran 3. This closes the split, plus the audit's stragglers: dotenv 17, framer-motion 13, @playwright/test aligned to the playwright already in the tree, zod-to-openapi ^9 (the ^7 line is zod-3-only and threw on every schema at spec generation).
Migration surface (all mechanical):
.errorsalias →.issues(35 files, incl. ZodLikeError in standardResponse)required_error/invalid_type_error/errorMap→ v4errorcallbacks (finance, projects, social routes)z.record(V)→z.record(z.string(), V)(10 files).refinefn-form second arg →errorcallback (usernameSchema, phone)ZodType<T, ZodTypeDef, unknown>→ZodType<T, unknown>.uuid()→.guid()at all 67 id validations: v4's.uuid()is RFC-strict (variant nibble 8/9/a/b) while our ids are whatever Postgres was handed — demo rows included..guid()is v3's exact behavior; strictness for ids we mint is the DB's job, not the parser's._zod.def, refinements-as-checks, catchall-based passthrough)Also fixes both CLAUDE.md stack tables, which still claimed Tailwind 3.3 / TS 5.8 months after main moved — stale prose that actively misled agents (this audit included, until measured).
Verification: type-check clean, lint clean, 282 suites / 2645 tests green locally.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn