mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4926] [MERGED] fix(server): give Professor Mari a safe lorebook.deleteEntry action #6545
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#6545
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/4926
Author: @kolacheee
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @kolacheee
Base:
staging← Head:fix/mari-lorebook-delete-entry📝 Commits (2)
629489dfix(server): give Professor Mari a safe lorebook.deleteEntry action (#4924)d9638b1test: isolate the lorebook.deleteEntry fixture cleanup in a finally block (#4924)📊 Changes
4 files changed (+78 additions, -1 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
packages/server/src/services/mari-db/mari-db.service.ts(+25 -0)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+4 -1)📝
scripts/regressions/open-issues.regression.ts(+48 -0)📄 Description
Linked issue
Closes #4924
Why this change
Professor Mari had no safe way to delete a single lorebook entry: her
app_datatoolkit exposeslorebook.addEntryandlorebook.updateEntrybut nodeleteEntry. When a user asked her to delete one entry,lorebook.deleteEntryfailed (not a real action), so she fell back to the rawmari db delete <table> --where <expr>command — a bulk delete with no row-count guard — and removed 77 entries across unrelated lorebooks instead of the one. (The deletion was recoverable via the Keep/Restore card, but the blast radius was the whole matched set.)What changed
packages/server/src/services/mari-db/mari-db.service.ts— added alorebook.deleteEntryapp_dataaction: it takesentryId, verifies the entry exists (throws otherwise), and deletes exactly that one row ({ kind: "delete", table: "lorebook_entries", id, cascade: false }) through the sameexecuteMutation→ Keep/Restore review as add/update. This is the identical shape the CLI'smari lorebooks delete-entry <id>already uses. Also registered delete aliases (lorebook.entry.delete,lorebook.entries.delete,lorebook.entry.remove,lorebook.removeentry, …).packages/server/src/services/professor-mari/workspace-agent.service.ts— registeredlorebook.deleteEntryin the action catalog and the Writes quick-ref, added a prompt bullet ("to delete a lorebook entry uselorebook.deleteEntry; never a rawmari db delete, whose--wherecan remove far more rows than intended; if a rawmari db deleteis ever unavoidable, dry-run and confirm the row count first"), and a worked example.scripts/regressions/open-issues.regression.ts— new test that creates a lorebook with two entries, deletes one vialorebook.deleteEntry, and asserts exactly one is removed, the other survives, and deleting a missing id is rejected.CHANGELOG.md— one Fixed entry.Note on classification:
lorebook.deleteEntryis correctly treated as mutating (its suffix isn't in the read-only whitelist), so it can't bypass the review and produces a recoverable Keep/Restore card.Out of scope (deliberately, per the issue): a broader guardrail on raw
mari db delete --wherebulk deletes (dry-run-and-confirm before applying) — can be tracked separately.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated, done by me:
pnpm checkpasses (TypeScript + ESLint + build, exit 0).open-issuesregression passes, including the new scoping test (delete one of two entries → exactly one removed, the other survives, missing id rejected).Still needs a human (please verify in a real browser, don't trust the boxes above):
lorebook.deleteEntry, only that entry is removed, and a Keep/Restore card appears (Restore puts it back).mari db deletefor a single-entry delete.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)CHANGELOG.mdupdated. Nodocs/change and no version bump.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.