[PR #2335] [MERGED] Persist persona-stats inventory acquisitions in game journal #5536

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2335
Author: @Xelvanis
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/2295-persona-stats-inventory-journal


📝 Commits (2)

  • 1fd6bef game: journal persona-stats inventory acquisitions
  • 9c6807f game: reconcile journal inventory in turn lane

📊 Changes

5 files changed (+165 additions, -11 deletions)

View changed files

📝 src/engine/generation/start-generation.ts (+18 -2)
📝 src/engine/generation/tracker-snapshots.ts (+20 -5)
📝 src/engine/modes/game/turn/game-turn.service.ts (+44 -1)
📝 src/engine/modes/game/world/journal.service.ts (+80 -1)
📝 src/features/modes/game/api/game-api.ts (+3 -2)

📄 Description

Linked issue

Closes #2295

Why this change

  • Game-mode persona-stats tracker snapshots could add an inventory item to playerStats.inventory without writing an acquired row to the game journal, so the item appeared in live inventory but the acquisition history was missing.

What changed

  • Sync missing acquired inventory rows from playerStats.inventory through the game journal service.
  • Persist game-mode persona-stats snapshot acquisitions into metadata.gameJournal when tracker snapshots are saved, so the acquired row survives later item removal.
  • Keep direct item journal writes from pre-syncing inventory so [inventory:] tag/manual item writes do not duplicate acquired rows.

Refactor impact

Primary owner:

  • Game mode journal/world-state tracker snapshot persistence.

Impact areas reviewed:

  • Game journal inventory log derivation and recap input.
  • Persona-stats tracker snapshot persistence.
  • Direct gameApi.addJournalEntry() item writes.
  • Non-game chat gating for persona-stats snapshot journal persistence.

Boundary notes:

  • Engine generation now calls the game journal service for game-mode-only journal metadata sync after saving tracker snapshots.
  • No shared API, Rust, Tauri command, or remote-runtime routing changes.

Pressure points touched:

  • None of the named pressure-point files were changed.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm exec vitest run src/engine/generation/tracker-snapshot-journal-2295.tmp.test.ts passed with 2 focused assertions; proof-only test file was removed before commit.
  • pnpm typecheck passed.
  • git diff --check passed.
  • pnpm check passed after the final diff.
  • Native Tauri/UI manual validation was not run; this is a storage/engine journal persistence fix with no visible layout change.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • This restores expected game journal behavior for an existing tracker path; it does not add a new discoverable feature.

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

No screenshots or recordings. The change persists game journal inventory rows and does not change visible layout or controls.

Summary by CodeRabbit

  • New Features
    • Inventory is now automatically synchronized with the game journal when character stats are updated
    • Game journal accurately tracks and records all inventory changes from the current game state

🔄 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/2335 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/2295-persona-stats-inventory-journal` --- ### 📝 Commits (2) - [`1fd6bef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1fd6befbeb23483ba99462ee0560b2bbbbd94432) game: journal persona-stats inventory acquisitions - [`9c6807f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9c6807f29ad9ca7bff5b45e448fcebd0d0980a40) game: reconcile journal inventory in turn lane ### 📊 Changes **5 files changed** (+165 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/start-generation.ts` (+18 -2) 📝 `src/engine/generation/tracker-snapshots.ts` (+20 -5) 📝 `src/engine/modes/game/turn/game-turn.service.ts` (+44 -1) 📝 `src/engine/modes/game/world/journal.service.ts` (+80 -1) 📝 `src/features/modes/game/api/game-api.ts` (+3 -2) </details> ### 📄 Description ## Linked issue Closes #2295 ## Why this change - Game-mode persona-stats tracker snapshots could add an inventory item to `playerStats.inventory` without writing an acquired row to the game journal, so the item appeared in live inventory but the acquisition history was missing. ## What changed - Sync missing acquired inventory rows from `playerStats.inventory` through the game journal service. - Persist game-mode persona-stats snapshot acquisitions into `metadata.gameJournal` when tracker snapshots are saved, so the acquired row survives later item removal. - Keep direct item journal writes from pre-syncing inventory so `[inventory:]` tag/manual item writes do not duplicate acquired rows. ## Refactor impact Primary owner: - Game mode journal/world-state tracker snapshot persistence. Impact areas reviewed: - Game journal inventory log derivation and recap input. - Persona-stats tracker snapshot persistence. - Direct `gameApi.addJournalEntry()` item writes. - Non-game chat gating for persona-stats snapshot journal persistence. Boundary notes: - Engine generation now calls the game journal service for game-mode-only journal metadata sync after saving tracker snapshots. - No shared API, Rust, Tauri command, or remote-runtime routing changes. Pressure points touched: - None of the named pressure-point files were changed. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm exec vitest run src/engine/generation/tracker-snapshot-journal-2295.tmp.test.ts` passed with 2 focused assertions; proof-only test file was removed before commit. - `pnpm typecheck` passed. - `git diff --check` passed. - `pnpm check` passed after the final diff. - Native Tauri/UI manual validation was not run; this is a storage/engine journal persistence fix with no visible layout change. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - This restores expected game journal behavior for an existing tracker path; it does not add a new discoverable feature. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No screenshots or recordings. The change persists game journal inventory rows and does not change visible layout or controls. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Inventory is now automatically synchronized with the game journal when character stats are updated * Game journal accurately tracks and records all inventory changes from the current game state <!-- 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:17:10 +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#5536
No description provided.