Files
airdef/airdef-mod/tests/wasm_contract.toml
T
chexit d45629ae29
build / mod (push) Failing after 22s
Fix the UI-event fuel trap on a second large raid order
The Windows log for #122 showed the mod stopping in the UI event
(fuel budget 1e9, remaining 0) with known_units <- order_raid <-
launch_wave <- ui_select: order_raid recomputed the planner snapshot
known_units() for every drone, and the snapshot itself rescanned the
whole force and the dedup list per intel entry. A second big Smart
order cost drones x intel-log x force-size inside one event.

Reproduced in actual WASM with measured per-callback fuel through the
exact ui_select(BTN_LAUNCH) handler (diagnostic guest, trigger.patch):
before, a 111-drone second order at revealed=13172/known=144 exhausted
exactly 1e9 and stopped the mod (an 11-drone order at the same state:
247805865); after, the same scenario passes with max command fuel
32946177/1e9, failures=0, and /stats at tick 2602 byte-identical.
A stacked single-point layout dies to one warhead (known=0, cheap
order), so the scenario deploys spread clusters with a moved player.

Fix: one known_units snapshot per order_raid passed to radar_strikes
and choose_target; known_units is a single O(log + force) set pass;
price_grid_on reuses its snapshot. Emitter/network targeting and
carrier choice semantics are unchanged (native equivalence test
against the former predicate; WASM checkpoint counters equal).
Limits unchanged; HD/recording untouched; wave size unrestricted.

Committed regressions: native snapshot-equivalence and
second-smart-order tests; the heavy WASM fixture now orders two Smart
raids through the wave screen's launch function (airdef preset +
airdef raid) with EW and a combat intel log, four accepted orders
asserted; the light contract covers preset and the empty-wave refusal.

Core release 195 + 8 scenarios; adapter 65 + 1 boundary + 5 scenarios;
light WASM 30 steps; heavy WASM 283 steps (tick max 182413686/300M,
command max 6939810/1e9, failures 0). Windows GUI acceptance remains
external and is not claimed.

Co-Authored-By: Kimi Code (Moonshot AI) <noreply@moonshot.cn>
2026-11-06 10:29:36 +03:00

122 lines
3.0 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Actual .hmod in the engine sandbox, with default fuel/memory limits.
# Missing render replies exercise fallback paths, not GPU correctness.
[[step]]
ticks = 2
frames = 2
expect.commands = ["airdef"]
[[step]]
command = "airdef capabilities"
[[step]]
command = "airdef deploy patriot"
[[step]]
command = "airdef deploy s400"
[[step]]
command = "airdef ground-cancel 2"
expect.error = "Нет ожидающей заявки RM48U"
# Exercise the typed inventory through the actual WASM command boundary.
[[step]]
command = "airdef ground-load 2"
expect.error = "Нет живого склада с RM48U рядом (60 блоков)"
[[step]]
command = "airdef deploy depot"
[[step]]
command = "airdef ground-load 2"
expect.error = "Склад №3 рядом, но RM48U: 0. Задайте запас: /airdef ground-stock 3 <количество>"
[[step]]
command = "airdef ground-stock 3 2"
expect.feedback = "Sandbox: задан начальный запас склада №3: RM48U 2"
[[step]]
command = "airdef ground-load 2"
expect.feedback = "С-400 №2: загружена RM48U (игровой профиль), ударных 1, ПВО 3; на складе RM48U 1, снятых ракет ПВО 1"
[[step]]
command = "airdef ground-unload 2"
expect.feedback = "С-400 №2: выгружена RM48U; ударных 0, ПВО 4"
# Split battery configuration crosses the same saved command boundary.
[[step]]
command = "airdef battery 2 launcher"
expect.feedback = "№2 С-400: режим launcher"
[[step]]
command = "airdef deploy radar_track"
[[step]]
command = "airdef radar 4 search"
expect.feedback = "№4 РЛС: роль search"
[[step]]
command = "airdef radar 4 engagement"
expect.feedback = "№4 РЛС: роль engagement"
[[step]]
command = "airdef radar 4 off"
expect.feedback = "№4 РЛС дальнего обнаружения: излучение РЛС off"
[[step]]
command = "airdef radar 4 on"
expect.feedback = "№4 РЛС дальнего обнаружения: излучение РЛС on"
[[step]]
command = "airdef radar 2 off"
expect.error = "У комплекса нет активной РЛС"
[[step]]
command = "airdef deploy s500_launcher"
# The wave screen's preset button through the command boundary; an empty wave cannot launch.
[[step]]
command = "airdef preset 0"
expect.feedback = "Готовый: Рой Шахедов"
[[step]]
command = "airdef preset 6"
expect.feedback = "Готовый: Пусто"
[[step]]
command = "airdef raid"
expect.error = "Налёт пуст: выберите типы и число"
[[step]]
command = "airdef wave mix 40 1500"
[[step]]
ticks = 240
frames = 120
[[step]]
command = "airdef clear"
[[step]]
ticks = 140
frames = 10
[[step]]
command = "airdef replay stop"
[[step]]
title-screen = true
ticks = 2
frames = 2
[[step]]
player = { x = 100.5, y = 64.0, z = 100.5 }
clock = { game-time = 500, day-time = 6000 }
ticks = 3
frames = 3
[[step]]
reload = true
ticks = 2
frames = 2
expect.commands = ["airdef"]