mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3486] [Issue]: mari-db service drifted from the real schema: stale cascade graph and wrong JSON column map #1885
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#1885
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?
Originally created by @kolacheee on GitHub (Jul 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3486
Originally assigned to: @kolacheee on GitHub.
Summary
services/mari-db(the Mari CLI's database layer) keeps private copies of schema knowledge that have drifted from the authoritative definitions.Why this is a problem: duplicated schema knowledge rots. The stale copies are load-bearing: one drives cascade deletes and the dangling-reference validator, the other drives JSON encode/decode.
What it negatively affects:
mari db delete --cascadesilently orphans conversation-call and game-engine rows; the validator cannot flag them (it uses the same stale graph); Mari reads and writes malformed JSON for the game snapshot/checkpoint tables. It also misleads agents into "fixing" whichever copy they find first.Expected behavior
One authoritative cascade graph and one authoritative JSON-column map, both matching the real schema.
Actual behavior
packages/server/src/services/mari-db/mari-db.service.ts:261— localCASCADESis a stale duplicate of the authoritative graph indb/file-backed-store.ts:217. Missing edges:chats → conversation_call_sessions,chats → conversation_call_messages,chats → game_engine_state, andconversation_call_sessions → conversation_call_messages. Bothmari db delete --cascadeand the dangling-reference validator consume the stale copy.packages/server/src/services/mari-db/mari-db.service.ts:327—JSON_COLUMNSlists phantom fields forgame_state_snapshots(7) andgame_checkpoints(2) while omitting the real JSON columns (recentEvents,personaStats,manualOverrides,fieldLocks;game_checkpointshassnapshotIdand nometadata). Result: get/list return raw JSON strings for the real columns, and insert/patch skipJSON.stringifyfor them.Steps to reproduce
mari-db.service.ts:261CASCADESagainstfile-backed-store.ts:217.mari db delete --cascadeon a chat that has conversation-call sessions: the call rows survive as orphans, and the validator reports nothing.Environment
45b650de9)Logs, screenshots, or video
N/A — file/line references above point at the exact code.
Additional context
Suggested direction: import the authoritative cascade graph and derive the JSON column map from the schema instead of duplicating either. A third mari-db finding (lorebook
folderIddropped byadd-entry/update-entry) is filed with the lorebook-folders issue since it belongs to that data-loss cluster. Found by a repo-wide read-only sweep; adversarially re-verified before filing. No fix started. Part of a coordinated set of sweep catalogue issues filed together.Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked: