[PR #4870] [MERGED] Fix Game persisted settings and Session Log metadata #6521

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4870
Author: @Xelvanis
Created: 8/10/2026
Status: ✅ Merged
Merged: 8/10/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/ui-settings-persistence


📝 Commits (2)

  • 1da4fde fix: preserve Game client persisted state
  • 33a749e fix: require boolean Game session markers

📊 Changes

5 files changed (+204 additions, -77 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/client/src/components/game/GameNarration.tsx (+2 -28)
➕ packages/client/src/lib/game-session-history.ts (+35 -0)
📝 packages/client/src/stores/ui.store.ts (+2 -49)
📝 scripts/regressions/open-issues.regression.ts (+164 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4869

Why this change

Game preferences and persisted narration metadata currently cross browser-local, server-sync, and JSON transport boundaries inconsistently. That can make Game's Send-on-Enter choice fail to follow the user's settings profile, let an offline restart resurrect the Game tutorial, and make Session Logs ignore stored token counts or the current-session marker.

The nearby UI-store migration also retains ten version gates whose work is repeated immediately by unconditional canonicalizers.

What changed

  • Added enterToSendGame to the synchronized UI settings projection.
  • Added gameTutorialDisabled to browser-local persistence while retaining its existing server sync.
  • Added a regression invariant requiring every server-synced UI setting to also be browser-local persisted.
  • Reused parseMessageExtraRecord when Session Logs estimate the current Game session, including JSON-string metadata, the latest isConversationStart marker, valid finite positive token counts, and malformed/absent fallback.
  • Removed only the ten redundant UI migration gates while preserving their unconditional canonicalizers and the real image-style-profile legacy fallback.
  • Added focused coverage to the existing open-issues regression lane and documented the user-facing fixes in the changelog.

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

  • Ran pnpm check against the final committed tree.
  • Ran the complete pnpm regression:issues aggregate; expected negative-fixture WARN/ERROR logs were emitted and the aggregate passed.
  • Ran git diff --check.
  • In a disposable headed Edge session, seeded an active Game chat through existing APIs with:
    • a 999-token message before the latest session marker;
    • current-session persisted token counts of 40, 80, and 120 returned through the ordinary JSON-string extra transport shape.
  • Opened Game Session Logs and confirmed all four log entries rendered while the current-session estimate displayed ~240 tokens, excluding the pre-marker 999-token message.
  • Repeated the visible Session Logs check at a 390×844 mobile viewport.
  • No visual styling or layout changed, so theme-specific before/after screenshots were not required. The disposable proof session was removed after verification.
  • Container validation was not run because this change is limited to client state projection, hydration, and deterministic regression coverage.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

The [Unreleased] changelog is updated. No user documentation, translated documentation, or version files require changes.

UI evidence (if applicable)

The affected UI is an existing Session Logs text estimate rather than a layout/style change. Headed desktop and mobile proof is described above; no repository image assets were added.

Summary by CodeRabbit

  • Bug Fixes

    • Game “Send on Enter” and tutorial-dismissal preferences now persist correctly across local storage and synchronization.
    • Session Logs now restore token counts and current-session markers reliably.
    • Active game-session token estimates now handle stored metadata and fallback calculations more accurately.
  • Tests

    • Added regression coverage for session history estimation, settings migration, synchronization, and persistence.

🔄 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/4870 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 8/10/2026 **Status:** ✅ Merged **Merged:** 8/10/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/ui-settings-persistence` --- ### 📝 Commits (2) - [`1da4fde`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1da4fde44117c210c774756408362e03452b85b4) fix: preserve Game client persisted state - [`33a749e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/33a749ee31ba89f96d8c84b001c81587b383b49c) fix: require boolean Game session markers ### 📊 Changes **5 files changed** (+204 additions, -77 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/client/src/components/game/GameNarration.tsx` (+2 -28) ➕ `packages/client/src/lib/game-session-history.ts` (+35 -0) 📝 `packages/client/src/stores/ui.store.ts` (+2 -49) 📝 `scripts/regressions/open-issues.regression.ts` (+164 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #4869 ## Why this change Game preferences and persisted narration metadata currently cross browser-local, server-sync, and JSON transport boundaries inconsistently. That can make Game's Send-on-Enter choice fail to follow the user's settings profile, let an offline restart resurrect the Game tutorial, and make Session Logs ignore stored token counts or the current-session marker. The nearby UI-store migration also retains ten version gates whose work is repeated immediately by unconditional canonicalizers. ## What changed - Added `enterToSendGame` to the synchronized UI settings projection. - Added `gameTutorialDisabled` to browser-local persistence while retaining its existing server sync. - Added a regression invariant requiring every server-synced UI setting to also be browser-local persisted. - Reused `parseMessageExtraRecord` when Session Logs estimate the current Game session, including JSON-string metadata, the latest `isConversationStart` marker, valid finite positive token counts, and malformed/absent fallback. - Removed only the ten redundant UI migration gates while preserving their unconditional canonicalizers and the real image-style-profile legacy fallback. - Added focused coverage to the existing open-issues regression lane and documented the user-facing fixes in the changelog. ## Validation - [x] `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) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Ran `pnpm check` against the final committed tree. - Ran the complete `pnpm regression:issues` aggregate; expected negative-fixture WARN/ERROR logs were emitted and the aggregate passed. - Ran `git diff --check`. - In a disposable headed Edge session, seeded an active Game chat through existing APIs with: - a 999-token message before the latest session marker; - current-session persisted token counts of 40, 80, and 120 returned through the ordinary JSON-string `extra` transport shape. - Opened Game **Session Logs** and confirmed all four log entries rendered while the current-session estimate displayed `~240 tokens`, excluding the pre-marker 999-token message. - Repeated the visible Session Logs check at a 390×844 mobile viewport. - No visual styling or layout changed, so theme-specific before/after screenshots were not required. The disposable proof session was removed after verification. - Container validation was not run because this change is limited to client state projection, hydration, and deterministic regression coverage. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) The `[Unreleased]` changelog is updated. No user documentation, translated documentation, or version files require changes. ## UI evidence (if applicable) The affected UI is an existing Session Logs text estimate rather than a layout/style change. Headed desktop and mobile proof is described above; no repository image assets were added. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Game “Send on Enter” and tutorial-dismissal preferences now persist correctly across local storage and synchronization. * Session Logs now restore token counts and current-session markers reliably. * Active game-session token estimates now handle stored metadata and fallback calculations more accurately. * **Tests** * Added regression coverage for session history estimation, settings migration, synchronization, and persistence. <!-- 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:11:13 +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#6521
No description provided.