Skip to content

chore(deps): upgrade zod to v4 - #35

Merged
willwashburn merged 1 commit into
mainfrom
claude/zod-v4-trajectories-9is4la
Jul 27, 2026
Merged

chore(deps): upgrade zod to v4#35
willwashburn merged 1 commit into
mainfrom
claude/zod-v4-trajectories-9is4la

Conversation

@willwashburn

@willwashburn willwashburn commented Jul 27, 2026

Copy link
Copy Markdown
Member

Bumps zod from ^3.23.0 to ^4.4.3 and migrates the affected APIs.

Changes

One hard break. ZodError.errors was removed in v4. createTrajectory and completeTrajectory (src/core/trajectory.ts:48, :218) read validation.error.errors[0] to surface the first message to the user; both now read .issues[0]. tsc caught these two and nothing else.

Deprecated spellings updated. z.string().url()z.url() (2 sites) and z.string().datetime()z.iso.datetime() (9 sites) in src/core/schema.ts. These still function in v4 but are deprecated in favour of the top-level forms.

Everything else was already v4-compatible. Notably describeReadFailure (src/storage/file.ts:164) and FileStorage.save (:427) both walk .issues with path / message, which is unchanged, so the quarantine and save-rejection messages keep their existing shape.

Verification

  • npm run typecheck, npm run build, npm run lint — clean
  • npm run test:run — 257/257 pass
  • CLI round-trip against the built dist: start → decision → complete → list, which exercises the write-side validateTrajectory and the read-side schema parse
  • Custom validation messages survive the upgrade — a malformed ID still reports id: Invalid trajectory ID format rather than v4's new generic wording

Note for whoever cuts the release

tsup externalizes dependencies, so zod is not bundled into dist — the published agent-trajectories package imports it at runtime. This bump therefore reaches consumers: anyone installing the next release pulls zod v4 instead of v3. npm resolution handles it fine (a consumer pinned to v3 just gets a nested v4), but it's a real dependency change in a published package rather than a dev-only bump, so it may warrant a minor rather than a patch.

Releases here are cut by pushing a v* tag, so that version choice is a manual call — nothing in this PR forces it. CHANGELOG.md is left untouched since it's generated.


Generated by Claude Code

Review in cubic

Bump zod from ^3.23.0 to ^4.4.3 and migrate the breaking/deprecated APIs:

- `ZodError.errors` was removed in v4; `createTrajectory`/`completeTrajectory`
  now read `error.issues[0]` (typecheck failed on the old property).
- `z.string().url()` -> `z.url()` and `z.string().datetime()` ->
  `z.iso.datetime()`, the non-deprecated v4 top-level forms.

Custom validation messages, issue paths, and the `describeReadFailure` /
`FileStorage.save` error rendering all keep their existing shape. Typecheck,
build, lint, and the full 257-test suite pass, and a CLI smoke test
(start -> decision -> complete -> list) round-trips through the write-side
`validateTrajectory` and read-side schema parse.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K2zPEUnsjW36Ezbg7gYm9x
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e33ed865-8a45-4f6f-ac54-9bafe1eb9aac

📥 Commits

Reviewing files that changed from the base of the PR and between c3a2b69 and 6b4ecc7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • package.json
  • src/core/schema.ts
  • src/core/trajectory.ts

📝 Walkthrough

Walkthrough

The PR upgrades Zod from 3.23.0 to 4.4.3, updates validation error access, and replaces URL and generic datetime validators with Zod 4 URL and ISO datetime validators across trajectory schemas.

Changes

Zod 4 validation migration

Layer / File(s) Summary
Zod 4 runtime compatibility
package.json, src/core/trajectory.ts
The Zod dependency is upgraded, and trajectory creation and completion read validation issues through validation.error.issues[0].
Stricter URL and datetime schemas
src/core/schema.ts
Trajectory-related URL fields use z.url(), while participation, chapter, trace, trajectory, and query timestamps use z.iso.datetime().

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: khaliqgant

Poem

I’m a bunny with schemas to tune,
Zod four now hops to the moon.
URLs stand clear,
ISO times appear,
And validation errors bloom!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely states the main change: upgrading Zod to v4.
Description check ✅ Passed The description accurately describes the Zod upgrade and the API migrations in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/zod-v4-trajectories-9is4la

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

@willwashburn
willwashburn merged commit 2ec99c4 into main Jul 27, 2026
9 checks passed
@willwashburn
willwashburn deleted the claude/zod-v4-trajectories-9is4la branch July 27, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants