[GH-ISSUE #8221] Migrate Zod 4 on staging while preserving stored data and transfers #8161

Closed
opened 2026-10-25 04:03:07 +07:00 by bsakaguchi · 2 comments
Owner

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

Originally assigned to: @SpicyMarinara on GitHub.

Problem

PR #8210 updates Zod from 3.25.76 to version 4, but the current schemas use APIs and parsing behavior that changed between major versions. The original dependency-only PR did not build. DOMPurify 3.4.17 is already present on staging.

Scope

@SpicyMarinara / Codex owns the compatibility work in existing PR #8210, targeting staging only.

  • Upgrade direct Zod consumers to the current stable 4.6.7 release and adapt removed APIs.
  • Preserve sparse records, nested defaults, optional fields, saved data, and import/export behavior.
  • Update ruleset JSON-schema generation without discarding its existing editor metadata.
  • Add no new import/export size or collection limits.
  • Keep the immediate request-validation hardening in #8216 separate; a major-version upgrade alone does not bound unbounded collections.

Validation

Run the full project check, meaningful parsing/import/export and ruleset-schema regressions, local review, and all required hosted checks plus Dottore review before staging merge.


Compatibility and security blocker — not ready to merge

Owner: @SpicyMarinara / Codex. The existing PR #8210 stays draft, targeting staging. Its published head is ccd3c374409f766fe0671969309ba8142353ba23; it must not be merged as it stands.

The native Zod 4.6.7 core migration is implemented. The full local pnpm check passed, including production client/server builds and the unchanged bundle budget. All 33 exported update schemas matched the captured Zod 3 empty-update baseline (19 accept with {}, 14 intentionally reject). The maintained real-route/storage compatibility regression and ruleset editor-schema regression passed. Local review found one small stored-parameter test gap; the added assertions received a completed two-file follow-up review with zero findings. Local validation used a private reconstructed dependency forest, not a successful frozen reinstall; earlier environment and disk failures are retained separately.

There is a separate, real public-contract blocker: downloaded packages are explicitly promised Zod 3 in the client host namespace and shared package-server imports. The existing marinara-host-namespace regression fails against the native-4 candidate with 4 !== 3. Silently replacing that library would break installed agents; changing only the advertised major or weakening that regression would not make the packages compatible.

A deliberately scoped zod-v3: npm:zod@3.25.76 production alias was investigated locally to preserve those interfaces while leaving the Engine core on native Zod 4. The exact repository audit command, pnpm audit --audit-level low --json, then exited 1 with one HIGH finding: GHSA-mrhx-c7xc-m3w5, affecting <4.6.6, through the client/server legacy 3.25.76 dependency. The production-only audit reported the same finding. The compatibility proposal has not been pushed or merged, and its runtime/lifecycle validation is unfinished. No audit suppression, fabricated version or silent major-API change was applied.

A mergeable resolution needs a coordinated SDK/downloaded-package migration to native Zod 4, or a genuinely patched legacy dependency that preserves the documented interface. That broader migration is not part of this PR's current authorized scope. #8216 tracks separate Engine request prevalidation; it is not complete remediation of legacy package validators. Keep #8221 open for this blocker. The premature translation follow-up #8226 is being closed because its proposed compatibility documentation never shipped.

Originally created by @SpicyMarinara on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8221 Originally assigned to: @SpicyMarinara on GitHub. ## Problem PR #8210 updates Zod from 3.25.76 to version 4, but the current schemas use APIs and parsing behavior that changed between major versions. The original dependency-only PR did not build. DOMPurify 3.4.17 is already present on staging. ## Scope @SpicyMarinara / Codex owns the compatibility work in existing PR #8210, targeting staging only. - Upgrade direct Zod consumers to the current stable 4.6.7 release and adapt removed APIs. - Preserve sparse records, nested defaults, optional fields, saved data, and import/export behavior. - Update ruleset JSON-schema generation without discarding its existing editor metadata. - Add no new import/export size or collection limits. - Keep the immediate request-validation hardening in #8216 separate; a major-version upgrade alone does not bound unbounded collections. ## Validation Run the full project check, meaningful parsing/import/export and ruleset-schema regressions, local review, and all required hosted checks plus Dottore review before staging merge. --- ## Compatibility and security blocker — not ready to merge Owner: @SpicyMarinara / Codex. The existing PR #8210 stays **draft**, targeting **staging**. Its published head is `ccd3c374409f766fe0671969309ba8142353ba23`; it must not be merged as it stands. The native Zod 4.6.7 core migration is implemented. The full local `pnpm check` passed, including production client/server builds and the unchanged bundle budget. All 33 exported update schemas matched the captured Zod 3 empty-update baseline (19 accept with `{}`, 14 intentionally reject). The maintained real-route/storage compatibility regression and ruleset editor-schema regression passed. Local review found one small stored-parameter test gap; the added assertions received a completed two-file follow-up review with zero findings. Local validation used a private reconstructed dependency forest, not a successful frozen reinstall; earlier environment and disk failures are retained separately. There is a separate, real public-contract blocker: downloaded packages are explicitly promised **Zod 3** in the client host namespace and shared package-server imports. The existing `marinara-host-namespace` regression fails against the native-4 candidate with `4 !== 3`. Silently replacing that library would break installed agents; changing only the advertised major or weakening that regression would not make the packages compatible. A deliberately scoped `zod-v3: npm:zod@3.25.76` production alias was investigated locally to preserve those interfaces while leaving the Engine core on native Zod 4. The exact repository audit command, `pnpm audit --audit-level low --json`, then exited **1** with **one HIGH** finding: [GHSA-mrhx-c7xc-m3w5](https://github.com/advisories/GHSA-mrhx-c7xc-m3w5), affecting `<4.6.6`, through the client/server legacy 3.25.76 dependency. The production-only audit reported the same finding. The compatibility proposal has **not been pushed or merged**, and its runtime/lifecycle validation is unfinished. No audit suppression, fabricated version or silent major-API change was applied. A mergeable resolution needs a coordinated SDK/downloaded-package migration to native Zod 4, or a genuinely patched legacy dependency that preserves the documented interface. That broader migration is not part of this PR's current authorized scope. #8216 tracks separate Engine request prevalidation; it is not complete remediation of legacy package validators. Keep #8221 open for this blocker. The premature translation follow-up #8226 is being closed because its proposed compatibility documentation never shipped.
bsakaguchi 2026-10-26 04:03:15 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 25, 2026):

