[PR #485] [MERGED] fix(game-map): preserve explicit move past metadata hydration #4637

Closed
opened 2026-10-22 04:09:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/485
Author: @Romuromylus
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/6/2026
Merged by: @Romuromylus

Base: main ← Head: fix/map-move-stale-partyposition


📝 Commits (3)

  • 55bd967 fix(game-map): preserve explicit move past metadata hydration
  • 8f3bbea fix(game-map): thread explicit move through hydration
  • 03b4c51 fix(game-map): anchor finalMap to targetMapId after hydration

📊 Changes

1 file changed (+30 additions, -6 deletions)

View changed files

📝 packages/server/src/routes/game.routes.ts (+30 -6)

📄 Description

Linked issue

Closes #484

Why this change

  • After a player clicked Set destination on the Game Mode map, the marker stayed stuck at the previous node. The GM still narrated the move (because the user message contains *moves to <label>*), but chat.metadata.gameMap.partyPosition never advanced — so subsequent prompts kept building from the stale location and the map widget never updated.

What changed

  • In packages/server/src/routes/game.routes.ts, the /map/move handler now re-applies the user's chosen partyPosition on top of the hydrated meta after buildHydratedGameMeta. That helper calls syncGameMapMetaPartyPosition(meta, currentLocation) where currentLocation is read from the latest gameStateSnapshot.location. Until the next /generate run persists a new snapshot, that location still records the previous node, so the sync was silently snapping partyPosition back to the old node before persistence.
  • A withActiveGameMapMeta call rebuilds gameMaps[] and activeGameMapId consistently with the corrected map.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Built and deployed the patched server image to a self-hosted Docker (EasyPanel) instance running Marinara Engine 1.5.8.
  • Opened an in-progress Game Mode chat with a node-style map and an active scene.
  • Clicked an adjacent node, confirmed Set destination, and sent a turn.
  • Before the fix: map marker remained on the previous node; on the next round the GM still framed the player as being at the old location even though it had narrated the move.
  • After the fix: the map marker jumps to the chosen node immediately on send, and the next GM round narrates from the new location. The destination indicator clears as before. No client-side errors in DevTools.

Docs and release impact

  • No docs changes needed

UI evidence (if applicable)

No UI code changed. Behaviour change is observed in the existing map widget — the marker now follows the user's destination click. Happy to attach a short screen recording if reviewers want one.

Summary by CodeRabbit

  • Bug Fixes
    • Player moves now reliably take precedence over background updates so chosen positions are not reverted.
    • Deliberate location overrides are immediately reflected in saved game state and activity logs.
    • After a move, the displayed map is anchored to the persisted map so the final view matches the stored game state.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/485 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/6/2026 **Status:** ✅ Merged **Merged:** 5/6/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `main` ← **Head:** `fix/map-move-stale-partyposition` --- ### 📝 Commits (3) - [`55bd967`](https://github.com/Pasta-Devs/Marinara-Engine/commit/55bd967b5d1d1dfa42667c0ba517348a8761aebb) fix(game-map): preserve explicit move past metadata hydration - [`8f3bbea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f3bbea76bf7d2609ac161f5e192354385dd401b) fix(game-map): thread explicit move through hydration - [`03b4c51`](https://github.com/Pasta-Devs/Marinara-Engine/commit/03b4c515f107210d03808f47816d67f3d4dec371) fix(game-map): anchor finalMap to targetMapId after hydration ### 📊 Changes **1 file changed** (+30 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/routes/game.routes.ts` (+30 -6) </details> ### 📄 Description ## Linked issue Closes #484 ## Why this change - After a player clicked **Set destination** on the Game Mode map, the marker stayed stuck at the previous node. The GM still narrated the move (because the user message contains `*moves to <label>*`), but `chat.metadata.gameMap.partyPosition` never advanced — so subsequent prompts kept building from the stale location and the map widget never updated. ## What changed - In `packages/server/src/routes/game.routes.ts`, the `/map/move` handler now re-applies the user's chosen `partyPosition` on top of the hydrated meta after `buildHydratedGameMeta`. That helper calls `syncGameMapMetaPartyPosition(meta, currentLocation)` where `currentLocation` is read from the latest `gameStateSnapshot.location`. Until the next `/generate` run persists a new snapshot, that location still records the previous node, so the sync was silently snapping `partyPosition` back to the old node before persistence. - A `withActiveGameMapMeta` call rebuilds `gameMaps[]` and `activeGameMapId` consistently with the corrected map. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Built and deployed the patched server image to a self-hosted Docker (EasyPanel) instance running Marinara Engine 1.5.8. - Opened an in-progress Game Mode chat with a node-style map and an active scene. - Clicked an adjacent node, confirmed **Set destination**, and sent a turn. - Before the fix: map marker remained on the previous node; on the next round the GM still framed the player as being at the old location even though it had narrated the move. - After the fix: the map marker jumps to the chosen node immediately on send, and the next GM round narrates from the new location. The destination indicator clears as before. No client-side errors in DevTools. ## Docs and release impact - [x] No docs changes needed ## UI evidence (if applicable) No UI code changed. Behaviour change is observed in the existing map widget — the marker now follows the user's destination click. Happy to attach a short screen recording if reviewers want one. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Player moves now reliably take precedence over background updates so chosen positions are not reverted. * Deliberate location overrides are immediately reflected in saved game state and activity logs. * After a move, the displayed map is anchored to the persisted map so the final view matches the stored game state. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4637
No description provided.