fix(debug): Inventory edits made while the game's menu is open arrive as asked and in order, and a long pause no longer drops them (#2980) #3030

Open
cuecuemoar wants to merge 2 commits from cuecuemoar/Longshot:fix/debug-inventory-modapi into main
Contributor

Summary

Reworked onto #3069. HumanBean's #3069 (73944b9c) rebuilt the Inventory page and gave the Cheats mod its own queue of the edits the game hasn't taken yet: it fixes the edits lost one into another that this PR first fixed. This PR is now only what that queue still gets wrong, on top of it. The earlier version of this branch (7a59ceaa) is replaced.

#2980 on main now: with the game's pause menu open, the Inventory page's edits still go wrong in three ways.

How to see it on main:

  1. Load a save, turn on Enable cheats, and open the game's pause menu (+).
  2. Press Insert on top of it, open Debug > Cheats > Inventory, check Items > Fairy Bow, then choose Upgrades > Quiver.
  3. Close both menus. Link has the Bow and no Quiver.
  4. Open the pause menu again, make any Inventory edit, and keep the pause menu open for 90 seconds (reading it, or with the Insert menu over it). After that no Inventory row can be chosen, and the edit never arrives.

Why it happens:

  • The edits waiting are worked out together, from one read of the counts. But an edit can do more than its row: the Bow comes with the Quiver its arrows need, a Bomb Bag with 20 bombs, a mask returns the others. The Quiver's edit was a toggle decided when the game took it, so it took the Bow's Quiver away again. Bombs set to 10 after a Bomb Bag was worked out from 0, so +10 on top of the bag's 20. The edits went in the rows' order, so with two masks the first one asked could be the one kept.
  • A pause of 90 seconds reads as the title. Link doesn't update while the pause menu is open, and game-core's state says "title" once Link hasn't updated for 90 s (IN_MAP_NS). The Cheats mod then locks the rows ("Load a save first.") and drops its edits. The same reading empties the mods' save data in api's storage (playthrough_gone, every store emptied): any mod with save data loses it after a long pause.

