bitspire/apps/machine/electron/__tests__
Padreug 79e1823cc5 fix(machine): decrement cassettes by position, not denomination, on cash-out
recordTransaction() updated cassette counts with WHERE denomination = ?,
but the v9 migration made position the PK precisely so duplicate
denominations across bays are legal (and the HAL dispense path already
returns authoritative per-position results). On any machine with two
bays of the same denomination, a single dispense drained every matching
bay row — silently corrupting inventory, the operator cassette-state
publish, and out-of-money gating.

- cassettes branch: decrement by c.position
- mock-only fallback (no per-bay results): drain matching bays greedily
  in position order, mirroring the dispenser's own fill order
- regression tests with a duplicate-denomination layout (3 of 5 fail
  against the old code)

Found during the dev-branch architecture review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-04 00:28:24 +02:00
..
state-store-bunker.test.ts feat(machine): source LNbits transport from the pairing seed, not just env 2026-07-02 21:53:51 +00:00
state-store-fees.test.ts test(machine): unit-cover operator-fees parser + state-store apply 2026-06-01 19:12:11 +02:00
state-store-transactions.test.ts fix(machine): decrement cassettes by position, not denomination, on cash-out 2026-07-04 00:28:24 +02:00