Mixed shop baskets and transaction failure checks
Shop acceptance commits sold instances, purchased instances, their placements, the resulting cash and the item-ID allocation in one SQLite transaction. The inventory writer requires each changed item and placement write to affect its intended row. It also reads back conditional player metadata and world allocation updates before commit. An unchanged value needs no write; a required write silently skipped by SQLite must fail the entire transaction. The existing in-memory inventory and shop draft remain available for retry, and no Complete reply is sent before commit.
The regression uses RAISE(IGNORE) as well as ordinary SQL errors. Without
checking required writes, an ignored statement can report success while other
statements commit, leaving cash, ownership or allocation inconsistent. The
checks add reads rather than rewriting unchanged rows. Idle-world and player
checkpoint cadence remain covered by the full suite.
Automated mixed-sale coverage
server/shop_multi_sale_test.go stages five original QL1 items at the Omni
Tools terminal, template 99491, with effective Computer Literacy 40:
| Offered item | Remaining count | Awarded credits |
|---|---|---|
| Kinetic Axe 209283 | 1 | 734 |
| Treatment Laboratory 25812 | 49 | 8 |
| Nano Recharger 85366 | 25 | 1 |
| Treatment Laboratory 25812 | 1 | 0 |
| Bullets 21605 | 100 | 1 |
The 744-credit sale funds two Lock Picks at 228 each, leaving 288 credits. The zero-credit row is consumed along with the other sales. Every package receives one new persistent instance in a vacated first-free slot. Repeated Accept and cold restore preserve precisely that outcome.
Thirteen injected failures cover error and ignored writes for cash, sold item deletion, sold placement deletion, purchased item insertion, purchase placement insertion and allocation, plus a deferred foreign-key failure at COMMIT. Each leaves durable state, live inventory, allocation and draft unchanged; removing the fault permits one successful outcome despite repeated Accept.
Additional cases remove the funding sale while purchases remain selected, distinguish one remaining laboratory charge from 49 when funding a purchase, and sell a zero-value row with a trigger prohibiting any unchanged cash write. The native pending-funds estimate counts each sale row's whole price, so it cannot replace the charge-aware authoritative check at Accept.
Native WASM checks
Two headed Chromium clients use the GPU and the shared HTTPS preview. Fixtures are created through the public control panel. Mouse and keyboard actions drive transactions; native heap, wire and SQLite reads verify results. The run checks:
- A NoDrop solar pistol is rejected locally without changing the draft.
- Offering a filled backpack reaches the server, aborts the draft and restores the previously offered axe. The backpack and its contained Lock Pick survive.
- All five sale rows quote 744 and two selected purchases quote 456. Removing the axe leaves the purchases selected with only 10 sale credits. Native Accept reports the 446-credit shortage and sends no Accept request.
- Re-offering the axe completes with 288 credits. SQLite already contains both new instances and the final balance when Complete reaches the client.
- The owner sees all expected items after page reload. The other player's private inventory and cash remain unchanged. The backpack opens with its original contained item after the sales.
- A real server restart and fresh native client restore the exact purchased identities, final cash and backpack contents, including the later live-skill test's third purchase. No transaction is replayed during reconnection.
Artifacts, exact instance IDs, screenshots, packet checks, restart verification
and fixture cleanup are retained under local/shop-multi-sale-smoke/.
The full server/catalog suite passes 5,096 tests and subtests; the new cases
also pass three repetitions under the race detector. Vet and server build pass.
This completes this bounded mixed-basket and atomicity check, not the broader
shop audit or historical stock/pricing reconstruction.
Open live Computer Literacy quote discrepancy
The run also reproduces a stale native BUY total. At effective skill 39 a selected Lock Pick displays 230. A second player casts Computer Literacy Proficiency 26396, raising effective skill to 49 while the shop stays open. The selected total remains 230. Removing that selection leaves a two-credit BUY total with an empty basket; re-adding it returns the cache to 230. Accept uses the current server quote of 228 and reduces cash from 288 to 60.
Original KKR 100a96b0 adds the current price to a cached aggregate;
100a97b0 subtracts the current price when removing a selection. DDR
10048d50 reads that aggregate rather than repricing the selected rows.
TradeUpdated redraws it without rebuilding the aggregate. Remove/Add at the
new skill preserves the residue. Complete's vending branch consumes sales and
clears selections without debiting purchases; the server's absolute cash
update supplies the resulting balance.
These are client contracts and a reproduced current-server discrepancy.
They do not establish whether the historical server froze prices, rebuilt
drafts, or applied another policy after a skill change. An ordinary quote
refresh primitive has not been recovered. Resolve that evidence and verify
both skill increases and decreases before choosing a pricing/lifecycle change.
The retained original evidence and precise call-path limits are in
docs/research-notes/shop-multi-sale-research/native/README.md and
completion-and-repricing.md.
A bounded follow-up found a later Trade and Repair wiki description claiming that a kiosk keeps its opening discount after a short CL buff expires. This is a secondary lead, not a dated 14.9.1 measurement; that page also describes a later 80-percent cap, unlike the original client's recovered 90-percent cap. It therefore does not justify freezing this server's drafts or rewriting the client's quote cache. The original opening-stat snapshot or corresponding server exchange remains the specific evidence gap. Further broad searches did not recover a period example; keep the live-quote issue open.
Empty selections
An empty selection has no purchase cost regardless of the unresolved pricing
policy. The client now resets the cached aggregate when removing its final row,
before notifying the GUI. Nonempty quantities and other rows retain their
existing arithmetic. This is a two-line correction in
client/game/kkr.dll/lifted-0012.c::sub_3601E2E0; the original unlink/decrement
path at 1001e36c left the stale aggregate intact.
client/tests/shop_empty_total.c invokes that native entry with positive and
negative residual quotes, a remaining quantity, another selected row, an unknown
identity and an already empty selection. It checks the total before notification,
list links, releases, return value and guest stack/register preservation under
native, paged-memory and WASM execution. TestBrowserShopEmptyTotal supplies a
controlled zero-credit character and one axe; no earned progression is claimed.
The native shop selects a Lock Pick, receives a raw Computer Literacy change
38 -> 48 (effective 39 -> 49), removes the purchase and funding axe, then accepts
the empty basket. The completion check is BUY 0, an actual Accept request and
unchanged cash, physical item properties and allocation after page/cold recovery.
This does not settle repricing while any purchase remains selected.
The pre-fix browser run at local/shop-empty-total/20261103-153518 shows BUY 2,
SELL -2, no selected server rows and no Accept request. The rebuilt client run at
local/shop-empty-total/20261103-154001 completes in 15.24 seconds: BUY/SELL 0,
one actual Accept and one Complete, the unchanged axe and zero credits after
native page replay and a cold database load. All retained traces are free of
client exceptions. Six focused Go checks (including that browser fixture),
native/paged entry tests and a standalone WASM entry test pass. Evidence and
bundle hashes are checked by local/shop-empty-total/tmp_verify.py.