Repository navigation
Update zod to v4 and vite to v8 - #215
Conversation
Bump `zod` ^3.23.0 → ^4.4.3 (core, extension, desktop) and `vite` ^7.0.4 → ^8.0.16 (desktop). Vite 8 forces two transitive bumps: `vitest` ^3 → ^4 (vitest 3 caps at vite 7) and `@vitejs/plugin-react` ^4 → ^6 (plugin-react 4 caps at vite 7). vitest is bumped across all three packages to avoid a split major in the lockfile. The only code change is in the IPC `call` helper: zod 4 reworked `ZodType`'s generics from `<Output, Def, Input>` to `<Output, Input, Internals>` and dropped the exported `ZodTypeDef`, so `ZodType<TOutput, ZodTypeDef, unknown>` becomes `ZodType<TOutput, unknown>` (same output/input intent). Verified: typecheck, full test suite (1741 tests), lint, the desktop `vite build` (vite 8 / Rolldown), and the extension `wxt build` all pass. Node v24 satisfies vite 8's engine; AI SDK v6 accepts zod 4. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WalkthroughUpgrades ChangesZod v4 and tooling upgrade
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Follow-up cleanup of the deprecated-but-functional zod calls left after the v4 bump. In zod 4 these are thin aliases over the new top-level functions, so the migration is behavior-preserving (the existing test suite already runs on zod 4.4.3 and the capture-envelope fixtures pin the edge cases — uppercase UUIDs, localhost URLs, calendar-invalid timestamps): - z.string().uuid() -> z.uuid() - z.string().url() -> z.url() - z.string().datetime() -> z.iso.datetime() - z.object(...).passthrough() -> z.looseObject(...) Verified: typecheck, full test suite (1741 tests), and lint all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3da5fa3. Configure here.
Bugbot caught a contract regression introduced by the zod 3→4 bump: `z.uuid()` enforces RFC 4122 version/variant nibbles, but the native host's `is_uuid` (apps/native-host/src/envelope.rs) accepts any 8-4-4-4-12 hex string. A stricter drain would quarantine captures the host already spooled. zod 3's `z.string().uuid()` was loose; zod 4 silently tightened it (the deprecated method aliases the strict `z.uuid()`), and the fixtures only covered RFC-valid v4 UUIDs so the gap went unnoticed. Switch the envelope id to `z.guid()` — zod 4's loose 8-4-4-4-12 hex validator — which mirrors the host exactly (verified: it still rejects dots/traversal, preserving the path-safety guard). Add a shared parity fixture with a non-RFC hex id so both the zod and Rust parity tests pin this and the drift can't recur silently. Verified: typecheck, full TS suite (1742 tests), the Rust parity test (shared_fixtures_pin_the_ts_contract), and lint all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The vite-8 cascade bumped vitest to ^4 in core, extension, and desktop but missed packages/db, leaving it on ^3 — a split vitest major in one workspace. Bump it too; its single dialect test passes unchanged on vitest 4. (The lingering transitive vite@7.3.5 is wxt-internal, owned by wxt@0.20.26 / @wxt-dev/module-react, not this skew — left as-is since the extension still builds on vite 8.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

What
Updates two dependencies to their latest major versions:
zod^3.23.0/3.23.0^4.4.3/4.4.3vite^7.0.4^8.0.16@vitejs/plugin-react^4.6.0^6.0.2vitest^3^4Why
Requested dependency refresh to latest.
zodandvitewere the targets; the other two bumps are forced by vite 8 —vitest@3caps at vite 7 and@vitejs/plugin-react@4caps at vite 7.vitestis bumped in all three packages (not just desktop) so the lockfile doesn't carry a split major.Code change
One file: the IPC
callhelper inpackages/core/src/ipc/invoke.ts. zod 4 reworkedZodType's generics from<Output, Def, Input>to<Output, Input, Internals>and removed the exportedZodTypeDef, soZodType<TOutput, ZodTypeDef, unknown>becomesZodType<TOutput, unknown>— same output/input intent.Reviewer notes
build.rolldownOptionsinstead of Rollup options..passthrough()(3 sites) andz.string().uuid()/.url()/.datetime()(capture-envelope, page-text). They still work and all tests pass; migrating them toz.looseObject/z.uuid()/z.url()is optional follow-up, not done here to keep this change minimal.ai@6) accepts zod 4 (^4.1.8); Node v24 satisfies vite 8's>=22.12.0engine.Verification
All green:
pnpm typecheck— 4 packagespnpm test— 1741 tests (core 761, desktop 948, extension 28, db 4)pnpm lint— only pre-existing warnings, none in touched filesvite build— succeeds (vite 8 / Rolldown)wxt build— succeeds on Vite 8.0.16🤖 Generated with Claude Code
Note
Medium Risk
Wide-reaching validation and desktop bundler changes (Zod 4 + Vite 8/Rolldown); capture
z.guid()is a deliberate contract tweak that must stay in sync with the Rust host parity tests.Overview
Major dependency refresh across the monorepo: Zod 3 → 4.4.3 (core, extension, desktop), Vite 7 → 8 and @vitejs/plugin-react 6 (desktop), and Vitest 3 → 4 (core, extension, desktop, db), with lockfile updates (Vite 8’s Rolldown-based bundler chain).
Zod 4 API migrations in shared validation code: IPC
callnow types schemas asZodType<TOutput, unknown>(dropsZodTypeDef). Settings, frontmatter, and chat history usez.looseObjectinstead of.object().passthrough(). Capture and extension wire schemas move toz.guid(),z.url(), andz.iso.datetime()— notablyz.guid()on captureidso drain validation matches the native host’s looser hex-UUID rules (not RFCz.uuid()). A parity fixture documents acceptance of non-RFC UUIDs.Build/test tooling only: no product feature logic beyond validation shape compatibility.
Reviewed by Cursor Bugbot for commit 54bca82. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit