[PR #1119] [MERGED] Fix lorebook update payload persistence #4932

Closed
opened 2026-10-22 04:11:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1119
Author: @cha1latte
Created: 5/23/2026
Status: ✅ Merged
Merged: 5/23/2026
Merged by: @cha1latte

Base: staging ← Head: fix/issue-1107-lorebook-persistence


📝 Commits (1)

  • 93a7497 Fix lorebook update payload persistence

📊 Changes

3 files changed (+105 additions, -16 deletions)

View changed files

📝 packages/server/src/routes/game.routes.ts (+23 -4)
📝 packages/server/src/routes/generate/lorebook-keeper-utils.ts (+43 -4)
📝 packages/server/src/services/conversation/character-commands.ts (+39 -8)

📄 Description

Linked issue

Closes #1107

Why this change

  • Game Mode and Professor Mari could receive lorebook update payloads shaped like the shared LorebookUpdateResult contract, with entry details nested under entry.
  • The existing persistence/parser paths only read top-level entryName / content fields, so those nested updates could result in no persisted lorebook entry even though the model-facing flow appeared successful.

What changed

  • Accept nested entry.name, entry.content, entry.keys, entry.tag, and related fields in Lorebook Keeper persistence.
  • Accept the same nested entry shape in Professor Mari update_lorebook commands.
  • Accept nested session entry payloads in the Game Lorebook Keeper session-end normalizer while preserving the existing top-level shape.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Machine verification: packages\server\node_modules\.bin\tsx.cmd scratch/issue-1107-lorebook-persistence-repro.mjs passed after reproducing the pre-fix failure. The harness covers nested LorebookUpdateResult-shaped creates, Professor Mari nested update_lorebook parsing, Game Lorebook Keeper nested session entry normalization, legacy top-level updates, malformed nested entries, and locked-entry protection.
  • Machine verification: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.
  • Machine verification: pnpm check passed. The first run timed out at 124 seconds with no failure; the rerun completed successfully.
  • Proof output: https://gist.github.com/cha1latte/788b594a5f06e1013cd994aa64b19b78

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

N/A - backend lorebook payload parsing/persistence fix.


🔄 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/1119 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/23/2026 **Status:** ✅ Merged **Merged:** 5/23/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-1107-lorebook-persistence` --- ### 📝 Commits (1) - [`93a7497`](https://github.com/Pasta-Devs/Marinara-Engine/commit/93a7497bd19a225a70039b2cc66c38ddc1bb10f8) Fix lorebook update payload persistence ### 📊 Changes **3 files changed** (+105 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/game.routes.ts` (+23 -4) 📝 `packages/server/src/routes/generate/lorebook-keeper-utils.ts` (+43 -4) 📝 `packages/server/src/services/conversation/character-commands.ts` (+39 -8) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #1107 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game Mode and Professor Mari could receive lorebook update payloads shaped like the shared `LorebookUpdateResult` contract, with entry details nested under `entry`. - The existing persistence/parser paths only read top-level `entryName` / `content` fields, so those nested updates could result in no persisted lorebook entry even though the model-facing flow appeared successful. ## What changed <!-- List the key changes in this PR --> - Accept nested `entry.name`, `entry.content`, `entry.keys`, `entry.tag`, and related fields in Lorebook Keeper persistence. - Accept the same nested entry shape in Professor Mari `update_lorebook` commands. - Accept nested session entry payloads in the Game Lorebook Keeper session-end normalizer while preserving the existing top-level shape. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Machine verification: `packages\server\node_modules\.bin\tsx.cmd scratch/issue-1107-lorebook-persistence-repro.mjs` passed after reproducing the pre-fix failure. The harness covers nested LorebookUpdateResult-shaped creates, Professor Mari nested `update_lorebook` parsing, Game Lorebook Keeper nested session entry normalization, legacy top-level updates, malformed nested entries, and locked-entry protection. - Machine verification: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. - Machine verification: `pnpm check` passed. The first run timed out at 124 seconds with no failure; the rerun completed successfully. - Proof output: https://gist.github.com/cha1latte/788b594a5f06e1013cd994aa64b19b78 ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) N/A - backend lorebook payload parsing/persistence fix. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:49 +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#4932
No description provided.