[PR #6789] [MERGED] feat(game): a bag per party member, and every inventory change saved by the server #7333

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

📋 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)

  • 1226222 feat(game): a bag per party member, and every inventory change saved by the server
  • 613f73a fix(game): keep each telling's inventory through branches, deleted swipes and new sessions
  • f32e6ef Merge remote-tracking branch 'origin/staging' into feat/ruleset-item-bags
  • 708053e Merge remote-tracking branch 'origin/staging' into feat/ruleset-item-bags
  • b42cf42 fix(game): drop the tellings record with a plain patch when a swipe deletion cannot update it
  • a05e246 fix(game): take back a reply's inventory answers when its chat is gone before they are carried out
  • be3569d fix(game): keep only the player's own bag in the detailed inventory
  • d685ba9 fix(game): rename a detailed entry only when the new name is in the player's own bag
  • f07ebeb fix(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

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 #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:

  • Nobody carried anything of their own. The Game Master could not hand the rope to Bram, and the player could not give a potion to a companion. A ruleset that tracks carrying weight would have nobody to weigh it against.
  • The Game Master's [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.
  • Refusals were never reported. Taking something the party does not have failed silently, and the Game Master never learned it.
  • Saves were split in two. Every change wrote the stacks and the game state's detailed inventory in two requests, and the browser rolled one back by hand if the other failed. The combat director's item spends updated only the stacks.
  • Tellings added up (#6774). Regenerating a reply that gave a sword, twice, left three swords. Swiping back to an earlier version did not undo the later ones.

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

  • A bag per party member. Each stack now names who carries it (holder). A stack without one belongs to the player's character, so every saved game opens exactly as it was.
    • Adding and renaming stay inside one bag.
    • Taking by name takes from the player's bag first, then the rest of the party.
    • A merge follows the stack it is dropped on.
    • A holder name with no letter or digit in it (such as ???) is the player's own bag, since it cannot be told apart from it.
  • The shared view. The inventory opens on All, which shows who carries each stack, with a tab per party member.
    • Give hands some or all of a stack to someone else, and dragging a stack onto a tab gives them all of it.
    • Add puts the new item in the open tab's bag (the player's from All).
    • Each party member's character sheet lists what they carry.
    • At phone width the stack's buttons wrap onto a second line, so Use stays visible beside Give.
  • One route for every change the player makes (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.
    • The detailed inventory on the game state follows only the player's own bag, since the sheet, the trackers and an encounter's prompt all read it as the player's. What a companion carries shows on their own sheet.
  • The Game Master's tags are carried out by the server, in every game:
    • who="Name" on add and remove, and action="give" to="Name". A give takes only from the bag it names, or the player's.
    • Each tag is answered with what happened (result, now or reason), one tag per item, in the saved reply, so a refusal is read back next turn. A result the Game Master wrote itself is never believed.
    • The answers are worked out on the current stacks before the reply is saved, and the stacks change only after it is saved. A reply that is never saved changes nothing. If the player changed the inventory in between, the saved answers are corrected to match.
    • The browser no longer applies anything; it announces the answered tags as the player reaches them.
  • Tellings never add up (#6774). The latest turn whose tags touched the inventory is remembered with the stacks it began with and what each swipe left.
    • A regenerated reply starts from the turn's beginning.
    • Switching swipes shows what that swipe left.
    • Both happen only while the stacks are still exactly what the replaced telling left. Once the player changes something, a new telling adds on top and nothing they did is undone.
    • Deleting a swipe moves the record's later tellings down with the swipes, and deleting the one shown shows what the telling now shown left, as switching to it would. Both delete routes now take their turn with swipe switches.
    • A branch takes the record with its copy of the turn, or leaves it behind when cut before that turn.
    • A new session and a saved chat profile never carry the record.
  • The Game Master sees who carries what (PARTY INVENTORY, one line per member) once anyone besides the player carries something. Otherwise the old PLAYER INVENTORY line is unchanged. The command line teaches who, to and give.
  • A tracker rebuilding a turn's game-state row keeps that turn's detailed inventory, the way it already keeps live sheet state. Only the world-state tracker's rebuild asks for this; every other write keeps the inventory it is given.
  • Typing right after picking a stack is kept. The amount and name fields used to be reset to the picked stack by an effect after it rendered, which on a busy page could overwrite what the player had already typed (found by the stacks browser test). Both are now worked out while rendering, keyed to the stack they were typed for.
  • Docs. The "The inventory" section in docs/game/party-and-npcs.md, and the CHANGELOG.

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

Run by the agent on this branch (five commits, with staging 0eac28284 merged in):

  • pnpm check exits 0.
  • pnpm regression:node passes 414/414.
  • pnpm smoke:ui passes 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=1 passes 13/13. The same batch passed six runs in a row after the typing fix below.

New lanes:

  • scripts/regressions/game-inventory-bags.regression.ts covers:
    • holders read and kept; adding, taking, giving, renaming and merging across bags;
    • every operation with its results and journal, refusals that change nothing, and the detailed inventory following by difference;
    • the tag grammar (every older form, plus who, to and give, forged results ignored), and who and to matched like a sheet command's who;
    • the 40-tag cap and unapplied tags answered as refused;
    • the tellings record;
    • the route saving stacks, detailed inventory and journal together, and refusing a malformed request whole;
    • a tracker rebuild keeping the inventory;
    • what the Game Master is shown.
  • scripts/regressions/game-inventory-turn.regression.ts drives real turns through the generate route with a scripted provider:
    • tags answered and carried out, and the prompt showing who carries what;
    • a refusal read back next turn;
    • an impersonated turn applying nothing;
    • regenerating, swiping back and forth, a player's change being kept, and a continuation;
    • a branch switching its own tellings, and a branch cut before the turn carrying no record;
    • deleting a telling that is not shown, the one shown, and every other one while a different swipe is shown;
    • the next session carrying every bag but not the record.
  • combat-director-route.regression.ts now 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:

  • a give without who taking from someone it did not name;
  • notification colours matched on English text;
  • drags resolved by index;
  • out-of-order save answers showing older stacks;
  • a failed save leaving the chat unsynced;
  • stale reply text downstream of a correction;
  • the swipe-switch rollback clobbering a newer choice;
  • unapplied tags keeping a forged result;
  • the turn record written apart from the stacks;
  • give and split counts accepting text like 2abc;
  • two quick swipe switches racing (swipe selection is now one at a time per chat);
  • a regenerated reply's prompt showing the inventory the replaced telling left, not the one it starts from.

The swipe accumulation it flagged was pre-existing (#6774) and is fixed here.

Two local CodeRabbit suggestions were declined:

  • Wrapping the route's commit in its own error handling: the app's global error handler already turns a throw into its structured response, and the operations themselves never throw.
  • Re-reading the chat after an older save's late answer: the newer answer has already set both the screen and the cache.

An intermittent failure of the stacks browser test (typing +50 right after a split) turned out to be two real problems, not a flake:

  • The page's own narration save answers with the whole chat metadata, and it could write the pre-split stacks back into the cache. The inventory save now claims its fields the way a metadata save does (claimChatMetadataFields).
  • The amount field was reset to the picked stack after it rendered, over what had just been typed. That is the typing fix above. The screen recording of a failing run showed the typed +50 replaced by 100 a moment later.

GitHub CodeRabbit's first review found four more, all real and fixed in the second commit:

  • a branch not taking the tellings record with its copy of the turn;
  • deleting a swipe leaving the record's swipe indexes out of step;
  • a replaced game-state row always keeping its old detailed inventory, even over one written on purpose;
  • a holder name keying to nothing being read as the player's bag by some helpers and not others.

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:

  • All shows whose each stack is, and a companion's tab shows only theirs.
  • Give (2 of 3 ropes) and dragging a stack onto a tab both saved and survived a reload; giving back showed its notification.
  • A Game Master turn adding, giving (to) and removing items was answered in the saved reply, a refused give with reason="none-held", and the notifications and the inventory agreed. The prompt showed PARTY INVENTORY and the new command line.
  • Regenerating that turn started from its beginning, and switching between the two tellings showed each one's inventory. After giving an item by hand, a regenerate kept that change and added on top.
  • A potion used from a fight's Items came from the player's own bag first, and the journal logged it once.
  • Ending the session and starting the next carried every bag.
  • At phone width in light mode the tabs, holder labels and Give row fit. This found the clipped Use button, now fixed.
  • Game Mode has no swipe arrows, so switching tellings was done through the route the chat view's arrows call.

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):

  • Let a real Game Master model give, take and hand over items with who and to, and confirm it follows the answered tags next turn.
  • Drag a stack onto a tab on a touch screen.
  • Branch a game with Branch before this decision after a turn that changed the inventory, and confirm the branch's inventory is right.

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

Docs touched: docs/game/party-and-npcs.md (carried by docs-i18n) and CHANGELOG.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

    • Party members can keep separate inventory bags. View items across the party or open an individual bag, give full or partial stacks, and add items to the selected bag.
    • Character sheets show carried items. Inventory changes are saved with the game state and journal, including items used in combat.
    • Game Master commands can add, remove, and transfer items between party members, with notifications for successful or refused changes. Unspecified removals draw from the player’s bag first, then other party bags.
    • Inventory stays aligned with saved reply versions when regenerating, switching versions, deleting replies, or branching chats. Manual inventory edits are preserved, and bags carry over between game sessions.
  • Bug Fixes

    • Fixed combat item use so spending items is recorded correctly, including for repeated commands.

🔄 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/6789 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/27/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-item-bags` --- ### 📝 Commits (9) - [`1226222`](https://github.com/Pasta-Devs/Marinara-Engine/commit/122622258f9374ff29c52ca1acc6ce2b356e5b64) feat(game): a bag per party member, and every inventory change saved by the server - [`613f73a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/613f73a47d508e148a27ec013640fec41f086208) fix(game): keep each telling's inventory through branches, deleted swipes and new sessions - [`f32e6ef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f32e6ef0d32bcc9c2a73ed98400b917bfe529bb1) Merge remote-tracking branch 'origin/staging' into feat/ruleset-item-bags - [`708053e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/708053e80ad3f60e104fcb46e38b2b76c9affdb7) Merge remote-tracking branch 'origin/staging' into feat/ruleset-item-bags - [`b42cf42`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b42cf42756ce03b261ce1afcb710cebb973a1485) fix(game): drop the tellings record with a plain patch when a swipe deletion cannot update it - [`a05e246`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a05e2462558ce6b13ee97ca58abc60da4e784c5a) fix(game): take back a reply's inventory answers when its chat is gone before they are carried out - [`be3569d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/be3569d6d72502ef946ec9685960134ce4e3662e) fix(game): keep only the player's own bag in the detailed inventory - [`d685ba9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d685ba96679644da23543a489801887b22b4b7ed) fix(game): rename a detailed entry only when the new name is in the player's own bag - [`f07ebeb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f07ebebcf5f9875e360c0598fe9beffda6dccff3) fix(game): only a rename in the player's own bag renames a detailed entry ### 📊 Changes **29 files changed** (+3801 additions, -645 deletions) <details> <summary>View changed files</summary> 📝 `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_ </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`. <!-- See CONTRIBUTING.md § Branches. --> ## 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: - **Nobody carried anything of their own.** The Game Master could not hand the rope to Bram, and the player could not give a potion to a companion. A ruleset that tracks carrying weight would have nobody to weigh it against. - **The Game Master's `[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. - **Refusals were never reported.** Taking something the party does not have failed silently, and the Game Master never learned it. - **Saves were split in two.** Every change wrote the stacks and the game state's detailed inventory in two requests, and the browser rolled one back by hand if the other failed. The combat director's item spends updated only the stacks. - **Tellings added up (#6774).** Regenerating a reply that gave a sword, twice, left three swords. Swiping back to an earlier version did not undo the later ones. 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 - **A bag per party member.** Each stack now names who carries it (`holder`). A stack without one belongs to the player's character, so every saved game opens exactly as it was. - Adding and renaming stay inside one bag. - Taking by name takes from the player's bag first, then the rest of the party. - A merge follows the stack it is dropped on. - A holder name with no letter or digit in it (such as `???`) is the player's own bag, since it cannot be told apart from it. - **The shared view.** The inventory opens on **All**, which shows who carries each stack, with a tab per party member. - **Give** hands some or all of a stack to someone else, and dragging a stack onto a tab gives them all of it. - **Add** puts the new item in the open tab's bag (the player's from **All**). - Each party member's character sheet lists what they carry. - At phone width the stack's buttons wrap onto a second line, so **Use** stays visible beside **Give**. - **One route for every change the player makes** (`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. - The detailed inventory on the game state follows only the player's own bag, since the sheet, the trackers and an encounter's prompt all read it as the player's. What a companion carries shows on their own sheet. - **The Game Master's tags are carried out by the server**, in every game: - `who="Name"` on add and remove, and `action="give" to="Name"`. A give takes only from the bag it names, or the player's. - Each tag is answered with what happened (`result`, `now` or `reason`), one tag per item, in the saved reply, so a refusal is read back next turn. A `result` the Game Master wrote itself is never believed. - The answers are worked out on the current stacks before the reply is saved, and the stacks change only after it is saved. A reply that is never saved changes nothing. If the player changed the inventory in between, the saved answers are corrected to match. - The browser no longer applies anything; it announces the answered tags as the player reaches them. - **Tellings never add up (#6774).** The latest turn whose tags touched the inventory is remembered with the stacks it began with and what each swipe left. - A regenerated reply starts from the turn's beginning. - Switching swipes shows what that swipe left. - Both happen only while the stacks are still exactly what the replaced telling left. Once the player changes something, a new telling adds on top and nothing they did is undone. - Deleting a swipe moves the record's later tellings down with the swipes, and deleting the one shown shows what the telling now shown left, as switching to it would. Both delete routes now take their turn with swipe switches. - A branch takes the record with its copy of the turn, or leaves it behind when cut before that turn. - A new session and a saved chat profile never carry the record. - **The Game Master sees who carries what** (`PARTY INVENTORY`, one line per member) once anyone besides the player carries something. Otherwise the old `PLAYER INVENTORY` line is unchanged. The command line teaches `who`, `to` and `give`. - **A tracker rebuilding a turn's game-state row keeps that turn's detailed inventory**, the way it already keeps live sheet state. Only the world-state tracker's rebuild asks for this; every other write keeps the inventory it is given. - **Typing right after picking a stack is kept.** The amount and name fields used to be reset to the picked stack by an effect after it rendered, which on a busy page could overwrite what the player had already typed (found by the stacks browser test). Both are now worked out while rendering, keyed to the stack they were typed for. - **Docs.** The "The inventory" section in `docs/game/party-and-npcs.md`, and the CHANGELOG. ## 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 Run by the agent on this branch (five commits, with staging 0eac28284 merged in): - `pnpm check` exits 0. - `pnpm regression:node` passes 414/414. - `pnpm smoke:ui` passes 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=1` passes 13/13. The same batch passed six runs in a row after the typing fix below. New lanes: - `scripts/regressions/game-inventory-bags.regression.ts` covers: - holders read and kept; adding, taking, giving, renaming and merging across bags; - every operation with its results and journal, refusals that change nothing, and the detailed inventory following by difference; - the tag grammar (every older form, plus `who`, `to` and `give`, forged results ignored), and who and to matched like a sheet command's `who`; - the 40-tag cap and unapplied tags answered as refused; - the tellings record; - the route saving stacks, detailed inventory and journal together, and refusing a malformed request whole; - a tracker rebuild keeping the inventory; - what the Game Master is shown. - `scripts/regressions/game-inventory-turn.regression.ts` drives real turns through the generate route with a scripted provider: - tags answered and carried out, and the prompt showing who carries what; - a refusal read back next turn; - an impersonated turn applying nothing; - regenerating, swiping back and forth, a player's change being kept, and a continuation; - a branch switching its own tellings, and a branch cut before the turn carrying no record; - deleting a telling that is not shown, the one shown, and every other one while a different swipe is shown; - the next session carrying every bag but not the record. - `combat-director-route.regression.ts` now 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: - a give without `who` taking from someone it did not name; - notification colours matched on English text; - drags resolved by index; - out-of-order save answers showing older stacks; - a failed save leaving the chat unsynced; - stale reply text downstream of a correction; - the swipe-switch rollback clobbering a newer choice; - unapplied tags keeping a forged `result`; - the turn record written apart from the stacks; - give and split counts accepting text like `2abc`; - two quick swipe switches racing (swipe selection is now one at a time per chat); - a regenerated reply's prompt showing the inventory the replaced telling left, not the one it starts from. The swipe accumulation it flagged was pre-existing (#6774) and is fixed here. Two local CodeRabbit suggestions were declined: - Wrapping the route's commit in its own error handling: the app's global error handler already turns a throw into its structured response, and the operations themselves never throw. - Re-reading the chat after an older save's late answer: the newer answer has already set both the screen and the cache. An intermittent failure of the stacks browser test (typing `+50` right after a split) turned out to be two real problems, not a flake: - The page's own narration save answers with the whole chat metadata, and it could write the pre-split stacks back into the cache. The inventory save now claims its fields the way a metadata save does (`claimChatMetadataFields`). - The amount field was reset to the picked stack after it rendered, over what had just been typed. That is the typing fix above. The screen recording of a failing run showed the typed `+50` replaced by `100` a moment later. GitHub CodeRabbit's first review found four more, all real and fixed in the second commit: - a branch not taking the tellings record with its copy of the turn; - deleting a swipe leaving the record's swipe indexes out of step; - a replaced game-state row always keeping its old detailed inventory, even over one written on purpose; - a holder name keying to nothing being read as the player's bag by some helpers and not others. 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: - **All** shows whose each stack is, and a companion's tab shows only theirs. - **Give** (2 of 3 ropes) and dragging a stack onto a tab both saved and survived a reload; giving back showed its notification. - A Game Master turn adding, giving (`to`) and removing items was answered in the saved reply, a refused give with `reason="none-held"`, and the notifications and the inventory agreed. The prompt showed `PARTY INVENTORY` and the new command line. - Regenerating that turn started from its beginning, and switching between the two tellings showed each one's inventory. After giving an item by hand, a regenerate kept that change and added on top. - A potion used from a fight's **Items** came from the player's own bag first, and the journal logged it once. - Ending the session and starting the next carried every bag. - At phone width in light mode the tabs, holder labels and Give row fit. This found the clipped **Use** button, now fixed. - Game Mode has no swipe arrows, so switching tellings was done through the route the chat view's arrows call. 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): - Let a real Game Master model give, take and hand over items with `who` and `to`, and confirm it follows the answered tags next turn. - Drag a stack onto a tab on a touch screen. - Branch a game with **Branch before this decision** after a turn that changed the inventory, and confirm the branch's inventory is right. ## 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]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs touched: `docs/game/party-and-npcs.md` (carried by `docs-i18n`) and `CHANGELOG.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. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Party members can keep separate inventory bags. View items across the party or open an individual bag, give full or partial stacks, and add items to the selected bag. * Character sheets show carried items. Inventory changes are saved with the game state and journal, including items used in combat. * Game Master commands can add, remove, and transfer items between party members, with notifications for successful or refused changes. Unspecified removals draw from the player’s bag first, then other party bags. * Inventory stays aligned with saved reply versions when regenerating, switching versions, deleting replies, or branching chats. Manual inventory edits are preserved, and bags carry over between game sessions. * **Bug Fixes** * Fixed combat item use so spending items is recorded correctly, including for repeated commands. <!-- 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:18:44 +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#7333
No description provided.