[PR #3466] [MERGED] Replay completed Game Mode sessions #5953

Closed
opened 2026-10-23 04:05:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3466
Author: @thetopham
Created: 7/11/2026
Status: ✅ Merged
Merged: 7/11/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/game-session-replay


📝 Commits (5)

  • 8286b6f Start game session replay (#3465)
  • cccf088 Add completed game session replay (#3465)
  • b5ce59a Merge remote-tracking branch 'origin/staging' into codex/game-session-replay
  • 819ca30 Fix Game session replay integration
  • 8f0b5cf Harden Game session replay state and cues

📊 Changes

12 files changed (+904 additions, -101 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/game/sessions-and-saves.md (+12 -0)
📝 packages/client/src/components/game/GameChoiceCards.tsx (+67 -40)
📝 packages/client/src/components/game/GameNarration.tsx (+25 -10)
📝 packages/client/src/components/game/GameSessionHistory.tsx (+15 -3)
➕ packages/client/src/components/game/GameSessionReplay.tsx (+305 -0)
📝 packages/client/src/components/game/GameSurface.tsx (+199 -48)
➕ packages/client/src/lib/game-choice-utils.ts (+8 -0)
➕ packages/client/src/lib/game-session-replay.ts (+165 -0)
📝 packages/client/src/lib/game-session-resolution.ts (+19 -0)
📝 packages/shared/src/types/chat.ts (+9 -0)
📝 scripts/regressions/open-issues.regression.ts (+79 -0)

📄 Description

Linked issue

Closes #3465

Why this change

Players can finish a memorable Game Mode session but cannot replay it from the beginning. Logs only provide limited text review, and concluded sessions do not offer deterministic, read-only playback of narration, presentation cues, or recorded choices.

What changed

  • Added a Replay Session action to each concluded Session History entry.
  • Reconstructs stored narration, player turns, party dialogue, inline choices, and recorded CYOA selections without invoking the GM.
  • Locks every replay fork except the original recorded choice, then continues along the stored path.
  • Replays stored and inline background, music, ambient, SFX, direction, and segment-effect cues while keeping replay state isolated from the live session.
  • Removes live toolbars, send controls, QTEs, weather, storyboard, reactions, and editable HUD widgets while replay is active.
  • Supports legacy sessions that only have a branch-named canonical chat, preferring canonical non-branch chats when both exist.
  • Persists replay presentation cues on newly generated turns and safely falls back to inline tags for older sessions.
  • Lazy-loads the replay screen so GameSurface remains within the enforced bundle budget.

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

Automated evidence

  • pnpm check passed outside the container (shared/server/client lint and production builds).
  • pnpm regression:issues passed.
  • Focused replay ESLint and TypeScript checks passed.
  • Production bundle check passed with GameSurface at 498.74 kB and replay split into a 9.35 kB on-demand chunk.

Manual verification notes

  • Opened the real concluded Session 7 and confirmed replay mode loads with read-only chrome and no normal Session toolbar.
  • Replayed Session 6 as 8 stored turns; at the first CYOA fork exactly the recorded choice was enabled and the other four choices were disabled.
  • Selected the recorded choice and confirmed playback advanced to Turn 3 without creating a game turn.
  • Replayed legacy Session 1 as 32 stored turns, confirming branch-named older sessions remain accessible.
  • Confirmed send controls and editable HUD widget controls are absent during replay.
  • Older generated backgrounds that no longer exist in the asset library fall back safely; inline narration and choices remain replayable.

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)

Documentation was added to docs/game/sessions-and-saves.md, and the Unreleased changelog was updated.

UI evidence (if applicable)

Validated in the in-app browser against the local saved campaign; screenshots are not attached because they contain private game-session content.

Summary by CodeRabbit

  • New Features

    • Added read-only replay for completed Game Mode sessions from Session History.
    • Replay sessions with narration, presentation cues, backgrounds, audio, and deterministic choice paths.
    • Added controls to replay, continue, watch again, or return to the current session.
    • Original choices are highlighted; other choices are disabled.
  • Documentation

    • Added guidance explaining replay behavior, compatibility, and limitations.
  • Tests

    • Added regression coverage for replay turn reconstruction, presentation cues, and session selection.

🔄 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/3466 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/11/2026 **Status:** ✅ Merged **Merged:** 7/11/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/game-session-replay` --- ### 📝 Commits (5) - [`8286b6f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8286b6f6d0c130dfe059987e190fae51d5d0377c) Start game session replay (#3465) - [`cccf088`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cccf088a411dcc6ea8edde39766d85761fb55ad4) Add completed game session replay (#3465) - [`b5ce59a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b5ce59af3d7a6995d9771efdcb85d4eadf18ab51) Merge remote-tracking branch 'origin/staging' into codex/game-session-replay - [`819ca30`](https://github.com/Pasta-Devs/Marinara-Engine/commit/819ca3012612bfa50da65f5ea6982fa03b9eaead) Fix Game session replay integration - [`8f0b5cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f0b5cf77ebcf36e4c20dede03cd993dd8d756ae) Harden Game session replay state and cues ### 📊 Changes **12 files changed** (+904 additions, -101 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/game/sessions-and-saves.md` (+12 -0) 📝 `packages/client/src/components/game/GameChoiceCards.tsx` (+67 -40) 📝 `packages/client/src/components/game/GameNarration.tsx` (+25 -10) 📝 `packages/client/src/components/game/GameSessionHistory.tsx` (+15 -3) ➕ `packages/client/src/components/game/GameSessionReplay.tsx` (+305 -0) 📝 `packages/client/src/components/game/GameSurface.tsx` (+199 -48) ➕ `packages/client/src/lib/game-choice-utils.ts` (+8 -0) ➕ `packages/client/src/lib/game-session-replay.ts` (+165 -0) 📝 `packages/client/src/lib/game-session-resolution.ts` (+19 -0) 📝 `packages/shared/src/types/chat.ts` (+9 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+79 -0) </details> ### 📄 Description ## Linked issue Closes #3465 ## Why this change Players can finish a memorable Game Mode session but cannot replay it from the beginning. Logs only provide limited text review, and concluded sessions do not offer deterministic, read-only playback of narration, presentation cues, or recorded choices. ## What changed - Added a Replay Session action to each concluded Session History entry. - Reconstructs stored narration, player turns, party dialogue, inline choices, and recorded CYOA selections without invoking the GM. - Locks every replay fork except the original recorded choice, then continues along the stored path. - Replays stored and inline background, music, ambient, SFX, direction, and segment-effect cues while keeping replay state isolated from the live session. - Removes live toolbars, send controls, QTEs, weather, storyboard, reactions, and editable HUD widgets while replay is active. - Supports legacy sessions that only have a branch-named canonical chat, preferring canonical non-branch chats when both exist. - Persists replay presentation cues on newly generated turns and safely falls back to inline tags for older sessions. - Lazy-loads the replay screen so GameSurface remains within the enforced bundle budget. ## 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` ### Automated evidence - `pnpm check` passed outside the container (shared/server/client lint and production builds). - `pnpm regression:issues` passed. - Focused replay ESLint and TypeScript checks passed. - Production bundle check passed with GameSurface at 498.74 kB and replay split into a 9.35 kB on-demand chunk. ### Manual verification notes - Opened the real concluded Session 7 and confirmed replay mode loads with read-only chrome and no normal Session toolbar. - Replayed Session 6 as 8 stored turns; at the first CYOA fork exactly the recorded choice was enabled and the other four choices were disabled. - Selected the recorded choice and confirmed playback advanced to Turn 3 without creating a game turn. - Replayed legacy Session 1 as 32 stored turns, confirming branch-named older sessions remain accessible. - Confirmed send controls and editable HUD widget controls are absent during replay. - Older generated backgrounds that no longer exist in the asset library fall back safely; inline narration and choices remain replayable. ## 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) Documentation was added to `docs/game/sessions-and-saves.md`, and the Unreleased changelog was updated. ## UI evidence (if applicable) Validated in the in-app browser against the local saved campaign; screenshots are not attached because they contain private game-session content. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added read-only replay for completed Game Mode sessions from Session History. * Replay sessions with narration, presentation cues, backgrounds, audio, and deterministic choice paths. * Added controls to replay, continue, watch again, or return to the current session. * Original choices are highlighted; other choices are disabled. * **Documentation** * Added guidance explaining replay behavior, compatibility, and limitations. * **Tests** * Added regression coverage for replay turn reconstruction, presentation cues, and session selection. <!-- 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-23 04:05:32 +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#5953
No description provided.