Skip to content

chore(deps): move to the zod 4 package and keep the v3 API via zod/v3 - #3774

Merged
knudtty merged 2 commits into
mainfrom
aaron/zod-v3-imports
Nov 23, 2026
Merged

knudtty merged 2 commits into
mainfrom
aaron/zod-v3-imports

Conversation

@knudtty

@knudtty knudtty commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #3773.

Zod 4.6.6 has been patched for a significant bug. Migrating every schema to the zod 4 API is a large change across the repo. This PR moves to the zod 4 package and keeps the zod 3 API through its zod/v3 subpath.

  • Bump zod from 3.25 to ^4.6.6 in api, app, common-utils and hdx-eval. yarn dedupe zod collapses the transitive zod 4 copies (MCP SDK, knip and others) to 4.6.7, so the lockfile has a single zod.
  • Change all 115 from 'zod' imports to from 'zod/v3'. No schema code changes.
  • Add yarn patches for zod-express-middleware@1.4.0 and @hookform/resolvers@3.9.0. Both only import zod in their .d.ts files, so each patch changes that one import to zod/v3. Without them, every route validator and form resolver fails to type check against the zod 4 root types.

References

@knudtty
knudtty added this pull request to stack #3775 November 23, 2026 18:17
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 23, 2026 8:26pm UTC
hyperdx-storybook Ready Ready Preview Nov 23, 2026 8:26pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a48fcb3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@hyperdx/api Patch
@hyperdx/app Patch
@hyperdx/common-utils Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 474 passed • 1 skipped • 1155s

Status Count
✅ Passed 474
❌ Failed 0
⚠️ Flaky 11
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@knudtty knudtty changed the title aaron/zod v3 imports chore(deps): move to the zod 4 package and keep the v3 API via zod/v3 Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 107 in total (1.12%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@knudtty
knudtty marked this pull request as ready for review November 23, 2026 18:28
@knudtty
knudtty requested a review from a team as a code owner November 23, 2026 18:28
@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI.

Why this tier:

  • Security-critical files (1) — auth or input validation, escalated at any size:
    • packages/api/src/utils/validators.ts
  • Critical-path files (11) — tenancy, public API, or shipped database config:
    • packages/api/src/routers/api/team.ts
    • packages/api/src/routers/external-api/v2/alerts.ts
    • packages/api/src/routers/external-api/v2/charts.ts
    • packages/api/src/routers/external-api/v2/connections.ts
    • packages/api/src/routers/external-api/v2/dashboards.ts
    • packages/api/src/routers/external-api/v2/savedSearches.ts
    • packages/api/src/routers/external-api/v2/search.ts
    • packages/api/src/routers/external-api/v2/sources.ts
    • packages/api/src/routers/external-api/v2/team.ts
    • packages/api/src/routers/external-api/v2/utils/dashboards.ts
    • packages/api/src/routers/external-api/v2/webhooks.ts
  • Cross-layer change: touches frontend (packages/app) + backend (packages/api) + shared utils (packages/common-utils)

Additional context: touches background tasks or the delivery pipeline lightly (4 lines, under the 30-line bar for Tier 4), touches the query rendering engine lightly (2 lines, under the 150-line bar for Tier 4), 3 file(s) in private internal-tooling packages, excluded from the line count

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 113
  • Production lines changed: 300 (+ 26 in test files, excluded from tier calculation)
  • Critical-path lines changed: 24
  • Branch: aaron/zod-v3-imports
  • Author: knudtty

To override this classification, remove the review/tier-4 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

Comment thread packages/hdx-eval/package.json Resolved
Base automatically changed from aaron/upgrade-images to main November 23, 2026 20:20
Bump zod from 3.25 to ^4.6.6 in api, app, common-utils and hdx-eval, and
switch every import to 'zod/v3' so schemas keep the zod 3 API without a
migration. yarn dedupe collapses the transitive zod 4 copies to 4.6.7.

zod-express-middleware and @hookform/resolvers 3.9 only import zod in their
type declarations; patch those to 'zod/v3' so they accept v3 schemas.
With the zod 4 package installed, 'zod' resolves to the v4 API, and editor
auto-imports pick it. v4 schemas don't compose with the shared v3 schemas and
throw a different ZodError class, so restrict 'zod', 'zod/v4' and 'zod/mini'
in api, app, common-utils and hdx-eval.

Enabling no-restricted-imports made four leftover eslint-disable directives
for it (from the old relative-import rule) report as unused; keep their
reasons as plain comments.
@knudtty
knudtty merged commit 210f3e2 into main Nov 23, 2026
31 of 33 checks passed

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — a48fcb3d Deployed Nov 23, 2026 by vercel[bot]
Preview – hyperdx-storybook — a48fcb3d Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants