commit 59405ade33d574d7478c17d4690ba6198edd6c09
parent 601b2ca4a7c272d693e0649b2cdf34460954050e
Author: anon <anon@example.com>
Date: Thu, 5 Nov 2026 22:50:10 +0000
Map alpha item recovery coverage and verify Snake corpse pickup
Diffstat:
4 files changed, 228 insertions(+), 1 deletion(-)
diff --git a/TODO.md b/TODO.md
@@ -145,7 +145,12 @@ research separately. More screenshots and test cases do not count as new gamepla
The recorded buried Aquaan case now uses held-pose vertex clearance, with
native warm/reconnect loot and atomic cold-pose coverage; see
[corpse placement](docs/corpse-pose.md). This fixes that visible failure,
- not the remaining ordinary-action coverage matrix.
+ not the remaining corpse coverage. November 5: the
+ [ordinary-action matrix](docs/alpha-item-recovery.md) now maps exact-state,
+ rejected-write/retry and native reconnect/cold evidence for these actions.
+ An original Giant Snake placement also passes visible native corpse picking,
+ loot transfer, reconnect and database recovery. The matrix lists the remaining
+ early-route body checks; living appearance coverage alone does not close them.
- [ ] **A7: All-faction early-game loop through levels 1-10.** Name the finite
training/hunting routes, starter/basic shops, supported mission encounters
diff --git a/docs/alpha-item-recovery.md b/docs/alpha-item-recovery.md
@@ -0,0 +1,87 @@
+# Alpha item and recovery coverage
+
+This is the ordinary-action map for TODO A6, reviewed November 5. It connects
+existing transaction regressions to native client evidence; it does not require
+replaying every historical edge case. No new ownership failure was found during
+this review. A6 remains open for the remaining early-route corpse visibility
+checks below. Shop breadth and affordability remain A5/A7 work.
+
+## Ordinary actions
+
+| Action | Exact state and transaction coverage | Native evidence and limits |
+| --- | --- | --- |
+| Buy recovery, ammunition and equipment; sell loot | `shop_purchases_test.go` covers charged packages, exact slots/identities, concurrent accept, failed commit and retry. `shop_multi_sale_test.go` covers partial charges, zero-value rows and failed writes without partial cash/ownership. `shop_live_items_test.go` covers reply loss. | [NPC vendors](npc-shops.md) and [early stock](early-shop-stock.md) record the five vendors, four training terminals, three weapon shops and 36 nano terminals. Purchase/use, sale, cancel and reconnect are covered; the stock fixtures also check cold recovery. Controlled money/skills establish transactions, not affordability or earned progression. |
+| Wear, remove and replace equipment | `equipment_test.go`, `equipment_replacement_test.go` and `equipment_conservation_test.go` cover delayed placement, requirements, full inventory, failed placement/retry, concurrent grants and lost replies with cold recovery. | [Inventory](inventory.md) records native equip/unequip/replacement and full-inventory refusal. `TestBrowserStarterColdRecovery` starts a new server and two native clients with a worn starter weapon, 17 lab charges and 50 credits. That checkpoint is seeded. `TestBrowserBackpackEquipment` covers bag-to-wear and exact ownership after cold load. |
+| Put items in a backpack, withdraw them, split/join charges and use recovery | `backpacks_test.go` covers native wire/restart, transfers between bags, capacity, concurrent transfer and failed save, split/join and reclaim. `backpack_medical_test.go` covers exact source/patient, last-charge consumption and failed commit/retry. | [Backpacks](backpacks.md) records native storage, restart, withdrawal/equip, charged stacks and full bags. `TestBrowserBackpackMedical` checks native use and source charges; retained verification reports 24 focused roots and 34 race roots. |
+| Trade items and money with another player | `player_trading_test.go` covers both owners and cash in one transaction and failed persistence. `player_trading_lifecycle_test.go` covers cancellation, concurrent accept, lost completion replies and death. `player_trading_rejection_test.go` covers loaded weapons, filled bags and prospective capacity. | [Player trading](player-trading.md) records two-client charged-stack/cash exchange, filled bags, cancellation and restart. `TestBrowserTradedWeapon` transfers a loaded gun, equips/fires it, then restores it in a new server/native session. The high-skill checkpoint is controlled, not an early-game balance claim. |
+| Die, retain protected equipment, reclaim other items | `player_death_test.go` covers death/reclaim atomicity and failed writes. `reclaim_test.go` covers retained worn/NoDrop items, private pickup, full inventory, failed pickup/retry, concurrency and native wire/restart. | [Reclaim](reclaim.md) records Omni and Clan/Neutral insurance routes. `TestBrowserBulkReclaimColdRecovery` restores a controlled level-10 death, collects 24 reclaim items, then starts another server/native session; all 33 items across both owners retain identity, quality, charges, ammunition and placement, with 1,319 credits unchanged. |
+| Loot remains once, including after reconnect/restart | `TestLootNativeCorpseTakeAndRestart`, `corpse_expiry_test.go`, `corpse_expiry_outcome_test.go` and loot-rights regressions cover exact transfer, expiry/pickup ordering, failed/ignored writes and commit failure/retry. The repaired synthetic NPC fixture now lets the expiry regressions execute with required geometry resources. | [Corpse loot](corpse-loot.md) records Leet and Tiny Stalker pickup/cold recovery. [Corpse placement](corpse-pose.md) records the fixed buried Aquaan. The new Giant Snake check below adds one original route placement. Other living-body captures do not establish their corpse poses. |
+
+Test files in the table are under `server/`. Exact item comparisons include
+identity, template, quality, slot, count and ammunition where applicable; cash
+is checked independently. Tests of rejected writes protect the boundary before
+success is published. A saved database read is distinguished from a new native
+session: both are useful, but only the latter checks client reconstruction.
+
+Selected retained artifacts supporting this map:
+
+- `local/npc-vendors/native-evidence.json` and `regressions-final.log`.
+- `local/old/equipment-conservation/` and
+ `local/old/starter-native-cold/20261104-155211/verification.json`.
+- `local/old/backpack-medical/verification.json` and
+ `local/old/backpack-medical/20261104-051416/`.
+- `local/old/player-trade-live-smoke/verification.txt` and
+ `local/old/traded-weapon/verification.json` (source `20261103-084609`).
+- `local/old/bulk-reclaim/20261104-161139/` and
+ `local/old/faction-checkpoint/verification.json` (source `20261103-073313`).
+- `local/old/corpse-replay/`, `local/alpha-npc-fixture/verified.log` and
+ `local/alpha-corpse-slope/20261105-143839/`.
+
+These ignored artifacts are local evidence, not repository dependencies. Some
+older subsystem documents retain their original paths before archival under
+`local/old/`. Existing evidence was mapped rather than rerun in this review.
+
+## Early-route corpses
+
+The finite creature list is the same 15 distinct bodies already inspected alive
+for [A3](npc-appearances.md#creature-appearance-scope). Shared species do not need
+every placement replayed, but a newly observed terrain failure reopens the
+relevant placement check.
+
+| Route | Corpse evidence established | Remaining body checks |
+| --- | --- | --- |
+| Omni training | Leet (17655), Giant Snake (30252), Tiny Stalker (17708), Aquaan (30369) | Reet (30365), Malle (17660) |
+| Clan training | Shared species use the evidence above | Grecko (22794), Rollerrat (17687), Blubbag (40075), Salamander (30354) |
+| Neutral training | Shared species use the evidence above | Android (17649), Biofreak (30258), Clawfinger (38387), Eye Mutant (17653), Blackout (45873) |
+
+The six clothed human opponent populations also have living-body evidence only
+in A3. Their remains need a representative native check of the shared humanoid
+corpse/equipment path when admitted to the selected combat route; living outfit
+inspection alone must not be reported as corpse evidence.
+
+The remaining check is small: reach a fresh corpse through controlled combat at
+an original route placement, inspect its recognizable body, use native picking
+and loot input, and compare exact source/destination ownership after reconnect
+and database recovery. Fix any reproduced visibility failure before extending
+the run. There is no requirement here to grind levels or recover the original
+generic slope formula.
+
+### Giant Snake checkpoint
+
+`TestBrowserTrainingSnakeCorpse` selects the lowest actor identity from original
+population `950/district/1/group/2/authored_point`, keeps its authored placement
+and rotation, lowers health to one and invokes the combat handler. The native
+client then enters with the fresh corpse already present. This proves corpse
+reconstruction and pickup, not the warm death animation or ordinary kill pace.
+
+The November 5 run passed in 13.54 seconds. The inspected capture shows the
+recognizable coiled body and open mouth above the terrain at approximately
+`[171.12706, 14.340281, 51.297123]`. Native right-click opens its loot window;
+pickup moves Monster Parts item 1, template 42640, QL1, count 1 to inventory slot
+64 and transfers exactly one credit. Reconnect retains that inventory. A fresh
+server database load verifies the same item and cash and the emptied corpse.
+
+Evidence is under `local/alpha-snake-corpse/20261105-144656/`, with the run log at
+`local/alpha-snake-corpse/native.log`. The browser and temporary server are closed
+by the fixture even on failure. This change adds coverage and the A6 map; it
+changes no gameplay behavior and does not close A6.
diff --git a/server/browser_snake_corpse_test.go b/server/browser_snake_corpse_test.go
@@ -0,0 +1,91 @@
+package main
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "runtime"
+ "testing"
+ "time"
+)
+
+func TestBrowserTrainingSnakeCorpse(t *testing.T) {
+ if os.Getenv("AO_GAME_TEST") != "1" {
+ t.Skip("set AO_GAME_TEST=1 for the original training Snake corpse")
+ }
+ _, source, _, _ := runtime.Caller(0)
+ root := filepath.Dir(filepath.Dir(source))
+ output := filepath.Join(root, "local/alpha-snake-corpse", time.Now().Format("20060102-150405"))
+ world := newTestServer(t)
+ var target *character
+ for _, actor := range world.characters {
+ if actor.npcDefinitionID == "950/district/1/group/2/authored_point" && (target == nil || actor.id < target.id) {
+ target = actor
+ }
+ }
+ if target == nil {
+ t.Fatal("missing original Snake population")
+ }
+ player := world.newCharacter()
+ player.position = target.position
+ player.position[2]++
+ player.rotation = [4]float32{0, 1, 0, 0}
+ player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("snake-corpse")))
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+
+ // Reach a fresh corpse through the combat handler without earning progression.
+ target.health = 1
+ world.combatRoll = func(uint32) uint32 { return 0 }
+ world.clients[1] = &worldClient{id: 1, ready: true, target: true, conn: &combatTestConn{}, npcs: map[uint32]bool{target.id: true}}
+ if err := world.handleCombat(world.clients[1], attackPacket(1, target.id)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ world.advanceCombat(player.nextAttack)
+ if target.corpse == nil || len(target.corpse.items) != 1 {
+ t.Fatal("controlled attack did not produce one corpse item")
+ }
+ item, credits := target.corpse.items[0], target.corpse.credits
+ delete(world.clients, 1)
+ player.position[2] = target.position[2] + 4
+ player.position[1], _ = world.terrain[player.playfield].elevation(player.position[0], player.position[2])
+ player.position[1] += .2
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+
+ mux := http.NewServeMux()
+ mux.Handle("/", world.httpHandler())
+ mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) {
+ world.mutex.Lock()
+ defer world.mutex.Unlock()
+ json.NewEncoder(w).Encode(map[string]any{"target": target.id, "position": target.position, "items": target.corpse.items,
+ "credits": target.corpse.credits, "inventory": player.inventory})
+ })
+ host := httptest.NewServer(mux)
+ defer host.Close()
+ defer closeTestSessions(t, world)
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
+ defer cancel()
+ command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_snake_corpse.mjs"), host.URL, output)
+ command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr
+ err := command.Run()
+ t.Logf("Browser artifacts: %s", output)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cold := newTestInventoryServer(t)
+ item.Slot = 64
+ if !reflect.DeepEqual(cold.characters[1].inventory.Items, []ownedItem{item}) || cold.characters[1].inventory.Credits != credits ||
+ len(cold.characters[target.id].corpse.items) != 0 || cold.characters[target.id].corpse.credits != 0 {
+ t.Fatal("native corpse pickup changed exact ownership after cold load")
+ }
+}
diff --git a/tools/client/test_snake_corpse.mjs b/tools/client/test_snake_corpse.mjs
@@ -0,0 +1,44 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs/promises';
+import {createRequire} from 'node:module';
+import {GameTest} from './game_test.mjs';
+
+const {chromium} = createRequire(import.meta.url)('playwright');
+const [url, output] = process.argv.slice(2);
+const browser = await chromium.launch({executablePath: '/usr/bin/chromium', args: [
+ '--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage',
+ '--disable-background-timer-throttling', '--disable-renderer-backgrounding']});
+let game;
+const evidence = {};
+try {
+ const context = await browser.newContext({viewport: {width: 1024, height: 768}});
+ await context.addCookies([{name: 'ao_client', value: 'snake-corpse', url}]);
+ const page = await context.newPage();
+ game = await GameTest.attach(page);
+ const server = async () => (await page.request.get(url + '/test-state')).json();
+ await page.goto(url);
+ await game.ready();
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ evidence.before = await server();
+ await game.save(output + '/corpse');
+ await game.click(...await game.pick(51050, evidence.before.target), 'right');
+ await game.wait('original Snake loot appears', state => state.grids.some(grid => grid.cells.some(cell => cell.identity[0] === 107 && !cell.dummy)));
+ await game.save(output + '/loot');
+ await game.click(30, 45);
+ await game.waitFor('exact original loot collected', async () => (await server()).items.length === 0);
+ evidence.collected = await server();
+ assert.deepEqual(evidence.collected.inventory.Items, [{...evidence.before.items[0], Slot: 64}]);
+ assert.equal(evidence.collected.inventory.Credits, evidence.before.credits);
+ await page.reload();
+ await game.ready();
+ evidence.reconnected = await server();
+ assert.deepEqual(evidence.reconnected.inventory, evidence.collected.inventory);
+ assert.deepEqual(game.errors, []);
+ console.log('PASS: training Snake corpse visible, picked and retained exact loot through reconnect');
+} finally {
+ try {
+ await fs.mkdir(output, {recursive: true});
+ await fs.writeFile(output + '/verification.json', JSON.stringify(evidence, null, 2) + '\n');
+ if (game) await game.save(output + '/final');
+ } finally { await browser.close(); }
+}