FA-86170 / Game economy crafting balance / Member archive
Inventory stack insertion: Overfull legacy stacks are drained · case 05
Adding items to an inventory with a legacy overfull stack destroys items.
Case contract
slots = list of None or [name, count]; names are case sensitive. First top up partial stacks (count < max_stack) of the same item in slot order, then fill empty slots in order with new stacks of at most max_stack. Reserved placeholders [name, 0] count as partial stacks. Legacy stacks above max_stack are left untouched. Returns {slots, leftover}.
Why this case matters
Game economies leak or destroy currency when one crafting or pricing rule is off by one boundary, rounding stage or state update; the defect is observable in exact integer outcomes.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| legacy overfull stack #1 | {"leftover": 0, "slots": [["Arrow", 20], ["Arrow", 8]]} | {"leftover": 0, "slots": [["Arrow", 25], ["Arrow", 3]]} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