Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
1118f49
docs: track complete October missing-feature repair scope
NickMesser Oct 25, 2026
305664a
fix(protocol): repair native mail return and loot failure layouts
NickMesser Oct 25, 2026
f6bf391
Merge branch 'fix/audit-protocol' into fix/audit-final
NickMesser Oct 25, 2026
3de467a
fix(economy): honor merchant grades and parse craft text flags
NickMesser Oct 25, 2026
24b4699
fix(webapi): require bearer authentication for administrative routes
NickMesser Oct 25, 2026
e2e9744
fix(economy): authorize bench recipes by active craft function
NickMesser Oct 25, 2026
f1abdb2
Merge branch 'fix/audit-economy' into fix/audit-final
NickMesser Oct 25, 2026
893882a
Merge branch 'fix/audit-web' into fix/audit-final
NickMesser Oct 25, 2026
23dc380
Merge branch 'fix/audit-bench' into fix/audit-final
NickMesser Oct 25, 2026
eb42882
docs: record reviewed audit fixes and protocol checks
NickMesser Oct 25, 2026
e9a870b
fix(world): enforce closed-zone access and safe returns
NickMesser Oct 25, 2026
80303b4
fix(skills): apply progression and combat modifiers
NickMesser Oct 25, 2026
3e492ed
Merge branch 'fix/audit-zones' into fix/audit-final
NickMesser Oct 25, 2026
d93ab35
Merge branch 'fix/audit-modifiers' into fix/audit-final
NickMesser Oct 25, 2026
4680231
test(game): enable paused time for standalone game regressions
NickMesser Oct 25, 2026
ae83bd8
fix(vehicles): recover native 1.2 slave attach transforms
NickMesser Oct 25, 2026
d612d99
fix(portals): read navigation doodad transform directly
NickMesser Oct 25, 2026
0901406
Merge branch 'fix/audit-attach' into fix/audit-final
NickMesser Oct 25, 2026
8540da1
docs: track combined modifier zone and attachment repairs
NickMesser Oct 25, 2026
04783cd
fix(game): load authored AoE diminishing rates
NickMesser Oct 25, 2026
7441d62
fix(game): enforce lobby creation and deletion authority
NickMesser Oct 25, 2026
cef4910
test(skills): update XP configuration through config cell
NickMesser Oct 25, 2026
64b2f6f
Merge branch 'fix/audit-aoe' into fix/audit-final
NickMesser Oct 25, 2026
0d93580
fix(skills): enforce authored buff breaker tags
NickMesser Oct 25, 2026
10c1b60
Merge branch 'fix/audit-characters' into fix/audit-final
NickMesser Oct 25, 2026
39ffe34
test(economy): allow creation in financial roundtrip fixture
NickMesser Oct 25, 2026
779dad2
docs: distinguish drafted and partial audit repairs
NickMesser Oct 25, 2026
dff3460
Merge branch 'fix/audit-final' into fix/audit-breakers
NickMesser Oct 25, 2026
9dd3453
fix(game): enforce unconditional zone banned tags before item and ski…
NickMesser Oct 25, 2026
47a8ba9
Merge branch 'fix/audit-zone-tags' into fix/audit-final
NickMesser Oct 25, 2026
e6f6920
fix(game): apply plot-scoped AoE diminishing policy
NickMesser Oct 25, 2026
d2e9fba
Merge branch 'fix/audit-aoe' into fix/audit-final
NickMesser Oct 25, 2026
4c69b28
Merge branch 'fix/audit-final' into fix/audit-breakers
NickMesser Oct 25, 2026
8fe6039
fix(game): guard buff starts against synchronous removal
NickMesser Oct 25, 2026
d0f1561
fix(game): enforce per-unit shared skill cooldown tags
NickMesser Oct 25, 2026
917759c
fix(game): repair damage interpolation percent terms and threat
NickMesser Oct 25, 2026
c173db9
test(game): initialize complete fixtures and pause channel time
NickMesser Oct 25, 2026
60cf045
Merge branch 'fix/audit-breakers' into fix/audit-final
NickMesser Oct 25, 2026
4de56b0
Merge branch 'fix/audit-damage' into fix/audit-final
NickMesser Oct 25, 2026
07cbc19
Merge branch 'fix/audit-final' into fix/audit-cooldowns
NickMesser Oct 25, 2026
28101e8
docs: record executable checks and compatibility policy repairs
NickMesser Oct 25, 2026
4721739
fix(game): keep shared cooldowns in native tag records
NickMesser Oct 25, 2026
0cf0f23
Merge shared cooldown admission and native tag snapshots
NickMesser Oct 25, 2026
af5db95
fix(skills): isolate controlled-unit cooldown snapshots
NickMesser Oct 25, 2026
e712343
fix(mail): expire ordinary player mail safely
NickMesser Oct 25, 2026
ed2f7a9
fix(game): enforce native final unit attribute limits
NickMesser Oct 25, 2026
22d8e20
Merge ordinary mail expiry and return escrow lifecycle
NickMesser Oct 25, 2026
da9284a
Merge native per-server final attribute limits
NickMesser Oct 25, 2026
dbd7cd9
fix(crafting): require a resolved same-account bench owner
NickMesser Oct 25, 2026
c85ad52
docs: track ship regressions and current validation limits
NickMesser Oct 25, 2026
090f515
fix(lanes): serialize allocation and preserve reservation ownership
NickMesser Oct 25, 2026
901b691
Merge atomic lane allocation and isolated concurrency regressions
NickMesser Oct 25, 2026
e7bd70a
ci: run isolated lane allocation tests on both platforms
NickMesser Oct 25, 2026
097f19f
fix(ai): include neutral movement speed before attribute cap
NickMesser Oct 25, 2026
393f953
Merge complete raw NPC movement cap
NickMesser Oct 25, 2026
1f53a66
test(game): use public container and item fixture APIs
NickMesser Oct 25, 2026
8486add
fix(economy): make vehicle cargo escrow transfers atomic
NickMesser Oct 25, 2026
73babdd
fix(vehicles): serialize ship summons across sessions
NickMesser Oct 25, 2026
bfc8e9a
Merge commit '1f53a66bd' into fix/audit-tradeship
NickMesser Oct 25, 2026
3953861
test(game): initialize live combat fixtures and pin immune bytes
NickMesser Oct 25, 2026
5dfd728
test(combat): populate cached health before theft checks
NickMesser Oct 25, 2026
a0a62db
fix(economy): retain cargo during ambiguous doodad cleanup
NickMesser Oct 25, 2026
ed7560d
Merge commit '5dfd7282b' into fix/audit-ship-session
NickMesser Oct 25, 2026
8c2e977
fix(economy): validate doodad escrow before releasing item IDs
NickMesser Oct 25, 2026
b255829
Merge checked cargo transfers and original-reference cleanup
NickMesser Oct 25, 2026
8db0e00
docs(audit): record cargo safeguards and validation limits
NickMesser Oct 25, 2026
da8e370
test(mail): decode expiry receiver with schema signedness
NickMesser Oct 25, 2026
ae07101
fix(vehicles): coordinate item mutations and restored ship publication
NickMesser Oct 25, 2026
cf17878
Merge commit 'b255829ce' into fix/audit-ship-session
NickMesser Oct 25, 2026
293749f
docs(audit): record selected data and lobby database checks
NickMesser Oct 25, 2026
06d68e5
feat(testclient): add bounded JSONL stdio control sessions
NickMesser Oct 25, 2026
7ac9af6
test(cargo): allocate distinct world object identities
NickMesser Oct 25, 2026
d43bd98
feat(vehicles): add read-only ship identity and cargo audit
NickMesser Oct 25, 2026
9a342dd
fix(economy): order item scopes before manager locks
NickMesser Oct 25, 2026
325c9a9
fix(testclient): enforce control privacy and lifecycle budgets
NickMesser Oct 25, 2026
cfc5e93
fix(vehicles): preserve ship audit rack allocation identity
NickMesser Oct 25, 2026
6a406e5
fix(vehicles): retain audit authority flag in oversized fallback
NickMesser Oct 25, 2026
3634393
Merge reviewed parent audit fixes into ship session lane
NickMesser Oct 25, 2026
481aa84
Merge reviewed ship identity diagnostics into ship session lane
NickMesser Oct 25, 2026
05974c4
docs(audit): record passing cargo and database regressions
NickMesser Oct 25, 2026
540edf5
Merge branch 'rust-rewrite' into fix/audit-final
NickMesser Oct 25, 2026
0d8e410
fix(testclient): bound and filter native batches and report timeouts
NickMesser Oct 25, 2026
78af6d9
Merge reviewed bounded headless control sessions
NickMesser Oct 25, 2026
54f98af
fix(world): coordinate spawn callbacks and saved cargo publication
NickMesser Oct 25, 2026
99f4713
test(testclient): propagate receive errors directly
NickMesser Oct 25, 2026
243953b
Merge reviewed ship publication and reconnect safeguards
NickMesser Oct 25, 2026
ce4b860
test(vehicles): compare audit receipt values without allocations
NickMesser Oct 25, 2026
f53dd86
test(game): exercise quest spawning and stabilize damage fixtures
NickMesser Oct 25, 2026
ec6114d
test(testclient): account for native position quantization
NickMesser Oct 26, 2026
9245057
merge: preserve audit-final testclient fixture fixes
NickMesser Oct 26, 2026
578a6a7
fix(testclient): check deadlines before polling control work
NickMesser Oct 26, 2026
a22e211
test(economy): reserve object identities in craft contention fixture
NickMesser Oct 26, 2026
96a67a5
merge: integrate synchronous control deadline guards
NickMesser Oct 26, 2026
296de98
docs: record verified control tests and remaining acceptance gates
NickMesser Oct 26, 2026
e547574
test(economy): retain spawn manager for cleanup assertions
NickMesser Oct 26, 2026
8aca3ea
test(vehicles): match signed persisted doodad phases
NickMesser Oct 26, 2026
198b7d4
test(testclient): make ambient teleport fixture deterministic
NickMesser Oct 26, 2026
87be929
docs: record qualified Merchant cargo validation
NickMesser Oct 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Lane allocation regressions
run: python -I -B ../Scripts/test_lane.py
- name: Build
run: cargo build --workspace --all-targets --locked
# Successor of the C# "Scripts Compile" step (the GM scripts are compiled into the binary).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,69 @@ from the C# version is still read between `Config.Local.json` and the
environment variables, but it can no longer be managed with a tool; move those
values to `Config.Local.json` or environment variables.)

