[PR #1381] [MERGED] Fix game gallery session aggregation #5051

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/refactor-issue-1366-game-gallery


📝 Commits (2)

  • 177c45f Fix game gallery session aggregation
  • f1ab465 Guard game gallery scope

📊 Changes

6 files changed (+151 additions, -13 deletions)

View changed files

📝 src/features/catalog/gallery/hooks/use-gallery.test.ts (+89 -1)
📝 src/features/catalog/gallery/hooks/use-gallery.ts (+48 -4)
📝 src/features/catalog/gallery/query-keys.ts (+5 -1)
📝 src/features/modes/game/components/GameSurface.tsx (+2 -1)
📝 src/features/modes/shared/chat-ui/components/ChatGallery.tsx (+6 -5)
📝 src/features/modes/shared/chat-ui/components/ChatGalleryDrawer.tsx (+1 -1)

📄 Description

Linked issue

Closes #1366

Why this change

  • Refactor chat gallery listing only queried gallery rows for the active chat ID, so Game Mode galleries lost legacy images from earlier/later session chats in the same game.

What changed

  • Resolve game gallery scope from Chat.metadata.gameId with groupId fallback.
  • List gallery rows for every game session chat in that scope, while keeping non-game galleries scoped to the active chat.
  • Pass the full chat object into the gallery drawer/grid so the hook can distinguish game vs non-game scope.
  • Keep game illustration invalidation aligned with the gallery query key.
  • Added unit coverage for game gallery scope selection, negative controls, and multi-chat gallery fetch fan-out.

Refactor impact

Primary owner:

  • Game mode

Impact areas reviewed:

  • Catalog gallery hook/query keys
  • Shared chat gallery drawer/grid
  • Game illustration/gallery invalidation

Boundary notes:

  • No storage schema, Rust command, dependency, remote runtime, auth, prompt assembly, or import/export behavior changed.
  • Uses existing generic storageApi.list calls for chats and gallery rows.

Pressure points touched:

  • Game gallery drawer via shared ChatGallery
  • GameSurface generated-illustration gallery invalidation

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 proof: node scratch\issue-1366-gallery-scope-proof.mjs failed before the fix and passes after the fix.
  • Codex proof: pnpm exec vitest run src/features/catalog/gallery/hooks/use-gallery.test.ts passed.
  • Codex proof: pnpm check passed locally.
  • Codex proof: node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed with compatibility rows and negative controls.
  • Manual follow-up: open a game with multiple session chats containing gallery images and confirm the Game Mode gallery shows images from all sessions while ordinary chat galleries remain per-chat.

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

  • Not attached. This fix is covered by scope/fan-out unit proof and pnpm check; no browser screenshot was captured.

Summary by CodeRabbit

  • New Features
    • Gallery now displays images from related game sessions within the same game scope, providing a unified view across game chats instead of just the current chat.
    • Images are consistently sorted by creation time with newest first.

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/1381 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 5/27/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-1366-game-gallery` --- ### 📝 Commits (2) - [`177c45f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/177c45f1dc10a903b0ebe122e04724aba05b4043) Fix game gallery session aggregation - [`f1ab465`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f1ab465a588701d3347c24c2ecf082a0ffc4f6e0) Guard game gallery scope ### 📊 Changes **6 files changed** (+151 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/features/catalog/gallery/hooks/use-gallery.test.ts` (+89 -1) 📝 `src/features/catalog/gallery/hooks/use-gallery.ts` (+48 -4) 📝 `src/features/catalog/gallery/query-keys.ts` (+5 -1) 📝 `src/features/modes/game/components/GameSurface.tsx` (+2 -1) 📝 `src/features/modes/shared/chat-ui/components/ChatGallery.tsx` (+6 -5) 📝 `src/features/modes/shared/chat-ui/components/ChatGalleryDrawer.tsx` (+1 -1) </details> ### 📄 Description ## Linked issue Closes #1366 ## Why this change - Refactor chat gallery listing only queried gallery rows for the active chat ID, so Game Mode galleries lost legacy images from earlier/later session chats in the same game. ## What changed - Resolve game gallery scope from `Chat.metadata.gameId` with `groupId` fallback. - List gallery rows for every game session chat in that scope, while keeping non-game galleries scoped to the active chat. - Pass the full chat object into the gallery drawer/grid so the hook can distinguish game vs non-game scope. - Keep game illustration invalidation aligned with the gallery query key. - Added unit coverage for game gallery scope selection, negative controls, and multi-chat gallery fetch fan-out. ## Refactor impact Primary owner: - Game mode Impact areas reviewed: - Catalog gallery hook/query keys - Shared chat gallery drawer/grid - Game illustration/gallery invalidation Boundary notes: - No storage schema, Rust command, dependency, remote runtime, auth, prompt assembly, or import/export behavior changed. - Uses existing generic `storageApi.list` calls for chats and gallery rows. Pressure points touched: - Game gallery drawer via shared `ChatGallery` - GameSurface generated-illustration gallery invalidation ## 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 proof: `node scratch\issue-1366-gallery-scope-proof.mjs` failed before the fix and passes after the fix. - Codex proof: `pnpm exec vitest run src/features/catalog/gallery/hooks/use-gallery.test.ts` passed. - Codex proof: `pnpm check` passed locally. - Codex proof: `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed with compatibility rows and negative controls. - Manual follow-up: open a game with multiple session chats containing gallery images and confirm the Game Mode gallery shows images from all sessions while ordinary chat galleries remain per-chat. ## 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 - Not attached. This fix is covered by scope/fan-out unit proof and `pnpm check`; no browser screenshot was captured. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Gallery now displays images from related game sessions within the same game scope, providing a unified view across game chats instead of just the current chat. * Images are consistently sorted by creation time with newest first. <!-- 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/1381?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:12:48 +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#5051
No description provided.