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#6508
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/4825
Author: @kolacheee
Created: 8/9/2026
Status: ✅ Merged
Merged: 8/9/2026
Merged by: @kolacheee
Base:
staging← Head:fix/4813-mari-safe-creates📝 Commits (2)
b960878fix(mari-db): route Professor Mari creates through Keep/Restore review (#4813)6c3ce3bMerge branch 'staging' into fix/4813-mari-safe-creates📊 Changes
4 files changed (+181 additions, -37 deletions)
View changed files
📝
packages/client/src/components/chat/HomeProfessorMariChat.tsx(+40 -0)📝
packages/client/src/localization/locales/en.json(+4 -0)📝
packages/server/src/services/mari-db/mari-db.service.ts(+9 -37)📝
scripts/regressions/open-issues.regression.ts(+128 -0)📄 Description
Linked issue
Refs #4813 (the approval-architecture half — "Thread B", part 1 of 2).
Why this change
The prompt guardrail already merged (#4816) makes Professor Mari less eager to modify things she was only asked to inspect. But #4813 has a second, more serious half: even when a change is genuinely unwanted, the approval flow could not stop it.
Every workspace-Mari
*.createaction — character, persona, lorebook, lorebook entry, theme, personal-extension draft, agent, and preset — was issued withrequiresApproval: false. That routed it down a branch that writes to disk immediately with no review card and no in-chat undo. So a creation Mari made on her own (the exact complaint in #4813) landed silently, and the only recovery was restoring from a backup. Edits and deletes, by contrast, already produced a Keep/Restore review card.There was also a latent data-loss vector:
planInsertrecordedbeforeRaw: nullunconditionally, so a create whose id collided with an existing row would overwrite that row, and a later Restore would then delete the original too.What changed
Server (
packages/server/src/services/mari-db/mari-db.service.ts):requiresApproval: falsefrom all 8*.createsites, soexecuteMutationtakes the review branch (createAppliedReview) and returns apendingapproval. The change is still applied immediately (apply-with-undo), but it is now undoable in chat: Restore deletes exactly the rows the create added, andrestorePlanalready reverses inserts in FK-safe order (children before parents), so a multi-row create like a lorebook plus its entries restores cleanly. This also brings non-activatingtheme.createinto review (activating themes already reviewed).planInsertclobber guard. A create whose primary-key row already exists is now refused with a clear error instead of overwriting it. An insert recordsbeforeRaw: null, so a colliding overwrite followed by Restore would have deleted the original too. (theme-createruns throughplanThemeCreate, which already blocks a colliding id with a validation error.)requiresApprovalescape hatch. With every create routed through review, nothing setrequiresApproval: falseanymore, leavingexecuteMutation's approval-free apply branch unreachable. Removed the branch and theParsedMutationRequest.requiresApprovalfield so there is no dormant way to apply a managed mutation without a review card.Client (
packages/client/src/components/chat/HomeProfessorMariChat.tsx,localization/locales/en.json):Tests (
scripts/regressions/open-issues.regression.ts):pendingreview and is readable while pending; Restore deletes a single-row create and a multi-row (lorebook + entry) create; Keep persists it; the clobber guard refuses a colliding id and leaves the pre-existing row intact; and a non-activatingtheme.createstill reviews.This is part 1 of the Thread-B fix. Part 2 (a follow-up PR) makes the Keep/Restore undo itself durable — today the pending review lives only in memory and is dropped after ten minutes or on restart.
Known limitation (deferred)
The clobber guard covers the parent row of a create. Related child inserts (a preset's sections and choice blocks, built by
planRelatedInserts) are not yet guarded, so apreset.createthat reuses an existing section/choice-block id could still overwrite it. Lorebook entries are unaffected because they always allocate fresh ids. This is a narrow, preset-specific gap and is being folded into the preset-focused fix for #4812 rather than widened here.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm check(TypeScript + ESLint + localization + build) passes.pnpm regression:issuesopen-issues lane passes, including the new create-review assertions above.capability-package-lifecycle.regression.tscurrently fails onstagingfor an unrelated reason (it expects capability minor 8 but the tree is at minor 9); it is not touched by this PR.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No
docs/changes and no version bump. New user-facing UI copy is added to the canonical English locale; community locales fall back to English per the project convention.Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.