[PR #2220] [MERGED] Fix game journal NPC and quest logs #5483

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2220
Author: @cha1latte
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2140-game-journal-logs


📝 Commits (10+)

  • 4b4c1ea fix(game): restore journal npc and quest logs
  • 04832bf chore: record issue 2140 draft pr
  • e63eb93 chore: complete issue 2140 proof ledger
  • dfbf436 chore: move issue 2140 proof out of pr diff
  • 798105a Merge remote-tracking branch 'upstream/refactor' into fix/issue-2140-game-journal-logs
  • ae9ccbe Merge remote-tracking branch 'upstream/refactor' into fix/issue-2140-game-journal-logs
  • de4fe46 fix: clear stale quest completion timestamps
  • e65745a fix: preserve completed quest timestamps
  • 7787b60 fix: normalize explicit quest completion timestamps
  • 359616b fix: respect combat result precedence

📊 Changes

3 files changed (+505 additions, -79 deletions)

View changed files

➕ scratch/bugfix-verification.json (+194 -0)
📝 src/engine/modes/game/world/journal.service.ts (+280 -6)
📝 src/features/modes/game/api/game-api.ts (+31 -73)

📄 Description

Linked issue

Closes #2140

Why this change

  • Game journal NPC interaction and quest rows were read/rendered by the journal and deterministic recap, but the refactor no longer wrote them. npc and quest journal commands fell through to generic events, and current tracked NPC/quest state was not hydrated into the journal.

What changed

  • Restored structured NPC and quest journal builders inside the React-free game journal service.
  • Moved journal command dispatch into the engine journal service, including npc and quest branches.
  • Hydrates journal reads, explicit journal writes, and session conclusion summaries from tracked gameNpcs plus normalized playerStats.activeQuests.
  • Preserves existing location/item journal command payload fields while keeping combat, note, and generic event dispatch in the same journal command path.
  • Captured focused local ignored proof for NPC/quest command routing, location/item payload fields, game-state sync, and deterministic recap output.

Refactor impact

Primary owner:

  • game mode / engine journal

Impact areas reviewed:

  • src/engine/modes/game/world/journal.service.ts
  • src/features/modes/game/api/game-api.ts
  • deterministic game journal recap behavior

Boundary notes:

  • Product journal behavior now lives in src/engine; the feature API imports focused engine helpers and still owns chat metadata persistence.
  • No raw Tauri, storage, provider, dependency, schema, auth, or prompt-pipeline changes.

Pressure points touched:

  • gameApi.addJournalEntry
  • gameApi.getJournal
  • gameApi.concludeSession

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

  • Codex focused repro before fix: the local ignored Vitest proof failed because applyJournalEntry and syncJournalFromGameState did not exist.
  • Codex focused proof after fix: the local ignored Vitest proof passed with 3 tests.
  • Codex ran pnpm typecheck and pnpm check:architecture; both passed.
  • Codex ran full pnpm check; it passed.
  • Codex ran the Marinara proof gate against the PR proof ledger; it passed.
  • Bunny pass completed before opening this draft.
  • Current GitHub Rust check is blocked by the upstream/refactor merge ref defining LorebookEntryAtomicRows and LorebookFolderDeleteAtomicRows twice in src-tauri/src/commands/storage/commands/entities.rs; this PR does not touch that file. A local merge of current upstream/refactor reproduced the same cargo check failure, so this draft stays blocked rather than expanding scope into unrelated Rust storage cleanup.

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:

  • Bugfix/compatibility restoration for existing game journal behavior; no new user-discoverable surface.

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 (if applicable)

  • N/A. This is a React-free journal command/state hydration fix verified with focused Vitest coverage and full repo checks; no visible layout changed.

Summary by CodeRabbit

  • Bug Fixes

    • Improved game journal synchronization for NPC interactions and quest logs.
    • Enhanced quest tracking with better status and completion handling.
    • Strengthened game state synchronization for accurate journal updates.
  • Chores

    • Internal journal service restructuring to improve code organization.

🔄 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/2220 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2140-game-journal-logs` --- ### 📝 Commits (10+) - [`4b4c1ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4b4c1ea4bc0f6893dd0c4e268ce7e6c33c23cff7) fix(game): restore journal npc and quest logs - [`04832bf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/04832bfe013b04018bd67e0f61a7a3c9d19f2fa7) chore: record issue 2140 draft pr - [`e63eb93`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e63eb93cf4897a86833719e6fa6305a4489c9e9c) chore: complete issue 2140 proof ledger - [`dfbf436`](https://github.com/Pasta-Devs/Marinara-Engine/commit/dfbf43699cbecbe815d1c7e9b32675aadeab41c5) chore: move issue 2140 proof out of pr diff - [`798105a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/798105a1f53e45c6ff526ce53c0267ac25298683) Merge remote-tracking branch 'upstream/refactor' into fix/issue-2140-game-journal-logs - [`ae9ccbe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ae9ccbe04b9b153a6b9022896095dd529a47caf6) Merge remote-tracking branch 'upstream/refactor' into fix/issue-2140-game-journal-logs - [`de4fe46`](https://github.com/Pasta-Devs/Marinara-Engine/commit/de4fe468c47ef7ced5d66fdbb6cb499980a3b1f2) fix: clear stale quest completion timestamps - [`e65745a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e65745a4580f18b7ecafd2c76160285e7df21b36) fix: preserve completed quest timestamps - [`7787b60`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7787b60da526ad283ef592c49bb83ba8661b7fe4) fix: normalize explicit quest completion timestamps - [`359616b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/359616beacdd65e9ae6b445f594ecf58573a56fc) fix: respect combat result precedence ### 📊 Changes **3 files changed** (+505 additions, -79 deletions) <details> <summary>View changed files</summary> ➕ `scratch/bugfix-verification.json` (+194 -0) 📝 `src/engine/modes/game/world/journal.service.ts` (+280 -6) 📝 `src/features/modes/game/api/game-api.ts` (+31 -73) </details> ### 📄 Description ## Linked issue Closes #2140 ## Why this change - Game journal NPC interaction and quest rows were read/rendered by the journal and deterministic recap, but the refactor no longer wrote them. `npc` and `quest` journal commands fell through to generic events, and current tracked NPC/quest state was not hydrated into the journal. ## What changed - Restored structured NPC and quest journal builders inside the React-free game journal service. - Moved journal command dispatch into the engine journal service, including `npc` and `quest` branches. - Hydrates journal reads, explicit journal writes, and session conclusion summaries from tracked `gameNpcs` plus normalized `playerStats.activeQuests`. - Preserves existing location/item journal command payload fields while keeping combat, note, and generic event dispatch in the same journal command path. - Captured focused local ignored proof for NPC/quest command routing, location/item payload fields, game-state sync, and deterministic recap output. ## Refactor impact Primary owner: - game mode / engine journal Impact areas reviewed: - `src/engine/modes/game/world/journal.service.ts` - `src/features/modes/game/api/game-api.ts` - deterministic game journal recap behavior Boundary notes: - Product journal behavior now lives in `src/engine`; the feature API imports focused engine helpers and still owns chat metadata persistence. - No raw Tauri, storage, provider, dependency, schema, auth, or prompt-pipeline changes. Pressure points touched: - `gameApi.addJournalEntry` - `gameApi.getJournal` - `gameApi.concludeSession` ## 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 - Codex focused repro before fix: the local ignored Vitest proof failed because `applyJournalEntry` and `syncJournalFromGameState` did not exist. - Codex focused proof after fix: the local ignored Vitest proof passed with 3 tests. - Codex ran `pnpm typecheck` and `pnpm check:architecture`; both passed. - Codex ran full `pnpm check`; it passed. - Codex ran the Marinara proof gate against the PR proof ledger; it passed. - Bunny pass completed before opening this draft. - Current GitHub Rust check is blocked by the `upstream/refactor` merge ref defining `LorebookEntryAtomicRows` and `LorebookFolderDeleteAtomicRows` twice in `src-tauri/src/commands/storage/commands/entities.rs`; this PR does not touch that file. A local merge of current `upstream/refactor` reproduced the same `cargo check` failure, so this draft stays blocked rather than expanding scope into unrelated Rust storage cleanup. ## 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: - Bugfix/compatibility restoration for existing game journal behavior; no new user-discoverable surface. ## 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 (if applicable) - N/A. This is a React-free journal command/state hydration fix verified with focused Vitest coverage and full repo checks; no visible layout changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved game journal synchronization for NPC interactions and quest logs. * Enhanced quest tracking with better status and completion handling. * Strengthened game state synchronization for accurate journal updates. * **Chores** * Internal journal service restructuring to improve code organization. <!-- 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:16:43 +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#5483
No description provided.