mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5406] [Feature]: Authoritative write ordering across experience-state rows and chat metadata #2995
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#2995
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 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5406
Originally assigned to: @kolacheee on GitHub.
What exists today
A game-surface Experience's save lives in two stores: the per-anchor
game_engine_staterow (the authority; rewinds with the story) and a chat-metadata key the package maintains as a boot cache (whole-blob, does not rewind). The package writes both on every flush.The problem (concrete scenario)
If the package's boot probe of the experience-state route fails transiently (server busy at startup, brief network error), the session degrades to metadata-only writes. Play continues; only the metadata copy advances. At the next boot the package sees the two stores disagree — and cannot safely tell which is newer:
We designed a client-side discriminator four different ways for the Pixelforge S5 plan (write counters, provenance flags,
anchorMatchedheuristics, anchor stamps) and adversarial review broke each one with a data-destroying counterexample. The root cause is structural: the metadata copy is chat-global and unanchored, the row is per-anchor with fallback-read semantics, and no client-visible value orders writes across the two stores. Until this exists, a degraded session's play is simply lost at the next normal boot (documented as an accepted limitation).The ask
A server-assigned, per-chat monotonic write ordinal (or trustworthy server timestamp), stamped on both paths and readable by the client:
PUT /api/game/:chatId/experience-stateand on the row's GET shape, andWith one shared ordering, the boot comparison becomes one line: whichever store carries the higher ordinal is newer, timeline moves included. This likely helps any future package with the same two-store shape, not just Pixelforge.
@kolacheee commented on GitHub (Aug 22, 2026):
Claiming this one — starting implementation now on
feat/5406-write-ordinal(branched fromstaging). Will open a draft PR once the shape is validated.Planned approach: one per-chat monotonic write counter that both stores draw from, so a client can totally order writes across them — a nullable
writeOrdinalon the experience-state row (assigned inside the existing per-chat PUT write lock, returned on PUT and GET), plus an engine-ownedmetadata.metadataWriteOrdinalsmirror stamped per top-level key by the queuedpatchMetadatapath. Exact field names and the monotonicity guarantee across the two lock domains will be documented in the PR.