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#6617
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/5079
Author: @kolacheee
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/15/2026
Merged by: @kolacheee
Base:
staging← Head:fix/5076-game-metadata-race📝 Commits (4)
1b28faffix(game): route time/weather metadata writes through the patch queue (#5076)3d0e24ftest(game): clean up seeded chats in the metadata-race regressiona5dda55Merge branch 'staging' into fix/5076-game-metadata-race46ea666Merge branch 'staging' into fix/5076-game-metadata-race📊 Changes
4 files changed (+133 additions, -13 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
package.json(+1 -1)📝
packages/server/src/routes/game.routes.ts(+16 -12)➕
scripts/regressions/game-metadata-race.regression.ts(+114 -0)📄 Description
Linked issue
Closes #5076
Why this change
Advancing Game Mode time or updating weather could silently revert any other change to the same chat's metadata that landed at the same moment. Both endpoints read the whole metadata blob, mutated one key, and wrote the entire blob back with no queue, so a concurrent write through the queued patch path everything else uses was reverted with no error.
The worst case is a permanent, silent World Map movement lock: the World Maps definition (including its
revisioncounter) lives in that same metadata blob, while the party's location lives in a separate snapshots table. If a definition write (a newly discovered location bumping the revision) lands inside the time-advance window, the definition is rolled back while the snapshot keeps the newer revision, and from then on every map move fails validation asspatial_transition_stale_definitionwith no visible cause. A player hits the time/weather buttons every session, so the race is easy to trigger during normal play.What changed
POST /game/time/advanceandPOST /game/weather/updatenow write through the queuedchats.patchMetadatapath instead of the unqueued whole-blobchats.updateMetadata, so a concurrent metadata write is merged rather than clobbered.time/advanceuses the updater form and recomputes the new time against the queue-fresh metadata, so concurrent time advances also can't lose an update.weather/updatewrites a narrow{ gameWeather }patch at both of its write sites.scripts/regressions/game-metadata-race.regression.ts, wired intoregression:issues) that holds the per-chat metadata queue open and asserts each handler blocks on it (the old whole-blob write bypassed the queue and would already be visible), then that a concurrent metadata write survives after the queue drains.Other
updateMetadatacall sites ingame.routes.tsshare this read-modify-write shape and are worth a follow-up audit, but these two are the ones a player hits every session (scoped per the issue).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated (done):
pnpm checkand the newgame-metadata-raceregression pass locally. The regression was confirmed to fail on the pre-fix handler and pass on the fix — it is deterministic (it holds the metadata queue open rather than relying on a timing stress loop), so it locks in the queue adoption.Still needs a manual pass in a running app (unchecked above on purpose):
/game/time/advance~10x) and confirm the custom key survives.spatial_transition_stale_definitionlock).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)CHANGELOG updated under Fixed. No user-facing docs under
docs/changed, so nodocs-i18nfollow-up is needed. No version bump.Summary by CodeRabbit
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.