## Web API authentication and migration

The game Web API now defaults to `127.0.0.1:1280`. Only `GET /status` is
anonymous; it returns uptime, player count and task/skill metrics. Every other
registered route requires `Authorization: Bearer <key>`, including character,
world and auction reads, mail listing, GM commands and mail with attachments.
Missing, invalid or duplicate credentials return HTTP 401 with a Bearer challenge.
Commands still use the selected online character's command access level.

For local status tooling, use this game's `Config.Local.json` override:

```json
{
"WebApiNetwork": {
"Host": "127.0.0.1",
"Port": 1280,
"Enabled": true,
"ApiKey": null
}
}
```

An absent, null or empty `ApiKey` disables access to every authenticated route,
including requests from localhost. To enable administrative tools, configure a
private, randomly generated key of at least 32 random bytes in the game process's
`WebApiNetwork__ApiKey` environment variable, or in the gitignored
`Config.Local.json` field `WebApiNetwork.ApiKey`. Keys accept ASCII letters,
digits and `-._~+/=`; whitespace is rejected. Keep the key separate from the
Login/Game `SecretKey`. Never put the key in URLs or commit it.

For example, generate a key privately in PowerShell before starting the game
process from the same environment (these commands do not print the key):

```powershell
$webApiRandom = [System.Security.Cryptography.RandomNumberGenerator]::Create()
$webApiBytes = New-Object byte[] 32
$webApiRandom.GetBytes($webApiBytes)
$webApiRandom.Dispose()
$env:WebApiNetwork__ApiKey = [Convert]::ToBase64String($webApiBytes)
```

