[PR #2380] [MERGED] Preserve player stats on empty persona-stats agent output #5569

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/persona-stats-empty-clobber


📝 Commits (1)

  • 1224d97 Preserve player stats on empty persona-stats agent output

📊 Changes

2 files changed (+80 additions, -3 deletions)

View changed files

📝 src/engine/generation/tracker-snapshots.test.ts (+70 -0)
📝 src/engine/generation/tracker-snapshots.ts (+10 -3)

📄 Description

Linked issue

Closes #2370

Why this change

The persona-stats tracker branch in gameStatePatchFromAgentResult assigned inventory, status, and personaStats unconditionally, so a truncated or empty agent payload wiped the player's existing inventory, stat bars, and status. The clobbered values persist to chat.gameState and become the next-turn baseline, making the loss permanent (high-severity roleplay data loss).

What changed

  • Guard each field so an empty array or blank string is treated as "no update" rather than a clear, mirroring the mergeCustomTrackerFieldsFromAgent length > 0 guard already used by the custom-tracker branch.

Refactor impact

Primary owner: engine generation (src/engine/generation/tracker-snapshots.ts)

Impact areas reviewed:

  • Only the persona-stats branch; the patch is spread over the snapshot, so omitting a key preserves the baseline value.

Boundary notes:

  • none — engine-layer pure logic.

Pressure points touched:

  • none

Validation

  • Matching validation command passes locally
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm vitest run src/engine/generation/tracker-snapshots.test.ts — 4 passed (2 existing + 2 new: empty payload preserves inventory/status/persona-stats; non-empty payload still applies).
  • pnpm exec tsc -b — clean.

Feature Discoverability

  • N/A because this PR is a data-loss bugfix and does not add a new thing users need to find.

Reason:

  • Corrects an existing merge path.

Docs and release impact

  • No docs changes needed

🔄 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/2380 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/6/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `refactor` ← **Head:** `fix/persona-stats-empty-clobber` --- ### 📝 Commits (1) - [`1224d97`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1224d97141ebb1a148d88952da2c85e562936ac1) Preserve player stats on empty persona-stats agent output ### 📊 Changes **2 files changed** (+80 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/tracker-snapshots.test.ts` (+70 -0) 📝 `src/engine/generation/tracker-snapshots.ts` (+10 -3) </details> ### 📄 Description ## Linked issue Closes #2370 ## Why this change The persona-stats tracker branch in `gameStatePatchFromAgentResult` assigned `inventory`, `status`, and `personaStats` unconditionally, so a truncated or empty agent payload wiped the player's existing inventory, stat bars, and status. The clobbered values persist to `chat.gameState` and become the next-turn baseline, making the loss permanent (high-severity roleplay data loss). ## What changed - Guard each field so an empty array or blank string is treated as "no update" rather than a clear, mirroring the `mergeCustomTrackerFieldsFromAgent` `length > 0` guard already used by the custom-tracker branch. ## Refactor impact Primary owner: engine generation (`src/engine/generation/tracker-snapshots.ts`) Impact areas reviewed: - Only the `persona-stats` branch; the patch is spread over the snapshot, so omitting a key preserves the baseline value. Boundary notes: - none — engine-layer pure logic. Pressure points touched: - none ## Validation - [ ] Matching validation command passes locally - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm vitest run src/engine/generation/tracker-snapshots.test.ts` — 4 passed (2 existing + 2 new: empty payload preserves inventory/status/persona-stats; non-empty payload still applies). - `pnpm exec tsc -b` — clean. ## Feature Discoverability - [x] N/A because this PR is a data-loss bugfix and does not add a new thing users need to find. Reason: - Corrects an existing merge path. ## Docs and release impact - [x] No docs changes needed --- <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:27 +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#5569
No description provided.