[PR #951] [MERGED] Fix stale Game Mode media between games #4854

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/951
Author: @cha1latte
Created: 5/17/2026
Status: ✅ Merged
Merged: 5/17/2026
Merged by: @cha1latte

Base: staging ← Head: fix/game-mode-stale-assets


📝 Commits (1)

  • 6558529 Fix stale game mode media

📊 Changes

2 files changed (+39 additions, -20 deletions)

View changed files

📝 packages/client/src/components/game/GameSurface.tsx (+34 -20)
📝 packages/server/src/routes/game.routes.ts (+5 -0)

📄 Description

Linked issue

No linked issue yet. User-reported bug from chat: Game Mode media assets can appear stale from previous games.

Why this change

  • Starting a new Game Mode in a reused chat could briefly show the previous game's background and continue playing its scene audio/ambient loop.

What changed

  • Clear persisted scene media metadata when /game/create reuses an existing chat for a new game.
  • Scope GameSurface runtime cleanup, scene restore state, and last-background cache by chatId + gameId so same-chat replacement games do not inherit prior media state.

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

Codex-run proof:

  • node scratch/game-stale-assets-repro.mjs failed before the fix with stale gameSceneBackground, gameSceneMusic, and gameSceneAmbient retained from the previous game.
  • node scratch/game-stale-assets-repro.mjs passes after the fix and verifies new-game metadata plus client runtime scope cleanup.
  • pnpm check passed locally.
  • Bunny review pass completed before opening this PR.

Manual verification notes

  • Non-blocking follow-up: replay the reporter's exact Pokemon-to-Tamodachi flow with their saved content/provider setup. Codex could not reproduce that exact user-created content locally, but the stale metadata/runtime path is covered by the scratch proof.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs, release, schema, dependency, or version files changed.

UI evidence (if applicable)

N/A. The visible symptom was caused by stale persisted/runtime scene media state; verification is via the focused lifecycle repro plus pnpm check.


🔄 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/951 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/17/2026 **Status:** ✅ Merged **Merged:** 5/17/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/game-mode-stale-assets` --- ### 📝 Commits (1) - [`6558529`](https://github.com/Pasta-Devs/Marinara-Engine/commit/65585294b8b0ce0c4123c0c7818b56e64a9659de) Fix stale game mode media ### 📊 Changes **2 files changed** (+39 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameSurface.tsx` (+34 -20) 📝 `packages/server/src/routes/game.routes.ts` (+5 -0) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> No linked issue yet. User-reported bug from chat: Game Mode media assets can appear stale from previous games. ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Starting a new Game Mode in a reused chat could briefly show the previous game's background and continue playing its scene audio/ambient loop. ## What changed <!-- List the key changes in this PR --> - Clear persisted scene media metadata when `/game/create` reuses an existing chat for a new game. - Scope GameSurface runtime cleanup, scene restore state, and last-background cache by `chatId + gameId` so same-chat replacement games do not inherit prior media state. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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` Codex-run proof: - `node scratch/game-stale-assets-repro.mjs` failed before the fix with stale `gameSceneBackground`, `gameSceneMusic`, and `gameSceneAmbient` retained from the previous game. - `node scratch/game-stale-assets-repro.mjs` passes after the fix and verifies new-game metadata plus client runtime scope cleanup. - `pnpm check` passed locally. - Bunny review pass completed before opening this PR. ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Non-blocking follow-up: replay the reporter's exact Pokemon-to-Tamodachi flow with their saved content/provider setup. Codex could not reproduce that exact user-created content locally, but the stale metadata/runtime path is covered by the scratch proof. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs, release, schema, dependency, or version files changed. ## UI evidence (if applicable) N/A. The visible symptom was caused by stale persisted/runtime scene media state; verification is via the focused lifecycle repro plus `pnpm check`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:11 +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#4854
No description provided.