An administrative caller using that same private environment can supply the header:

```powershell
$webApiHeaders = @{ Authorization = 'Bearer ' + $env:WebApiNetwork__ApiKey }
Invoke-RestMethod -Uri http://127.0.0.1:1280/api/world/logged-characters -Headers $webApiHeaders
```

Existing configurations with `Host: "*"`, `0.0.0.0`, `::`, or any other
non-loopback address now fail startup unless a nonempty valid key is configured.
For local monitoring, change the host to `127.0.0.1`; for remote administration,
configure the private key and use an HTTPS reverse proxy or SSH tunnel so the
Bearer token is encrypted in transit. The HTTP listener itself does not provide TLS.
Authentication does not make anonymous routes private: `/status` remains public
on the configured interface. Restart the game process after changing the bind,
key or `Enabled` setting; configuration reload does not restart the listener or
rotate its credential snapshot.

To disable the API even when the shipped config contains the section, set
`"WebApiNetwork": { "Enabled": false }` in `Config.Local.json`. A missing or null
section also disables it. Existing clients must add the Bearer header to every
`/api` request; local `/status` checks continue to work without credentials.

## Tower defense event schedules

Tower defense controllers are reserved for events instead of spawning permanently.
Expand Down
132 changes: 108 additions & 24 deletions Scripts/lane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ setvar() { # setvar <lane> KEY VALUE: rewrite one KEY= line of the registry file
local f; f=$(reg "$1"); grep -v "^$2=" "$f" > "$f.tmp" || true; echo "$2=$3" >> "$f.tmp"; mv "$f.tmp" "$f"; }
mysql_up() { "${MYSQL[@]}" -N -e "select 1" >/dev/null 2>&1; }

