[PR #2224] [MERGED] Restore combat init debug logging #5487

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-2143-combat-init-debug


📝 Commits (2)

  • cb750ab Restore combat init debug logging
  • 6548195 Refresh PR metadata check

📊 Changes

4 files changed (+42 additions, -4 deletions)

View changed files

📝 src/engine/contracts/types/combat-encounter.ts (+3 -0)
📝 src/engine/modes/game/mechanics/combat-init.service.ts (+31 -4)
📝 src/features/modes/game/api/game-api.ts (+5 -0)
📝 src/features/modes/game/components/GameSurface.tsx (+3 -0)

📄 Description

Linked issue

Closes #2143

Why this change

  • Game-mode combat encounter initialization lost its debug-mode diagnostic trace during the refactor. Debug Mode could still be enabled globally, but the combat-init request contract and service no longer accepted or emitted the [debug/game/combat:init] request/response details.

What changed

  • Restored debugMode on EncounterInitRequest and added an optional debug sink for structured diagnostics.
  • Emitted combat-init request, raw response, and parsed response debug entries from the React-free game combat-init service when debug mode is enabled.
  • Forwarded debug mode and the existing agent debug log sink from the game combat generation caller into gameApi.initCombatEncounter.
  • Preserved quiet behavior when debug mode is disabled.

Refactor impact

Primary owner:

Game mode / engine combat generation

Impact areas reviewed:

  • src/engine/contracts/types/combat-encounter.ts
  • src/engine/modes/game/mechanics/combat-init.service.ts
  • src/features/modes/game/api/game-api.ts
  • src/features/modes/game/components/GameSurface.tsx

Boundary notes:

  • Product behavior stays in src/engine.
  • React UI stays in src/features.
  • The feature API wrapper forwards the existing UI debug setting/sink into the engine contract; the engine service remains React-free.
  • No Rust, storage, schema, dependency, auth, prompt-pipeline, or remote-runtime routing changes.

Pressure points touched:

  • GameSurface automatic combat generation path now forwards Debug Mode into combat init.

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

  • Scratch repro before fix: pnpm exec vitest run --config scratch/vitest.config.mts failed because combat init returned a generated encounter but emitted debugEntryCount: 0.
  • Scratch repro after fix: pnpm exec vitest run --config scratch/vitest.config.mts passed with two cases: debug mode on emits [debug/game/combat:init] entries, debug mode off emits none while generation still succeeds.
  • Focused validation: pnpm typecheck passed.
  • Full baseline: pnpm check passed.
  • Bunny review: pass against origin/refactor.
  • Workflow note: the optional local proof-gate helper referenced by workflow notes was unavailable at C:/Users/celia/.codex/tools/marinara-proof-gate.mjs; this does not block the core claim because the scratch repro and full baseline passed.
  • No human-only verification is required for the core claim.

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 for existing Debug Mode diagnostics; no new discoverable product 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

N/A for screenshots; this is a developer diagnostic/logging bug. Evidence is captured in scratch/repro-before.txt, scratch/repro-after.txt, and scratch/bugfix-verification.json.


🔄 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/2224 **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-2143-combat-init-debug` --- ### 📝 Commits (2) - [`cb750ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb750abcf9d6b563e0d333226443cdcc0ddfb996) Restore combat init debug logging - [`6548195`](https://github.com/Pasta-Devs/Marinara-Engine/commit/65481952156aeed8607afffb1bff17ff37df11a3) Refresh PR metadata check ### 📊 Changes **4 files changed** (+42 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/types/combat-encounter.ts` (+3 -0) 📝 `src/engine/modes/game/mechanics/combat-init.service.ts` (+31 -4) 📝 `src/features/modes/game/api/game-api.ts` (+5 -0) 📝 `src/features/modes/game/components/GameSurface.tsx` (+3 -0) </details> ### 📄 Description ## Linked issue Closes #2143 ## Why this change - Game-mode combat encounter initialization lost its debug-mode diagnostic trace during the refactor. Debug Mode could still be enabled globally, but the combat-init request contract and service no longer accepted or emitted the `[debug/game/combat:init]` request/response details. ## What changed - Restored `debugMode` on `EncounterInitRequest` and added an optional debug sink for structured diagnostics. - Emitted combat-init request, raw response, and parsed response debug entries from the React-free game combat-init service when debug mode is enabled. - Forwarded debug mode and the existing agent debug log sink from the game combat generation caller into `gameApi.initCombatEncounter`. - Preserved quiet behavior when debug mode is disabled. ## Refactor impact Primary owner: Game mode / engine combat generation Impact areas reviewed: - `src/engine/contracts/types/combat-encounter.ts` - `src/engine/modes/game/mechanics/combat-init.service.ts` - `src/features/modes/game/api/game-api.ts` - `src/features/modes/game/components/GameSurface.tsx` Boundary notes: - Product behavior stays in `src/engine`. - React UI stays in `src/features`. - The feature API wrapper forwards the existing UI debug setting/sink into the engine contract; the engine service remains React-free. - No Rust, storage, schema, dependency, auth, prompt-pipeline, or remote-runtime routing changes. Pressure points touched: - `GameSurface` automatic combat generation path now forwards Debug Mode into combat init. ## 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 - Scratch repro before fix: `pnpm exec vitest run --config scratch/vitest.config.mts` failed because combat init returned a generated encounter but emitted `debugEntryCount: 0`. - Scratch repro after fix: `pnpm exec vitest run --config scratch/vitest.config.mts` passed with two cases: debug mode on emits `[debug/game/combat:init]` entries, debug mode off emits none while generation still succeeds. - Focused validation: `pnpm typecheck` passed. - Full baseline: `pnpm check` passed. - Bunny review: pass against `origin/refactor`. - Workflow note: the optional local proof-gate helper referenced by workflow notes was unavailable at `C:/Users/celia/.codex/tools/marinara-proof-gate.mjs`; this does not block the core claim because the scratch repro and full baseline passed. - No human-only verification is required for the core claim. ## 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 for existing Debug Mode diagnostics; no new discoverable product 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 N/A for screenshots; this is a developer diagnostic/logging bug. Evidence is captured in `scratch/repro-before.txt`, `scratch/repro-after.txt`, and `scratch/bugfix-verification.json`. --- <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:45 +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#5487
No description provided.