[PR #1709] [MERGED] fix(long-term-memory): load newer settings on zod 4 and oversized lists (1.4.94) #1701

Closed
opened 2026-10-27 06:05:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1709
Author: @Promansis
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @Promansis

Base: staging ← Head: fix(long-term-memory)/zod-v4-lenient-settings


📝 Commits (4)

  • a1f8ca8 fix(long-term-memory): load newer settings on zod 4 and oversized lists (#1688)
  • 4a8e2d6 Merge upstream/staging into fix(long-term-memory)/zod-v4-lenient-settings; release long-term-memory 1.4.94
  • a0e6eeb fix(long-term-memory): keep a wrong-typed list failing on zod 4 (1.4.94)
  • 998e842 fix(long-term-memory): only a string enum miss counts as a newer option (1.4.94)

📊 Changes

15 files changed (+230 additions, -110 deletions)

View changed files

➕ artifacts/long-term-memory-1.4.94.zip (+0 -0)
📝 catalog/catalog.json (+6 -6)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+6 -6)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+6 -6)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/long-term-memory/CHANGELOG.md (+4 -0)
📝 packages/long-term-memory/manifest.json (+3 -3)
📝 packages/long-term-memory/server.mjs (+39 -39)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/persistence/backup-restore.ts (+1 -1)
📝 packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts (+51 -14)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/long-term-memory-routes.regression.ts (+4 -1)
📝 tests/long-term-memory-storage.regression.ts (+91 -15)

📄 Description

Pull request

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #1688

Why this change

  • Long-Term Memory reads settings a newer version wrote leniently: it drops fields, enum values and out-of-range values this version does not know instead of failing to start. That relied on zod 3's issue codes. zod 4 names an enum miss invalid_value (as it does a literal miss), and both zod 4 and the Engine's patched zod 3.25.76 report only the range of a list that is over its maximum, never its entries. So a newer enum value kept the file from loading, or a newer entry in an oversized list dropped the whole list. This is also the long-term-memory-storage failure seen in #1670.

What changed

  • Affected package ID: long-term-memory (1.4.94, rebuilt manifest, server.mjs, artifacts/long-term-memory-1.4.94.zip and catalog entries).
  • settings.ts: invalid_value counts as an unknown enum value except on the top-level version, which still fails the parse. When a list is over its range, each entry is checked alone and only the ones with an unknown enum value are dropped; the old whole-list fallback applies only if nothing was dropped. readLtmSettingsFile and backup-restore.ts readConfig accept z.ZodType<T, any, any> so they typecheck under zod 3 and 4.
  • tests/long-term-memory-storage.regression.ts: existing assertions accept both zod 3 and 4 issue codes; one new case runs the splitter against a zod/v4 schema (unknown key, enum miss, oversized list with one newer entry, a range value, version: 2, and a list still oversized after the drop).
  • Follow-up in the second commit: the first CI run on the Engine's staging (now zod ^4.6.7) showed zod 4 also reports too_big beside invalid_type for a string given where a list belongs, so the range fallback dropped a wrong-typed field and it loaded. settings.ts now skips a range issue when the same path has a type error, with a regression case. The storage and route tests also matched zod 3 message text (greater than or equal, invalid_enum_value|Required); they accept zod 4's wording too.
  • Dottore finding (Low): zod 4 reports every enum non-member as invalid_value, including null and numbers. isUnknownEnumValue now takes the stored value and accepts invalid_value only for a string, with a zod 4 case for mode: null and modes: ["a", 5]. A list over its maximum with no unknown string entry still falls back as a whole, as documented.
  • Merged upstream/staging (gacha-forge changes) and released through reland.mjs.

Package and security impact

  • Affected package IDs: long-term-memory
  • Engine compatibility impact: none; engine.min / engine.maxExclusive unchanged.
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none. Newer values stay on disk and are written back on save, as before. Request bodies stay strict.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Author-run on HEAD 998e84237 against Engine 81f0896d3 (zod 3.25.76): test-ltm.sh storage, test-ltm.sh routes-backup, npm run check, npm run typecheck:packages, test-catalog-lanes, validate-package-locales, validate-catalog, catalog-release-notes and catalog-generatedat-determinism regressions.
  • Author-run against a separate throwaway checkout of Engine staging (81f07e4, zod 4.6.7), as the Long-Term Memory package browser workflow does: all nine Engine-backed suites (storage branch-recall engine-fields routes routes-imports routes-scope-identity routes-backup installation host-styles) pass, and node scripts/typecheck-packages.mjs long-term-memory reports no strict errors.
  • These are notes, not the checklist above. Not installed through a running Engine.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

None; no UI change.

🤖 Generated with Claude Code


