[PR #5117] [MERGED] fix(tracker): stop Inventory Tracker wiping untracked groups #6636

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

📋 Pull Request Information

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

Base: staging ← Head: fix/inventory-tracker-data-loss


📝 Commits (5)

  • 9e373b1 fix(tracker): stop Inventory Tracker wiping untracked groups
  • bf8b5c9 Merge branch 'staging' into fix/inventory-tracker-data-loss
  • e761e1d fix(tracker): normalize inventory exclusivity names
  • 636b7a8 Merge remote-tracking branch 'origin/staging' into review/pr-5117
  • 3e42261 Merge remote-tracking branch 'origin/staging' into review/pr-5117

📊 Changes

8 files changed (+214 additions, -27 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/core-flows.e2e.ts (+1 -1)
📝 packages/client/src/stores/ui.store.ts (+6 -1)
📝 packages/server/src/routes/generate/generate-route-utils.ts (+66 -24)
📝 packages/shared/src/utils/tracker-field-locks.ts (+38 -0)
📝 scripts/regressions/agent-runtime.regression.ts (+1 -0)
📝 scripts/regressions/prompt.regression.ts (+100 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+1 -1)

📄 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 #5125

Follow-up to #5112 / #5105.

Why this change

Inventory Tracker updates could silently erase groups omitted by the agent, restore a carried duplicate after equipping a locked item, serialize overflowing quantities as null, or leave the new section hidden in existing persisted panel layouts. These are data-integrity failures in the feature introduced for #5105.

What changed

  • Preserve omitted inventory groups instead of treating absence as an empty replacement.
  • Enforce carried/currency/equipped exclusivity after lock merging and normalize compared names consistently.
  • Clamp parsed and combined quantities to Number.MAX_SAFE_INTEGER.
  • Bump the persisted UI store version so existing layouts gain the Inventory section.
  • Repair the agent result-type regression vocabulary and add focused regression coverage.
  • Document the fixes in CHANGELOG.md.

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

Automated evidence:

  • pnpm check passed on the final review-fix commit.
  • pnpm regression:agent-runtime and pnpm regression:roleplay passed before review.
  • The Inventory Tracker assertions in pnpm regression:prompt pass, including omitted groups, lock merging, normalized-name exclusivity without lock data, and quantity overflow. The full lane still reports the unrelated pre-existing ElevenLabs tone-tag assertion documented on staging.

Remaining maintainer verification items:

  • Manually verify upgrading a persisted store at version 93 makes the Inventory section visible.
  • Manually verify equipping a locked carried item moves it instead of duplicating it.
  • Manually verify a partial agent response leaves omitted inventory groups intact.

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] <paths> follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md now records the user-facing data-integrity fixes. No user-facing documentation, localization, translated docs, or release metadata changes are required.

UI evidence (if applicable)

Not applicable; this fixes state migration and server/shared inventory merge behavior without changing the rendered UI.

Summary by CodeRabbit

  • Bug Fixes

    • Inventory tracker updates now preserve omitted sections and modify only requested fields.
    • Prevented duplicate entries across carried, currency, and equipped items.
    • Locked items now move safely between carried and equipped sections.
    • Quantities are clamped to safe values, preventing invalid data.
    • Empty updates no longer rewrite existing snapshots.
  • Improvements

    • Existing tracker layouts now migrate to include the Inventory section with normalized ordering.

🔄 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/5117 **Author:** [@augusteo](https://github.com/augusteo) **Created:** 8/16/2026 **Status:** ✅ Merged **Merged:** 8/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/inventory-tracker-data-loss` --- ### 📝 Commits (5) - [`9e373b1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9e373b12704b1f2d38c2a6dd5babc566bd7d9e3d) fix(tracker): stop Inventory Tracker wiping untracked groups - [`bf8b5c9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bf8b5c960d46a46ecf9e7f51b9de2ebbe41050ed) Merge branch 'staging' into fix/inventory-tracker-data-loss - [`e761e1d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e761e1d89b4658d8ace86464dfec2b8a1bae20da) fix(tracker): normalize inventory exclusivity names - [`636b7a8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/636b7a8c9a1f4837fa0cc9966b8c85bc07007446) Merge remote-tracking branch 'origin/staging' into review/pr-5117 - [`3e42261`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3e4226185380bb76a3416f9da9e8af40df026e2e) Merge remote-tracking branch 'origin/staging' into review/pr-5117 ### 📊 Changes **8 files changed** (+214 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/core-flows.e2e.ts` (+1 -1) 📝 `packages/client/src/stores/ui.store.ts` (+6 -1) 📝 `packages/server/src/routes/generate/generate-route-utils.ts` (+66 -24) 📝 `packages/shared/src/utils/tracker-field-locks.ts` (+38 -0) 📝 `scripts/regressions/agent-runtime.regression.ts` (+1 -0) 📝 `scripts/regressions/prompt.regression.ts` (+100 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+1 -1) </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`. ## Linked issue Closes #5125 Follow-up to #5112 / #5105. ## Why this change Inventory Tracker updates could silently erase groups omitted by the agent, restore a carried duplicate after equipping a locked item, serialize overflowing quantities as `null`, or leave the new section hidden in existing persisted panel layouts. These are data-integrity failures in the feature introduced for #5105. ## What changed - Preserve omitted inventory groups instead of treating absence as an empty replacement. - Enforce carried/currency/equipped exclusivity after lock merging and normalize compared names consistently. - Clamp parsed and combined quantities to `Number.MAX_SAFE_INTEGER`. - Bump the persisted UI store version so existing layouts gain the Inventory section. - Repair the agent result-type regression vocabulary and add focused regression coverage. - Document the fixes in `CHANGELOG.md`. ## 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 Automated evidence: - `pnpm check` passed on the final review-fix commit. - `pnpm regression:agent-runtime` and `pnpm regression:roleplay` passed before review. - The Inventory Tracker assertions in `pnpm regression:prompt` pass, including omitted groups, lock merging, normalized-name exclusivity without lock data, and quantity overflow. The full lane still reports the unrelated pre-existing ElevenLabs tone-tag assertion documented on `staging`. Remaining maintainer verification items: - Manually verify upgrading a persisted store at version 93 makes the Inventory section visible. - Manually verify equipping a locked carried item moves it instead of duplicating it. - Manually verify a partial agent response leaves omitted inventory groups intact. ## 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] <paths>` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `CHANGELOG.md` now records the user-facing data-integrity fixes. No user-facing documentation, localization, translated docs, or release metadata changes are required. ## UI evidence (if applicable) Not applicable; this fixes state migration and server/shared inventory merge behavior without changing the rendered UI. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Inventory tracker updates now preserve omitted sections and modify only requested fields. * Prevented duplicate entries across carried, currency, and equipped items. * Locked items now move safely between carried and equipped sections. * Quantities are clamped to safe values, preventing invalid data. * Empty updates no longer rewrite existing snapshots. * **Improvements** * Existing tracker layouts now migrate to include the Inventory section with normalized ordering. <!-- 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:12:18 +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#6636
No description provided.