# mkdir is atomic in Git Bash as well as on Unix (flock is not shipped with Git for Windows).
# Hold this across allocation AND publication, and serialize destructive cleanup with it too.
# Never reclaim a lock by PID or age: PIDs are reused, and a killed shell may leave git running.
# An interrupted/stale lock fails closed. After verifying ALL creators and their children have
# stopped, inspect its files and any partial worktree/branch/target before removing it manually.
allocation_lock() {
ALLOCATION_LOCK="$LANES/.allocation.lock"
ALLOCATION_OWNER=""
local timeout=${AAEMU_LANE_LOCK_TIMEOUT:-30} start=$SECONDS
[[ "$timeout" =~ ^[0-9]{1,6}$ ]] || die "AAEMU_LANE_LOCK_TIMEOUT must be seconds (0-999999)"
timeout=$((10#$timeout))
mkdir -p "$LANES"
trap 'allocation_unlock' EXIT
trap 'exit 129' HUP; trap 'exit 130' INT; trap 'exit 143' TERM
until mkdir "$ALLOCATION_LOCK" 2>/dev/null; do
# The owner may release it between the failed mkdir and this loop; retry even if gone.
if (( SECONDS - start >= timeout )); then
die "allocation/cleanup locked ($ALLOCATION_LOCK); retry. If interrupted, verify all creators and children stopped and inspect partial resources before manual recovery; never remove a lock by PID or age"
fi
sleep 0.1
done
# A unique marker also prevents our EXIT trap from releasing a replacement owner's lock.
# Interruption before the marker exists deliberately leaves a stale lock, never an unsafe unlock.
ALLOCATION_OWNER=$(mktemp -d "$ALLOCATION_LOCK/owner.XXXXXXXXXX")
}
allocation_owned() { [ -n "${ALLOCATION_OWNER:-}" ] && [ -d "$ALLOCATION_OWNER" ]; }
allocation_unlock() {
allocation_owned || return 0
rm -f "$ALLOCATION_OWNER/lane.env"
rmdir "$ALLOCATION_OWNER" && rmdir "$ALLOCATION_LOCK"
}

# The lane whose worktree contains $PWD (or the script), unless a name was given.
current() {
local n=${1:-}
Expand All @@ -65,7 +97,7 @@ clients_on() {
}
port_free() { ! netstat -ano 2>/dev/null | grep LISTENING | grep -q ":$1 "; }

cmd_new() {
cmd_new() (
local name="" type=fix base=$BASE_DEFAULT
while [ $# -gt 0 ]; do
case "$1" in
Expand All @@ -74,13 +106,18 @@ cmd_new() {
esac; shift
done
[[ "$name" =~ ^[a-z0-9][a-z0-9-]{1,30}$ ]] || die "name: 2-31 chars of a-z 0-9 - (e.g. quest-crash)"
[ -f "$(reg "$name")" ] && die "lane '$name' exists (Scripts/lane.sh info $name)"
allocation_lock
if [ -e "$(reg "$name")" ] || [ -L "$(reg "$name")" ]; then
die "lane '$name' exists (Scripts/lane.sh info $name)"
fi
# Never share a target dir between worktrees: identical artifact names make cargo's mtime
# fingerprints miss edits, so tests can silently run another worktree's code.
local wt="$WT_ROOT/$name" branch="$type/$name" target="$TARGET_ROOT/$name"
[ -e "$wt" ] && die "$wt already exists"
[ -e "$target" ] && die "$target already exists (Scripts/lane.sh gc)"
mkdir -p "$LANES"
if [ -e "$wt" ] || [ -L "$wt" ]; then die "$wt already exists"; fi
if [ -e "$target" ] || [ -L "$target" ]; then die "$target already exists (Scripts/lane.sh gc)"; fi
git -C "$REPO" check-ref-format "refs/heads/$branch" || die "invalid branch '$branch'"
if git -C "$REPO" show-ref --verify --quiet "refs/heads/$branch"; then die "branch '$branch' already exists"; fi
local head; head=$(git -C "$REPO" rev-parse --verify "$base^{commit}")

local prefix=""
for p in "${PORT_PREFIXES[@]}"; do
Expand All @@ -90,7 +127,60 @@ cmd_new() {
done
[ -n "$prefix" ] || die "no free port block (24xxx-39xxx); finish old lanes first"

# Until lane.env is published the lock reserves all four resources. Roll back only artifacts
# we know we created, while still holding that lock. Ambiguous/partial Git failures retain it
# for inspection rather than deleting a pre-existing branch or allowing prefix reuse.
local target_started=0 target_created=0 worktree_started=0 worktree_created=0 published=0
new_exit() {
local status=$? clean=1
trap - EXIT
if ! allocation_owned; then
echo "lane: allocation lock ownership lost; leaving resources untouched" >&2
exit 1
fi
if [ "$published" = 0 ] && [ ! "$(reg "$name")" -ef "$ALLOCATION_OWNER/lane.env" ]; then
if [ "$worktree_created" = 1 ]; then
rm -f "$wt/rust/.cargo/config.toml" || clean=0
# No --force: unexpected changes or removal errors require inspection.
git -C "$REPO" worktree remove "$wt" || clean=0
if [ "$clean" = 1 ]; then
git -C "$REPO" update-ref -d "refs/heads/$branch" "$head" || clean=0
fi
elif [ "$worktree_started" = 1 ]; then
if [ -e "$wt" ] || git -C "$REPO" show-ref --verify --quiet "refs/heads/$branch"; then clean=0; fi
fi
if [ "$target_created" = 1 ] && [ "$clean" = 1 ]; then rmdir "$target" || clean=0; fi
if [ "$target_started" = 1 ] && [ "$target_created" = 0 ]; then
if [ -e "$target" ] || [ -L "$target" ]; then clean=0; fi
fi
fi
if [ "$clean" = 1 ]; then allocation_unlock
else echo "lane: partial creation retained with $ALLOCATION_LOCK; inspect $wt, $branch and $target before manual recovery" >&2; fi
exit "$status"
}
trap new_exit EXIT
# Leave the reservation details inside the lock for inspection after a hard interruption.
local db=${name//-/_}
cat > "$ALLOCATION_OWNER/lane.env" <<EOF
LANE=$name
BRANCH=$branch
BASE=$base
WT=$wt
TARGET=$target
PORT_PREFIX=$prefix
LIVE=$LIVE_PREFIX$name
DB_GAME=lane_${db}_game
DB_LOGIN=lane_${db}_login
CREATED=$(date +%Y-%m-%dT%H:%M:%S)
CHECKED=
EOF
mkdir -p "$WT_ROOT" "$TARGET_ROOT"
target_started=1
mkdir "$target"
target_created=1
worktree_started=1
git -C "$REPO" worktree add -q "$wt" -b "$branch" "$base"
worktree_created=1
mkdir -p "$wt/rust/.cargo"
cat > "$wt/rust/.cargo/config.toml" <<EOF
# Machine-local (gitignored), written by Scripts/lane.sh for lane '$name'.
Expand All @@ -108,23 +198,14 @@ debug = "line-tables-only"
[profile.test]
debug = "line-tables-only"
EOF
local db=${name//-/_}
cat > "$(reg "$name")" <<EOF
LANE=$name
BRANCH=$branch
BASE=$base
WT=$wt
TARGET=$target
PORT_PREFIX=$prefix
LIVE=$LIVE_PREFIX$name
DB_GAME=lane_${db}_game
DB_LOGIN=lane_${db}_login
CREATED=$(date +%Y-%m-%dT%H:%M:%S)
CHECKED=
EOF
# Atomic, no-clobber publication of the unchanged registry format. A link also lets the EXIT
# trap recognize successful publication if a signal arrives before the next shell command.
allocation_owned || die "allocation lock ownership lost; leaving resources untouched"
ln -T "$ALLOCATION_OWNER/lane.env" "$(reg "$name")"
published=1
echo "lane '$name' ready"
cmd_info "$name"
}
)

cmd_info() {
local n; n=$(current "${1:-}"); load "$n"
Expand Down Expand Up @@ -199,9 +280,10 @@ stop_lane_procs() { # stop_lane_procs <live dir> <login port> <target dir or emp
[ -z "$ids" ] || { echo "stopped processes: $(echo $ids)"; sleep 2; }
}

cmd_done() {
cmd_done() (
local name="" force=0 keep_branch=0
for a in "$@"; do case "$a" in --force) force=1 ;; --keep-branch) keep_branch=1 ;; *) name=$a ;; esac; done
allocation_lock
local n; n=$(current "$name"); load "$n"
if [ -d "$WT" ] && [ $force = 0 ]; then
[ -z "$(git -C "$WT" status --porcelain | grep -v 'rust/.cargo/')" ] \
Expand All @@ -225,13 +307,15 @@ cmd_done() {
rm -f "$(reg "$n")"
[ -d "$WT" ] && echo "note: $WT is still open in some process (a shell's cwd?); gc removes the empty folder later"
echo "lane $n removed (worktree, target dir, runtime dir, databases$( [ $keep_branch = 1 ] || echo ', branch'))"
}
)

cmd_gc() {
cmd_gc() (
local apply=0 min_age=24
while [ $# -gt 0 ]; do
case "$1" in --apply) apply=1 ;; --min-age-hours) min_age=$2; shift ;; *) die "unknown option $1" ;; esac; shift
done
# A dry run is read-only. Applying GC must not delete an unpublished creator's target/worktree.
[ "$apply" = 0 ] || allocation_lock
# Everything that is referenced stays: lane registry entries and any worktree's cargo target-dir.
local keep=()
for f in "$LANES"/*.env; do [ -f "$f" ] && keep+=("$(grep '^TARGET=' "$f" | cut -d= -f2-)" "$(grep '^LIVE=' "$f" | cut -d= -f2-)" "$(grep '^WT=' "$f" | cut -d= -f2-)"); done
Expand Down Expand Up @@ -270,7 +354,7 @@ cmd_gc() {
fi
[ $found = 1 ] || echo " nothing to clean"
[ $apply = 1 ] || echo "(dry run: add --apply to delete the candidates above)"
}
)

case "${1:-}" in
new) shift; cmd_new "$@" ;; list) cmd_list ;; info) shift; cmd_info "${1:-}" ;;
Expand Down
Loading
Loading