[PR #1473] [MERGED] Standardize Game Mode session chat metadata responses #5107

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/refactor-game-session-chat-contract


📝 Commits (4)

  • 7d2fd12 Standardize Game Mode session chat metadata responses
  • dc6acf2 Address Game Mode session chat review feedback
  • 84f68a7 Address inventory journal sync review feedback
  • d249fbc Merge remote-tracking branch 'upstream/refactor' into fix/refactor-game-session-chat-contract

📊 Changes

8 files changed (+649 additions, -366 deletions)

View changed files

📝 graphify-out/GRAPH_REPORT.md (+20 -20)
📝 graphify-out/graph.json (+393 -237)
📝 graphify-out/manifest.json (+10 -10)
📝 src/features/modes/game/api/game-api.test.ts (+80 -0)
📝 src/features/modes/game/api/game-api.ts (+41 -33)
📝 src/features/modes/game/components/GameJournal.tsx (+12 -2)
📝 src/features/modes/game/components/GameSurface.tsx (+59 -28)
📝 src/features/modes/game/hooks/use-game.ts (+34 -36)

📄 Description

Linked issue

Refs #1467

Why this change

  • Follow-up to the Game Mode state staleness fix. Several Game Mode API methods mutate chat metadata, but not all of them returned the updated chat object to the UI. That left some UI paths relying on refetches or local patch reconstruction instead of the source-of-truth chat returned by storage.

What changed

  • Added sessionChat to Game Mode metadata mutation responses.
  • Updated Game Mode hooks/components to publish returned sessionChat values into React Query and the active chat store.
  • Replaced local guessed metadata patches for start-game/widget flows with returned source-of-truth chats.
  • Added response-contract coverage for start-game and map-generation metadata updates.
  • Refreshed Graphify outputs after the code changes.

Refactor impact

Primary owner:

Game mode

Impact areas reviewed:

  • Game Mode API response contracts
  • Game Mode hooks that synchronize chat detail cache and active chat state
  • Direct GameSurface generated-asset and journal metadata paths
  • Game journal notes save flow
  • Graphify output

Boundary notes:

  • Product behavior remains in src/features/modes/game and existing engine contracts.
  • No React imports were added to src/engine.
  • No raw Tauri/remote-runtime calls were introduced.
  • This does not change storage schema, dependencies, auth, versioning, or provider transport.

Pressure points touched:

  • GameSurface
  • Game Mode hooks
  • Game Mode API contract layer
  • Graphify output

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex ran pnpm test -- src/features/modes/game/api/game-api.test.ts; 1 file / 6 tests passed.
  • Codex ran pnpm typecheck; passed.
  • Codex ran graphify update .; passed.
  • Codex ran pnpm check; passed, including architecture, frontend typecheck, Rust check, and docs check.
  • Codex ran pnpm build; passed. Vite reported the existing large chunk warning.
  • Codex ran git diff --cached --check; passed.
  • Browser/Tauri manual verification was not run because this change is a metadata response/cache contract audit rather than a new visual workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A; no visible UI layout change.

Summary by CodeRabbit

  • New Features

    • Server responses now include updated session data so changes (maps, assets, time/weather, notes, reputation, etc.) are immediately reflected in the UI.
  • Bug Fixes

    • Improved state synchronization so game session updates and generated assets consistently propagate across the app and active session view.
  • Tests

    • Added tests verifying metadata mutation contracts and session state/update flows.

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/1473 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/28/2026 **Status:** ✅ Merged **Merged:** 5/28/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-game-session-chat-contract` --- ### 📝 Commits (4) - [`7d2fd12`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7d2fd12b4e9a7099935a0744e439d94f5b102200) Standardize Game Mode session chat metadata responses - [`dc6acf2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dc6acf2c46a174d562a47838d88afd623d80c79a) Address Game Mode session chat review feedback - [`84f68a7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/84f68a7199bff33e2300e1cd9b659ff1b3007fda) Address inventory journal sync review feedback - [`d249fbc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d249fbc6780176a60583305d08e174ae9558c6ec) Merge remote-tracking branch 'upstream/refactor' into fix/refactor-game-session-chat-contract ### 📊 Changes **8 files changed** (+649 additions, -366 deletions) <details> <summary>View changed files</summary> 📝 `graphify-out/GRAPH_REPORT.md` (+20 -20) 📝 `graphify-out/graph.json` (+393 -237) 📝 `graphify-out/manifest.json` (+10 -10) 📝 `src/features/modes/game/api/game-api.test.ts` (+80 -0) 📝 `src/features/modes/game/api/game-api.ts` (+41 -33) 📝 `src/features/modes/game/components/GameJournal.tsx` (+12 -2) 📝 `src/features/modes/game/components/GameSurface.tsx` (+59 -28) 📝 `src/features/modes/game/hooks/use-game.ts` (+34 -36) </details> ### 📄 Description ## Linked issue Refs #1467 ## Why this change - Follow-up to the Game Mode state staleness fix. Several Game Mode API methods mutate chat metadata, but not all of them returned the updated chat object to the UI. That left some UI paths relying on refetches or local patch reconstruction instead of the source-of-truth chat returned by storage. ## What changed - Added `sessionChat` to Game Mode metadata mutation responses. - Updated Game Mode hooks/components to publish returned `sessionChat` values into React Query and the active chat store. - Replaced local guessed metadata patches for start-game/widget flows with returned source-of-truth chats. - Added response-contract coverage for start-game and map-generation metadata updates. - Refreshed Graphify outputs after the code changes. ## Refactor impact Primary owner: Game mode Impact areas reviewed: - Game Mode API response contracts - Game Mode hooks that synchronize chat detail cache and active chat state - Direct `GameSurface` generated-asset and journal metadata paths - Game journal notes save flow - Graphify output Boundary notes: - Product behavior remains in `src/features/modes/game` and existing engine contracts. - No React imports were added to `src/engine`. - No raw Tauri/remote-runtime calls were introduced. - This does not change storage schema, dependencies, auth, versioning, or provider transport. Pressure points touched: - `GameSurface` - Game Mode hooks - Game Mode API contract layer - Graphify output ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex ran `pnpm test -- src/features/modes/game/api/game-api.test.ts`; 1 file / 6 tests passed. - Codex ran `pnpm typecheck`; passed. - Codex ran `graphify update .`; passed. - Codex ran `pnpm check`; passed, including architecture, frontend typecheck, Rust check, and docs check. - Codex ran `pnpm build`; passed. Vite reported the existing large chunk warning. - Codex ran `git diff --cached --check`; passed. - Browser/Tauri manual verification was not run because this change is a metadata response/cache contract audit rather than a new visual workflow. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A; no visible UI layout change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Server responses now include updated session data so changes (maps, assets, time/weather, notes, reputation, etc.) are immediately reflected in the UI. * **Bug Fixes** * Improved state synchronization so game session updates and generated assets consistently propagate across the app and active session view. * **Tests** * Added tests verifying metadata mutation contracts and session state/update flows. <!-- 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/1473?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:13:20 +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#5107
No description provided.