[PR #6794] [MERGED] feat(game): items keep who they are when renamed (item ids and nicknames) #7335

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6794
Author: @kolacheee
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @kolacheee

Base: staging ← Head: feat/inventory-item-ids


📝 Commits (10+)

  • 6ae20d6 feat(game): items keep who they are when renamed (item ids and nicknames)
  • e6909ae Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids
  • a6b9a66 fix(game): unique fight line names, effects found for nicknamed lines, and the count an add reports
  • bbb549d fix(game): match a fight's item effects by each item's own name first
  • 1a86069 Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids
  • 39043d0 fix(game): draw a detailed entry by id first and leave untouched entries alone
  • e3b7f94 Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids
  • c66e7b2 fix(game): answer takes and gives with the count of the item they moved
  • 7b44118 fix(game): carry an entry of an item nobody holds as that item, and say both names plainly on Use
  • 48438b5 fix(game): trust an own name read off an id only when it makes that id again, and name an add by its stack

📊 Changes

20 files changed (+1274 additions, -394 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/game/party-and-npcs.md (+4 -4)
📝 e2e/game-inventory-bags.e2e.ts (+27 -5)
📝 packages/client/src/components/game/GameInventory.tsx (+88 -51)
📝 packages/client/src/components/game/GameSurface.tsx (+64 -50)
📝 packages/client/src/localization/locales/en.json (+4 -1)
📝 packages/server/src/routes/combat-director.routes.ts (+32 -9)
📝 packages/server/src/routes/game-inventory.routes.ts (+1 -1)
📝 packages/server/src/services/game/combat-director.service.ts (+3 -1)
📝 packages/server/src/services/game/game-inventory.service.ts (+3 -6)
📝 packages/server/src/services/game/gm-prompts.ts (+12 -5)
📝 packages/shared/src/features/combat-director.ts (+3 -1)
📝 packages/shared/src/types/game-state.ts (+3 -0)
📝 packages/shared/src/utils/game-inventory-ops.ts (+95 -85)
📝 packages/shared/src/utils/game-inventory-stacks.ts (+380 -102)
📝 packages/shared/src/utils/game-inventory-tags.ts (+19 -9)
📝 packages/shared/src/utils/game-inventory-turns.ts (+4 -2)
📝 scripts/regressions/combat-director-route.regression.ts (+104 -0)
📝 scripts/regressions/game-inventory-bags.regression.ts (+303 -48)
📝 scripts/regressions/game-inventory-stacks.regression.ts (+123 -14)

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

Why this change

Game Mode's inventory told items apart only by their names:

  • A rename changed what an item was. Renaming a stack of Rope to "Grandpa's rope" made it something else: the Game Master's remove no longer found it, and a fight listed it as another item.
  • A rename could pour one item into another. Renaming a stack to the name of something else in the same bag merged the two, whether or not they were the same thing.
  • The detailed inventory had to guess renames. The detailed inventory on the game state (what the sheet, the trackers and an encounter's prompt read) had no ids, so the server matched it to the stacks by comparing names before and after each change. Four rounds of review on #6789 each found another edge case in that guessing.
  • New items were all the same item. The inventory's Add made placeholders called "New item", which were one item until renamed.

This is the first half of slice I2b of the ruleset items plan (the user's ruling during #6789's review): items get a stable identity before ruleset items, which need one even more, arrive in the second half. It needs no Capability API change.

What changed

  • Every stack is an item with an id.
    • A stack keeps the item's own name, which a rename never changes.
    • A plain item's id is worked out from its own name (plain: and its letters and digits in any script, or a fingerprint for a name with none), so saved games stay byte-identical. Ruleset items will store a catalog reference in the next PR.
    • Splits, gifts and merges keep the item. Stacks merge only when they are the same item, whatever each is called.
  • A rename is a nickname. The stack shows it in place of the own name, with the own name beside it in the stack's header. Typing the own name back clears it. A rename never merges anything.
  • Naming an item (the Game Master's tags, a fight spending one) finds it by its own name or by a nickname, ignoring case.
    • The item whose own name it is always wins over another item's nickname.
    • A named bag is read on its own, so who="Bram" finds Bram's nickname even when the player holds an item of that own name.
    • A Game Master give hands stacks over one by one, so a nickname travels with its stack.
    • Adding by a name that another bag holds adds that item, called by its own name.
  • The Game Master sees both names, such as Grandpa's rope (Rope) ×2, and the command line says to write either name, never both.
  • Fights show each item by the name the player sees and spend it by its own name, so a nickname can never spend another item. No two lines share a name: a nickname that another line also goes by is shown with the item's own name, such as "Potion (Cord)" beside a real "Potion", and a name still taken after that gets a number. A line listed under anything but its own name keeps that own name in the fight's saved state, and spends are added up per own name. An item's effect is found under its line's name, or the name it is shown by, or its own name, on both fight screens.
  • The detailed inventory follows items, not names. Each entry carries the id of the item it follows (item), stamped the first time the Engine moves it; an entry written without one (by a tracker, or before this) is matched by name once. A rename only changes the name an entry shows, so its description and place survive renames and gifts. The rename records and all the rename guessing are gone.
  • The inventory screen:
    • Add takes a name first, in a field beside the button, and adding an item the bag already has tops up its stack.
    • The name field on a selected stack edits its nickname; its placeholder is the item's own name.
    • Use outside a fight says both names ("I use my Grandpa's rope (Rope).").
  • Carry-over keeps nicknames, and a detailed entry that follows an item by id is never added twice under another name.
  • Docs. The "The inventory" section in docs/game/party-and-npcs.md, and the CHANGELOG. The ruleset items plan records how identity was built, and that I3's invented items should use invented:<id> (a colon never appears in a catalog id).

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 at 9b5bbc6d9 (the feature commit, the review fixes a6b9a66e1, bbb549d12, 39043d082, c66e7b2f5, 7b441183e, 48438b506, 41c99c345, 93d31a009, df39d128c, 2fa3667be and 9b5bbc6d9, and merges of staging up to e28d46240). The full gates below ran at 2fa3667be; the last commit, 9b5bbc6d9, changes one sentence of the Game Master's prompt and the lane line that checks it, and passed pnpm check and the bags lane:

  • pnpm check exits 0, and pnpm localization:check exits 0.
  • pnpm regression:node passes 421/421. provider-compat failed once, when this machine could not look up Google's API host (EAI_AGAIN), and passed when rerun; this PR does not touch providers.
  • 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.

Lanes:

  • game-inventory-stacks.regression.ts: a rename is a nickname (same item, counted and named either way, never merged, cleared by the own name, read back and dropped when it is the own name); which item a name makes (case, punctuation and Latin, Greek and Cyrillic accents aside, every script kept with the marks that belong to its letters, such as がく and かく staying two items, a plus or minus sign in front of a number kept, so "Sword +1" and "Sword -1" stay two items, fingerprints for names with no letters, long names not cut into one); carry-over keeping nicknames, bringing back an entry of an item nobody holds as that item, and bringing a fingerprinted id back by its entry's name.
  • game-inventory-bags.regression.ts: gives keeping nicknames (part and whole); the detailed inventory keyed by item (companions' changes ignored, renames only renaming, an entry followed by id whatever it is called, drawn from before an entry found by name, another item's entry never moved for sharing a name, entries without an id matched once and stamped on a gain or a loss, a name the item went by looked for before the one it takes now, and an entry under another held item's own name left to that item); Game Master tags naming a nicknamed item either way, a give by nickname, an add by a name another bag holds; takes, gives and adds answering with the count of the item they moved; own names winning over nicknames and a named bag read alone; the prompt showing both names and telling the Game Master to write one of them, never both; a nickname counting as a player's change for the tellings record.
  • combat-director-route.regression.ts: a cord nicknamed "Potion" beside a real potion; the fight lists "Potion (Cord)" and "Potion", and using the cord's line spends the cord while the potion stays. A fight whose listed item is gone refuses a spend that another item's nickname would make up ("Inventory changed").

Forty deliberate breaks of these rules, in the shared helpers, the fight route and the prompt, were each caught.

Local CodeRabbit (coderabbit review --agent), run before each push:

  • Before opening, it found three, all fixed: an item's own name wins over another item's nickname, Use says both names, and fights spend by the own name. Then one more, fixed: two fight lines could share a name, so the second could never be picked. It also suggested combining spends when two fight lines resolve to the same own name, declined at first and applied after GitHub's first review.
  • After GitHub's second review, it found two, fixed in 39043d082: the detailed inventory draws from the entry carrying the item's id before one found by name and leaves untouched entries alone, and the classic fight screen finds a used item's line by normalized name. Fixing the first turned up one of my own: a numbered line for an item without a nickname had no own name to be spent by, which the same commit fixes.
  • After the last merge of staging, it found twelve more over seven passes, eleven fixed:
    • 7b441183e: carry-over judges an entry with an item id only by that id, and Use says "Nickname (Name)" in the Game Master's own form instead of through a translation.
    • 48438b506: carry-over reads an own name off an id only when that name makes the same id again, and Add names the stack the item went onto.
    • 41c99c345: accents come off Latin, Greek and Cyrillic letters only, so a Japanese dakuten or a Devanagari vowel sign keeps two items apart; a fight's spend is checked against that exact item; and the bags browser test clears a nickname by typing the own name.
    • 93d31a009: a plus or minus sign in front of a number stays in the id.
    • df39d128c: a cord nicknamed "Rope" could take the real rope's detailed entry when that entry had no id. Names the item went by are looked for first, and a name that is another held item's own name is left to that item. The same commit fixes a step I added to the bags browser test, which clicked the already selected stack (closing it) before clearing its nickname.
    • 2fa3667be: the docs said a nicknamed stack never merges into anything, beside a Merge bullet saying stacks of one item merge whatever each is called. They now say setting a nickname never merges a stack by itself.
    • 9b5bbc6d9: the prompt said a "Nickname (Name)" item could be named either way, which left room to copy the whole label into item=, and no item goes by that. It now says to write either name, never both. This was the only finding of the last pass, at 2fa3667be.
    • Declined: stamping the item's id on every entry found by name on a decrease. An entry found by name is stamped when a change reaches it; stamping entries a change never touched would undo an earlier pass's fix, that a change leaves the entries it does not touch alone.

GitHub CodeRabbit's first review found three more, all fixed in a6b9a66e1: fight lines could still share a name when a third item is really called "Potion (Cord)"; an item's effect named by its own name was not found for a line shown by its nickname; and an add by a nickname another bag holds answered now="0". Its translated-docs note is answered by the batched [docs-i18n] issue. Its second review found one more, fixed in bbb549d12: an item really called "Potion (Cord)" lost its effect to a cord listed under that name, so each line now takes the effect named by its own name first. Its third review's outside-diff finding (a take could answer with the count of another item once the named item was gone) is fixed in c66e7b2f5: which items a name means is settled before a take or a give, and now counts only those items.

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 (light mode, desktop width):

  • The inventory's Add row shows a name field and Add, disabled until a name is typed.
  • Renaming the player's Rope to "Grandpa's rope" saved { name: "Rope", nickname: "Grandpa's rope" }; the slot shows the nickname, and the header reads "Grandpa's rope (Rope) carried by Ada".
  • Adding "rope" by name topped up that stack to 4, instead of making a new item.
  • A Game Master turn with remove item="Rope" and give item="Grandpa's rope" count="2" to="Bram": the prompt showed Ada: Grandpa's rope (Rope) ×4 and the new command-line sentence; both tags were answered ok, and Bram's new stack kept the nickname.
  • Use on the nicknamed rope sent "I use my Grandpa's rope (Rope)."

Also run by the agent after opening, in the same instance:

  • A reload. After a full page reload, both nicknamed stacks still read "Grandpa's rope", and the stack's header still shows "Grandpa's rope (Rope) carried by Ada", with the own name as the nickname field's placeholder.
  • A fight. With Ada's potion nicknamed "Red vial" and Bram carrying a plain potion, the fight listed "Red vial ×2" (spent as "Potion"). Using "Red vial" from Items took Ada's own stack, left Bram's potion, and logged one "Potion used" in the journal.
  • Mobile width (375 px, dark). The stack's header, nickname field, action row and the Add row all fit inside the panel.
  • A real model. Six Game Master turns ran on a local model (Gemma 4 E4B, Q8, through llama-server) instead of the stand-in. It called the item by its nickname in its narration ("your Grandpa's rope"), and the one time it wrote inventory tags it named that item by its own name, item="Rope". That tag was a give to "environment", which the Engine refused as unknown-character before looking the item up. Its add item="Torch" in the same reply was carried out. In the other turns it wrote no inventory tag, so nothing changed, as it should. A small local model rarely writes the command at all; which name finds which item is the Engine's own logic, covered by the lanes and the stand-in turns above.

Nothing is left to verify by hand.

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 bags browser test adds an item by name and renames a stack, then checks the nickname shows, that adding the item's own name tops up the same stack, and that typing the own name back clears the nickname.

Summary by CodeRabbit

  • New Features

    • Inventory stacks can have nicknames without changing their underlying item identity. Nicknamed stacks remain separate, and restoring an item’s own name clears its nickname.
    • Add items by name; matching items in the selected bag have their quantity increased. Nicknames are preserved when stacks are split or given.
    • Detailed inventory descriptions follow items through renames and gifts. Combat inventory distinguishes items with overlapping nicknames and names, while counts group stacks by item identity.
  • Bug Fixes

    • Combat item use and inventory counts resolve nicknames to the correct items, preventing unintended deductions or missed matches.

🔄 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/6794 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 9/28/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/inventory-item-ids` --- ### 📝 Commits (10+) - [`6ae20d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6ae20d6a1e9d7966ffb513ececc15192c3648ba7) feat(game): items keep who they are when renamed (item ids and nicknames) - [`e6909ae`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e6909ae0af4bc9b84364b89f6904b4423473fe02) Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids - [`a6b9a66`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a6b9a66e15d528e1f0c4314a44bc66bac905c8eb) fix(game): unique fight line names, effects found for nicknamed lines, and the count an add reports - [`bbb549d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bbb549d12cb816419b7de68be9afc56512bbae99) fix(game): match a fight's item effects by each item's own name first - [`1a86069`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1a86069411cea0ad11568917e7bd68e94047ebe3) Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids - [`39043d0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/39043d08247f771ecc132ad5e4931b6240e49428) fix(game): draw a detailed entry by id first and leave untouched entries alone - [`e3b7f94`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e3b7f94aac21818447abc32c5cbfe8307f20d325) Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids - [`c66e7b2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c66e7b2f5dab700411058b0f447d196630ea1555) fix(game): answer takes and gives with the count of the item they moved - [`7b44118`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7b441183e758d7027b28cd13a7148a78d31c3641) fix(game): carry an entry of an item nobody holds as that item, and say both names plainly on Use - [`48438b5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48438b506dd507fee21572a8704dc809659c9426) fix(game): trust an own name read off an id only when it makes that id again, and name an add by its stack ### 📊 Changes **20 files changed** (+1274 additions, -394 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/game/party-and-npcs.md` (+4 -4) 📝 `e2e/game-inventory-bags.e2e.ts` (+27 -5) 📝 `packages/client/src/components/game/GameInventory.tsx` (+88 -51) 📝 `packages/client/src/components/game/GameSurface.tsx` (+64 -50) 📝 `packages/client/src/localization/locales/en.json` (+4 -1) 📝 `packages/server/src/routes/combat-director.routes.ts` (+32 -9) 📝 `packages/server/src/routes/game-inventory.routes.ts` (+1 -1) 📝 `packages/server/src/services/game/combat-director.service.ts` (+3 -1) 📝 `packages/server/src/services/game/game-inventory.service.ts` (+3 -6) 📝 `packages/server/src/services/game/gm-prompts.ts` (+12 -5) 📝 `packages/shared/src/features/combat-director.ts` (+3 -1) 📝 `packages/shared/src/types/game-state.ts` (+3 -0) 📝 `packages/shared/src/utils/game-inventory-ops.ts` (+95 -85) 📝 `packages/shared/src/utils/game-inventory-stacks.ts` (+380 -102) 📝 `packages/shared/src/utils/game-inventory-tags.ts` (+19 -9) 📝 `packages/shared/src/utils/game-inventory-turns.ts` (+4 -2) 📝 `scripts/regressions/combat-director-route.regression.ts` (+104 -0) 📝 `scripts/regressions/game-inventory-bags.regression.ts` (+303 -48) 📝 `scripts/regressions/game-inventory-stacks.regression.ts` (+123 -14) </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 #6791 ## Why this change Game Mode's inventory told items apart only by their names: - **A rename changed what an item was.** Renaming a stack of Rope to "Grandpa's rope" made it something else: the Game Master's `remove` no longer found it, and a fight listed it as another item. - **A rename could pour one item into another.** Renaming a stack to the name of something else in the same bag merged the two, whether or not they were the same thing. - **The detailed inventory had to guess renames.** The detailed inventory on the game state (what the sheet, the trackers and an encounter's prompt read) had no ids, so the server matched it to the stacks by comparing names before and after each change. Four rounds of review on #6789 each found another edge case in that guessing. - **New items were all the same item.** The inventory's Add made placeholders called "New item", which were one item until renamed. This is the first half of slice I2b of the ruleset items plan (the user's ruling during #6789's review): items get a stable identity before ruleset items, which need one even more, arrive in the second half. It needs no Capability API change. ## What changed - **Every stack is an item with an id.** - A stack keeps the item's own `name`, which a rename never changes. - A plain item's id is worked out from its own name (`plain:` and its letters and digits in any script, or a fingerprint for a name with none), so saved games stay byte-identical. Ruleset items will store a catalog reference in the next PR. - Splits, gifts and merges keep the item. Stacks merge only when they are the same item, whatever each is called. - **A rename is a nickname.** The stack shows it in place of the own name, with the own name beside it in the stack's header. Typing the own name back clears it. A rename never merges anything. - **Naming an item** (the Game Master's tags, a fight spending one) finds it by its own name or by a nickname, ignoring case. - The item whose own name it is always wins over another item's nickname. - A named bag is read on its own, so `who="Bram"` finds Bram's nickname even when the player holds an item of that own name. - A Game Master give hands stacks over one by one, so a nickname travels with its stack. - Adding by a name that another bag holds adds that item, called by its own name. - **The Game Master sees both names**, such as `Grandpa's rope (Rope) ×2`, and the command line says to write either name, never both. - **Fights** show each item by the name the player sees and spend it by its own name, so a nickname can never spend another item. No two lines share a name: a nickname that another line also goes by is shown with the item's own name, such as "Potion (Cord)" beside a real "Potion", and a name still taken after that gets a number. A line listed under anything but its own name keeps that own name in the fight's saved state, and spends are added up per own name. An item's effect is found under its line's name, or the name it is shown by, or its own name, on both fight screens. - **The detailed inventory follows items, not names.** Each entry carries the id of the item it follows (`item`), stamped the first time the Engine moves it; an entry written without one (by a tracker, or before this) is matched by name once. A rename only changes the name an entry shows, so its description and place survive renames and gifts. The rename records and all the rename guessing are gone. - **The inventory screen:** - **Add** takes a name first, in a field beside the button, and adding an item the bag already has tops up its stack. - The name field on a selected stack edits its nickname; its placeholder is the item's own name. - **Use** outside a fight says both names ("I use my Grandpa's rope (Rope)."). - **Carry-over** keeps nicknames, and a detailed entry that follows an item by id is never added twice under another name. - **Docs.** The "The inventory" section in `docs/game/party-and-npcs.md`, and the CHANGELOG. The ruleset items plan records how identity was built, and that I3's invented items should use `invented:<id>` (a colon never appears in a catalog id). ## 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 at 9b5bbc6d9 (the feature commit, the review fixes a6b9a66e1, bbb549d12, 39043d082, c66e7b2f5, 7b441183e, 48438b506, 41c99c345, 93d31a009, df39d128c, 2fa3667be and 9b5bbc6d9, and merges of staging up to e28d46240). The full gates below ran at 2fa3667be; the last commit, 9b5bbc6d9, changes one sentence of the Game Master's prompt and the lane line that checks it, and passed `pnpm check` and the bags lane: - `pnpm check` exits 0, and `pnpm localization:check` exits 0. - `pnpm regression:node` passes 421/421. `provider-compat` failed once, when this machine could not look up Google's API host (`EAI_AGAIN`), and passed when rerun; this PR does not touch providers. - `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. Lanes: - `game-inventory-stacks.regression.ts`: a rename is a nickname (same item, counted and named either way, never merged, cleared by the own name, read back and dropped when it is the own name); which item a name makes (case, punctuation and Latin, Greek and Cyrillic accents aside, every script kept with the marks that belong to its letters, such as がく and かく staying two items, a plus or minus sign in front of a number kept, so "Sword +1" and "Sword -1" stay two items, fingerprints for names with no letters, long names not cut into one); carry-over keeping nicknames, bringing back an entry of an item nobody holds as that item, and bringing a fingerprinted id back by its entry's name. - `game-inventory-bags.regression.ts`: gives keeping nicknames (part and whole); the detailed inventory keyed by item (companions' changes ignored, renames only renaming, an entry followed by id whatever it is called, drawn from before an entry found by name, another item's entry never moved for sharing a name, entries without an id matched once and stamped on a gain or a loss, a name the item went by looked for before the one it takes now, and an entry under another held item's own name left to that item); Game Master tags naming a nicknamed item either way, a give by nickname, an add by a name another bag holds; takes, gives and adds answering with the count of the item they moved; own names winning over nicknames and a named bag read alone; the prompt showing both names and telling the Game Master to write one of them, never both; a nickname counting as a player's change for the tellings record. - `combat-director-route.regression.ts`: a cord nicknamed "Potion" beside a real potion; the fight lists "Potion (Cord)" and "Potion", and using the cord's line spends the cord while the potion stays. A fight whose listed item is gone refuses a spend that another item's nickname would make up ("Inventory changed"). Forty deliberate breaks of these rules, in the shared helpers, the fight route and the prompt, were each caught. Local CodeRabbit (`coderabbit review --agent`), run before each push: - Before opening, it found three, all fixed: an item's own name wins over another item's nickname, **Use** says both names, and fights spend by the own name. Then one more, fixed: two fight lines could share a name, so the second could never be picked. It also suggested combining spends when two fight lines resolve to the same own name, declined at first and applied after GitHub's first review. - After GitHub's second review, it found two, fixed in 39043d082: the detailed inventory draws from the entry carrying the item's id before one found by name and leaves untouched entries alone, and the classic fight screen finds a used item's line by normalized name. Fixing the first turned up one of my own: a numbered line for an item without a nickname had no own name to be spent by, which the same commit fixes. - After the last merge of staging, it found twelve more over seven passes, eleven fixed: - 7b441183e: carry-over judges an entry with an item id only by that id, and **Use** says "Nickname (Name)" in the Game Master's own form instead of through a translation. - 48438b506: carry-over reads an own name off an id only when that name makes the same id again, and **Add** names the stack the item went onto. - 41c99c345: accents come off Latin, Greek and Cyrillic letters only, so a Japanese dakuten or a Devanagari vowel sign keeps two items apart; a fight's spend is checked against that exact item; and the bags browser test clears a nickname by typing the own name. - 93d31a009: a plus or minus sign in front of a number stays in the id. - df39d128c: a cord nicknamed "Rope" could take the real rope's detailed entry when that entry had no id. Names the item went by are looked for first, and a name that is another held item's own name is left to that item. The same commit fixes a step I added to the bags browser test, which clicked the already selected stack (closing it) before clearing its nickname. - 2fa3667be: the docs said a nicknamed stack never merges into anything, beside a Merge bullet saying stacks of one item merge whatever each is called. They now say setting a nickname never merges a stack by itself. - 9b5bbc6d9: the prompt said a "Nickname (Name)" item could be named either way, which left room to copy the whole label into `item=`, and no item goes by that. It now says to write either name, never both. This was the only finding of the last pass, at 2fa3667be. - Declined: stamping the item's id on every entry found by name on a decrease. An entry found by name is stamped when a change reaches it; stamping entries a change never touched would undo an earlier pass's fix, that a change leaves the entries it does not touch alone. GitHub CodeRabbit's first review found three more, all fixed in a6b9a66e1: fight lines could still share a name when a third item is really called "Potion (Cord)"; an item's effect named by its own name was not found for a line shown by its nickname; and an add by a nickname another bag holds answered `now="0"`. Its translated-docs note is answered by the batched `[docs-i18n]` issue. Its second review found one more, fixed in bbb549d12: an item really called "Potion (Cord)" lost its effect to a cord listed under that name, so each line now takes the effect named by its own name first. Its third review's outside-diff finding (a `take` could answer with the count of another item once the named item was gone) is fixed in c66e7b2f5: which items a name means is settled before a take or a give, and `now` counts only those items. 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 (light mode, desktop width): - The inventory's Add row shows a name field and **Add**, disabled until a name is typed. - Renaming the player's Rope to "Grandpa's rope" saved `{ name: "Rope", nickname: "Grandpa's rope" }`; the slot shows the nickname, and the header reads "Grandpa's rope (Rope) carried by Ada". - Adding "rope" by name topped up that stack to 4, instead of making a new item. - A Game Master turn with `remove item="Rope"` and `give item="Grandpa's rope" count="2" to="Bram"`: the prompt showed `Ada: Grandpa's rope (Rope) ×4` and the new command-line sentence; both tags were answered `ok`, and Bram's new stack kept the nickname. - **Use** on the nicknamed rope sent "I use my Grandpa's rope (Rope)." Also run by the agent after opening, in the same instance: - **A reload.** After a full page reload, both nicknamed stacks still read "Grandpa's rope", and the stack's header still shows "Grandpa's rope (Rope) carried by Ada", with the own name as the nickname field's placeholder. - **A fight.** With Ada's potion nicknamed "Red vial" and Bram carrying a plain potion, the fight listed "Red vial ×2" (spent as "Potion"). Using "Red vial" from **Items** took Ada's own stack, left Bram's potion, and logged one "Potion used" in the journal. - **Mobile width (375 px, dark).** The stack's header, nickname field, action row and the Add row all fit inside the panel. - **A real model.** Six Game Master turns ran on a local model (Gemma 4 E4B, Q8, through llama-server) instead of the stand-in. It called the item by its nickname in its narration ("your Grandpa's rope"), and the one time it wrote inventory tags it named that item by its own name, `item="Rope"`. That tag was a give to "environment", which the Engine refused as `unknown-character` before looking the item up. Its `add item="Torch"` in the same reply was carried out. In the other turns it wrote no inventory tag, so nothing changed, as it should. A small local model rarely writes the command at all; which name finds which item is the Engine's own logic, covered by the lanes and the stand-in turns above. Nothing is left to verify by hand. ## 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 bags browser test adds an item by name and renames a stack, then checks the nickname shows, that adding the item's own name tops up the same stack, and that typing the own name back clears the nickname. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Inventory stacks can have nicknames without changing their underlying item identity. Nicknamed stacks remain separate, and restoring an item’s own name clears its nickname. * Add items by name; matching items in the selected bag have their quantity increased. Nicknames are preserved when stacks are split or given. * Detailed inventory descriptions follow items through renames and gifts. Combat inventory distinguishes items with overlapping nicknames and names, while counts group stacks by item identity. * **Bug Fixes** * Combat item use and inventory counts resolve nicknames to the correct items, preventing unintended deductions or missed matches. <!-- 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: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#7335
No description provided.