mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6546
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4933
Author: @kolacheee
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @kolacheee
Base:
staging← Head:fix/mari-lorebook-charbook-sync📝 Commits (2)
609ec31fix(mari): sync an embedded character's lorebook on Mari's generic mutations (#4927)2bb45d7test(mari): assert the embedded-sync restore succeeds before reading content (#4927)📊 Changes
3 files changed (+125 additions, -0 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/services/mari-db/mari-db.service.ts(+36 -0)📝
scripts/regressions/open-issues.regression.ts(+88 -0)📄 Description
Linked issue
Closes #4927
Why this change
When a lorebook is embedded in a character card, the card keeps a derived copy at
data.character_book, and the character editor's Lorebook tab reads from that copy directly. The HTTP lorebook routes keep it fresh by callingsyncCharacterBookFromLorebookafter every entry mutation.Professor Mari's edits do not go through those routes — her
app_dataactions andmari db/mari lorebooksCLI both run through the generic mari-db mutation path (executeMutation→applyPlan, andrestoreAppliedReview→restorePlan), which never called the sync. So when Mari added, edited, or deleted an entry in a lorebook embedded in a character, the character'sdata.character_bookwas left stale: the change looked applied, but reopening the character editor's Lorebook tab showed the old entries (the edit appeared to roll back). Restoring one of her edits had the same gap in reverse.This is the systemic counterpart to the per-route sync — surfaced by CodeRabbit on #4926 and split out here so #4926 (the safe single-entry delete) could stay focused.
What changed
syncAffectedCharacterBooks, which collects the lorebook ids touched by an applied plan and rebuilds each embedded character'sdata.character_bookvia the existingsyncCharacterBookFromLorebook. It is a no-op for standalone (non-embedded) lorebooks and swallows its own errors, so a sync failure can never fail the underlying mutation.applyPlan(apply) and after a successfulrestorePlan(Restore) — so it never fires on the#4852state-changed early-return that leaves data and the pending review intact.lorebook_entrieschanges it collects bothbefore.lorebookIdandafter.lorebookId, so an entry reparented from one lorebook to another resyncs the lorebook it left, not just the destination.syncCharacterBookFromLorebookrebuilds from the live row, which is already gone by the time the hook runs, so it would silently no-op. Clearing a deleted embedded lorebook's footprint (and re-embedding it on Restore), to match the HTTPDELETEroute, is tracked as a follow-up in #4932.open-issues.regression.tscovering the entry edit + Restore resync and the cross-lorebook reparent.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated (already run locally, boxes above left for the human to confirm per repo policy):
pnpm checkpasses (TypeScript + ESLint + client build) with exit 0.scripts/regressions/open-issues.regression.tspasses, including the new embedded-sync case: an entry edited vialorebook.updateEntryrebuilds the embedded character'scharacter_book;restoreAppliedReviewreverts it; and a cross-lorebook reparent (mari db patch lorebook_entries … --json '{"lorebookId":…}') resyncs the source lorebook.Still to verify in a real browser (not yet done):
data.character_book+ theembeddedLorebookpointer are set), then ask Professor Mari to add / edit / delete an entry in that lorebook. Reopen the character editor's Lorebook tab and confirm the change is reflected (previously it appeared to roll back).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Notes: adds a
CHANGELOG.mdentry under### Fixed. No user-facing docs underdocs/changed, so nodocs-i18nupdate is required. No version bump.UI evidence (if applicable)
Not applicable — this is a server-side data-coherence fix with no UI change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.