[GH-ISSUE #1577] deps: migrate the host schema contract before adopting Zod 4 #1554

Closed
opened 2026-10-23 04:02:57 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @SpicyMarinara on GitHub (Oct 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1577

Originally assigned to: @SpicyMarinara on GitHub.

Compatibility blocker

The dependency-only Zod 4 upgrade in #1559 cannot currently preserve the Engine/schema contract. The compatible tooling consolidation is #1576, tracked in #1575. @SpicyMarinara owns this follow-up.

On unchanged Agents staging source at 96e05d42b923006f14281c5b1589f443f68b4a39, the existing World Maps regression passes with Zod 3.25.76:

npm ci
npx tsx --tsconfig tests/tsconfig.regressions.json tests/map-location-limit.regression.ts

Changing only the root dependency/lockfile to Zod 4.6.7 makes that same test fail before assertions:

packages/hierarchical-maps/src/engine/packages/maps-shared/src/maps-model.ts:50
TypeError: import_shared.spatialContextDefinitionSchema.innerType is not a function

Maps currently unwraps the Engine's refined schema, replaces its captured 500-location ceiling with the package's 5,000-location ceiling, then reapplies the remaining shared validation. Zod 4 removes the ZodEffects wrapper and changes how refinements live on schemas, as described in its official migration guide. Simply deleting the unwrap or retaining every original refinement would alter validation and reject valid larger maps.

Current Engine shared, server, and client manifests all declare zod: ^3.25.76; Agents intentionally resolves the same dependency across its captured shared code and feature builds, and browser packages receive the Engine's Zod object through the host namespace. Version 3.25.76 is also the latest published Zod 3 release.

Required before adopting Zod 4

Trace and migrate the shared schema/refinement boundary together with Engine, preserving every existing validation rule and the package's location ceiling. Validate captured schemas, build-time use, host runtime use, and package browser behavior without duplicating or weakening the host contract. This requires a deliberate coordinated migration rather than a dependency-only maintenance bump. Keep Zod 3.25.76 until that proof exists.

Originally created by @SpicyMarinara on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/1577 Originally assigned to: @SpicyMarinara on GitHub. ## Compatibility blocker The dependency-only Zod 4 upgrade in #1559 cannot currently preserve the Engine/schema contract. The compatible tooling consolidation is #1576, tracked in #1575. @SpicyMarinara owns this follow-up. On unchanged Agents `staging` source at `96e05d42b923006f14281c5b1589f443f68b4a39`, the existing World Maps regression passes with Zod 3.25.76: ```sh npm ci npx tsx --tsconfig tests/tsconfig.regressions.json tests/map-location-limit.regression.ts ``` Changing only the root dependency/lockfile to Zod 4.6.7 makes that same test fail before assertions: ```text packages/hierarchical-maps/src/engine/packages/maps-shared/src/maps-model.ts:50 TypeError: import_shared.spatialContextDefinitionSchema.innerType is not a function ``` Maps currently unwraps the Engine's refined schema, replaces its captured 500-location ceiling with the package's 5,000-location ceiling, then reapplies the remaining shared validation. Zod 4 removes the `ZodEffects` wrapper and changes how refinements live on schemas, as described in its [official migration guide](https://zod.dev/v4/changelog#drops-zodeffects). Simply deleting the unwrap or retaining every original refinement would alter validation and reject valid larger maps. Current Engine shared, server, and client manifests all declare `zod: ^3.25.76`; Agents intentionally resolves the same dependency across its captured shared code and feature builds, and browser packages receive the Engine's Zod object through the host namespace. Version 3.25.76 is also the latest published Zod 3 release. ## Required before adopting Zod 4 Trace and migrate the shared schema/refinement boundary together with Engine, preserving every existing validation rule and the package's location ceiling. Validate captured schemas, build-time use, host runtime use, and package browser behavior without duplicating or weakening the host contract. This requires a deliberate coordinated migration rather than a dependency-only maintenance bump. Keep Zod 3.25.76 until that proof exists.
bsakaguchi 2026-10-23 04:02:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1554
No description provided.