aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 9024baa7db5cbb57770f806acb68ad2c186fa17c
parent f1d160c7a58bc840ac137021579cde470032e36c
Author: anon <anon@example.com>
Date:   Thu, 29 Oct 2026 21:28:09 +0000

Verify native corpse reentry and full-inventory loot retry

Diffstat:
MTODO.md | 10++++++++++
Mdocs/corpse-scene-audit.md | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Mserver/partial_loot_test.go | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 144 insertions(+), 4 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -3190,6 +3190,16 @@ and server restarts. Turn every reproduced bug into a focused regression test. remains open. New partial-loot regressions cover second-transfer write failures, full-inventory retry, stale slots, selected qualities and cold expiry of only untaken items. See [native corpse audit](docs/corpse-scene-audit.md). +- [x] Verify ordinary item pickup after native scene reentry and full-inventory + retry. An earned part now transfers after section 10 -> 13 -> 10 while both + clients retain the same typed corpse objects. With 30 occupied inventory slots, + the native client refuses another part without sending a transfer request. + Uploading the original starter map at raw Map Navigation 5 frees one slot; + the same open corpse then transfers its exact part once. Ledgers retain + all 55 unconsumed original instances and three new parts, with the used map + explicitly consumed. A public-handler regression separately verifies server + refusal, durable map consumption, retry, duplication prevention and cold + expiry. See [native corpse audit](docs/corpse-scene-audit.md). - [x] Commit corpse expiry before native removal. Check: unclaimed loot and filled bags retire atomically before close/delete packets; failed or ignored writes and failed COMMIT preserve state and retry. Cover both respawn/expiry orderings, diff --git a/docs/corpse-scene-audit.md b/docs/corpse-scene-audit.md @@ -45,9 +45,55 @@ cause. The harness now waits for an actual typed corpse and retains failed picker samples instead of treating displayed zero HP as a completed kill. These results do not justify adding corpse replay to the shop's section fix. -Successful pickup of an item-bearing corpse after section reentry, native -full-inventory rejection/retry, open-window transitions and generic placement -on slopes remain part of the broader P0 audit. +The later checks below complete item-bearing pickup after section reentry and +native full-inventory refusal/retry. Open-window lifecycle transitions and +generic placement on slopes remain part of the broader P0 audit. + +## Item-bearing pickup and full inventory + +The same earned fighter and ordinary observer continued on the unchanged +preview with ordinary native controls. Seven full-health Snake kills generated +three collected parts, one unclaimed part and 21 collected credits. There were +no forced drops, grants or changes to enemies, skills, resources or wallets. +The unclaimed part 235 expired before pickup; it was never player-owned. + +Corpse 1068780 retained untaken QL1 part 236 while the fighter walked from native +section 10 through 13 and back. Both clients retained their same typed corpse +objects. Normal turn keys faced the returning fighter toward the remains; +the native picker then identified the exact `51050:1068780` object. Reopening +and left-clicking moved part 236 into durable inventory 91 and native slot 75. +The earlier failed return search had retained the route's facing direction. +Correcting the test controls establishes successful picking without a server +replay or corpse-placement change. + +Another ordinary pickup put part 237 into the last free slot 93. With all 30 +ordinary inventory slots occupied, a click on part 238 in corpse 1068783 showed +the native message `Inventory full, please make room in your inventory first!` +and left the icon and durable corpse slot intact. This refusal occurred in +the client before a transfer request; it does not independently test the +server's full-inventory rejection. + +The fighter then right-clicked its original Startup Maps - Omni-Tek instance 18 +in inventory 66. Its raw Map Navigation remained 5. The original item contract +checks side and existing map knowledge, with no skill threshold. The server +atomically consumed 18 and learned masks `[0, 0x18c00, 0x1600403b]`; only the +owner received the three map-stat updates and removal. The still-unclaimed +part 238 remained on the same corpse during this intermediate state. + +A click in that same open loot window then generated one transfer request +and acknowledgement, moving 238 into the freed slot 66 (native 50). An extra +click did not duplicate it. Exact durable and native ledgers account for +all 55 unconsumed original instances and the three new parts; only the used +map 18 was removed from the original 56. The observer received no items, cash +or XP. The fighter retained its original XP 11750, IP 14645, ammo, laboratory +charges and raw skills, with 242 credits. These low-level kills were grey to +the level 5 fighter and did not test new XP progression. + +An additional out-of-range fight attempt changed no health or inventory and +ended at the test's guard deadline. The next attempt approached normally +before attacking. Both harness failures closed their owned browser contexts; +neither was a WASM exception. Private snapshots, typed-object probes, packet +reassembly, screenshots and reconciliations are in `local/loot-native-capacity/`. ## Partial-loot regressions @@ -61,13 +107,22 @@ on slopes remain part of the broader P0 audit. - Filling the last inventory slot, safely refusing the next item, explicitly destroying one unrelated fixture item, and retrying the same open corpse slot without duplicating either taken instance, including after expiry/restart. +- Refusing a pickup when full, consuming an authored starter map at normal + starting skill, and retrying the same open corpse slot. Cold snapshots check + refusal and map consumption separately, followed by duplicate pickup and + corpse expiry, with exact unrelated-item and learned-map retention. -The focused run passes all three roots/seven results; the related selection +The initial focused run passes all three roots/seven results; its related selection passes101 roots/342results. The same complete selection passes under the race detector, with no race warnings or skipped tests. Vet passes. The final race run used a30-minute allowance; the earlier default-timeout log is retained as incomplete evidence. +The later combined map/partial-loot selection, including starter-map consumption +and retry, passes all 11 roots/96 results normally and under the race detector. +The normal and race logs contain exactly the same passing cases, with no failures, +skips or race warnings. Vet passes. + A guarded restart preserved every global player, wallet, item, placement, mission, encounter and learned nano exactly against the stopped snapshot. Both tested clients then reconstructed all41 inventory instances by ID, slot, @@ -77,6 +132,16 @@ only earned-wallet change is the five collected credits. No WASM page exception was recorded. The console includes uncategorized HTTP404 responses, whose cause has not been established by these captures. +A second guarded cold restart after the full-inventory run preserves the same +global durable tables exactly. Both native clients reconstruct all 43 instances +by ID, slot, quantity, quality and template endpoints, including parts 236/237/238 +in slots 91/93/66. The used map remains absent, and the fighter reconstructs all +three authored map masks and its 242-credit wallet. All 58 currently owned +instances across the four test characters remain exact, with no WASM page +exceptions. The native GPU renderer is GPU OpenGL; test windows did not +use the shared desktop. Uncategorized console HTTP 404 messages remain in the +new captures too; these runs do not establish their cause. + All owned test browser profiles are closed, with no connected test sessions. The sole preview remains healthy on HTTPS8443 and the other default ports. Complete private ledgers, native screenshots, reassembled packet records, diff --git a/server/partial_loot_test.go b/server/partial_loot_test.go @@ -199,3 +199,68 @@ func TestPartialCorpseLootFullInventoryRetryRetainsBothInstances(t *testing.T) { t.Fatal("explicitly destroyed instance returned", count, err) } } + +func TestFullCorpseLootRetryAfterUsingStarterMap(t *testing.T) { + world, _, killed := newExpiringCorpseWorld(t) + player := world.characters[1] + player.appearance = player.appearance&^(3<<9) | 2<<9 + player.stats.Navigation.MapNavigation = 5 + for slot := uint32(64); slot < 94; slot++ { + player.inventory.Items = append(player.inventory.Items, + ownedItem{ID: slot + 100, Type: 51018, Template: 121567, Quality: 1, Slot: slot, Count: 1}) + } + player.inventory.Items[0] = ownedItem{ID: 164, Type: 51005, Template: 116693, Quality: 1, Slot: 64, Count: 1} + player.inventory.LastID, world.nextItem = 193, 193 + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + if err := world.handleLootUse(world.clients[1], lootUseRequest(1)); err != nil { + t.Fatal(err) + } + + if err := world.handleInventory(world.clients[1], lootTakeRequest()); err != nil { + t.Fatal(err) + } + full := newTestInventoryServer(t) + if err := world.handleOwnedItemUse(world.clients[1], backpackUseRequest(1, 64, 2)[20:]); err != nil { + t.Fatal(err) + } + uploaded := newTestInventoryServer(t) + if err := world.handleInventory(world.clients[1], lootTakeRequest()); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(world.clients[1], lootTakeRequest()); err != nil { + t.Fatal(err) + } + world.advanceCorpseExpiry(killed.Add(180 * time.Second)) + cold := newTestInventoryServer(t) + + if len(full.characters[1].inventory.Items) != 30 || full.characters[1].inventory.MapFlags != [3]uint32{} || + !slices.Equal(full.characters[1000000].corpse.items, []ownedItem{{ID: 17, Type: 51005, Template: 42640, Quality: 1, Count: 1}}) { + t.Fatal("full-inventory refusal changed the map or untaken part") + } + if len(uploaded.characters[1].inventory.Items) != 29 || len(uploaded.characters[1000000].corpse.items) != 1 { + t.Fatal("map upload transferred loot before the retry") + } + for _, current := range []*server{uploaded, world, cold} { + if current.characters[1].inventory.MapFlags != [3]uint32{0, 0x18c00, 0x1600403b} || + current.characters[1].stats.Navigation.MapNavigation != 5 || current.nextItem != 193 { + t.Fatal("map upload changed the skill, identity counter or authored knowledge") + } + for slot := uint32(65); slot < 94; slot++ { + if !slices.Contains(current.characters[1].inventory.Items, ownedItem{ID: slot + 100, Type: 51018, Template: 121567, Quality: 1, Slot: slot, Count: 1}) { + t.Fatal("map upload or loot retry changed an unrelated item", slot) + } + } + } + for _, current := range []*server{world, cold} { + if len(current.characters[1].inventory.Items) != 30 || + !slices.Contains(current.characters[1].inventory.Items, ownedItem{ID: 17, Type: 51005, Template: 42640, Quality: 1, Slot: 64, Count: 1}) { + t.Fatal("retry or corpse expiry lost or duplicated the part") + } + } + var count int + if err := cold.db.QueryRow("SELECT COUNT(*) FROM items WHERE id=164").Scan(&count); err != nil || count != 0 { + t.Fatal("consumed starter map returned", count, err) + } +}