[PR #1761] [MERGED] Add durable tracker row IDs #5267

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

📋 Pull Request Information

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

Base: refactor ← Head: feat/issue-1528-tracker-row-ids


📝 Commits (2)

  • 730b0e7 Add durable tracker row ids
  • 1d36248 Address review feedback: tracker row identity fixes

📊 Changes

18 files changed (+641 additions, -95 deletions)

View changed files

📝 src/engine/contracts/types/game-state.ts (+11 -1)
➕ src/engine/generation/tracker-snapshots.test.ts (+134 -0)
📝 src/engine/generation/tracker-snapshots.ts (+3 -2)
📝 src/engine/shared/game-state/player-stats.ts (+7 -5)
➕ src/engine/shared/game-state/tracker-row-ids.test.ts (+59 -0)
➕ src/engine/shared/game-state/tracker-row-ids.ts (+142 -0)
📝 src/features/modes/game/components/GameSurface.tsx (+48 -3)
📝 src/features/modes/roleplay/components/RoleplayHUD.tsx (+6 -4)
📝 src/features/runtime/generation/hooks/use-generate.ts (+6 -39)
📝 src/features/runtime/tracker/components/CustomTrackerPanel.tsx (+1 -1)
📝 src/features/runtime/tracker/components/PersonaTrackerPanel.tsx (+1 -1)
📝 src/features/runtime/tracker/components/TrackerSectionList.tsx (+1 -0)
📝 src/features/runtime/tracker/components/quest-tracker/QuestRow.tsx (+1 -1)
📝 src/features/runtime/tracker/components/tracker-data-sidebar.stats.tsx (+1 -1)
📝 src/features/runtime/tracker/hooks/use-tracker-mutations.ts (+15 -8)
➕ src/features/runtime/world-state/lib/tracker-state-edits.test.ts (+119 -0)
📝 src/features/runtime/world-state/lib/tracker-state-edits.ts (+81 -28)
📝 src/features/runtime/world-state/stores/world-state.store.ts (+5 -1)

📄 Description

Linked issue

Closes #1528

Why this change

  • Nested tracker rows were still reconciled by visible labels like name or text, so duplicate stat names, inventory item names, custom field names, or quest objective text could cause manual edits and agent snapshot merges to target the wrong row.

What changed

  • Added durable nested tracker row IDs for character/player/persona stats, inventory items, custom tracker fields, and quest objectives.
  • Added engine-owned normalization/defaulting so legacy snapshots and generated agent output without IDs remain readable and are saved/current-state normalized.
  • Updated tracker merge paths to prefer durable IDs while retaining visible-key fallback for legacy/no-id rows.
  • Updated manual tracker row creation and game inventory additions to assign manual-* IDs.
  • Added focused coverage for duplicate labels, legacy no-id fallback, and snapshot normalization/defaulting.

Refactor impact

Primary owner:

world-state / engine generation

Impact areas reviewed:

  • Engine game-state contract and tracker snapshot persistence
  • Shared player-stat parsing
  • Runtime tracker merge helpers and tracker UI row keys
  • Roleplay HUD tracker widgets and game inventory sync path

Boundary notes:

  • Engine/shared game-state normalization stays React-free.
  • Feature code continues using runtime/world-state helpers rather than raw storage or Tauri APIs.
  • No Rust storage migration is included; snapshots remain JSON-compatible and normalize at read/save/current-state boundaries.

Pressure points touched:

  • GameSurface inventory tracker sync
  • Roleplay HUD tracker widget merge paths
  • Runtime tracker panel row identity and keys

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • pnpm check passes locally before PR push/handoff, including the unused-code check
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Manual verification notes

Codex verification run from clean worktree C:\tmp\Marinara-Engine-issue-1528:

  • pnpm test src/features/runtime/world-state/lib/tracker-state-edits.test.ts passed.
  • pnpm test src/engine/generation/tracker-snapshots.test.ts passed.
  • pnpm typecheck passed.
  • pnpm check passed, including line endings, architecture, frontend typecheck, Rust check, docs, and unused-code check.
  • Bunny review pass completed locally for the current diff.

Manual browser/Tauri verification was not run because this is a data-contract and merge-logic change, not a visible UI layout claim.

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

No docs changes were made; this is a tracker state contract/compatibility implementation.

UI evidence

N/A. No visual UI behavior or layout claim; row keys changed only to preserve identity after the new durable IDs are present.

Summary by CodeRabbit

  • Bug Fixes
    • Improved tracker system reliability and consistency across quest objectives, inventory items, character statistics, and custom fields.
    • Enhanced game state persistence and data recovery capabilities with improved support for legacy save data.
    • More stable and reliable synchronization of tracker updates throughout the game interface.

🔄 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/1761 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `feat/issue-1528-tracker-row-ids` --- ### 📝 Commits (2) - [`730b0e7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/730b0e7c46b64d022c264c421435978064041aa9) Add durable tracker row ids - [`1d36248`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1d3624856a6af356e336050a4da01c1ebca46fe0) Address review feedback: tracker row identity fixes ### 📊 Changes **18 files changed** (+641 additions, -95 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/contracts/types/game-state.ts` (+11 -1) ➕ `src/engine/generation/tracker-snapshots.test.ts` (+134 -0) 📝 `src/engine/generation/tracker-snapshots.ts` (+3 -2) 📝 `src/engine/shared/game-state/player-stats.ts` (+7 -5) ➕ `src/engine/shared/game-state/tracker-row-ids.test.ts` (+59 -0) ➕ `src/engine/shared/game-state/tracker-row-ids.ts` (+142 -0) 📝 `src/features/modes/game/components/GameSurface.tsx` (+48 -3) 📝 `src/features/modes/roleplay/components/RoleplayHUD.tsx` (+6 -4) 📝 `src/features/runtime/generation/hooks/use-generate.ts` (+6 -39) 📝 `src/features/runtime/tracker/components/CustomTrackerPanel.tsx` (+1 -1) 📝 `src/features/runtime/tracker/components/PersonaTrackerPanel.tsx` (+1 -1) 📝 `src/features/runtime/tracker/components/TrackerSectionList.tsx` (+1 -0) 📝 `src/features/runtime/tracker/components/quest-tracker/QuestRow.tsx` (+1 -1) 📝 `src/features/runtime/tracker/components/tracker-data-sidebar.stats.tsx` (+1 -1) 📝 `src/features/runtime/tracker/hooks/use-tracker-mutations.ts` (+15 -8) ➕ `src/features/runtime/world-state/lib/tracker-state-edits.test.ts` (+119 -0) 📝 `src/features/runtime/world-state/lib/tracker-state-edits.ts` (+81 -28) 📝 `src/features/runtime/world-state/stores/world-state.store.ts` (+5 -1) </details> ### 📄 Description ## Linked issue Closes #1528 ## Why this change - Nested tracker rows were still reconciled by visible labels like `name` or `text`, so duplicate stat names, inventory item names, custom field names, or quest objective text could cause manual edits and agent snapshot merges to target the wrong row. ## What changed - Added durable nested tracker row IDs for character/player/persona stats, inventory items, custom tracker fields, and quest objectives. - Added engine-owned normalization/defaulting so legacy snapshots and generated agent output without IDs remain readable and are saved/current-state normalized. - Updated tracker merge paths to prefer durable IDs while retaining visible-key fallback for legacy/no-id rows. - Updated manual tracker row creation and game inventory additions to assign `manual-*` IDs. - Added focused coverage for duplicate labels, legacy no-id fallback, and snapshot normalization/defaulting. ## Refactor impact Primary owner: world-state / engine generation Impact areas reviewed: - Engine game-state contract and tracker snapshot persistence - Shared player-stat parsing - Runtime tracker merge helpers and tracker UI row keys - Roleplay HUD tracker widgets and game inventory sync path Boundary notes: - Engine/shared game-state normalization stays React-free. - Feature code continues using runtime/world-state helpers rather than raw storage or Tauri APIs. - No Rust storage migration is included; snapshots remain JSON-compatible and normalize at read/save/current-state boundaries. Pressure points touched: - `GameSurface` inventory tracker sync - Roleplay HUD tracker widget merge paths - Runtime tracker panel row identity and keys ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] `pnpm check` passes locally before PR push/handoff, including the unused-code check - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Codex verification run from clean worktree `C:\tmp\Marinara-Engine-issue-1528`: - `pnpm test src/features/runtime/world-state/lib/tracker-state-edits.test.ts` passed. - `pnpm test src/engine/generation/tracker-snapshots.test.ts` passed. - `pnpm typecheck` passed. - `pnpm check` passed, including line endings, architecture, frontend typecheck, Rust check, docs, and unused-code check. - Bunny review pass completed locally for the current diff. Manual browser/Tauri verification was not run because this is a data-contract and merge-logic change, not a visible UI layout claim. ## 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 No docs changes were made; this is a tracker state contract/compatibility implementation. ## UI evidence N/A. No visual UI behavior or layout claim; row keys changed only to preserve identity after the new durable IDs are present. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved tracker system reliability and consistency across quest objectives, inventory items, character statistics, and custom fields. * Enhanced game state persistence and data recovery capabilities with improved support for legacy save data. * More stable and reliable synchronization of tracker updates throughout the game interface. <!-- 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:14: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#5267
No description provided.