mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6789] [MERGED] feat(game): a bag per party member, and every inventory change saved by the server #7333
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#7333
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/6789
Author: @kolacheee
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/27/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-item-bags📝 Commits (9)
1226222feat(game): a bag per party member, and every inventory change saved by the server613f73afix(game): keep each telling's inventory through branches, deleted swipes and new sessionsf32e6efMerge remote-tracking branch 'origin/staging' into feat/ruleset-item-bags708053eMerge remote-tracking branch 'origin/staging' into feat/ruleset-item-bagsb42cf42fix(game): drop the tellings record with a plain patch when a swipe deletion cannot update ita05e246fix(game): take back a reply's inventory answers when its chat is gone before they are carried outbe3569dfix(game): keep only the player's own bag in the detailed inventoryd685ba9fix(game): rename a detailed entry only when the new name is in the player's own bagf07ebebfix(game): only a rename in the player's own bag renames a detailed entry📊 Changes
29 files changed (+3801 additions, -645 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/game/party-and-npcs.md(+10 -4)➕
e2e/game-inventory-bags.e2e.ts(+123 -0)📝
packages/client/src/components/game/GameInventory.tsx(+394 -100)📝
packages/client/src/components/game/GameSurface.tsx(+321 -407)📝
packages/client/src/hooks/use-chats.ts(+14 -0)📝
packages/client/src/lib/game-inventory-amount.ts(+8 -0)📝
packages/client/src/lib/game-tag-parser.ts(+10 -48)📝
packages/client/src/localization/locales/en.json(+23 -0)📝
packages/server/src/routes/chats.routes.ts(+118 -28)📝
packages/server/src/routes/combat-director.routes.ts(+15 -16)➕
packages/server/src/routes/game-inventory.routes.ts(+26 -0)📝
packages/server/src/routes/game.routes.ts(+3 -0)📝
packages/server/src/routes/generate.routes.ts(+220 -2)📝
packages/server/src/routes/index.ts(+2 -0)➕
packages/server/src/services/game/game-inventory.service.ts(+257 -0)📝
packages/server/src/services/game/gm-prompts.ts(+26 -2)📝
packages/server/src/services/storage/chats.storage.ts(+8 -0)📝
packages/server/src/services/storage/game-state.storage.ts(+23 -6)📝
packages/shared/src/index.ts(+4 -0)...and 9 more files
📄 Description
Linked issue
Closes #6772
Closes #6774
Why this change
Game Mode had one inventory for the whole party, and how it was saved caused problems of its own:
[inventory:]tags were applied in the browser, only as the player read each part of the narration. A reply that finished while nobody was reading, or was read on another device, never changed the inventory.This is slice I2 of the ruleset items plan, for every Game Mode game, with or without a ruleset. Ruleset items in the inventory (the item picker, equipping, binding and placement by carrying weight) follow in the next slice. It needs no Capability API change.
What changed
holder). A stack without one belongs to the player's character, so every saved game opens exactly as it was.???) is the player's own bag, since it cannot be told apart from it.POST /api/game/inventory). It saves the stacks, the detailed inventory and the journal in one queued transaction. The inventory screen's six handlers now send operations to it and show what it answers with. The combat director's item spends use the same helper, so they now reach the detailed inventory and the journal too.who="Name"on add and remove, andaction="give" to="Name". A give takes only from the bag it names, or the player's.result,noworreason), one tag per item, in the saved reply, so a refusal is read back next turn. Aresultthe Game Master wrote itself is never believed.PARTY INVENTORY, one line per member) once anyone besides the player carries something. Otherwise the oldPLAYER INVENTORYline is unchanged. The command line teacheswho,toandgive.docs/game/party-and-npcs.md, and the CHANGELOG.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on this branch (five commits, with staging
0eac28284merged in):pnpm checkexits 0.pnpm regression:nodepasses 414/414.pnpm smoke:uipasses 7/7.pnpm regression:ui e2e/game-inventory-bags.e2e.ts e2e/game-inventory-stacks.e2e.ts e2e/game-combat-ai.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1passes 13/13. The same batch passed six runs in a row after the typing fix below.New lanes:
scripts/regressions/game-inventory-bags.regression.tscovers:who,toandgive, forged results ignored), and who and to matched like a sheet command'swho;scripts/regressions/game-inventory-turn.regression.tsdrives real turns through the generate route with a scripted provider:combat-director-route.regression.tsnow checks a fight's item spend reaches the journal once.New browser test
e2e/game-inventory-bags.e2e.ts: the shared view with holders, a member's tab, giving 2 of 3 with Give, dragging a stack onto a tab, and adding from a member's tab.Forty deliberate breaks of these rules, in the shared helpers, the server and the prompt, were each caught. One more, reading a continuation's starting row from the turn's base row instead of its own, is not caught: in every flow the lane can drive the two are the same row, so the explicit read is a safeguard rather than a change in behaviour.
Local CodeRabbit (
coderabbit review --agent --base staging), fifteen passes, down to 0 findings. Fixed along the way:whotaking from someone it did not name;result;2abc;The swipe accumulation it flagged was pre-existing (#6774) and is fixed here.
Two local CodeRabbit suggestions were declined:
An intermittent failure of the stacks browser test (typing
+50right after a split) turned out to be two real problems, not a flake:claimChatMetadataFields).+50replaced by100a moment later.GitHub CodeRabbit's first review found four more, all real and fixed in the second commit:
Its later rounds found two more, fixed in their own commits: a reply whose chat was deleted before its tags were carried out kept its answers, and the detailed inventory counted every companion's items as the player's.
Clicked through by the agent, in a separate Engine instance on its own ports and data folder, with a stand-in model that answers with scripted replies:
to) and removing items was answered in the saved reply, a refused give withreason="none-held", and the notifications and the inventory agreed. The prompt showedPARTY INVENTORYand the new command line.The previous session's tellings record travelling into the next session was also found this way, and is fixed.
Still to verify by hand (not done by the agent):
whoandto, and confirm it follows the answered tags next turn.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
docs/game/party-and-npcs.md(carried bydocs-i18n) andCHANGELOG.md. Translations are batched for the items arc: this section joins the batched[docs-i18n]issue opened after the arc's last slice, so no per-PR issue is opened.UI evidence (if applicable)
The browser test saves two screenshots: the Give row open on a player's stack in the shared view, and a companion's tab after a gift and an addition.
Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.