aorecomp

Anarchy Online classic in the browser

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


commit ad98323bb1f625440a8653a1e50a2005104d5453
parent 731d8377e879260547a685646605a75b82baf7a5
Author: anon <anon@example.com>
Date:   Mon,  2 Nov 2026 19:15:28 +0000

Resolve Backyard1 bank visibility report with native coverage

Diffstat:
MTODO.md | 20++++++++++----------
Mdocs/bank-storage.md | 48++++++++++++++++++++++++++++++++++++++++++++++++
Mdocs/mission-levels.md | 4++--
Aserver/browser_backyard_bank_test.go | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atools/client/test_backyard_bank.mjs | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 254 insertions(+), 12 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -3089,16 +3089,16 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah Unique scope, stack operations and reconnect/restart are covered. See [bank storage](docs/bank-storage.md) for native evidence and reconstruction policies. -- [ ] [P1] Verify ordinary Backyard1 bank rendering and picking. The earned - level-eight owner reaches within five metres of original terminal - 51005:3221752760 at [109.204704,115.00013,152.970703]. Its typed native actor - exists and projects, but no bank body is visible in the retained first-person - view and the maintained picker cannot hit it. Compare the original statel, - scene/model activation and current port before changing placement or geometry; - alternate-camera helper failures do not establish a native crash. Verify an - ordinary bank Use/transfer and cold recovery after resolving the actual cause. - The 201-terminal server tests do not prove physical native access to each. - Evidence: `local/earned-nine/native-20261101-234800/` and its README. +- [x] [P0] Resolve the Backyard1 bank rendering and picking report. The retained + failed view projects terminal 51005:3221752760 off-screen; a controlled nearby + checkpoint and observed native first-person alignment reveal its original + model and permit picking/Use. Original statel/template audits and an indoor + control support retaining authored geometry and placement. A short native + regression deposits/withdraws the same item, repeats access after page reload, + then picks and withdraws it through a fresh server/client at both placements. + All IDs, quantities and properties survive. This is a focused controlled + regression, not new earned-progression evidence or access proof for all 201 + banks. See [Backyard1 bank access](docs/bank-storage.md#backyard1-native-access). - [x] Verify server-side bank rejection in the WASM UI with a Unique duplicate hidden in an unopened carried backpack. Action 146 restores the source and native text explains the rejection, without the action-46 contract error. diff --git a/docs/bank-storage.md b/docs/bank-storage.md @@ -220,3 +220,51 @@ the previous production code using a temporary Go overlay. Runtime conservation checks pass in `local/bank-failure-smoke/verification.json`; cleanup confirms only the owned test character and items were removed and SQLite integrity remains sound. + +## Backyard1 native access + +The reported invisible Backyard1 bank is usable with the original model and +placement. In the retained earned-level-eight south approach, its origin +projects to `[-353.66, 1022.52]` on a 1024x768 frame. Being within five metres +and having a typed actor did not put its body in the camera view. A controlled +nearby checkpoint reproduces another off-screen third-person projection; +ordinary first-person alignment exposes the complete bank and its native +pick/Use target. The driver observes the camera transition before picking. + +Fresh original-resource reads compare the complete template 116807 descriptor +with the maintained catalog and inspect these two original statels: + +| Placement | Playfield | Identity | Position | +| --- | --- | --- | --- | +| Backyard1 | 3000 | 51005:3221752760 | 109.204704, 115.000130, 152.970703 | +| Indoor control | 1183 | 51005:3221357727 | 196.798264, 5.009963, 136.839828 | + +Both have no per-instance stat overrides and use stat 12's model 1010001:55865, +SHA256 `d84ecb6fba5c56c9e2608467db3b5119903a4f81f0c7b918da463d652b10dd71`. +Their different authored rotations remain intact. Original KKR +`PlayfieldAnarchy_t::CreateRDBDynels` at 0x1014d650 and activation 0x100b25c0 were +checked through REA; retained evidence is +`ev_895d39b7b3e640e05cbe14541292b364f1f38252caee2d420b36101fccb2e16b`. +The complete audit, payloads and activation evidence are under +`local/backyard-bank/`. This result supports retaining the original rendering, +geometry and placement. + +`TestBrowserBackyardBank` uses the maintained `GameTest` harness, real native +input and two controlled level-one players with one Monster Part each. At +each placement it picks the real terminal, waits for the rendered bank window, +deposits and withdraws the exact item, closes the bank, reloads the page and +deposits it again. After closing the original database, a new server and fresh +browser contexts reopen each bank and withdraw those same physical IDs. +Native inventory and server state agree on template, QL, quantity, ammunition +and slot. No native/page errors occurred. These are controlled item-contract +fixtures, not earned acquisition or a replay of the earlier city approach. + +The complete native check passed in 46.44s; screenshots and traces are retained +under `local/backyard-bank/20261102-111304/`. Focused bank Go tests passed +in 20.021s, and vet passed. The production server, original resources and +published WASM remain unchanged. This closes the specific Backyard1 report; +it does not establish physical access to every original terminal. + +```sh +AO_GAME_TEST=1 go test ./server -run '^TestBrowserBackyardBank$' -count=1 -timeout=4m -v +``` diff --git a/docs/mission-levels.md b/docs/mission-levels.md @@ -664,8 +664,8 @@ in 1823.64 seconds and the cold fixture in 641.57 seconds; each closes its owned browsers and server. Evidence is retained under `local/earned-nine/`, including `bank-roundtrip-verified.json`, `restock-verified.json`, `checkpoint-verified.json` and `cold-restock-verified.json`. This does not establish earned level nine or -original shop-stock membership. The separate Backyard1 bank rendering/picking -gap remains recorded in the TODO. +original shop-stock membership. The separate Backyard1 camera/picking report +is resolved by the [focused native check](bank-storage.md#backyard1-native-access). ## Native earned level nine diff --git a/server/browser_backyard_bank_test.go b/server/browser_backyard_bank_test.go @@ -0,0 +1,115 @@ +package main + +import ( + "context" + "crypto/sha256" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "runtime" + "slices" + "testing" + "time" +) + +func TestBrowserBackyardBank(t *testing.T) { + if os.Getenv("AO_GAME_TEST") != "1" { + t.Skip("set AO_GAME_TEST=1 for the focused native bank check") + } + _, source, _, _ := runtime.Caller(0) + root := filepath.Dir(filepath.Dir(source)) + output := filepath.Join(root, "local/backyard-bank", time.Now().Format("20060102-150405")) + world := newTestServer(t) + for index, point := range []struct { + playfield uint32 + position [3]float32 + rotation [4]float32 + }{ + {3000, [3]float32{109.204704, 115.01, 149.970703}, [4]float32{0, 0, 0, 1}}, + {1183, [3]float32{193.79826, 5.01, 136.83983}, [4]float32{0, 0.70710677, 0, 0.70710677}}, + } { + player := world.newCharacter() + player.name = fmt.Sprint("Bankcheck", index) + player.playfield, player.position, player.rotation = point.playfield, point.position, point.rotation + player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint("bank-check-", index)))) + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + if err := world.savePosition_locked(player); err != nil { + t.Fatal(err) + } + if granted, err := world.grantItem_locked(player, 42640); err != nil || !granted { + t.Fatal(granted, err) + } + } + testState := func(w http.ResponseWriter, r *http.Request) { + world.mutex.Lock() + defer world.mutex.Unlock() + states := make(map[uint32]any) + for id, player := range world.characters { + if !player.npc { + client := world.clients[id] + states[id] = map[string]any{"inventory": player.inventory, "bankOpen": client != nil && client.bank != nil} + } + } + json.NewEncoder(w).Encode(states) + } + mux := http.NewServeMux() + mux.Handle("/", world.httpHandler()) + mux.HandleFunc("GET /test-state", testState) + host := httptest.NewServer(mux) + defer host.Close() + closeTestBrowserStreams(t, world) + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + + command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_backyard_bank.mjs"), host.URL, output, "live") + 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) + } + if err := world.flushPositions(time.Now().Add(20 * time.Second)); err != nil { + t.Fatal(err) + } + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + host.Close() + if err := world.db.Close(); err != nil { + t.Fatal(err) + } + cold := newServer() + defer cold.db.Close() + for _, id := range []uint32{1, 2} { + if len(world.characters[id].inventory.Items) != 0 || len(world.characters[id].inventory.Bank) != 1 || + !slices.Equal(world.characters[id].inventory.Items, cold.characters[id].inventory.Items) || + !slices.Equal(world.characters[id].inventory.Bank, cold.characters[id].inventory.Bank) || + world.characters[id].inventory.Credits != cold.characters[id].inventory.Credits { + t.Fatal("native bank deposit changed across cold recovery", id) + } + } + world = cold + coldMux := http.NewServeMux() + coldMux.Handle("/", cold.httpHandler()) + coldMux.HandleFunc("GET /test-state", testState) + coldHost := httptest.NewServer(coldMux) + defer coldHost.Close() + closeTestBrowserStreams(t, cold) + command = exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_backyard_bank.mjs"), coldHost.URL, filepath.Join(output, "cold"), "cold") + command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr + if err := command.Run(); err != nil { + t.Fatal(err) + } + for _, id := range []uint32{1, 2} { + if len(cold.characters[id].inventory.Items) != 1 || len(cold.characters[id].inventory.Bank) != 0 || cold.characters[id].inventory.Items[0].ID != id { + t.Fatal("cold native withdrawal lost the exact instance", id) + } + } +} diff --git a/tools/client/test_backyard_bank.mjs b/tools/client/test_backyard_bank.mjs @@ -0,0 +1,79 @@ +import assert from 'node:assert/strict'; +import {createRequire} from 'node:module'; +import {GameTest} from './game_test.mjs'; + +const {chromium} = createRequire(import.meta.url)('playwright'); +const [url, output, phase] = 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']}); +const failures = []; +try { + for (const [index, id] of [[0, 3221752760], [1, 3221357727]]) { + const context = await browser.newContext({viewport: {width: 1024, height: 768}}); + await context.addCookies([{name: 'ao_client', value: 'bank-check-' + index, url}]); + const page = await context.newPage(); + const game = await GameTest.attach(page); + const state = async () => (await (await page.request.get(url + '/test-state')).json())[index + 1]; + try { + await page.goto(url); + await game.ready(); + if (phase === 'live' && index === 0) await game.walk(109.204704, 150.720703); + if (!game.state.camera.firstPerson) await game.hold('F8', 'native first-person camera', snapshot => snapshot.camera.firstPerson); + await game.save(output + '/' + index + '/approach'); + const [px, py] = await game.pick(51005, id); + await game.click(px, py, 'right'); + await game.wait('bank Use acknowledged', () => game.events.some(event => + event.direction === 'framereceived' && event.opcode === '343c287f')); + await game.wait('native bank window open', snapshot => snapshot.regions.some(region => + region[0] === 0 && region[1] === 0 && region[2] === 178 && region[3] === 128)); + assert.equal((await state()).bankOpen, true); + await game.key('KeyI'); + const expected = {ID: index + 1, Type: 51005, Template: 42640, Quality: 1, Slot: 64, Count: 1, Ammo: 0}; + if (phase === 'live') { + assert.deepEqual((await state()).inventory.Items, [expected]); + await game.click(681, 45); + await game.click(30, 45); + await game.wait('exact deposit removes the carried row', snapshot => !game.local(snapshot).inventory.some(item => item.id === index + 1)); + assert.deepEqual((await state()).inventory.Bank, [{...expected, Slot: 0}]); + await game.save(output + '/' + index + '/deposited'); + } else { + assert.deepEqual((await state()).inventory.Bank, [{...expected, Slot: 0}]); + } + await game.click(30, 45); + await game.wait('exact bank withdrawal returns the row', snapshot => game.local(snapshot).inventory.some(item => item.id === index + 1 && item.slot === 48)); + assert.deepEqual((await state()).inventory.Items, [expected]); + assert.deepEqual((await state()).inventory.Bank, []); + await game.click(170, 8); + await game.wait('native bank close', snapshot => !snapshot.regions.some(region => + region[0] === 0 && region[1] === 0 && region[2] === 178 && region[3] === 128)); + assert.equal((await state()).bankOpen, false); + if (phase === 'live') { + await page.reload(); + await game.ready(); + assert(game.local().inventory.some(item => item.id === index + 1 && item.slot === 48)); + if (!game.state.camera.firstPerson) await game.hold('F8', 'reconnected first-person camera', snapshot => snapshot.camera.firstPerson); + const [x, y] = await game.pick(51005, id); + await game.click(x, y, 'right'); + await game.wait('reconnected native bank open', snapshot => snapshot.regions.some(region => + region[0] === 0 && region[1] === 0 && region[2] === 178 && region[3] === 128)); + await game.key('KeyI'); + await game.click(681, 45); + await game.click(30, 45); + await game.wait('same item deposited before cold startup', snapshot => !game.local(snapshot).inventory.some(item => item.id === index + 1)); + assert.deepEqual((await state()).inventory.Bank, [{...expected, Slot: 0}]); + } + assert.equal(game.errors.length, 0); + console.log('PASS:', phase, 'original bank picking and exact-instance transfers', index, id); + } catch (error) { + failures.push(error); + console.log('FAIL:', index, error.message); + } finally { + try { await game.save(output + '/' + index + '/final'); } + finally { await context.close(); } + } + } + assert.equal(failures.length, 0, failures.map(error => error.message).join('\n')); +} finally { + await browser.close(); +}