mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5418] Checkpoint-restore legacy fallback writes the only unstamped experience-state createdAt #3001
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#3001
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/5418
Originally assigned to: @kolacheee on GitHub.
The checkpoint-restore legacy fallback in
packages/server/src/routes/game.routes.ts(the branch used when a checkpoint has no usableengineStateDatacapture — pre-#5102 checkpoints, or a corrupt blob) is now the onlygame_engine_statewriter in the experience-state family that does not stampcreatedAt. The PUT, the bulk import, and the captured-restore branch all stamp strictly past the namespace's newest row viaexperienceStateStampBase(#5405); the legacy fallback still takes the store's defaultnow().Why this matters:
experienceStateStampBasereturnsmax(now, newest + 1), so a stamped burst can legitimately run ahead of the wall clock — a full 100-row import stamps up to ~99 ms into the future. An unstampednow()landing inside that window sorts behind rows that were written before it.createdAtis the sole recency key forgetLatest, the anchor-cap prune, and the next checkpoint's capture lookup, so the freshly restored world can lose all three to rows it was meant to supersede — an ordering inversion, not just a cosmetic tie.Once #5417 lands there is a second consequence: that same fallback row gets a freshly allocated
writeOrdinal(deliberately the highest in the chat), so the row carries two ordering signals that disagree —writeOrdinalsays newest,createdAtmay not. Nothing breaks today because the boot comparison readswriteOrdinalwhilecreatedAtdrives the prune/getLatestfamily, but the two should agree rather than depending on consumers never crossing.Fix shape: stamp the legacy-fallback write through the same
experienceStateStampBase(getLatest(chatId, cpEngineRow.gameType))the captured branch uses. Note this branch restores whatevergameTypethe lookup finds, so the stamp would also apply to a restored turn-game row — that is consistent (the restore is genuinely the namespace's newest write, and the stamp collapses tonow()in a namespace that has never been future-stamped), but it is a deliberate widening of #5405's stamp family and worth stating in the PR.Surfaced by CodeRabbit's outside-diff-range finding on PR #5417 and dispositioned there: https://github.com/Pasta-Devs/Marinara-Engine/pull/5417#issuecomment-5383069183 (declined for that PR — the asymmetry is pre-existing #5405 behavior on staging, and #5417 was already carrying a cross-feature merge).
@kolacheee commented on GitHub (Aug 22, 2026):
Taking this one (kolacheee, agent-assisted) — branch
fix/5418-legacy-restore-stampincoming.