[PR #903] [MERGED] Fix Game Mode asset regeneration portraits #4826

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

📋 Pull Request Information

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

Base: staging ← Head: fix/issue-895-game-asset-regeneration


📝 Commits (2)

  • ca9fb31 Fix game asset regeneration portraits
  • bc87d34 Align game asset NPC name normalization

📊 Changes

4 files changed (+101 additions, -29 deletions)

View changed files

📝 packages/client/src/components/game/GameSurface.tsx (+17 -26)
➕ packages/client/src/components/game/game-asset-generation-payload.ts (+81 -0)
📝 packages/client/src/stores/game-mode.store.ts (+1 -1)
📝 packages/server/src/routes/game.routes.ts (+2 -2)

📄 Description

Linked issue

Closes #895

Why this change

  • Game Mode could keep treating old NPC portrait URLs as final after generated assets were deleted or regenerated, so the background regenerated while portraits appeared skipped or stale.

What changed

  • Extracted the missing Game Mode asset payload calculation into a pure helper.
  • When a saved generated background is missing from the asset manifest, the asset retry payload now schedules the background and the full NPC portrait set, forcing existing generated NPC portrait names so the set can refresh together.
  • Refreshed NPC portrait URLs now replace stale NPC avatar URLs in both client state and persisted Game Mode metadata.
  • Generated NPC portrait responses always include a cache-busting query string so regenerated files are visible immediately.

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

  • Codex scratch repro before the fix: pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-895-npc-avatar-repro.ts exited 1 because patchNpcAvatars kept /api/avatars/npc/chat-895/mira.png instead of applying /api/avatars/npc/chat-895/mira.png?v=895.
  • Codex scratch repro after the fix: the same command passed, confirming refreshed NPC avatar URLs replace stale ones, newly discovered NPC avatars are still added, and a missing saved generated background schedules background regeneration plus forced portrait regeneration for the full NPC set.
  • Codex baseline: pnpm check passed.
  • Bunny review: passed before opening this PR.

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 or release metadata changes needed; this is a focused Game Mode bug fix.

UI evidence (if applicable)

N/A - this is a Game Mode asset-regeneration state/payload fix verified with a focused scratch repro and pnpm check.

Summary by CodeRabbit

  • Bug Fixes

    • Improved NPC avatar synchronization to reliably update avatars when they change, rather than only when missing.
    • Fixed cache behavior to consistently refresh generated avatars, ensuring the latest versions are displayed.
  • Refactor

    • Consolidated asset generation logic for cleaner code organization.

Review Change Stack


🔄 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/903 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/15/2026 **Status:** ✅ Merged **Merged:** 5/15/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-895-game-asset-regeneration` --- ### 📝 Commits (2) - [`ca9fb31`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ca9fb31a9240b9856963fdac891e1835bfe5eea2) Fix game asset regeneration portraits - [`bc87d34`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bc87d343e700bc20d9d84742f03b4d551963eeeb) Align game asset NPC name normalization ### 📊 Changes **4 files changed** (+101 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameSurface.tsx` (+17 -26) ➕ `packages/client/src/components/game/game-asset-generation-payload.ts` (+81 -0) 📝 `packages/client/src/stores/game-mode.store.ts` (+1 -1) 📝 `packages/server/src/routes/game.routes.ts` (+2 -2) </details> ### 📄 Description ## 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 --> Closes #895 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game Mode could keep treating old NPC portrait URLs as final after generated assets were deleted or regenerated, so the background regenerated while portraits appeared skipped or stale. ## What changed <!-- List the key changes in this PR --> - Extracted the missing Game Mode asset payload calculation into a pure helper. - When a saved generated background is missing from the asset manifest, the asset retry payload now schedules the background and the full NPC portrait set, forcing existing generated NPC portrait names so the set can refresh together. - Refreshed NPC portrait URLs now replace stale NPC avatar URLs in both client state and persisted Game Mode metadata. - Generated NPC portrait responses always include a cache-busting query string so regenerated files are visible immediately. ## 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` ### 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. --> - Codex scratch repro before the fix: `pnpm --filter @marinara-engine/server exec tsx ../../scratch/issue-895-npc-avatar-repro.ts` exited 1 because `patchNpcAvatars` kept `/api/avatars/npc/chat-895/mira.png` instead of applying `/api/avatars/npc/chat-895/mira.png?v=895`. - Codex scratch repro after the fix: the same command passed, confirming refreshed NPC avatar URLs replace stale ones, newly discovered NPC avatars are still added, and a missing saved generated background schedules background regeneration plus forced portrait regeneration for the full NPC set. - Codex baseline: `pnpm check` passed. - Bunny review: passed before opening this PR. ## 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 or release metadata changes needed; this is a focused Game Mode bug fix. ## UI evidence (if applicable) N/A - this is a Game Mode asset-regeneration state/payload fix verified with a focused scratch repro and `pnpm check`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved NPC avatar synchronization to reliably update avatars when they change, rather than only when missing. * Fixed cache behavior to consistently refresh generated avatars, ensuring the latest versions are displayed. * **Refactor** * Consolidated asset generation logic for cleaner code organization. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/903?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:10:59 +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#4826
No description provided.