mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5168] [MERGED] fix(tracker): repair Inventory Tracker write paths, flow entries as chips #6654
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6654
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5168
Author: @augusteo
Created: 8/17/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/inventory-tracker-density📝 Commits (8)
f6c9218fix(tracker): repair Inventory Tracker write paths, flow entries as chips48d6964fix(tracker): nest chip lock and hover states inside the pillaf6c15efix(tracker): express a locked chip on the pill, not behind its text7ceadf0fix(tracker): mark a locked chip with a padlock, not a restyled pillec5808afix(chats): reject a non-object playerStats payload on game-state PATCH78a00f8Merge branch 'staging' into fix/inventory-tracker-densitye20ad63test(tracker): type normalized player stats624a88aMerge remote-tracking branch 'origin/staging' into review/pr-5168📊 Changes
19 files changed (+667 additions, -87 deletions)
View changed files
📝
CHANGELOG.md(+8 -1)📝
docs/roleplay/hud-and-trackers.md(+6 -2)📝
packages/client/src/components/chat/RoleplayHUD.tsx(+12 -7)📝
packages/client/src/features/tracker-panel/components/TrackerDataSidebar.tsx(+5 -1)📝
packages/client/src/features/tracker-panel/components/TrackerSectionList.tsx(+20 -4)📝
packages/client/src/features/tracker-panel/components/controls/SectionControls.tsx(+7 -2)📝
packages/client/src/features/tracker-panel/components/sections/InventoryTrackerPanel.tsx(+91 -22)➕
packages/client/src/features/tracker-panel/lib/inventory-tracker-edit.ts(+55 -0)📝
packages/client/src/hooks/use-game-state-patcher.ts(+31 -1)📝
packages/client/src/hooks/use-settings-sync.ts(+35 -2)📝
packages/client/src/lib/agent-suite-tracker-slices.ts(+23 -3)📝
packages/client/src/stores/ui.store.ts(+2 -2)📝
packages/server/src/routes/chats.routes.ts(+15 -1)📝
packages/server/src/routes/generate/generate-route-utils.ts(+5 -35)📝
packages/shared/src/index.ts(+1 -0)➕
packages/shared/src/utils/inventory-tracker-rows.ts(+168 -0)📝
packages/shared/src/utils/tracker-field-locks.ts(+2 -4)📝
scripts/regressions/open-issues.regression.ts(+32 -0)📝
scripts/regressions/prompt.regression.ts(+149 -0)📄 Description
Linked issue
Closes #5172
Why this change
Running the shipped Inventory Tracker against a real chat turned up five defects and confirmed the density problem the feature was meant to solve was still there, one level down.
The section was invisible. Not for everyone — for anyone whose synced UI settings blob was written before the section existed.
useSettingsSyncoverwrites the locally migrated store with the server blob (use-settings-sync.ts:284), andtrackerPanelSectionOrderwas the one tracker preference that blob never re-normalized on ingest. The store-version bump in #5117 only ever fixed the browser-local copy. Reproduced on my own install:Quest Board follows Present Characters directly, with the agent active and holding data. This is general, not inventory-specific — every future tracker section would have hit it.
Hand edits skipped every rule the agent path enforced. Tracker Panel and HUD edits wrote rows straight to state, so name trimming, duplicate merging, the quantity clamp, and the rule keeping equipped gear out of carried inventory were all bypassed. A value the agent could never emit could still be typed in. The Agent Suite JSON editor checked only that the three keys were arrays, and the chat game-state route accepted any
playerStatspayload unchecked — so every client-side rule was bypassable by a direct API call.The layout spent its budget on the wrong things. A fixed 36px quantity cell was drawn on every row including the qty-1 rows, which was all nine rows in a live agent run. And three fixed columns split the panel between three groups of wildly unequal length: at the widest setting each column was ~95px and names truncated, while a two-row group sat mostly empty.
What changed
Fixes
trackerPanelSectionOrderandtrackerPanelCollapsedSections, and forces a server rewrite when normalization changed a value — otherwise the stale array survives and re-arrives on the next device.patchPlayerStatsFields, derived from the snapshot being written to. Equipping a carried item rewrites two fields; three independent callbacks could not express that, and the synthesized removal was being dropped.chats.routes.tsnormalizesplayerStatson write.normalizeInventoryTrackerRowsandclampInventoryTrackerQtymoved to@marinara-engine/sharedso all four writers share one implementation.Layout
×Nonly above one; the delete×moved inside the chip so it reflows instead of overhanging its neighbour.@container, so it lays out identically docked and in the HUD popover. Previously the popover had no container ancestor and rendered differently.12 items in 5 lines at 340px, with no truncation; one per line below 300px.
Hiding the quantity at 1 would make it unreachable, so add mode and lock mode both reveal the control on every entry.
Two design notes
Merging on hand edits. Rows merge by name here exactly as on the server, so optimistic state cannot drift from what was persisted. Adding stays safe because each new placeholder gets a name no existing row has — otherwise two untouched "New item" rows would collapse into one with
qty: 2.Marking a locked entry.
InlineEditandInlineNumberpaint a fill and ring when a field is locked. That wasdesigned for bare rows on a panel; inside a chip that already has a border it drew a second surface within the
first, so a pinned entry no longer looked like its neighbours. A padlock marks the lock instead and the chip keeps
exactly the same border and fill as every other chip. Restyling the chip was the wrong instinct: the tracker panel
defines its own scoped colour tokens, so a value derived from
var(--foreground)resolves differently there andreads as greyed-out rather than pinned. Nothing is locked in the screenshots above, so every chip is identical.
Popover density. The HUD popover hardcodes add and delete modes on, so every chip there shows
×1and a delete×. That is pre-existing popover behaviour, not something this PR changes, but it does mean the density gain is smaller there than in the docked panel.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated, on this branch:
pnpm check— passes.pnpm regression— 123/124. The one failure,extension-security.regression.ts, is pre-existing: it fails identically on cleanorigin/stagingwith this branch's changes stashed.pnpm regression:prompt,open-issues.regression.ts— pass, including the new assertions.Browser, against a real Roleplay chat with the official
inventory-trackerpackage installed and a live agent run:inventorypresent.Waterskinchip toShort axe, which was equipped: removed from carried rather than appearing in both lists.Second short axecorrectly survived as a distinct item.PATCH /game-statewith" Copper bit "and a carried"short AXE": normalized toCopper bit, duplicate dropped.+, quantity control on every entry; two adds producedNew itemandNew item 2, notqty: 2.×inside the chip, no overlap.Container:
docker buildfrom the repoDockerfilesucceeded, image ran,/api/healthreturned 200 and the container logged no errors.normalizeInventoryTrackerPlayerStatsis in bothpackages/shared/distandpackages/server/dist/routes/chats.routes.js.Edge cases:
trackerPanelBackgroundColor, and the HUD popover follows the app theme; chips, borders,×Nand the delete controls all stay legible on the dark palette.0, each group renders Nothing tracked, and the layout does not collapse.open-issues.regression.ts), and the game-state route now answers 400 for a non-objectplayerStats(covered inprompt.regression.ts).Still not verified, and I could not do it from here:
@media (pointer: coarse). That media query cannot be made to match in this automation context (matchMedia('(pointer: coarse)')staysfalseand the tab cannot emulate touch), so the rule is present in the source but its effect on a real touch device is unconfirmed.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)docs/roleplay/hud-and-trackers.mdandCHANGELOG.mdare updated here. The translated packs are in a companion PR againstdocs-i18n— all ten packs still described the HUD as it was before the Inventory Tracker existed, so that PR brings them level with English rather than only mirroring this change. Manifests rebuilt and all ten passvalidate-pack.mjs.Follow-up worth opening separately
There is still no way to move an item between groups — equipping means deleting from one group and retyping in the other. That needs its own interaction design, so I kept it out of this diff.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Maintainer follow-up: CodeRabbit findings were applied and the branch was revalidated before merge.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.