[PR #8394] [MERGED] fix(packages): preserve legacy validators across dependency layouts #8573

Closed
opened 2026-11-07 16:45:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8394
Author: @SpicyMarinara
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/8393-map-activation


📝 Commits (7)

  • 6389719 test: reproduce package compatibility failures in hoisted installs (#8393)
  • 50da983 fix(packages): resolve snapshot dependencies from the Engine manifest
  • 555e800 fix(packages): preserve declared bundled dependencies in snapshots
  • 63d02f2 fix(packages): recover persisted legacy-validator activation failures
  • a8eafc9 test: compare canonical Windows paths in dependency fixture
  • eb165bb fix(packages): keep host dependency failures out of package rollback
  • 227890a test: pin combined host-failure return before package rollback

📊 Changes

8 files changed (+536 additions, -51 deletions)

View changed files

📝 .github/workflows/pull-request-checks.yml (+4 -0)
📝 docs/development/optional-agent-packages.md (+18 -9)
📝 packages/server/src/services/capability-packages/capability-module-runtime.service.ts (+22 -7)
📝 packages/server/src/services/capability-packages/capability-native-dependencies.service.ts (+69 -18)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+17 -1)
➕ scripts/regressions/capability-hoisted-dependencies.regression.ts (+205 -0)
📝 scripts/regressions/capability-server-externals.regression.ts (+194 -13)
📝 scripts/regressions/startup-inject-gate.regression.ts (+7 -3)

📄 Description

Linked issue

Closes #8393

Why this change

The Zod 3 compatibility repair assumed that dependencies were physically present in packages/server/node_modules. Hoisted and partially hoisted layouts can leave that folder absent or incomplete while the Engine still resolves its dependencies normally. Downloaded packages then lose their compatibility links and can load native Zod 4, reproducing the exact At.innerType / Ct.innerType failures from World Maps 1.7.1 and rollback 1.6.0. An external data folder can lose the other shared imports too.

There is also a persisted recovery gap: prior Zod failures are saved as terminal package errors, and startup excludes them before the repaired loader runs. Therefore an installation can remain disabled even when it already contains #8210. The actual published Maps and Slurp payloads reproduce this state with the previous loader.

The reporter's exact dependency layout is unknown. This PR fixes the reproduced loader defect; it does not assume that the reporter installed with npm or that their Engine build was stale.

What changed

  • Resolve host-managed package dependencies from the Engine server manifest using Node's package resolver, supporting direct, hoisted and partial layouts and data folders outside the checkout.
  • Preserve patched Zod 3 for package imports while Engine core keeps native Zod 4. Missing or incompatible compatibility dependencies produce a clear activation error. Missing optional/development libraries are skipped; installed development tools remain available.
  • Classify Engine dependency setup failures separately from package faults: preserve the requested version and previous-version metadata, avoid a rollback or terminal package error, and retry after the Engine dependency is repaired. Preserve the original failure if snapshot cleanup also fails.
  • Preserve declared package-owned dependency trees and the existing non-destructive treatment of real legacy dependency directories. Map documents, chat selections and package data are not migrated or deleted.
  • Retry only the known legacy-validator error signatures for API-1 server packages, keeping normal compatibility and file-integrity checks before import. Other error messages stay disabled; successful normal activation clears the saved errors.
  • Add Windows junction coverage for the layout regression and the complete installed-package server ABI, including package-owned dependencies.
  • Correct the SDK's dependency-resolution description. #8395 tracks the translated documentation on docs-i18n.

Validation

  • pnpm install completed.
  • Initial layout regression: three controls passed and six layout cases failed before the fix. The same pre-fix regression also failed in native Windows CI; raw logs are retained. The expanded regression passes 14/14 cases locally, including missing/wrong-major compatibility dependencies, required/optional missing metadata, scoped imports, hidden package metadata exports and development-tool retention.
  • Existing server-externals regression passed, including default/named/CommonJS/subpath Zod ABI, host module identity, moved/dangling legacy links, unmanaged-directory preservation, native core Zod 4 and the new package-owned dependency activation case. The bundled-dependency review case was reproduced before the correction and passes afterward.
  • Both unchanged published Maps 1.7.1 and 1.6.0 server bundles pass all 16 direct/hoisted/partial/external-data import combinations with patched Zod 3.25.76.
  • Actual compiled Engine activation of complete verified Maps 1.7.1 and Slurp2 0.4.1 payloads reached active/ready without rollback or network requests. A pre-existing package-owned saved-map document remained byte-equivalent.
  • Actual official staging catalog/downloader fetched and hash-verified the 581,365-byte Maps 1.7.1 archive (04b45bf0d1d90041cc61d6d40e06a19c90a84130339a6d85fbddf888d66c6a82), installed it, and activated it to ready with the saved-map document unchanged. This used disposable external data and made only catalog/artifact requests to the official Agents repository.
  • Final pnpm check passed at eb165bbe8f71ddef2893a8bb3b8817e897b854f5, including formatting, localization, lint/type checks and production build. One existing client hook warning remains. Final desktop Chromium smoke passed 7/7. The package lifecycle regression passed.
  • Actual published Maps 1.7.1 and Slurp2 0.4.1 payloads seeded in persisted error state now recover to active/ready with their saved-map document unchanged and zero network requests. Before the recovery fix, Maps remained excluded as having no server runtime. The startup regression also proves unrelated errors stay quarantined and a recognized-but-tampered package is rejected before execution.
  • Local CodeRabbit full review completed; its one bundled-dependency finding was reproduced and repaired. Both subsequent repair reviews completed with zero remaining findings, including the recovery delta. The subsequent host-failure repair and Windows path correction were also reviewed with zero findings. Independent source reviews passed.

Dottore's first full review at 63d02f254 identified one LOW defect: a host dependency failure could roll the package back and leave it disabled after host repair. The actual activation regression failed before the repair (v2 became v1), then passed with a typed host error, v2/previous-v1 metadata preserved, and successful activation after restoring the alias. The final host-error patch preserves normal integrity/code-failure handling.

The first repaired Windows run passed 13/14 layout controls; the remaining test compared an 8.3 short pathname with the equivalent long pathname before reaching its metadata-refusal assertion. Both sides now use realpath; equality and the required-dependency negative control remain intact. Raw original logs are retained. At production head eb165bbe8, native Windows subsequently passed both steps: 14/14 layout cases plus the complete server activation/ABI regression. Dottore completed the incremental repair review with zero defects, one optional note, and automatically resolved the original finding.

Manual verification notes

  • Manually verify World Maps activation, existing maps and date/time on the affected Windows installation after updating and restarting Engine.
  • Manually verify World Maps installation through Download Agents in the browser.

The source/layout, package activation and real downloader probes ran on macOS/Node with disposable data. Native Windows CI is configured to run dependency junctions and the complete server contract; final-head GitHub checks and Dottore Review remain merge gates. These are not claims of testing the reporter's physical installation or browser UI. The Discord attachments linked in the issue currently return HTTP 403.

Docs and release impact

English SDK documentation updated; #8395 tracks translations. No Engine version, storage-format, capability API or downloadable package version change. No frontend layout or user-facing control change.

Final test-only follow-up

Candidate 227890a5798e7599ab1f66177a67142967a934c5 changes only startup-inject-gate.regression.ts from the reviewed production head eb165bbe8. That old structural assertion pinned the lifecycle-only condition and its exact comment; it now requires the combined lifecycle/dependency guard's complete early-return block to end before rollback. The equality/ordering requirement is preserved and strengthened; production files are unchanged.

The focused regression and its local CodeRabbit review pass. The previous full Node run passed 1,122/1,123 files and identified only this stale assertion; the final candidate is rerunning the complete hosted gates. Local compiled/runtime/download proofs and pnpm check remain accurately pinned to the identical production code at eb165bbe8.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8394 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/8393-map-activation` --- ### 📝 Commits (7) - [`6389719`](https://github.com/Pasta-Devs/Marinara-Engine/commit/63897196a4dfb83a0c661173a69a17155bf8c077) test: reproduce package compatibility failures in hoisted installs (#8393) - [`50da983`](https://github.com/Pasta-Devs/Marinara-Engine/commit/50da983db994c527e2d3bcc7460b2babec12dd65) fix(packages): resolve snapshot dependencies from the Engine manifest - [`555e800`](https://github.com/Pasta-Devs/Marinara-Engine/commit/555e8007879f8d82a299070acb56221ca1b2b345) fix(packages): preserve declared bundled dependencies in snapshots - [`63d02f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/63d02f2543502a8017df596d02b22663eb422272) fix(packages): recover persisted legacy-validator activation failures - [`a8eafc9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a8eafc9b42376ac445d0e915a54f4d1e28a144ae) test: compare canonical Windows paths in dependency fixture - [`eb165bb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eb165bbe8f71ddef2893a8bb3b8817e897b854f5) fix(packages): keep host dependency failures out of package rollback - [`227890a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/227890a5798e7599ab1f66177a67142967a934c5) test: pin combined host-failure return before package rollback ### 📊 Changes **8 files changed** (+536 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/pull-request-checks.yml` (+4 -0) 📝 `docs/development/optional-agent-packages.md` (+18 -9) 📝 `packages/server/src/services/capability-packages/capability-module-runtime.service.ts` (+22 -7) 📝 `packages/server/src/services/capability-packages/capability-native-dependencies.service.ts` (+69 -18) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+17 -1) ➕ `scripts/regressions/capability-hoisted-dependencies.regression.ts` (+205 -0) 📝 `scripts/regressions/capability-server-externals.regression.ts` (+194 -13) 📝 `scripts/regressions/startup-inject-gate.regression.ts` (+7 -3) </details> ### 📄 Description ## Linked issue Closes #8393 ## Why this change The Zod 3 compatibility repair assumed that dependencies were physically present in `packages/server/node_modules`. Hoisted and partially hoisted layouts can leave that folder absent or incomplete while the Engine still resolves its dependencies normally. Downloaded packages then lose their compatibility links and can load native Zod 4, reproducing the exact `At.innerType` / `Ct.innerType` failures from World Maps 1.7.1 and rollback 1.6.0. An external data folder can lose the other shared imports too. There is also a persisted recovery gap: prior Zod failures are saved as terminal package errors, and startup excludes them before the repaired loader runs. Therefore an installation can remain disabled even when it already contains #8210. The actual published Maps and Slurp payloads reproduce this state with the previous loader. The reporter's exact dependency layout is unknown. This PR fixes the reproduced loader defect; it does not assume that the reporter installed with npm or that their Engine build was stale. ## What changed - Resolve host-managed package dependencies from the Engine server manifest using Node's package resolver, supporting direct, hoisted and partial layouts and data folders outside the checkout. - Preserve patched Zod 3 for package imports while Engine core keeps native Zod 4. Missing or incompatible compatibility dependencies produce a clear activation error. Missing optional/development libraries are skipped; installed development tools remain available. - Classify Engine dependency setup failures separately from package faults: preserve the requested version and previous-version metadata, avoid a rollback or terminal package error, and retry after the Engine dependency is repaired. Preserve the original failure if snapshot cleanup also fails. - Preserve declared package-owned dependency trees and the existing non-destructive treatment of real legacy dependency directories. Map documents, chat selections and package data are not migrated or deleted. - Retry only the known legacy-validator error signatures for API-1 server packages, keeping normal compatibility and file-integrity checks before import. Other error messages stay disabled; successful normal activation clears the saved errors. - Add Windows junction coverage for the layout regression and the complete installed-package server ABI, including package-owned dependencies. - Correct the SDK's dependency-resolution description. #8395 tracks the translated documentation on docs-i18n. ## Validation - `pnpm install` completed. - Initial layout regression: three controls passed and six layout cases failed before the fix. The same pre-fix regression also failed in native Windows CI; raw logs are retained. The expanded regression passes 14/14 cases locally, including missing/wrong-major compatibility dependencies, required/optional missing metadata, scoped imports, hidden package metadata exports and development-tool retention. - Existing server-externals regression passed, including default/named/CommonJS/subpath Zod ABI, host module identity, moved/dangling legacy links, unmanaged-directory preservation, native core Zod 4 and the new package-owned dependency activation case. The bundled-dependency review case was reproduced before the correction and passes afterward. - Both unchanged published Maps 1.7.1 and 1.6.0 server bundles pass all 16 direct/hoisted/partial/external-data import combinations with patched Zod 3.25.76. - Actual compiled Engine activation of complete verified Maps 1.7.1 and Slurp2 0.4.1 payloads reached active/ready without rollback or network requests. A pre-existing package-owned saved-map document remained byte-equivalent. - Actual official staging catalog/downloader fetched and hash-verified the 581,365-byte Maps 1.7.1 archive (`04b45bf0d1d90041cc61d6d40e06a19c90a84130339a6d85fbddf888d66c6a82`), installed it, and activated it to ready with the saved-map document unchanged. This used disposable external data and made only catalog/artifact requests to the official Agents repository. - Final `pnpm check` passed at `eb165bbe8f71ddef2893a8bb3b8817e897b854f5`, including formatting, localization, lint/type checks and production build. One existing client hook warning remains. Final desktop Chromium smoke passed 7/7. The package lifecycle regression passed. - Actual published Maps 1.7.1 and Slurp2 0.4.1 payloads seeded in persisted error state now recover to active/ready with their saved-map document unchanged and zero network requests. Before the recovery fix, Maps remained excluded as having no server runtime. The startup regression also proves unrelated errors stay quarantined and a recognized-but-tampered package is rejected before execution. - Local CodeRabbit full review completed; its one bundled-dependency finding was reproduced and repaired. Both subsequent repair reviews completed with zero remaining findings, including the recovery delta. The subsequent host-failure repair and Windows path correction were also reviewed with zero findings. Independent source reviews passed. Dottore's first full review at `63d02f254` identified one LOW defect: a host dependency failure could roll the package back and leave it disabled after host repair. The actual activation regression failed before the repair (v2 became v1), then passed with a typed host error, v2/previous-v1 metadata preserved, and successful activation after restoring the alias. The final host-error patch preserves normal integrity/code-failure handling. The first repaired Windows run passed 13/14 layout controls; the remaining test compared an 8.3 short pathname with the equivalent long pathname before reaching its metadata-refusal assertion. Both sides now use `realpath`; equality and the required-dependency negative control remain intact. Raw original logs are retained. At production head `eb165bbe8`, native Windows subsequently passed both steps: 14/14 layout cases plus the complete server activation/ABI regression. Dottore completed the incremental repair review with zero defects, one optional note, and automatically resolved the original finding. ### Manual verification notes - [ ] Manually verify World Maps activation, existing maps and date/time on the affected Windows installation after updating and restarting Engine. - [ ] Manually verify World Maps installation through Download Agents in the browser. The source/layout, package activation and real downloader probes ran on macOS/Node with disposable data. Native Windows CI is configured to run dependency junctions and the complete server contract; final-head GitHub checks and Dottore Review remain merge gates. These are not claims of testing the reporter's physical installation or browser UI. The Discord attachments linked in the issue currently return HTTP 403. ## Docs and release impact English SDK documentation updated; #8395 tracks translations. No Engine version, storage-format, capability API or downloadable package version change. No frontend layout or user-facing control change. ## Final test-only follow-up Candidate `227890a5798e7599ab1f66177a67142967a934c5` changes only `startup-inject-gate.regression.ts` from the reviewed production head `eb165bbe8`. That old structural assertion pinned the lifecycle-only condition and its exact comment; it now requires the combined lifecycle/dependency guard's complete early-return block to end before rollback. The equality/ordering requirement is preserved and strengthened; production files are unchanged. The focused regression and its local CodeRabbit review pass. The previous full Node run passed 1,122/1,123 files and identified only this stale assertion; the final candidate is rerunning the complete hosted gates. Local compiled/runtime/download proofs and pnpm check remain accurately pinned to the identical production code at eb165bbe8. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:45:41 +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-Engine#8573
No description provided.