mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5102] game-surface Experiences cannot persist state in game_engine_state — swipes/branches/checkpoints diverge #2822
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#2822
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 (Aug 15, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5102
Originally assigned to: @kolacheee on GitHub.
The gap
game_engine_stateis the engine's per-(chatId, messageId, swipeIndex)state table, and it already rides every lifecycle seam a game state needs: swipe delete and re-index, message/chat/group delete prunes, branch re-anchoring, and (since #5077/#5084) checkpoint restore viagetLatestAtOrBefore. But it is only reachable through the turn-game runner — agame-surfaceExperience (a package that owns an entire Game mode world) cannot store its state there.So an Experience's world state lives in chat metadata instead: a whole-blob-rewrite store that no engine seam rewinds — swipes don't rewind the world, branches copy stale state under dead message anchors, and checkpoint restores skip it entirely. The engine does all of this correctly for its own stores; a package gets none of it.
(Package-registered routes are not an alternative: the sanctioned route registrar wraps
requirePrivilegedAccess, which demands the admin secret off loopback — unusable from Android over LAN, the primary mobile deployment.)Suggested fix
Host-owned routes on the game router exposing
game_engine_stateto the chat's stamped Experience, reusingcreateGameEngineStateStorage(#5084) unchanged:GET /api/game/:chatId/experience-state→ the latest visible row for the chat's Experience;PUT /api/game/:chatId/experience-state→ create/update a row anchored to the current turn.Scoping and safety:
gameType: "experience:<gameExperienceId>", and the routes refuse chats without a stampedgameExperienceId— an Experience can only touch its own chat's experience rows, and turn-game rows are never reachable;stateblob (the table is sharded per-chat, so this avoids both the metadata whole-blob rewrite and the monolithiccapabilityDocumentstable);With this, an Experience's world inherits swipe/branch/checkpoint correctness from the engine instead of reimplementing (or lacking) it. Driving case: the pixel-RPG Experience's saves, currently in chat metadata with documented swipe-divergence. From the Pixelforge exploration roadmap (PR-E). Verified against current
staging.@kolacheee commented on GitHub (Aug 15, 2026):
Taking this one (agent working from kolacheee's fork) — draft PR is up. One notable find while building the regression suite: game_engine_state's create() dedupe deleted prior rows for an anchor regardless of gameType, so the first-ever second writer in a chat would have silently clobbered the other's row — the dedupe is now scoped to the writer's own type, byte-identical for every existing single-writer chat.