What this changes:

  • One row at a time, in the order asked (Changes in game/mods/cheats/src/system_mod.rs). The changes waiting go to the game one row at a time, oldest first: each is worked out from counts that show the one before it. A row changed again moves last. A row the counts show as asked already sends nothing. With the game running and one row changed, nothing is slower; with several rows waiting, each takes about a second more (two reads of the counts, 500 ms apart).
  • The next change waits until the game has the last one (Out and EXPIRY in system_mod.rs; BeanBot's L1). The game makes a pouch's change, a song's flag and the rupees some updates after it takes the edit, so "none queued and two reads" was a guess. A change sent is now done only when the counts show its row as asked; or changed and the same at two reads in a row (the game made less or more: a bag's most); or after 6 reads (about 3 s of Link's updates, the counts' reads stop while he doesn't update) with neither, when the game turned it down, and a line in the log says so. A row keeps the player's value while its change is out (Changes::stands).
  • An unlock or relock says which (INVENTORY_UNLOCK 201, INVENTORY_RELOCK 202 in game/crates/game-core/src/debug.rs). Each does nothing when Link already holds the item, or holds none of it, so an edit worked out from counts that don't show an earlier change yet (the game makes a pouch's change after it takes the event) can't undo it. A song's edit too (the game's own setter, as #3089). The menu sends them (inventory_actions in debug_tab.rs); INVENTORY_TOGGLE (200) stays for the input recordings and the tours that send it (scripts/tours/route.py).
  • A pause is no title, however long (state.rs). The title now also needs nothing holding the game still in its own pause manager: its pause menu's and game over screen's pauses (pause::MENU_TYPES, which the API's game.paused already reads) or a mod's (DebugPause, game.pause()). The manager is read every time, with no timing. Where this build can't read it, the pause menu's screen having updated in the last 200 ms counts (menus::up_now).

Read first: Changes::edits, Out and Changes::hold in system_mod.rs; inventory_edit in debug.rs; mode_of and held_still in state.rs.

Fixes #2980
See #3069
See #2990

Testing

Tested: Windows 10 (build 19045), RTX 4090, driver 617.42, headless, through the PC's job queue.

The acknowledgement (head a2f85e801, test aa5e66e6c, on main 2d87a5c9a; the runtime was built from 64ff5f0f7 on main 4d3b41c56, the same two commits before a clean rebase (git range-diff shows both unchanged, and main since doesn't touch these files' code: only Cargo.lock lines of another crate)):

  • Run main-20261205-143559: Lens, Magic Beans, Mask of Truth, Fairy Bow, then Quiver with the pause menu open for 132 s. Every edit arrived in order; the Bow gave its Quiver and the Quiver row then sent nothing; at the end Lens 1, Beans 4, Mask of Truth 1, Bow 1, Quiver 1. Gold Skulltula Tokens by 100 Right presses: exactly 100.
  • Run l1-main-20261205-143929 (quick reversals): paused Magic Beans 0, 1, 0: +1 then -1, ends 0. Paused Epona's Song unlocked then relocked: ends locked (the relock replaced the unlock while it still waited). With the game running, Lens checked then cleared: +1 then -1, ends 0.
  • Run main-20261205-144202: four edits under a 133 s pause; the rows stayed choosable past 90 s, and all arrived after it.
  • No run logged the expiry (not in the game's counts after 6 reads), and nothing was dropped.
  • (The driver's Magic Beans slider asked 5 and set the row to 4, as on 2026-12-04: one key press lost in the driver; the row's value is what arrived.)

Before the acknowledgement: after is this PR's fix at 9e68a372, which has the same code as the pushed head a9b8bdd0 (only tests were added after it); before is main at ca830e89. Neither main commit since changes these files. Each side is a runtime built from its commit alone.

Each run used the repository save kokiri-start (Kokiri Forest, child) with Enable cheats on. It opened the game's pause menu and checked that the game's frame count stopped. Then, under the Insert menu (Debug > Cheats > Inventory), it made its edits, closed both menus, read every row it touched, then with the game running pressed Right 100 times on Gold Skulltula Tokens, from 0.

  • After (9e68a372; run main-20261204-085746): Lens of Truth, Magic Beans, Mask of Truth, Fairy Bow, then Quiver, with the pause menu open for 126 s. The log once it closed:
    cheats: inventory Item_GlassTruth +1 (had 0, now 0, event status 2)
    cheats: inventory Item_MagicBean +4 (had 0, now 0, event status 2)
    cheats: inventory Armor_Child_Mask_Truth +1 (had 0, now 0, event status 2)
    cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2)
    cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2)
    
    • Every edit arrived, in the order made. The Quiver's own change found the Bow's Quiver in the counts and sent nothing. At the end the rows read Lens 1, Beans 4, Mask of Truth 1, Bow 1, Quiver 1.
    • The rows stayed choosable for the whole 126 s.
    • Gold Skulltula Tokens reached exactly 100, in 11 steps (+1, then about +13 each).
    • ("now" is read in the same update, just after the change is sent, and still shows the old count.)
  • Before (ca830e89; run main-20261203-215758): Lens, Bow, then Quiver, with the pause menu open for 78 s. The Bow gave its Quiver, then cheats: inventory Item_Quiver_Small -1 (had 1, now 1, event status 2): Bow 1, Quiver 0 at the end. Gold reached 100.
  • Before, a long pause (ca830e89; run main-20261203-220020): the Lens unlocked 11 s into the pause, which then stayed open. Past 90 s no Inventory row could be chosen (the menu's focus fell to the Debug tab). After the pause menu closed, the Lens never arrived. Five earlier runs with more edits stopped the same way at about 90 s.
  • Seen on both: three quick Right presses on Magic Beans (2 frames apart) while paused gave 2, then two more gave 4. The menu's slider counted one of each pair once; a menu matter, not this one's.
  • By hand (9e68a372, windowed, Pause in background on; run hand-20261204-093607): the game's pause menu open past 90 s, with Alt+Tab away and back while it was open (the game held 13 s, 22 s, 172 s, 307 s, 1028 s, 18 s and 99.5 s), Inventory edits made under it before and after. The rows stayed choosable throughout. Every edit arrived once the pause menu closed, none dropped:
    cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2)
    cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2)
    cheats: inventory Item_GlassTruth +1 (had 0, now 0, event status 2)
    
    then the same rows unchecked (Weapon_Range_Bow -1, Item_GlassTruth -1, Item_Arrow_Normal -30), and after the long holds the Bow, its Quiver and the Lens again. An edit shows in the game (its pause menu's item tabs included) only once the game runs: the game makes it in its own event, as on main.
  • By hand, the title with an edit waiting (BeanBot's L3; 64ff5f0f7, windowed, Skip title screen off; run hand-l3b-20261205-153245): an Inventory edit made under the game's pause menu, then to the title through the pause menu's System page and a save loaded, once within 90 s and once after more than 90 s at the title. Both times the edit was not made while the pause menu was up, the Inventory rows were locked ("Load a save first.") as soon as no save was loaded, and Link did not have the item once the save had loaded: the edit was dropped. The log has no cheats: inventory line for it (the rows' changes and the queue are emptied at the title without one).
  • Not run in the game: the title from the game over screen; two masks asked one after the other, and the Bomb Bag then Bombs (the tests cover both).

The checks:

  • The tests. The test commit (aa5e66e6c) adds eight that fail on main, each for the bug's reason:

    • a_bow_and_then_its_quiver_asked_while_the_game_takes_nothing_both_arrive: Quiver 0 at the end.
    • changes_waiting_reach_the_game_in_the_order_made: the first mask asked is the one held.
    • an_amount_asked_after_the_bag_it_needs_is_the_amount_asked: 30 bombs, not 10.
    • a_pause_is_no_title_however_long_it_lasts: Title.
    • a_thing_given_and_taken_back_before_the_game_shows_it_ends_taken_back: the Kokiri Sword checked then cleared before the game made the first change: sword 1.
    • an_amount_changed_again_before_the_game_shows_the_first_is_the_amount_asked_last: Bombs 30 then 10: the 10 sent before the 30 showed.
    • an_edit_the_game_turns_down_holds_the_next_change_a_while_not_for_ever: the next change went before the turned-down one could show.
    • an_amount_the_game_caps_lets_the_next_change_go_once_the_counts_hold_still: the next change sent before the capped 20 showed.

    The four new ones use a pouch whose changes wait for the game's next update (Pouch::later), with a cap and a refusal.

    The Cheats tests run the mod's own queue (Changes) and the game side's own edit (game_core::debug::inventory_edit) over a pouch on the stand-in host (items.pouchCount and items.addOrRemove faked). They include counts read before an earlier edit showed, as the game makes a pouch's change late. The fix commit adds a_songs_unlock_or_relock_asks_for_that_whatever_it_finds. The test commit's two seams do nothing yet: Changes::hold, and mode_of's held.

  • Here they pass. game-core 446 (on 2d87a5c9a), sysmod-cheats 67. Mutants caught: each of the acknowledgement's three rules, the cap rule without its two reads or without "changed", the expiry at 3 and at 20, the old two-read rule, all rows at once, a row's place kept, a toggle sent, an unlock or relock as a toggle. Not caught: the Follow using holds instead of stands (the mod's frame has no game-free harness; the runs above show the rows keep the value), the two-read minimum removed (the three rules already need later reads), asked()'s clamp (the menu can't ask past it).

  • What the tests don't model: the other bags' fill, a change the game makes more than 6 reads later (the expiry then lets the next go: the case BeanBot found comes back for that row), the steps of a split amount made at different updates, songs, bottles and rupees through the Cheats path (the game-core song test covers the ops), and the pause manager itself (held_still is reached only in the game).

  • Linux, WSL (64ff5f0f7, the head's tree, against main 4d3b41c56): nothing fails here that doesn't fail on main. run_all --strict 879 passed / 58 failed / 13 skipped on both, the same 58 checks (main's Linux failures: gpu/vk fixtures without <format>, test_cheat_items' pouch-name order, test_i18n_complete's missing Fill title screen and aspect-ratio translations, test_dev_update). The host compile check: Linux 83 units and Windows (llvm-mingw) 81 units, 0 failed on both. cargo test: game-core 443, sysmod-cheats 67, none failing (main 441 and 60). test_menu_i18n passes.

  • A cold review of the acknowledgement (64ff5f0f7) found nothing blocking. Not changed, named here: a count already at its cap asked higher (Bombs 20 in a 20 bag set to 30, a full wallet) changes nothing, so the next change waits the 3 s expiry and the log line shows; the two-read minimum also costs about 500 ms a row that the rules no longer need.

  • A cold review of the first version (ec95ea73) found that the pause menu's 200 ms signal goes stale when frames stop (pause in background, a long stall), and that a batch of edits could still undo one another. Both are fixed: the title rule now reads the pause manager, and the changes go one row at a time. Two more cases became tests.

Still to test: None. (Not run: the title reached from the game over screen.)

Measurements

Nothing to measure: a change to the Debug tools' Inventory page and to how the host tells the title from a pause. The title rule reads the pause manager's 20 entries once per call to the state (bounded reads, as the API's game.paused does). Rendering and presenting are untouched.

Risks

  • What could break: the Inventory page's edits, now sent one row at a time, so several rows changed while paused take about a second each once the game runs again; an edit the game turns down or can't make (a full bag asked more) holds the next for about 3 s. And everything that reads the game's mode: during a pause of more than 90 s it now reads Paused, not Title, for the mods' save data (storage), the API's game.mode, the cinematic skip and the save watch. Each of those then sees what it sees in a short pause.
  • Back to the title with edits waiting: they are dropped, as on main: the Cheats mod empties its changes and the queue as soon as the counts show no save loaded (the rows lock then, not after 90 s), so the next save loaded doesn't get them (seen by hand, within and after 90 s).
  • Turning it off: there is no switch; a revert is enough.
  • For players: nothing changes in saves, the settings or the caches. Enable cheats is off by default.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (Linux run in Testing: nothing fails here that doesn't fail on main; main's clippy, schema-gen and four cargo tests named there.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (On the test commit aa5e66e6c, the eight new tests fail, each for the bug's reason.)
  • A check under tests/ that reads changed source is updated, not weakened. (None needed a change: the ones reading Cargo.lock and the Cheats mod's files pass unchanged, test_cargo_lock_sources, test_cheat_items, test_pipeline_tour, test_menu_ini_keys, test_option_ids among them; test_lifter fails the same on main.)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (No host C++ changed; the game's Rust builds on both.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZj1iUjCGWg1VCi3CZq

## Summary **Reworked onto #3069.** HumanBean's #3069 (`73944b9c`) rebuilt the Inventory page and gave the Cheats mod its own queue of the edits the game hasn't taken yet: it fixes the edits lost one into another that this PR first fixed. This PR is now only what that queue still gets wrong, on top of it. The earlier version of this branch (`7a59ceaa`) is replaced. **#2980 on `main` now:** with the game's pause menu open, the Inventory page's edits still go wrong in three ways. **How to see it on `main`:** 1. Load a save, turn on Enable cheats, and open the game's pause menu (+). 2. Press Insert on top of it, open Debug > Cheats > Inventory, check Items > Fairy Bow, then choose Upgrades > Quiver. 3. Close both menus. Link has the Bow and no Quiver. 4. Open the pause menu again, make any Inventory edit, and keep the pause menu open for 90 seconds (reading it, or with the Insert menu over it). After that no Inventory row can be chosen, and the edit never arrives. **Why it happens:** - **The edits waiting are worked out together, from one read of the counts.** But an edit can do more than its row: the Bow comes with the Quiver its arrows need, a Bomb Bag with 20 bombs, a mask returns the others. The Quiver's edit was a toggle decided when the game took it, so it took the Bow's Quiver away again. Bombs set to 10 after a Bomb Bag was worked out from 0, so +10 on top of the bag's 20. The edits went in the rows' order, so with two masks the first one asked could be the one kept. - **A pause of 90 seconds reads as the title.** Link doesn't update while the pause menu is open, and `game-core`'s state says "title" once Link hasn't updated for 90 s (`IN_MAP_NS`). The Cheats mod then locks the rows ("Load a save first.") and drops its edits. The same reading empties the mods' save data in `api`'s storage (`playthrough_gone`, every store emptied): any mod with save data loses it after a long pause. **What this changes:** - **One row at a time, in the order asked** (`Changes` in `game/mods/cheats/src/system_mod.rs`). The changes waiting go to the game one row at a time, oldest first: each is worked out from counts that show the one before it. A row changed again moves last. A row the counts show as asked already sends nothing. With the game running and one row changed, nothing is slower; with several rows waiting, each takes about a second more (two reads of the counts, 500 ms apart). - **The next change waits until the game has the last one** (`Out` and `EXPIRY` in `system_mod.rs`; BeanBot's L1). The game makes a pouch's change, a song's flag and the rupees some updates after it takes the edit, so "none queued and two reads" was a guess. A change sent is now done only when the counts show its row as asked; or changed and the same at two reads in a row (the game made less or more: a bag's most); or after 6 reads (about 3 s of Link's updates, the counts' reads stop while he doesn't update) with neither, when the game turned it down, and a line in the log says so. A row keeps the player's value while its change is out (`Changes::stands`). - **An unlock or relock says which** (`INVENTORY_UNLOCK` 201, `INVENTORY_RELOCK` 202 in `game/crates/game-core/src/debug.rs`). Each does nothing when Link already holds the item, or holds none of it, so an edit worked out from counts that don't show an earlier change yet (the game makes a pouch's change after it takes the event) can't undo it. A song's edit too (the game's own setter, as #3089). The menu sends them (`inventory_actions` in `debug_tab.rs`); `INVENTORY_TOGGLE` (200) stays for the input recordings and the tours that send it (`scripts/tours/route.py`). - **A pause is no title, however long** (`state.rs`). The title now also needs nothing holding the game still in its own pause manager: its pause menu's and game over screen's pauses (`pause::MENU_TYPES`, which the API's `game.paused` already reads) or a mod's (`DebugPause`, `game.pause()`). The manager is read every time, with no timing. Where this build can't read it, the pause menu's screen having updated in the last 200 ms counts (`menus::up_now`). **Read first:** `Changes::edits`, `Out` and `Changes::hold` in `system_mod.rs`; `inventory_edit` in `debug.rs`; `mode_of` and `held_still` in `state.rs`. Fixes #2980 See #3069 See #2990 ## Testing **Tested:** Windows 10 (build 19045), RTX 4090, driver 617.42, headless, through the PC's job queue. **The acknowledgement (head `a2f85e801`, test `aa5e66e6c`, on `main` `2d87a5c9a`; the runtime was built from `64ff5f0f7` on `main` `4d3b41c56`, the same two commits before a clean rebase (`git range-diff` shows both unchanged, and `main` since doesn't touch these files' code: only `Cargo.lock` lines of another crate)):** - Run `main-20261205-143559`: Lens, Magic Beans, Mask of Truth, Fairy Bow, then Quiver with the pause menu open for 132 s. Every edit arrived in order; the Bow gave its Quiver and the Quiver row then sent nothing; at the end Lens 1, Beans 4, Mask of Truth 1, Bow 1, Quiver 1. Gold Skulltula Tokens by 100 Right presses: exactly 100. - Run `l1-main-20261205-143929` (quick reversals): paused Magic Beans 0, 1, 0: `+1` then `-1`, ends 0. Paused Epona's Song unlocked then relocked: ends locked (the relock replaced the unlock while it still waited). With the game running, Lens checked then cleared: `+1` then `-1`, ends 0. - Run `main-20261205-144202`: four edits under a 133 s pause; the rows stayed choosable past 90 s, and all arrived after it. - No run logged the expiry (`not in the game's counts after 6 reads`), and nothing was dropped. - (The driver's Magic Beans slider asked 5 and set the row to 4, as on 2026-12-04: one key press lost in the driver; the row's value is what arrived.) **Before the acknowledgement:** after is this PR's fix at `9e68a372`, which has the same code as the pushed head `a9b8bdd0` (only tests were added after it); before is `main` at `ca830e89`. Neither `main` commit since changes these files. Each side is a runtime built from its commit alone. Each run used the repository save `kokiri-start` (Kokiri Forest, child) with Enable cheats on. It opened the game's pause menu and checked that the game's frame count stopped. Then, under the Insert menu (Debug > Cheats > Inventory), it made its edits, closed both menus, read every row it touched, then with the game running pressed Right 100 times on Gold Skulltula Tokens, from 0. - **After** (`9e68a372`; run `main-20261204-085746`): Lens of Truth, Magic Beans, Mask of Truth, Fairy Bow, then Quiver, with the pause menu open for 126 s. The log once it closed: ``` cheats: inventory Item_GlassTruth +1 (had 0, now 0, event status 2) cheats: inventory Item_MagicBean +4 (had 0, now 0, event status 2) cheats: inventory Armor_Child_Mask_Truth +1 (had 0, now 0, event status 2) cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2) cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2) ``` - Every edit arrived, in the order made. The Quiver's own change found the Bow's Quiver in the counts and sent nothing. At the end the rows read Lens 1, Beans 4, Mask of Truth 1, Bow 1, Quiver 1. - The rows stayed choosable for the whole 126 s. - Gold Skulltula Tokens reached exactly 100, in 11 steps (`+1`, then about `+13` each). - ("now" is read in the same update, just after the change is sent, and still shows the old count.) - **Before** (`ca830e89`; run `main-20261203-215758`): Lens, Bow, then Quiver, with the pause menu open for 78 s. The Bow gave its Quiver, then `cheats: inventory Item_Quiver_Small -1 (had 1, now 1, event status 2)`: Bow 1, Quiver 0 at the end. Gold reached 100. - **Before, a long pause** (`ca830e89`; run `main-20261203-220020`): the Lens unlocked 11 s into the pause, which then stayed open. Past 90 s no Inventory row could be chosen (the menu's focus fell to the Debug tab). After the pause menu closed, the Lens never arrived. Five earlier runs with more edits stopped the same way at about 90 s. - **Seen on both:** three quick Right presses on Magic Beans (2 frames apart) while paused gave 2, then two more gave 4. The menu's slider counted one of each pair once; a menu matter, not this one's. - **By hand** (`9e68a372`, windowed, Pause in background on; run `hand-20261204-093607`): the game's pause menu open past 90 s, with Alt+Tab away and back while it was open (the game held 13 s, 22 s, 172 s, 307 s, 1028 s, 18 s and 99.5 s), Inventory edits made under it before and after. The rows stayed choosable throughout. Every edit arrived once the pause menu closed, none dropped: ``` cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first (event status 2) cheats: inventory Weapon_Range_Bow +1 (had 0, now 0, event status 2) cheats: inventory Item_GlassTruth +1 (had 0, now 0, event status 2) ``` then the same rows unchecked (`Weapon_Range_Bow -1`, `Item_GlassTruth -1`, `Item_Arrow_Normal -30`), and after the long holds the Bow, its Quiver and the Lens again. An edit shows in the game (its pause menu's item tabs included) only once the game runs: the game makes it in its own event, as on `main`. - **By hand, the title with an edit waiting** (BeanBot's L3; `64ff5f0f7`, windowed, Skip title screen off; run `hand-l3b-20261205-153245`): an Inventory edit made under the game's pause menu, then to the title through the pause menu's System page and a save loaded, once within 90 s and once after more than 90 s at the title. Both times the edit was not made while the pause menu was up, the Inventory rows were locked ("Load a save first.") as soon as no save was loaded, and Link did not have the item once the save had loaded: the edit was dropped. The log has no `cheats: inventory` line for it (the rows' changes and the queue are emptied at the title without one). - **Not run in the game:** the title from the game over screen; two masks asked one after the other, and the Bomb Bag then Bombs (the tests cover both). The checks: - **The tests.** The test commit (`aa5e66e6c`) adds eight that fail on `main`, each for the bug's reason: - `a_bow_and_then_its_quiver_asked_while_the_game_takes_nothing_both_arrive`: Quiver 0 at the end. - `changes_waiting_reach_the_game_in_the_order_made`: the first mask asked is the one held. - `an_amount_asked_after_the_bag_it_needs_is_the_amount_asked`: 30 bombs, not 10. - `a_pause_is_no_title_however_long_it_lasts`: Title. - `a_thing_given_and_taken_back_before_the_game_shows_it_ends_taken_back`: the Kokiri Sword checked then cleared before the game made the first change: sword 1. - `an_amount_changed_again_before_the_game_shows_the_first_is_the_amount_asked_last`: Bombs 30 then 10: the 10 sent before the 30 showed. - `an_edit_the_game_turns_down_holds_the_next_change_a_while_not_for_ever`: the next change went before the turned-down one could show. - `an_amount_the_game_caps_lets_the_next_change_go_once_the_counts_hold_still`: the next change sent before the capped 20 showed. The four new ones use a pouch whose changes wait for the game's next update (`Pouch::later`), with a cap and a refusal. The Cheats tests run the mod's own queue (`Changes`) and the game side's own edit (`game_core::debug::inventory_edit`) over a pouch on the stand-in host (`items.pouchCount` and `items.addOrRemove` faked). They include counts read before an earlier edit showed, as the game makes a pouch's change late. The fix commit adds `a_songs_unlock_or_relock_asks_for_that_whatever_it_finds`. The test commit's two seams do nothing yet: `Changes::hold`, and `mode_of`'s `held`. - **Here they pass.** game-core 446 (on `2d87a5c9a`), sysmod-cheats 67. Mutants caught: each of the acknowledgement's three rules, the cap rule without its two reads or without "changed", the expiry at 3 and at 20, the old two-read rule, all rows at once, a row's place kept, a toggle sent, an unlock or relock as a toggle. Not caught: the Follow using `holds` instead of `stands` (the mod's frame has no game-free harness; the runs above show the rows keep the value), the two-read minimum removed (the three rules already need later reads), `asked()`'s clamp (the menu can't ask past it). - **What the tests don't model:** the other bags' fill, a change the game makes more than 6 reads later (the expiry then lets the next go: the case BeanBot found comes back for that row), the steps of a split amount made at different updates, songs, bottles and rupees through the Cheats path (the game-core song test covers the ops), and the pause manager itself (`held_still` is reached only in the game). - **Linux, WSL** (`64ff5f0f7`, the head's tree, against `main` `4d3b41c56`): nothing fails here that doesn't fail on `main`. `run_all --strict` 879 passed / 58 failed / 13 skipped on both, the same 58 checks (`main`'s Linux failures: gpu/vk fixtures without `<format>`, `test_cheat_items`' pouch-name order, `test_i18n_complete`'s missing Fill title screen and aspect-ratio translations, `test_dev_update`). The host compile check: Linux 83 units and Windows (llvm-mingw) 81 units, 0 failed on both. `cargo test`: game-core 443, sysmod-cheats 67, none failing (`main` 441 and 60). `test_menu_i18n` passes. - **A cold review of the acknowledgement** (`64ff5f0f7`) found nothing blocking. Not changed, named here: a count already at its cap asked higher (Bombs 20 in a 20 bag set to 30, a full wallet) changes nothing, so the next change waits the 3 s expiry and the log line shows; the two-read minimum also costs about 500 ms a row that the rules no longer need. - **A cold review** of the first version (`ec95ea73`) found that the pause menu's 200 ms signal goes stale when frames stop (pause in background, a long stall), and that a batch of edits could still undo one another. Both are fixed: the title rule now reads the pause manager, and the changes go one row at a time. Two more cases became tests. **Still to test:** None. (Not run: the title reached from the game over screen.) ## Measurements Nothing to measure: a change to the Debug tools' Inventory page and to how the host tells the title from a pause. The title rule reads the pause manager's 20 entries once per call to the state (bounded reads, as the API's `game.paused` does). Rendering and presenting are untouched. ## Risks - **What could break:** the Inventory page's edits, now sent one row at a time, so several rows changed while paused take about a second each once the game runs again; an edit the game turns down or can't make (a full bag asked more) holds the next for about 3 s. And everything that reads the game's mode: during a pause of more than 90 s it now reads Paused, not Title, for the mods' save data (`storage`), the API's `game.mode`, the cinematic skip and the save watch. Each of those then sees what it sees in a short pause. - **Back to the title with edits waiting:** they are dropped, as on `main`: the Cheats mod empties its changes and the queue as soon as the counts show no save loaded (the rows lock then, not after 90 s), so the next save loaded doesn't get them (seen by hand, within and after 90 s). - **Turning it off:** there is no switch; a revert is enough. - **For players:** nothing changes in saves, the settings or the caches. Enable cheats is off by default. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). (Linux run in Testing: nothing fails here that doesn't fail on `main`; `main`'s clippy, schema-gen and four cargo tests named there.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. (On the test commit `aa5e66e6c`, the eight new tests fail, each for the bug's reason.) - [x] A check under `tests/` that reads changed source is updated, not weakened. (None needed a change: the ones reading `Cargo.lock` and the Cheats mod's files pass unchanged, `test_cargo_lock_sources`, `test_cheat_items`, `test_pipeline_tour`, `test_menu_ini_keys`, `test_option_ids` among them; `test_lifter` fails the same on `main`.) - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (No host C++ changed; the game's Rust builds on both.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [x] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZj1iUjCGWg1VCi3CZq
The Debug tab's Inventory edits go to the game through one action slot (game-core's MENU_ACTION), which Link's update
takes, and Link does not update while the game's own pause menu is open: there each edit replaced the one before, and
only the last reached the game when the pause menu closed. An Amount of more than 63 is several actions given at once,
so even with the game running only its last step arrived (100 Gold Skulltula Tokens from 0 gave 37). An edit left
waiting through a return to the title reached the next save loaded. Unlocking the Fairy Bow or the Fairy Slingshot gave
no Quiver or Bullet Bag, so every arrow or seed picked up after stayed 0 (#2416).

The two halves become functions in game-core's debug.rs, each doing what the code did: set_inventory (the Amount's
actions given to the slot: the Cheats mod's set_amount, through command::set_inventory), next_code (what Link's update
takes: the slot, then the live file's), inventory_shown (what the Amount shows: the game's count as last read), inventory_frame
(the Cheats mod's frame, told whether a map is loading: nothing yet); travel.rs counts its reads of the page's counts
(inventory_reads). inventory_actions moves from the Cheats mod to game-core with its test, and travel.rs's bag lookup is
bags_of. The tests run them against a game kept in the test (each edit as inventory_edit takes it), and each fails here
with only the slot's last action taken:

- edits made while the game takes none, then play: the Lens, the Beans' last Amount, 100 tokens, the mask entered
  last held, the Bow and the Quiver it gave ([0, 0, 0, 0, 0, 0, 1]);
- an item set again goes after the edits entered since (Keaton, Truth, Keaton, the Lens);
- an Amount of 100 from 0 (37);
- Switch age pressed after an edit is taken first, and the edit after it (the Lens lost);
- a map loading (the next save's, after a return to the title) drops what waits, and frames with nothing loading, as
  behind the pause menu, keep it (the Beans reach the next save);
- the Debug tools turned off drop what waits;
- a recording's playback, which drops the player's actions, takes no edit (it was handed one);
- an edit waits while the game has no count of its item (it was handed over);
- the Amount shows the edit waiting, the last one set, and once taken until the counts are read twice (it shows the
  game's count as last read, so the row went back to it);
- travel.rs's bag test: the Bow and the Slingshot with no bag need the smallest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZhUMJCa5pBywxCyGrc
Link's update takes the Debug tab's actions, and it does not run while the game's own pause menu is open. The Inventory
page put each edit in the tools' one action slot, so there the Amount went back to the count the game last had, each
edit replaced the one before, and only the last reached the game when the menu closed. An Amount of more than 63 is
several actions given at once, so only its last step arrived even with the game running.

Each item's edit now waits on its own in game-core's debug.rs (set_inventory), and Link's update takes them one an
update after the tools' own action (next_code), the earliest made first: an Amount set again replaces its item's edit
and goes last, and a mask's unlock returns the mask held, so of two masks the one held after is the last made, as in
play. An edit is begun from the item's count as the game has it when it is first taken, not from the count the page
last read (the page's counts stand still while nothing is taken, and an earlier edit may have changed the item: the
Quiver the Bow gave stays). Its steps of 63 then go one an update. While it waits the Amount shows the count asked
(inventory_shown), and its help says changes wait while the game's menu is open. Once it is taken whole the Amount
still shows the count asked until the page's counts are read twice since (travel.rs's inventory_reads): the game's
pouch takes a change later and the counts are read twice a second, so the row went back to the count before, and the
next press of an Amount set fast started from it (in the game, 100 presses from 0 went 3, 1, ... 7, 1: -2, -6). The
Amount set starts from that count too.

The game counts items and takes actions only as Link updates, so an edit left waiting through a return to the title
reached the next save. While the Debug tools are on, the Cheats mod tells game-core each frame whether the game is
loading a map (inventory_frame, from session::loading: the game's Sequence_IsLoadingBanc), and a map loading drops what
waits: another save always loads its map before Link's first update in it, and with the game running nothing waits
through a load. (Not the save.load site: in the game it is reached again and again while the pause menu is open, so
every edit made there was dropped.) Turning the tools off drops it too. A recording's playback, which takes none of the player's actions,
leaves the edits waiting rather than handing them to it; an edit whose item has no count yet waits for one, about two
seconds at most.

Unlocking the Fairy Bow or the Fairy Slingshot with none of its bags held gives the smallest Quiver or Bullet Bag
first, as the game's chest does (travel.rs's WEAPON_AMMO through bags_of), so arrows and seeds picked up after count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZhUMJCa5pBywxCyGrc
Author
Contributor

Tested in game: Windows 10, RTX 4090, driver 617.42, headless through the job queue, repository save kokiri-start, Debug tools on. On 7268665b (runtime from the commit alone): six Inventory edits made under the game's pause screen (Lens, Beans 3 then 5, Mask of Truth, Keaton Mask, Fairy Bow) all reached the game in the order made once it closed, the Bow with a Quiver first; the Amount read while paused was each count set; 100 Right presses on Gold Skulltula Tokens gave 100 steps of +1. Before, on mod-api 582b6a1ab: only the Bow arrived (no Quiver), the Amount went back to 0 each time, and the Gold presses overshot. Log lines in Testing.

Tested in game: Windows 10, RTX 4090, driver 617.42, headless through the job queue, repository save kokiri-start, Debug tools on. On 7268665b (runtime from the commit alone): six Inventory edits made under the game's pause screen (Lens, Beans 3 then 5, Mask of Truth, Keaton Mask, Fairy Bow) all reached the game in the order made once it closed, the Bow with a Quiver first; the Amount read while paused was each count set; 100 Right presses on Gold Skulltula Tokens gave 100 steps of +1. Before, on mod-api 582b6a1ab: only the Bow arrived (no Quiver), the Amount went back to 0 each time, and the Gold presses overshot. Log lines in Testing.
Author
Contributor

Screenshots of the same spot, Debug > Cheats with Magic Beans chosen, taken right after setting its Amount to 5 with the game's pause screen open underneath (headless, kokiri-start).

Before (mod-api 582b6a1ab): the help says nothing about the pause screen, and the run read the Amount as 0, the count the game last had.

Before: mod-api 582b6a1ab

After (7268665b): the help says changes wait while the game's menu is open and apply in the order made, and the run read the Amount as 5, the count waiting.

After: 7268665b

The slider runs to 999, so 5 and 0 look the same in it; the counts come from the run's reads of the setting (Testing).

Screenshots of the same spot, Debug > Cheats with Magic Beans chosen, taken right after setting its Amount to 5 with the game's pause screen open underneath (headless, kokiri-start). **Before** (`mod-api` `582b6a1ab`): the help says nothing about the pause screen, and the run read the Amount as 0, the count the game last had. ![Before: mod-api 582b6a1ab](attach:amount-paused-before.png) **After** (`7268665b`): the help says changes wait while the game's menu is open and apply in the order made, and the run read the Amount as 5, the count waiting. ![After: 7268665b](attach:amount-paused-after.png) The slider runs to 999, so 5 and 0 look the same in it; the counts come from the run's reads of the setting (Testing).
Member
@review
BeanBot requested changes 2026-12-02 20:11:14 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. A second edit can be discarded while an earlier pouch event is still in flight, leaving the inventory at the wrong count. The Bow and Slingshot bag fix also addresses a separate bug and should be reviewed separately under the repository’s one-topic rule.

The change queues Inventory edits, displays their requested counts, and gives a Bow or Slingshot its smallest bag when needed. The reported game run shows the main paused-menu and large-amount cases improving, but the queue can still lose a rapid reversal.

Blocking (2): must change before merging.

  1. L1 game/crates/game-core/src/debug.rs:320: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. (more on the line) Do: Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal.
  2. L2 game/crates/game-core/src/travel.rs:1407: The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary to the repository’s one-topic rule. (more on the line) Do: Move the weapon-to-ammunition mapping and its tests into a separate pull request.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3 game/crates/game-core/src/debug.rs:282: The save-boundary behavior still needs the in-game run identified in the PR. (more on the line) Do: Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped.

@fix can do L1 and L2.

Checks: Still running: PR description / Title and description (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Yes for the cases tested: on Windows, the reported head run delivered all paused edits and 100 token presses as 100 +1 steps; the base delivered only the last paused edit and overshot the token count. The return-to-title case remains untested in game.

Other systems: The queue runs in Link’s update and interacts with delayed pouch events, input recording, map loading and other Debug actions. The reported run covers normal play and paused edits; the game-free tests model immediate pouch application and do not cover an event still in flight. Rendering, saves’ format, audio and input bindings are unchanged.

Switches: None.

Reviewed: 7268665bd4 against 582b6a1abf: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the diff and commit messages; inspected the changed code and its inventory, loading, playback and menu callers. The available output for the complete changed files was truncated, so not all unchanged portions of debug.rs and travel.rs were read. docs/review-checklist.md and the adjacent Tooling checkout were absent. Screenshots were described in comments but their attachments were not available for inspection.; nothing run (a code review).

Checked and fine:

  • Both commits have AI-assistance trailers.
  • No switches, generated files, third-party files or game-derived artifacts are added in the diff.
  • The reported game-free tests cover ordering, replacement, playback and the two weapon bag mappings.

Testing: Read-only review; no code, tests or scripts were run. The PR reports a Windows in-game comparison and game-free tests on Linux.

Overlaps and merge order: The description identifies #2990 as the main-branch version to close in favor of this port; no other overlap was established from the supplied evidence.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A second edit can be discarded while an earlier pouch event is still in flight, leaving the inventory at the wrong count. The Bow and Slingshot bag fix also addresses a separate bug and should be reviewed separately under the repository’s one-topic rule. The change queues Inventory edits, displays their requested counts, and gives a Bow or Slingshot its smallest bag when needed. The reported game run shows the main paused-menu and large-amount cases improving, but the queue can still lose a rapid reversal. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/game-core/src/debug.rs:320`: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. (more on the line) **Do:** Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal. 2. **L2** `game/crates/game-core/src/travel.rs:1407`: The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary to the repository’s one-topic rule. (more on the line) **Do:** Move the weapon-to-ammunition mapping and its tests into a separate pull request. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3** `game/crates/game-core/src/debug.rs:282`: The save-boundary behavior still needs the in-game run identified in the PR. (more on the line) **Do:** Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped. `@fix` can do L1 and L2. **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the cases tested: on Windows, the reported head run delivered all paused edits and 100 token presses as 100 +1 steps; the base delivered only the last paused edit and overshot the token count. The return-to-title case remains untested in game. **Other systems:** The queue runs in Link’s update and interacts with delayed pouch events, input recording, map loading and other Debug actions. The reported run covers normal play and paused edits; the game-free tests model immediate pouch application and do not cover an event still in flight. Rendering, saves’ format, audio and input bindings are unchanged. **Switches:** None. **Reviewed:** 7268665bd492 against 582b6a1abf03: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the diff and commit messages; inspected the changed code and its inventory, loading, playback and menu callers. The available output for the complete changed files was truncated, so not all unchanged portions of debug.rs and travel.rs were read. docs/review-checklist.md and the adjacent Tooling checkout were absent. Screenshots were described in comments but their attachments were not available for inspection.; nothing run (a code review). **Checked and fine:** - Both commits have AI-assistance trailers. - No switches, generated files, third-party files or game-derived artifacts are added in the diff. - The reported game-free tests cover ordering, replacement, playback and the two weapon bag mappings. **Testing:** Read-only review; no code, tests or scripts were run. The PR reports a Windows in-game comparison and game-free tests on Linux. **Overlaps and merge order:** The description identifies #2990 as the main-branch version to close in favor of this port; no other overlap was established from the supplied evidence. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
@ -171,0 +279,4 @@
/// Each frame the game presents, while the Debug tools are on (the Cheats mod's frame, the main thread): `loading`,
/// whether the game is loading a map ([`crate::session::loading`]). A map loading drops the edits waiting, before
/// Link's first update in it: after a return to the title they were the last save's.
pub fn inventory_frame(loading: bool) {
Member

L3 (should fix): The save-boundary behavior still needs the in-game run identified in the PR.

When: An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it.

Do: Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped.

**L3** (should fix): The save-boundary behavior still needs the in-game run identified in the PR. *When:* An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it. **Do:** Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped.
@ -171,0 +317,4 @@
}
return 0;
};
e.left = Some(inventory_actions(e.item, e.amount, have, e.want));
Member

L1 (blocking): A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied.

When: Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0.

Do: Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal.

**L1** (blocking): A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. *When:* Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0. **Do:** Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal.
@ -1397,0 +1404,4 @@
/// The weapons that shoot ammunition, and it: the Fairy Bow and the Fairy Slingshot. Unlocked with none of its bags
/// held, every arrow or seed picked up after stayed 0 (#2416), so a weapon added gives its smallest bag first, as the
/// game's chest does.
pub const WEAPON_AMMO: &[(&str, &str)] =
Member

L2 (blocking): The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary to the repository’s one-topic rule.

When: The Bow and Slingshot can lack ammunition bags even when no Inventory edit is queued; correcting that behavior is independent of preserving queued edits.

Do: Move the weapon-to-ammunition mapping and its tests into a separate pull request.

**L2** (blocking): The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary to the repository’s one-topic rule. *When:* The Bow and Slingshot can lack ammunition bags even when no Inventory edit is queued; correcting that behavior is independent of preserving queued edits. **Do:** Move the weapon-to-ammunition mapping and its tests into a separate pull request.
cuecuemoar force-pushed fix/debug-inventory-modapi from 7268665bd4
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to a9e8fcd14b
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
2026-12-02 20:22:16 +00:00
Compare
cuecuemoar force-pushed fix/debug-inventory-modapi from a9e8fcd14b
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to b75e4f0823
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
2026-12-02 20:36:13 +00:00
Compare
cuecuemoar changed title from WIP: fix(debug): the Inventory rows keep every edit made while the game's menu is open, in order, and an unlocked Fairy Bow or Slingshot comes with its bag (#2980, #2416) to WIP: fix(debug): the Inventory rows keep every edit made while the game's menu is open, in the order made, and an Amount of more than one step arrives whole (#2980) 2026-12-02 20:57:35 +00:00
Author
Contributor

Answers to BeanBot's review of 7268665b (review 3105). The head is now b75e4f08.

L1 (a replacement begun before an earlier change shows in the pouch count): the game shows each change in the item's count by Link's next update. Each edit is begun in a later update than the step before it (one action per update), so it starts from the count after that step.

  • The tightest case, in game. On 7268665b the Bow's unlock gave a Quiver, and a Quiver set to 1 was taken in the very next update. If the count were still 0 there, its edit would have been an unlock toggle, taking the Quiver back off. The log has no Quiver action: the edit found the Quiver held and had nothing to do.
  • Every press, in game. 100 Right presses on Gold Skulltula Tokens logged had 0, had 1, ... had 99: each step read the count the one before had just made.
  • Within one update the count doesn't move yet (the log's "now", read just after the change is sent, still shows the old count). That is why the Amount row keeps showing the count asked until the counts have been read twice since.
  • So I've left out a test pouch that applies changes later than the next update: the game wasn't seen doing that. A rapid reversal (0→1→0) is the case above: the second edit is begun from the count after the first.

L2 (one topic): split out. The Fairy Bow and Slingshot bag is now #3033, with its own test and in-game run. This PR no longer touches it, and the two merge cleanly in either order.

L3 (the return to the title): still in Still to test, for a run by hand. The headless driver can't go through the game's own System menu to the title and a save list. In the tests, inventory_frame(true) stands for that load.

Since the review, a second cold review found three changes to the fix that no test caught. Each now has a test: an edit replaced while its count is read, an edit whose item never gets a count, and an Amount set back to the count the page read. In-game results for the head are in Testing.

Answers to BeanBot's review of `7268665b` (review 3105). The head is now `b75e4f08`. **L1 (a replacement begun before an earlier change shows in the pouch count):** the game shows each change in the item's count by Link's next update. Each edit is begun in a later update than the step before it (one action per update), so it starts from the count after that step. - **The tightest case, in game.** On `7268665b` the Bow's unlock gave a Quiver, and a Quiver set to 1 was taken in the very next update. If the count were still 0 there, its edit would have been an unlock toggle, taking the Quiver back off. The log has no Quiver action: the edit found the Quiver held and had nothing to do. - **Every press, in game.** 100 Right presses on Gold Skulltula Tokens logged `had 0`, `had 1`, ... `had 99`: each step read the count the one before had just made. - **Within one update** the count doesn't move yet (the log's "now", read just after the change is sent, still shows the old count). That is why the Amount row keeps showing the count asked until the counts have been read twice since. - So I've left out a test pouch that applies changes later than the next update: the game wasn't seen doing that. A rapid reversal (0→1→0) is the case above: the second edit is begun from the count after the first. **L2 (one topic):** split out. The Fairy Bow and Slingshot bag is now https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/3033, with its own test and in-game run. This PR no longer touches it, and the two merge cleanly in either order. **L3 (the return to the title):** still in Still to test, for a run by hand. The headless driver can't go through the game's own System menu to the title and a save list. In the tests, `inventory_frame(true)` stands for that load. Since the review, a second cold review found three changes to the fix that no test caught. Each now has a test: an edit replaced while its count is read, an edit whose item never gets a count, and an Amount set back to the count the page read. In-game results for the head are in Testing.
cuecuemoar changed title from WIP: fix(debug): the Inventory rows keep every edit made while the game's menu is open, in the order made, and an Amount of more than one step arrives whole (#2980) to fix(debug): the Inventory rows keep every edit made while the game's menu is open, in the order made, and an Amount of more than one step arrives whole (#2980) 2026-12-02 20:58:51 +00:00
HumanBean changed target branch from mod-api to main 2026-12-03 05:48:56 +00:00
cuecuemoar force-pushed fix/debug-inventory-modapi from b75e4f0823
All checks were successful
PR description / Title and description (pull_request_target) Successful in 7s
to 7a59ceaa0f
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-03 19:52:29 +00:00
Compare
Author
Contributor

L1 is fixed, the reviewer's defer option. An item's next edit is not begun until the game's count shows the last change handed over; it then begins from that count. The other items' edits go on meanwhile. A change the game never shows (refused) holds its item's next edit for 120 of Link's updates (about 2 s at 60) with a log line, then it goes on from the game's count. A map loading or the Debug tools off drop these changes with the edits waiting.

The earlier answer no longer held because 1a86a938 (#3089) made a song's edit go through the game's own setter, applied at the game's next update. A change can outlive the update that handed it over, so a replacement has to wait for the count rather than assume the next update shows it.

The test commit (4f3476b6) adds the tests, with a game fake that applies a change later and refuses some. On it alone, 24 game-core tests fail, each new one for the bug's reason (only the slot's last edit taken; setting 1 and back to 0 leaves 1; a song unlocked then relocked ends (true, true)). At the head 7a59ceaa: game-core 419 pass, sysmod-cheats 54 pass, 25 of 25 mutants caught, the two i18n checks pass, rustfmt has nothing to say about this diff's files. Linux (on 60b0d627 against main 1780f597): the strict suite 824 passed / 52 failed / 12 skipped against main's 826/50/12; the two head-only fails were the i18n checks, fixed by the strings and passing now; every other failure and skip is the same on both.

A cold review of 60b0d627 found that the tools' own Teleport or Switch age dropped the edits it should keep. That load now keeps them: the action is noted when Link's update takes it, and a frame that finds a map loading within 5 s of it keeps the edits waiting and the changes not shown yet and logs why; any other load still drops. Three tests cover it, and four more cover the review's surviving mutants. The head is 7a59ceaa. In game, with the pause screen open, the Bow and Magic Beans 3 entered before a Switch age or a Teleport arrived after it (runs age-after-20261203-123839, teleport-after-20261203-124110); on main both were lost. The two edits were taken during the fade, before the load began, so the keep itself was not reached in game; the tests cover it.

In game (Windows 10 build 19045, RTX 4090, driver 617.42), after 7f70253d (the same code as 7a59ceaa) against main 1780f597 (run l1-after-20261203-123522): with the pause screen open, Magic Beans set to 0, then 1, then 0 ended 0, and Epona's Song unlocked then relocked ended locked, with no cheats lines (once the game made the earlier change there was nothing to change); with the game running, the Lens unlocked then locked logged +1 (had 0 ...) then -1 (had 1 ...) and ended locked; no expiry or drop lines. Before, on main: Magic Beans 1, Epona's Song unlocked, the Lens unlocked.

L2 is #3033, merged (e229c0c2). L3 is still to test by hand: through the game's System menu to the title and load a save.

**L1 is fixed, the reviewer's defer option.** An item's next edit is not begun until the game's count shows the last change handed over; it then begins from that count. The other items' edits go on meanwhile. A change the game never shows (refused) holds its item's next edit for 120 of Link's updates (about 2 s at 60) with a log line, then it goes on from the game's count. A map loading or the Debug tools off drop these changes with the edits waiting. The earlier answer no longer held because `1a86a938` (#3089) made a song's edit go through the game's own setter, applied at the game's next update. A change can outlive the update that handed it over, so a replacement has to wait for the count rather than assume the next update shows it. The test commit (`4f3476b6`) adds the tests, with a game fake that applies a change later and refuses some. On it alone, 24 game-core tests fail, each new one for the bug's reason (only the slot's last edit taken; setting 1 and back to 0 leaves 1; a song unlocked then relocked ends `(true, true)`). At the head `7a59ceaa`: game-core 419 pass, sysmod-cheats 54 pass, 25 of 25 mutants caught, the two i18n checks pass, rustfmt has nothing to say about this diff's files. Linux (on `60b0d627` against `main` `1780f597`): the strict suite 824 passed / 52 failed / 12 skipped against `main`'s 826/50/12; the two head-only fails were the i18n checks, fixed by the strings and passing now; every other failure and skip is the same on both. A cold review of `60b0d627` found that the tools' own Teleport or Switch age dropped the edits it should keep. That load now keeps them: the action is noted when Link's update takes it, and a frame that finds a map loading within 5 s of it keeps the edits waiting and the changes not shown yet and logs why; any other load still drops. Three tests cover it, and four more cover the review's surviving mutants. The head is `7a59ceaa`. In game, with the pause screen open, the Bow and Magic Beans 3 entered before a Switch age or a Teleport arrived after it (runs `age-after-20261203-123839`, `teleport-after-20261203-124110`); on `main` both were lost. The two edits were taken during the fade, before the load began, so the keep itself was not reached in game; the tests cover it. In game (Windows 10 build 19045, RTX 4090, driver 617.42), after `7f70253d` (the same code as `7a59ceaa`) against `main` `1780f597` (run `l1-after-20261203-123522`): with the pause screen open, Magic Beans set to 0, then 1, then 0 ended 0, and Epona's Song unlocked then relocked ended locked, with no cheats lines (once the game made the earlier change there was nothing to change); with the game running, the Lens unlocked then locked logged `+1 (had 0 ...)` then `-1 (had 1 ...)` and ended locked; no expiry or drop lines. Before, on `main`: Magic Beans 1, Epona's Song unlocked, the Lens unlocked. L2 is #3033, merged (`e229c0c2`). L3 is still to test by hand: through the game's System menu to the title and load a save.
cuecuemoar force-pushed fix/debug-inventory-modapi from 7a59ceaa0f
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to a9b8bdd0e3
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-04 16:32:02 +00:00
Compare
cuecuemoar changed title from fix(debug): the Inventory rows keep every edit made while the game's menu is open, in the order made, and an Amount of more than one step arrives whole (#2980) to fix(debug): Inventory edits made while the game's menu is open arrive as asked and in order, and a long pause no longer drops them (#2980) 2026-12-04 16:32:15 +00:00
Author
Contributor

Reworked onto #3069; the head is now a9b8bdd0 (test 5429d9b3, fix a9b8bdd0, on main d6e819e0).

#3069 gave the Cheats mod its own queue of the Inventory page's edits, which conflicted with this whole branch. That queue fixes the edits lost one into another, so the earlier version here (7a59ceaa, its own queue in game-core) is dropped. This PR is now only what main still gets wrong. I ran main (ca830e89) in the game with the pause menu open:

  • Fairy Bow, then Quiver: the Quiver is lost. The Bow came with its Quiver, then the Quiver's toggle took it away (run main-20261203-215758).
  • A pause of more than 90 s reads as the title: every Inventory row locks and the edits waiting are dropped (run main-20261203-220020). The same reading empties the mods' save data in api's storage.

The fix:

  • the changes waiting go one row at a time, in the order asked, each from counts that show the earlier ones;
  • the menu sends an explicit unlock or relock (201, 202) instead of a toggle;
  • the title rule also needs no pause in the game's pause manager.

The description has the details. A cold review of the first version found the pause menu's 200 ms signal too weak (pause in background) and a batch that could still undo itself; both are fixed and tested.

BeanBot's review 3105 was of 7268665b, the old design; nothing it names is in the code now. Its L1 (an edit from stale counts) is what main's queue and the explicit unlock/relock cover here. L2 (#2416) merged as #3033. Its L3 (a title load with edits waiting) is unchanged from main, and is now under Risks.

In the game, after (9e68a372, the same code as the head), run main-20261204-085746: Lens, Magic Beans, Mask of Truth, Bow, then Quiver, with the pause menu open for 126 s. Every edit arrived in order, the Quiver was kept, and Gold reached exactly 100. Linux: nothing fails here that doesn't fail on main.

**Reworked onto #3069; the head is now `a9b8bdd0`** (test `5429d9b3`, fix `a9b8bdd0`, on `main` `d6e819e0`). #3069 gave the Cheats mod its own queue of the Inventory page's edits, which conflicted with this whole branch. That queue fixes the edits lost one into another, so the earlier version here (`7a59ceaa`, its own queue in `game-core`) is dropped. This PR is now only what `main` still gets wrong. I ran `main` (`ca830e89`) in the game with the pause menu open: - **Fairy Bow, then Quiver:** the Quiver is lost. The Bow came with its Quiver, then the Quiver's toggle took it away (run `main-20261203-215758`). - **A pause of more than 90 s** reads as the title: every Inventory row locks and the edits waiting are dropped (run `main-20261203-220020`). The same reading empties the mods' save data in `api`'s storage. The fix: - the changes waiting go one row at a time, in the order asked, each from counts that show the earlier ones; - the menu sends an explicit unlock or relock (201, 202) instead of a toggle; - the title rule also needs no pause in the game's pause manager. The description has the details. A cold review of the first version found the pause menu's 200 ms signal too weak (pause in background) and a batch that could still undo itself; both are fixed and tested. **BeanBot's review 3105** was of `7268665b`, the old design; nothing it names is in the code now. Its L1 (an edit from stale counts) is what `main`'s queue and the explicit unlock/relock cover here. L2 (#2416) merged as #3033. Its L3 (a title load with edits waiting) is unchanged from `main`, and is now under Risks. In the game, after (`9e68a372`, the same code as the head), run `main-20261204-085746`: Lens, Magic Beans, Mask of Truth, Bow, then Quiver, with the pause menu open for 126 s. Every edit arrived in order, the Quiver was kept, and Gold reached exactly 100. Linux: nothing fails here that doesn't fail on `main`.
Author
Contributor

The hand test from Still to test has run; its result is in Tested. Windows 10, RTX 4090, the fix at 9e68a372 (the head's code), windowed with Pause in background on. The game's pause menu stayed open past 90 s, with Alt+Tab away and back while it was open (holds of 13 s to 1028 s), and Inventory edits were made under it before and after. The rows stayed choosable throughout, and every edit arrived once the pause menu closed: the Bow with its Quiver, the Lens, then the same rows unchecked, then all three again after the long holds. An edit shows in the game only once it runs again (the game makes it in its own event), as on main. Still to test is now None; nothing in the code changed.

**The hand test from Still to test has run; its result is in Tested.** Windows 10, RTX 4090, the fix at `9e68a372` (the head's code), windowed with Pause in background on. The game's pause menu stayed open past 90 s, with Alt+Tab away and back while it was open (holds of 13 s to 1028 s), and Inventory edits were made under it before and after. The rows stayed choosable throughout, and every edit arrived once the pause menu closed: the Bow with its Quiver, the Lens, then the same rows unchecked, then all three again after the long holds. An edit shows in the game only once it runs again (the game makes it in its own event), as on `main`. Still to test is now None; nothing in the code changed.
Owner
@review
BeanBot requested changes 2026-12-05 18:05:11 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. A later inventory edit can still be calculated before an earlier event has changed the count. The save-boundary behavior also lacks the identified in-game run.

The change orders pending inventory edits, uses explicit unlock and relock operations, and keeps long pauses from being mistaken for the title screen. It adds up to roughly one second per queued row, but its fixed read delay does not guarantee that an earlier edit has taken effect.

Blocking (1): must change before merging.

  1. L1 game/crates/game-core/src/debug.rs:320: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. When: Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0. Do: Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3 game/crates/game-core/src/debug.rs:282: The save-boundary behavior still needs the in-game run identified in the PR. When: An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it. Do: Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped.

@fix can do L1.

Since the last review (on 7268665bd4)
Resolved: L2 (The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary t…)
Still open: L1 (A new edit is calculated from the pouch count even when a previous edit’s event has been s…); L3 (The save-boundary behavior still needs the in-game run identified in the PR.)

Checks: Still running: 10 checks.

Also noticed (1; not asked for, not blocking)
  • The description identifies the existing risk that edits waiting at the title may reach a save loaded within 90 seconds.
More: does it help, other systems, switches, what was read

Does it help: Yes for the reported Bow and long-pause cases: the described Windows runs kept the Quiver and delivered edits after a 126-second pause; the base lost the Quiver and dropped an edit after 90 seconds. The stale-event case remains unresolved.

Other systems: The mode change also affects mod storage, game.mode, cinematic skipping and save watching. The reported long-pause run covers Windows; the description reports Linux game-free checks but no Linux game run.

Switches: None.

Reviewed: a9b8bdd0e3 against d6e819e084: Read the repository rules and pull request template, the diff, state.rs, debug_tab.rs and the relevant queue and inventory-edit code and tests. The larger changed files and generated Cargo.lock were skimmed; docs/review-checklist.md and the adjacent Tooling rules were unavailable.; nothing run (a code review).

Checked and fine:

  • Explicit unlock and relock retain the legacy toggle operation for existing callers.
  • Pending rows are ordered by their latest changes, and the tests cover the Bow, masks and Bomb Bag interactions.
  • The reported Windows run exercises a pause lasting longer than 90 seconds.

Testing: No commands that build or run code were executed. The author reports in-game Windows runs and game-free checks; CI is still running.

Overlaps and merge order: #3069 is incorporated in the base; #3033 is reported merged.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A later inventory edit can still be calculated before an earlier event has changed the count. The save-boundary behavior also lacks the identified in-game run. The change orders pending inventory edits, uses explicit unlock and relock operations, and keeps long pauses from being mistaken for the title screen. It adds up to roughly one second per queued row, but its fixed read delay does not guarantee that an earlier edit has taken effect. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/game-core/src/debug.rs:320`: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. *When:* Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0. **Do:** Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3** `game/crates/game-core/src/debug.rs:282`: The save-boundary behavior still needs the in-game run identified in the PR. *When:* An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it. **Do:** Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped. `@fix` can do L1. **Since the last review** (on 7268665bd492) Resolved: L2 (The weapon bag fix is a separate bug fix bundled with the Inventory edit queue, contrary t…) Still open: L1 (A new edit is calculated from the pouch count even when a previous edit’s event has been s…); L3 (The save-boundary behavior still needs the in-game run identified in the PR.) **Checks:** Still running: 10 checks. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The description identifies the existing risk that edits waiting at the title may reach a save loaded within 90 seconds. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported Bow and long-pause cases: the described Windows runs kept the Quiver and delivered edits after a 126-second pause; the base lost the Quiver and dropped an edit after 90 seconds. The stale-event case remains unresolved. **Other systems:** The mode change also affects mod storage, game.mode, cinematic skipping and save watching. The reported long-pause run covers Windows; the description reports Linux game-free checks but no Linux game run. **Switches:** None. **Reviewed:** a9b8bdd0e3dd against d6e819e08433: Read the repository rules and pull request template, the diff, state.rs, debug_tab.rs and the relevant queue and inventory-edit code and tests. The larger changed files and generated Cargo.lock were skimmed; docs/review-checklist.md and the adjacent Tooling rules were unavailable.; nothing run (a code review). **Checked and fine:** - Explicit unlock and relock retain the legacy toggle operation for existing callers. - Pending rows are ordered by their latest changes, and the tests cover the Bow, masks and Bomb Bag interactions. - The reported Windows run exercises a pause lasting longer than 90 seconds. **Testing:** No commands that build or run code were executed. The author reports in-game Windows runs and game-free checks; CI is still running. **Overlaps and merge order:** #3069 is incorporated in the base; #3033 is reported merged. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed fix/debug-inventory-modapi from a9b8bdd0e3
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 34d4fa4056
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-05 19:21:13 +00:00
Compare
BeanBot left a comment

Recommendation: Request changes. A later inventory edit can still be calculated before an earlier event’s effect appears in the counts, leaving the requested amount wrong. The reported runs do not cover the outstanding save-boundary case.

What @fix changed
I changed this pull request: the new head is 34d4fa4056. I rebased it onto main (4d3b41c56f).

Not done

  • Delayed pouch events can lose a rapid reversal: The queue needs an acknowledgement that each pouch event has finished, including refused or capped changes, before it calculates the next edit. Waiting for the requested count alone can leave the queue stuck. A delayed-application fake pouch test is also needed.

Nothing was built or run: the checks run again on the new head.

The change orders queued inventory edits, uses explicit unlock and relock operations, and prevents long pauses from being mistaken for the title screen. It improves the reported Bow and long-pause cases, but its two-read delay does not guarantee that earlier changes have reached the inventory.

Blocking (1): must change before merging.

  1. L1 game/crates/game-core/src/debug.rs:320: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. When: Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0. Do: Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3 game/crates/game-core/src/debug.rs:282: The save-boundary behavior still needs the in-game run identified in the PR. When: An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it. Do: Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped.

@fix can do L1.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported cases: the Windows run kept all edits through a 126-second pause and retained the Bow’s Quiver; the before run lost the Quiver. A separate before run dropped an edit after 90 seconds. The delayed-event case remains unfixed.

Other systems: The mode change also affects mod storage, the game API, cinematic skip and save watching. Windows long-pause behavior was exercised; the title-to-save boundary remains untested. Linux checks were reported against main, but no Linux game run was reported.

Switches: None.

Reviewed: 34d4fa4056 against 4d3b41c56f: Read AGENTS.md, CONTRIBUTING.md, state.rs and the Cheats manifest; inspected the full diff for the changed Rust files and the relevant inventory queue and game-side edit paths. Other changed files and surrounding code were skimmed; not every changed code file was read in full.; nothing run (a code review).

Checked and fine:

  • Explicit unlock and relock operations avoid toggling an item in the opposite direction when its current count has changed.
  • The reported long-pause run exercised the pause-manager path with backgrounding and showed the queued edits arriving.

Testing: No commands that build or run tests were executed. The author reports Windows game runs and game-free tests; CI has not yet run on this head.

Overlaps and merge order: The PR is reworked on the merged inventory queue from #3069; #3033 is reported merged.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A later inventory edit can still be calculated before an earlier event’s effect appears in the counts, leaving the requested amount wrong. The reported runs do not cover the outstanding save-boundary case. **What `@fix` changed** I changed this pull request: the new head is 34d4fa40565f. I rebased it onto `main` (4d3b41c56f16). **Not done** - **Delayed pouch events can lose a rapid reversal**: The queue needs an acknowledgement that each pouch event has finished, including refused or capped changes, before it calculates the next edit. Waiting for the requested count alone can leave the queue stuck. A delayed-application fake pouch test is also needed. Nothing was built or run: the checks run again on the new head. The change orders queued inventory edits, uses explicit unlock and relock operations, and prevents long pauses from being mistaken for the title screen. It improves the reported Bow and long-pause cases, but its two-read delay does not guarantee that earlier changes have reached the inventory. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/game-core/src/debug.rs:320`: A new edit is calculated from the pouch count even when a previous edit’s event has been sent but has not yet been applied. *When:* Starting at zero, set an item to 1, then set it back to 0 before the first pouch event applies. The second edit reads 0, produces no actions and is removed; the first event can then apply, leaving 1 instead of the requested 0. **Do:** Track outstanding pouch changes until they are reflected in the game, or defer calculating the replacement until the prior event has applied. Add a test whose fake pouch applies events later and exercises a rapid reversal. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3** `game/crates/game-core/src/debug.rs:282`: The save-boundary behavior still needs the in-game run identified in the PR. *When:* An edit left waiting while returning to the title must be dropped before the next save’s Link update; the unit test supplies the loading signal directly and cannot verify when the game presents it. **Do:** Run the described pause-menu-to-title and load-save scenario once in game, confirming that the edit is dropped. `@fix` can do L1. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported cases: the Windows run kept all edits through a 126-second pause and retained the Bow’s Quiver; the before run lost the Quiver. A separate before run dropped an edit after 90 seconds. The delayed-event case remains unfixed. **Other systems:** The mode change also affects mod storage, the game API, cinematic skip and save watching. Windows long-pause behavior was exercised; the title-to-save boundary remains untested. Linux checks were reported against main, but no Linux game run was reported. **Switches:** None. **Reviewed:** 34d4fa40565f against 4d3b41c56f16: Read AGENTS.md, CONTRIBUTING.md, state.rs and the Cheats manifest; inspected the full diff for the changed Rust files and the relevant inventory queue and game-side edit paths. Other changed files and surrounding code were skimmed; not every changed code file was read in full.; nothing run (a code review). **Checked and fine:** - Explicit unlock and relock operations avoid toggling an item in the opposite direction when its current count has changed. - The reported long-pause run exercised the pause-manager path with backgrounding and showed the queued edits arriving. **Testing:** No commands that build or run tests were executed. The author reports Windows game runs and game-free tests; CI has not yet run on this head. **Overlaps and merge order:** The PR is reworked on the merged inventory queue from #3069; #3033 is reported merged. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
cuecuemoar force-pushed fix/debug-inventory-modapi from 34d4fa4056
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to a2f85e801a
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Waiting to run
2026-12-05 21:48:58 +00:00
Compare
Author
Contributor

BeanBot's L1 is fixed; the head is now a2f85e801 (test aa5e66e6c, on main 2d87a5c9a). It builds on BeanBot's rebase (34d4fa405), which is kept.

L1, a change worked out before the last one showed: the next change now waits for the game to have the last one, instead of two reads after nothing is queued. A change sent is done when the counts show its row as asked. If the game made less or more (a bag's most), it is done once the row has changed and reads the same twice in a row. If neither happens within 6 reads (about 3 s of Link's updates; the reads stop while he doesn't update), the game turned it down: the next change goes and the log says so. While its change is out, the row keeps the player's value. This is Out and EXPIRY in system_mod.rs.

The four new tests use a pouch whose changes wait for the game's next update, as asked. Each fails on the test commit:

  • the Kokiri Sword checked, then cleared before the first change showed: ends 0;
  • Bombs 30, then 10: ends 10, not 40;
  • an edit the game turns down: holds the next change, but not for ever;
  • a capped amount: lets the next change go before the expiry.

In the game (Windows 10, RTX 4090, 617.42, a runtime of the same two commits):

  • paused Magic Beans 0, 1, 0 ended 0;
  • Epona's Song unlocked then relocked ended locked;
  • the Lens checked then cleared, with the game running, ended 0;
  • the paused-edits run and a 133 s pause delivered everything, and the expiry never fired.

The Linux suite is the same as on main. A cold review found nothing blocking; the two costs it named are in the description's Testing.

L3, the title and a save loaded with an edit waiting: that one can't be driven headless here; a hand run is next. It is in Still to test, and the "Everything in Still to test" box is unticked until it has run.

**BeanBot's L1 is fixed; the head is now `a2f85e801`** (test `aa5e66e6c`, on `main` `2d87a5c9a`). It builds on BeanBot's rebase (`34d4fa405`), which is kept. **L1, a change worked out before the last one showed:** the next change now waits for the game to have the last one, instead of two reads after nothing is queued. A change sent is done when the counts show its row as asked. If the game made less or more (a bag's most), it is done once the row has changed and reads the same twice in a row. If neither happens within 6 reads (about 3 s of Link's updates; the reads stop while he doesn't update), the game turned it down: the next change goes and the log says so. While its change is out, the row keeps the player's value. This is `Out` and `EXPIRY` in `system_mod.rs`. The four new tests use a pouch whose changes wait for the game's next update, as asked. Each fails on the test commit: - the Kokiri Sword checked, then cleared before the first change showed: ends 0; - Bombs 30, then 10: ends 10, not 40; - an edit the game turns down: holds the next change, but not for ever; - a capped amount: lets the next change go before the expiry. **In the game** (Windows 10, RTX 4090, 617.42, a runtime of the same two commits): - paused Magic Beans 0, 1, 0 ended 0; - Epona's Song unlocked then relocked ended locked; - the Lens checked then cleared, with the game running, ended 0; - the paused-edits run and a 133 s pause delivered everything, and the expiry never fired. The Linux suite is the same as on `main`. A cold review found nothing blocking; the two costs it named are in the description's Testing. **L3, the title and a save loaded with an edit waiting:** that one can't be driven headless here; a hand run is next. It is in Still to test, and the "Everything in Still to test" box is unticked until it has run.
Author
Contributor

BeanBot's L3 has run by hand; its result is in Tested. Windows 10, RTX 4090, 617.42, a windowed runtime of 64ff5f0f7 (the head's code), Skip title screen off; run hand-l3b-20261205-153245.

An Inventory edit was made under the game's pause menu. Then the run went to the title through the pause menu's System page and loaded a save, once within 90 s and once after more than 90 s at the title. Both times:

  • the Inventory rows locked ("Load a save first.") as soon as no save was loaded;
  • Link did not have the item once the save had loaded, so the waiting edit was dropped.

The earlier Risks line ("a save loaded within 90 s gets them") was wrong, and so was BeanBot's "Also noticed" note taken from it. The Cheats mod empties its changes and the queue as soon as the counts show no save loaded, not after 90 s. Risks now says so. Not run: the title reached from the game over screen.

**BeanBot's L3 has run by hand; its result is in Tested.** Windows 10, RTX 4090, 617.42, a windowed runtime of `64ff5f0f7` (the head's code), Skip title screen off; run `hand-l3b-20261205-153245`. An Inventory edit was made under the game's pause menu. Then the run went to the title through the pause menu's System page and loaded a save, once within 90 s and once after more than 90 s at the title. Both times: - the Inventory rows locked ("Load a save first.") as soon as no save was loaded; - Link did not have the item once the save had loaded, so the waiting edit was dropped. The earlier Risks line ("a save loaded within 90 s gets them") was wrong, and so was BeanBot's "Also noticed" note taken from it. The Cheats mod empties its changes and the queue as soon as the counts show no save loaded, not after 90 s. Risks now says so. Not run: the title reached from the game over screen.
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Waiting to run
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/debug-inventory-modapi:cuecuemoar-fix/debug-inventory-modapi'
git switch 'cuecuemoar-fix/debug-inventory-modapi'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
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
MagicBeanDev/Longshot!3030
No description provided.