Skip to content

feat!: migrate public schemas to Zod 4 for Charter 3.0.0 - #413

Merged
stackbilt-admin merged 10 commits into
mainfrom
feat/issue-310-zod4-major
Nov 2, 2026
Merged

stackbilt-admin merged 10 commits into
mainfrom
feat/issue-310-zod4-major

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Problem and result

Charter exports Zod schema objects from core, blast, and surface. Moving them from Zod 3 to patched Zod 4 changes their consumer-facing runtime/type APIs, so this PR prepares a unified 3.0.0 major release, rather than concealing the change in a dependency patch. It resolves the remaining HIGH Zod advisory without suppressing the audit.

All five workspace Zod declarations now require ^4.6.6 (lockfile: 4.6.7), all 13 published package versions are 3.0.0, and scaffolded Zod dependencies use the same patched floor. The private root version stays 0.11.0. The MCP alias record supplies explicit key and value schemas. Governance identifiers use z.guid() to preserve previously accepted UUID-like identifiers, rather than silently adopting Zod 4's stricter version/variant checks.

Migration notes: docs/migrations/3.0.0-zod-4.md. They explain public schema extension, .issues error handling, runtime constructor identity, safe-integer/non-finite validation changes, defaults, and unchanged Node engine declarations. No public export is removed or renamed. Existing JSON defaults, unknown-key stripping, map behavior, transforms, and notary checks are covered by regression tests.

Closes #310 when merged. Related #397.

Prerequisite and review scope

This branch includes the compatible dependency repair commits from #404, whose tip is 41c32f983df6be971383fef81f2723e4824e8921. The implementation-only comparison is against that commit/branch. The PR targets main so the repository's pull_request: branches: [main] CI runs.

#404 alone still has the Zod audit failure. This PR supplies the first complete zero-audit candidate; after approval, a merge commit preserving its included #404 ancestry can incorporate both without bypassing #404's red audit gate. Do not merge either PR or publish packages until the release coordinator receives explicit approval. Re-enable Dependabot Zod-major updates only after the migration lands.

Validation evidence

Windows Node 24.19.0 / pnpm 9.15.9, isolated worktree:

  • pnpm install --no-frozen-lockfile resolved the migration; a subsequent elevated pnpm install --frozen-lockfile --force repaired an interrupted local install and passed without lockfile edits.
  • pnpm run build: passed.
  • pnpm run typecheck: passed.
  • pnpm run publish:check: passed for all packed artifacts.
  • pnpm audit --json: zero vulnerabilities (0 low/moderate/high/critical). Gate remains unchanged. Evidence: coordinator evidence/issue-310-audit.json.
  • pnpm exec vitest run packages/cli/src/__tests__/zod4-compat.test.ts packages/cli/src/__tests__/serve-zod4.test.ts: 7/7 passed after dependency repair. Includes a real MCP stdio initialize/list-tools/valid-call/invalid-call round trip.
  • Final clean pnpm run test: 1,936 passed, 4 failed, 1,940 total, 217.11 seconds. The four failures exactly match the established Windows baseline: bootstrap's POSIX-host path premise, context-refresh and serve-context path separators, and Ctrl-D fake-TTY behavior. No additional failing test identified. Final log: worktree .cache/issue-310-tests-final.log.
  • Manual checks: mutating one parse's alias/extension defaults does not affect later parses; .safeExtend() on the public refined notary schema retains all three cross-field checks.
  • All 13 published package versions verified as 3.0.0; original LF/CRLF styles preserved in all 19 modified tracked files. Whitespace validation uses core.whitespace=cr-at-eol for the existing CRLF core schema file.
  • Historical PR chore(deps): bump zod from 3.25.76 to 4.6.5 #290 Governance run 35507494106 was inspected: build failed TS2554 at serve.ts's one-argument z.record; that actual incompatibility is fixed here. Current context-refresh uses Charter's snapshot parser, rather than the historical Zod-based implementation mentioned in the issue.

An earlier test attempt overlapped an interrupted dependency reinstall and is intentionally excluded as invalid evidence. Full Linux/Node 20 CI is required before approval; a green governance workflow summary alone does not prove its advisory continue-on-error steps passed. No merging, tagging, publishing, deployment, production data modification, or remote branch deletion performed.

@stackbilt-admin
stackbilt-admin marked this pull request as ready for review November 2, 2026 15:58
@stackbilt-admin
stackbilt-admin merged commit 6715b9f into main Nov 2, 2026
7 checks passed
@stackbilt-admin
stackbilt-admin deleted the feat/issue-310-zod4-major branch November 27, 2026 23:55
stackbilt-admin added a commit that referenced this pull request Nov 28, 2026
Rename the [Unreleased] content to a [3.0.0] section with a YYYY-MM-DD
date placeholder for the release owner, add a fresh empty [Unreleased],
and add the missing entries: the Zod 4 breaking change with the
migration guide link (#310 / #413), the security pins (#404, #425), the
MCP SDK 1.32.1 -> 1.32.2 bump (b38f04a) and the fixes from #398, #399,
#400, #341, #389, #401, #402, #403, #409, #410 and #411.

Docs only; no package versions or code change.

Refs #397

Co-authored-by: Kurt Overmier <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

chore(deps): migrate zod 3 → 4 across the workspace

2 participants