chore(deps): bump zod to v4#933
Open
SnowboardTechie wants to merge 1 commit into
Open
Conversation
Contributor
|
🚀 Website Preview Deployed! Preview your changes at: https://cg-pr-933.billy-daly.workers.dev This preview will be automatically deleted when the PR is closed. |
f219093 to
37b45ad
Compare
Bump the catalog zod range ^3.25.76 -> ^4.4.3. zod is a runtime dependency of the published @common-grants/sdk and @common-grants/cli, so this is a release-warranting change (changeset included). Breaking changes adapted for zod v4: - z.record(X) single-arg form dropped -> z.record(z.string(), X) (models.ts otherDates/customFields/customFilters, with-custom-fields.ts DEFAULT_VALUE_SCHEMAS.object + the error-message example, and three specs). - ZodType generic dropped its middle Def param: z.ZodType<Out, Def, In> -> z.ZodType<Out, In> (client OppSchema; plugin transform framework define-plugin.ts + transforms.ts, where z.ZodType<T, z.ZodTypeDef, any> -> z.ZodType<T, any>). - ZodObject generics collapsed (UnknownKeysParam / catchall removed): HasCustomFields now z.ZodObject<Shape>. - AnyZodObject removed -> z.ZodObject (extensible-schema-coverage test). - Response helpers (Ok/Paginated/Sorted/Filtered/Created) switched their generic constraint from the deprecated z.ZodTypeAny to z.ZodType so v4 carries the concrete output type through .extend (fixes .data inference). - CLI validation error wording changed "Invalid url" -> "Invalid URL" (error-handling test assertion). templates/express-js pins zod directly and is a manually-maintained, out-of-workspace template (not catalog-managed, not in CI) -- left untouched. Verified: pnpm run ci green across core, changelog-emitter, cli, sdk, website.
37b45ad to
911d0ca
Compare
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.
Summary
zodrange^3.25.76→^4.4.3(latest 4.x).zodis a runtime dependency of the published@common-grants/sdkand@common-grants/cli, so this is a release-warranting change — a patch changeset is included (per ADR-0010 + chore(deps): bump the runtime group across 1 directory with 3 updates #821 precedent).pnpm run ciis green across every package.Changes proposed
zod: ^3.25.76→^4.4.3in thecatalog:block ofpnpm-workspace.yaml, lockfile regenerated, plus the v4 source/test adaptations.Breaking changes handled
z.record()single-arg dropped → two-argz.record(z.string(), …):models.ts(otherDates,customFields,customFilters),with-custom-fields.ts(DEFAULT_VALUE_SCHEMAS.object+ the error-message example), and two specs.ZodTypegeneric dropped its middleDefparam:z.ZodType<Out, Def, In>→z.ZodType<Out, In>(clientOppSchema).ZodObjectgenerics collapsed (UnknownKeysParam/ catchall removed):HasCustomFields→z.ZodObject<Shape>.AnyZodObjectremoved →z.ZodObject(extensible-schema-coveragetest).Ok/Paginated/Sorted/Filtered/Created) switched their generic constraint from the deprecatedz.ZodTypeAnytoz.ZodType, so v4 carries the concrete output type through.extend(fixes.datainference in the client).Invalid url→Invalid URL(error-handlingtest assertion).Changeset:
.changeset/zod-v4.md—patchfor@common-grants/sdkand@common-grants/cli(the two published packages that depend onzodat runtime viadependencies). Thewebsitealso consumeszodbut is private and not changeset-tracked.Out of scope:
templates/express-jspinszoddirectly (not catalog-managed, not in the workspace, not in CI) — per the repo's "templates are manually maintained, refreshed deliberately" convention, its pin is left untouched and would be a separate deliberate refresh.Context for reviewers
Local verification (documented nix dev env, Node 22):
pnpm run ci→ green across core, changelog-emitter, cli (119), sdk (380), website (69). No TS errors, prettier clean, cspell clean.pnpm audit --audit-level high: the onehigh(undiciviawebsite > wrangler > miniflare) is pre-existing onmain—undici@7.24.8is byte-identical betweenmainand this branch; the lockfile diff does not touchundici. This bump introduces no new advisories.Consumer integration (per the repo rule that SDK/runtime changes are validated from a downstream consumer): the local v4 SDK was packed to a tarball and installed into the consumer harness alongside the
ts-cg-grants-govplugin. The SDK packs to a valid publish shape and the consumer plugin builds, type-checks (tsc), and packs successfully against the v4 SDK tarball; the installed SDK correctly declares and resolveszod@4.4.3downstream. The harness's existing example scenarios fail on missing exports (PluginError,F,classifyFilters) — that is pre-existing scenario drift against an older SDK surface (those symbols don't exist onmain, with or without this bump), not a v4 regression.Additional information
The deprecated v4 method forms still used in the codebase (
z.string().uuid()/url()/datetime(),.strict(),.passthrough(),.merge(),z.ZodTypeAnyin non-inference positions) compile and run unchanged under v4, so they are intentionally left as-is to keep the diff minimal; they can be modernized separately if desired.