[GH-ISSUE #4927] [Issue]: Professor Mari lorebook entry mutations skip syncCharacterBookFromLorebook (stale embedded character book) #2730

Closed
opened 2026-10-21 05:54:03 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Aug 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4927

Originally assigned to: @kolacheee on GitHub.

Summary

Every Professor Mari app_data lorebook entry mutation — lorebook.create (with entries), addEntry, updateEntry, and now deleteEntry (#4924) — goes through the generic mari-db mutation path and never calls syncCharacterBookFromLorebook. Only the HTTP routes (packages/server/src/routes/lorebooks.routes.ts) call it after a mutation. So when Mari edits a lorebook that is a character's embedded book (data.character_book), the character's derived copy is left stale, on both apply and Restore.

Expected behavior

After Mari adds, updates, or deletes a lorebook entry, any character whose embedded data.character_book derives from that lorebook is resynced (and re-synced again if the change is Restored), matching the HTTP route behavior.

Actual behavior

executeMutation/applyPlan in mari-db.service.ts write lorebook_entries directly with no syncCharacterBookFromLorebook call, so the embedded character book drifts out of sync for all of Mari's entry mutations.

Steps to reproduce

  1. Have a character with an embedded lorebook (data.character_book).
  2. Ask Mari to add/update/delete an entry in that lorebook.
  3. The lorebook row updates but the character's data.character_book still reflects the old entries.

Environment

  • Marinara Engine version: staging
  • Install type: source

Additional context

Surfaced by CodeRabbit on #4926 (the lorebook.deleteEntry PR), but it is pre-existing and systemic — addEntry/updateEntry (shipped in #4791/#4796) already have the same gap; deleteEntry just follows the established pattern. The fix belongs in the generic mutation/restore path so it covers all of Mari's lorebook entry mutations on both apply and Restore (a heavier change than #4924's focused scope), with regression coverage for apply and Restore against an embedded-book character.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Aug 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4927 Originally assigned to: @kolacheee on GitHub. ## Summary Every Professor Mari `app_data` lorebook *entry* mutation — `lorebook.create` (with entries), `addEntry`, `updateEntry`, and now `deleteEntry` (#4924) — goes through the generic `mari-db` mutation path and **never calls `syncCharacterBookFromLorebook`**. Only the HTTP routes (`packages/server/src/routes/lorebooks.routes.ts`) call it after a mutation. So when Mari edits a lorebook that is a character's embedded book (`data.character_book`), the character's derived copy is left stale, on both apply and Restore. ## Expected behavior After Mari adds, updates, or deletes a lorebook entry, any character whose embedded `data.character_book` derives from that lorebook is resynced (and re-synced again if the change is Restored), matching the HTTP route behavior. ## Actual behavior `executeMutation`/`applyPlan` in `mari-db.service.ts` write `lorebook_entries` directly with no `syncCharacterBookFromLorebook` call, so the embedded character book drifts out of sync for all of Mari's entry mutations. ## Steps to reproduce 1. Have a character with an embedded lorebook (`data.character_book`). 2. Ask Mari to add/update/delete an entry in that lorebook. 3. The lorebook row updates but the character's `data.character_book` still reflects the old entries. ## Environment - Marinara Engine version: staging - Install type: source ## Additional context Surfaced by CodeRabbit on #4926 (the `lorebook.deleteEntry` PR), but it is **pre-existing and systemic** — `addEntry`/`updateEntry` (shipped in #4791/#4796) already have the same gap; `deleteEntry` just follows the established pattern. The fix belongs in the generic mutation/restore path so it covers all of Mari's lorebook entry mutations on both apply and Restore (a heavier change than #4924's focused scope), with regression coverage for apply and Restore against an embedded-book character. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:54:03 +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#2730
No description provided.