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#5968
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/3502
Author: @kolacheee
Created: 7/11/2026
Status: ✅ Merged
Merged: 7/11/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/3486-mari-db-drift📝 Commits (2)
b955c08fix(mari-db): import the authoritative cascade graph and make JSON_COLUMNS schema-trueea69e2efix(mari-db): add the message-scoped game-row edges to the cascade graph📊 Changes
2 files changed (+38 additions, -52 deletions)
View changed files
📝
packages/server/src/db/file-backed-store.ts(+12 -1)📝
packages/server/src/services/mari-db/mari-db.service.ts(+26 -51)📄 Description
Linked issue
Fixes #3486
Why this change
services/mari-db(the Mari CLI's database layer) kept two private copies of schema knowledge, and both had drifted from the real definitions. The stale copies were load-bearing:mari db delete --cascadesilently orphaned conversation-call and game-engine rows, the dangling-reference validator could not see them (it uses the same graph), and the JSON column map made Mari read raw strings and skip stringification for real JSON columns while "handling" columns that do not exist.What changed
Cascade graph — deduplicated at the source.
db/file-backed-store.tsnow exports itsCASCADESrelation graph as the single source of truth, andmari-db.service.tsimports it instead of maintaining a duplicate. The duplicate was missing four edges (chats → conversation_call_sessions,chats → conversation_call_messages,chats → game_engine_state,conversation_call_sessions → conversation_call_messages); all mari-db consumers (cascade delete, the standalone validator, and the mutation-plan dangling check) now see the full graph, and any relation added in the store automatically reaches them.JSON column map — made schema-true, and the drift ran deeper than the issue's two examples. I audited the entire map against the drizzle schema (script cross-checks every entry both directions: phantoms and omissions). Findings beyond the two game tables from #3486:
game_state_snapshots(7) andgame_checkpoints(2) items, plusregex_scripts.rules/tags,prompt_presets.tags,prompt_sections.enabledModes,choice_blocks.choices,chat_presets.parameters/tags, andmetadataentries forchat_images,character_images,assets,custom_themes, andmanifest/settingsforinstalled_extensions(none of those tables have any JSON column).game_state_snapshots.recentEvents/personaStats/manualOverrides/fieldLocks, all sixprompt_presetsJSON columns (sectionOrder,groupOrder,variableGroups,variableValues,parameters,defaultChoices),regex_scripts.trimStrings/placement/targetCharacterIds,chat_presets.settings,choice_blocks.options,prompt_sections.markerConfig,game_engine_state.state, andapi_connections.comfyuiWorkflow.Two judgment calls, documented in code comments:
comfyuiWorkflowis included because the app itself throws "Invalid ComfyUI workflow JSON" on parse failure (placeholders live inside string values), so JSON validity is already its contract;treatAsLocalEndpointis excluded because it is a boolean-as-text whose doc comment merely mentions JSON tool behavior.Known pre-existing limitation (unchanged, noting for completeness): mari-db does not model the store's
SET_NULL_RELATIONS, so CLI cascade deletes do not null out storyboard keyframe references the way app-level deletes do.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Runtime-validated end to end against a scratch server (fresh
DATA_DIR), driving the realmariCLI over HTTP:conversation_call_messagesrow with an unknowncallIdis now BLOCKED at write time withDangling reference callId=... -> conversation_call_sessions.id(pre-fix, the validator was blind to this relation). A clean dataset still reportsstatus: "passed".mari db delete chats <id> --cascade --apply, the chat'sconversation_call_sessions,conversation_call_messages, andgame_engine_staterows are all gone (pre-fix they survived as orphans).game_engine_state.state,game_state_snapshots.recentEvents/personaStats, andregex_scripts.trimStrings/placementstores proper JSON text on disk (not[object Object]) andmari db get --parsed/db selectreturn real parsed values.Docs and release impact
UI evidence (if applicable)
N/A — Mari CLI / server internals; no UI surface.
Summary by CodeRabbit
Bug Fixes
Refactor
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.