🔄 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-Agents/pull/1709 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `staging` ← **Head:** `fix(long-term-memory)/zod-v4-lenient-settings` --- ### 📝 Commits (4) - [`a1f8ca8`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a1f8ca87dd1cbc2530ff5b4a4e6a836ba8ac9ce9) fix(long-term-memory): load newer settings on zod 4 and oversized lists (#1688) - [`4a8e2d6`](https://github.com/Pasta-Devs/Marinara-Agents/commit/4a8e2d6305573dfdf152b6dffff0b3eb5e80105e) Merge upstream/staging into fix(long-term-memory)/zod-v4-lenient-settings; release long-term-memory 1.4.94 - [`a0e6eeb`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a0e6eeb0d254d9f4c3db8d02edc17668ecab30a9) fix(long-term-memory): keep a wrong-typed list failing on zod 4 (1.4.94) - [`998e842`](https://github.com/Pasta-Devs/Marinara-Agents/commit/998e84237cfa186a77e145dcbfde033ce352a20d) fix(long-term-memory): only a string enum miss counts as a newer option (1.4.94) ### 📊 Changes **15 files changed** (+230 additions, -110 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/long-term-memory-1.4.94.zip` (+0 -0) 📝 `catalog/catalog.json` (+6 -6) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+6 -6) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+6 -6) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/long-term-memory/CHANGELOG.md` (+4 -0) 📝 `packages/long-term-memory/manifest.json` (+3 -3) 📝 `packages/long-term-memory/server.mjs` (+39 -39) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/persistence/backup-restore.ts` (+1 -1) 📝 `packages/long-term-memory/src/engine/packages/server/src/services/long-term-memory/settings.ts` (+51 -14) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/long-term-memory-routes.regression.ts` (+4 -1) 📝 `tests/long-term-memory-storage.regression.ts` (+91 -15) </details> ### 📄 Description # Pull request > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #1688 ## Why this change - Long-Term Memory reads settings a newer version wrote leniently: it drops fields, enum values and out-of-range values this version does not know instead of failing to start. That relied on zod 3's issue codes. zod 4 names an enum miss `invalid_value` (as it does a literal miss), and both zod 4 and the Engine's patched zod 3.25.76 report only the range of a list that is over its maximum, never its entries. So a newer enum value kept the file from loading, or a newer entry in an oversized list dropped the whole list. This is also the `long-term-memory-storage` failure seen in #1670. ## What changed - Affected package ID: `long-term-memory` (1.4.94, rebuilt manifest, `server.mjs`, `artifacts/long-term-memory-1.4.94.zip` and catalog entries). - `settings.ts`: `invalid_value` counts as an unknown enum value except on the top-level `version`, which still fails the parse. When a list is over its range, each entry is checked alone and only the ones with an unknown enum value are dropped; the old whole-list fallback applies only if nothing was dropped. `readLtmSettingsFile` and `backup-restore.ts` `readConfig` accept `z.ZodType<T, any, any>` so they typecheck under zod 3 and 4. - `tests/long-term-memory-storage.regression.ts`: existing assertions accept both zod 3 and 4 issue codes; one new case runs the splitter against a `zod/v4` schema (unknown key, enum miss, oversized list with one newer entry, a range value, `version: 2`, and a list still oversized after the drop). - Follow-up in the second commit: the first CI run on the Engine's `staging` (now zod `^4.6.7`) showed zod 4 also reports `too_big` beside `invalid_type` for a string given where a list belongs, so the range fallback dropped a wrong-typed field and it loaded. `settings.ts` now skips a range issue when the same path has a type error, with a regression case. The storage and route tests also matched zod 3 message text (`greater than or equal`, `invalid_enum_value|Required`); they accept zod 4's wording too. - Dottore finding (Low): zod 4 reports every enum non-member as `invalid_value`, including `null` and numbers. `isUnknownEnumValue` now takes the stored value and accepts `invalid_value` only for a string, with a zod 4 case for `mode: null` and `modes: ["a", 5]`. A list over its maximum with no unknown string entry still falls back as a whole, as documented. - Merged `upstream/staging` (gacha-forge changes) and released through `reland.mjs`. ## Package and security impact - Affected package IDs: `long-term-memory` - Engine compatibility impact: none; `engine.min` / `engine.maxExclusive` unchanged. - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none. Newer values stay on disk and are written back on save, as before. Request bodies stay strict. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Author-run on HEAD `998e84237` against Engine `81f0896d3` (zod 3.25.76): `test-ltm.sh storage`, `test-ltm.sh routes-backup`, `npm run check`, `npm run typecheck:packages`, `test-catalog-lanes`, `validate-package-locales`, `validate-catalog`, `catalog-release-notes` and `catalog-generatedat-determinism` regressions. - Author-run against a separate throwaway checkout of Engine `staging` (`81f07e4`, zod 4.6.7), as the Long-Term Memory package browser workflow does: all nine Engine-backed suites (`storage branch-recall engine-fields routes routes-imports routes-scope-identity routes-backup installation host-styles`) pass, and `node scripts/typecheck-packages.mjs long-term-memory` reports no strict errors. - These are notes, not the checklist above. Not installed through a running Engine. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) None; no UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 06:05: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#1701
No description provided.