Owner: @SpicyMarinara / Codex. Resuming the closed native-core candidate for the authorized issue sweep. Current staging now includes a reviewed Zod 3 security backport, so I am testing native Zod 4 core validation with an explicit backported Zod 3 compatibility alias for the documented API-1 package interfaces. No package library major will be silently changed. PR #8210 will remain draft until the compatibility, storage/transfer, install, security, and review gates pass.

<!-- gh-comment-id:6395970050 --> @SpicyMarinara commented on GitHub (Oct 25, 2026): Owner: @SpicyMarinara / Codex. Resuming the closed native-core candidate for the authorized issue sweep. Current staging now includes a reviewed Zod 3 security backport, so I am testing native Zod 4 core validation with an explicit backported Zod 3 compatibility alias for the documented API-1 package interfaces. No package library major will be silently changed. PR #8210 will remain draft until the compatibility, storage/transfer, install, security, and review gates pass.
Author
Owner

@SpicyMarinara commented on GitHub (Oct 25, 2026):

Implemented in PR #8210, merged to staging as 7bb1c9c19e7dcc1f98d3facdbcab0690cffc4e5c from reviewed head ea12cf9fbe7137b2d0a7dc22d41287cea1fcb56d. Head/merge ancestry is verified; the actual merged tree b83f61b11197b2b2cdaf9e0b7626ace82056a330 matches the predicted native-plus-world-clock merge.

Engine core now uses native Zod 4.6.7. Existing API-1 packages retain their synchronous, patched Zod 3 namespace in a separate lazy chunk. Sparse updates, nested defaults, party-summary fallback, bounded HTTP diagnostics, imports/transfers and generated ruleset schemas retain their intended behavior.

Full local pnpm check, the actual installed-package production browser case, static chunk graph, import/security/native-export controls and all hosted required checks, Node shards and platform jobs passed. The combined candidate also passed a full check, 11 focused regression files, and the final Gacha package's real five-process update/offline/uninstall lifecycle with all seven saved documents preserved. Local CodeRabbit findings and all three substantive Dottore findings were reproduced and addressed; final Dottore was Viable, With Notes, with all threads resolved. Mari explicitly authorized approval of this exact head and checking only the verified automated validation item; both manual boxes remain unchecked.

The existing exact-version legacy security backport remains required for API-1 compatibility; the configured audit passes with its reviewed exception, not a claim that raw upstream advisory metadata is clean. Post-merge staging CI is tracked separately as the final media PR proceeds. Translated SDK/schema documentation is tracked by #8303. No app/storage-format/API version change or main promotion.

<!-- gh-comment-id:6397180180 --> @SpicyMarinara commented on GitHub (Oct 25, 2026): Implemented in [PR #8210](https://github.com/Pasta-Devs/Marinara-Engine/pull/8210), merged to `staging` as `7bb1c9c19e7dcc1f98d3facdbcab0690cffc4e5c` from reviewed head `ea12cf9fbe7137b2d0a7dc22d41287cea1fcb56d`. Head/merge ancestry is verified; the actual merged tree `b83f61b11197b2b2cdaf9e0b7626ace82056a330` matches the predicted native-plus-world-clock merge. Engine core now uses native Zod 4.6.7. Existing API-1 packages retain their synchronous, patched Zod 3 namespace in a separate lazy chunk. Sparse updates, nested defaults, party-summary fallback, bounded HTTP diagnostics, imports/transfers and generated ruleset schemas retain their intended behavior. Full local `pnpm check`, the actual installed-package production browser case, static chunk graph, import/security/native-export controls and all hosted required checks, Node shards and platform jobs passed. The combined candidate also passed a full check, 11 focused regression files, and the final Gacha package's real five-process update/offline/uninstall lifecycle with all seven saved documents preserved. Local CodeRabbit findings and all three substantive Dottore findings were reproduced and addressed; final Dottore was **Viable, With Notes**, with all threads resolved. Mari explicitly authorized approval of this exact head and checking only the verified automated validation item; both manual boxes remain unchecked. The existing exact-version legacy security backport remains required for API-1 compatibility; the configured audit passes with its reviewed exception, not a claim that raw upstream advisory metadata is clean. Post-merge staging CI is tracked separately as the final media PR proceeds. Translated SDK/schema documentation is tracked by #8303. No app/storage-format/API version change or main promotion.
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-Engine#8161
No description provided.