Fix the UI-event fuel trap on a second large raid order
build / mod (push) Failing after 22s

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>
This commit is contained in:
2026-11-04 21:49:25 +03:00
parent 61aaa0bf35
commit d45629ae29
19 changed files with 1907 additions and 43 deletions
+47 -17
View File
@@ -1,11 +1,11 @@
{
"airdef": {
"diff_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"dirty": false,
"sha": "293236490b567866f7468a5bee5d61b0dcf8086d"
"diff_sha256": "143fbab5f1fd60981df9ef8ef3081b08a4102507f2588c6942924a7325b5139b",
"dirty": true,
"sha": "e6a70004406b34ea17884875ce236a5fb4b849e4"
},
"api_level": 27,
"artifact_sha256": "cb52fa5fd6beb266c63f2a5f2aa50553c24bc435a212c76142cc1bd228fd0aa6",
"api_level": 29,
"artifact_sha256": "c4ef7d759524eb053ccd55f0eccdcb49c91954201eb4e0ad923ee9b2828efc4e",
"build_identity": {
"checks": {
"airdef_diff_sha256": true,
@@ -17,15 +17,45 @@
"wit_sha256": true
},
"matches": true,
"path": "airdef-mod/target/horizon-mod/build-identity.json"
"path": "/private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/build-identity.json"
},
"command": "test-budgets",
"engine": {
"identity": "ed7615d362490f57bca5ac239c64eb9360913a4b",
"pin": "ed7615d362490f57bca5ac239c64eb9360913a4b"
"identity": "73b9d307048fc44d7f21fa3c829fc5a855d144a6",
"pin": "73b9d307048fc44d7f21fa3c829fc5a855d144a6"
},
"exit_code": 0,
"output": " Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s\n Running `<checkout>/horizon/target/debug/cargo-horizon-mod horizon-mod test --hmod <checkout>/airdef-mod/target/horizon-mod/airdef.hmod budget`\nrunning 1 scripts against <checkout>/airdef-mod/target/horizon-mod/airdef.hmod\ntest tests/wasm_budget.toml ... ok (271 steps)\ntest result: ok. 1 passed\n",
"measured_fuel": {
"available": true,
"callbacks": [
{
"budget": 1000000000,
"callback": "command",
"calls": 79,
"failures": 0,
"max_used": 6939810,
"mod": "airdef"
},
{
"budget": 10000000,
"callback": "frame",
"calls": 2202,
"failures": 0,
"max_used": 77,
"mod": "airdef"
},
{
"budget": 300000000,
"callback": "tick",
"calls": 3302,
"failures": 0,
"max_used": 182413686,
"mod": "airdef"
}
],
"scope": "guest callback fuel; excludes host CPU, memory and GPU time"
},
"output": " Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s\n Running `/private/tmp/issue-122-raid/horizon/target/debug/cargo-horizon-mod horizon-mod test --hmod /private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/airdef.hmod --fuel-profile budget`\nrunning 1 scripts against /private/tmp/issue-122-raid/airdef-mod/target/horizon-mod/airdef.hmod\nfuel airdef command: calls=79 max=6939810 budget=1000000000 failures=0\nfuel airdef frame: calls=2202 max=77 budget=10000000 failures=0\nfuel airdef tick: calls=3302 max=182413686 budget=300000000 failures=0\ntest tests/wasm_budget.toml ... ok (283 steps)\ntest result: ok. 1 passed\n",
"runtime_limits": {
"fuel_per_call": {
"event": 1000000000,
@@ -34,16 +64,16 @@
"tick": 300000000
},
"memory_bytes": 67108864,
"metering": "source_configured; measured_per_scenario: unavailable",
"metering": "source_configured",
"source": "horizon/crates/horizon-mods/src/runtime.rs",
"wasmtime_component_model": true,
"wasmtime_fuel_metering": true
},
"scenario": "tests/budgets/wasm_flat_budget.toml",
"scenario_counts": {
"accepted_raids_asserted": 2,
"air_defense_units": 64,
"frames": 2052,
"accepted_raids_asserted": 4,
"air_defense_units": 68,
"frames": 2202,
"layout_unit_limit": 2000,
"peak_airborne_observed": null,
"raid_requests": 2,
@@ -51,13 +81,13 @@
"scripts": 1,
"snapshot_airborne_asserted": 184,
"snapshot_tick": 2102,
"steps": 271,
"ticks": 2102
"steps": 283,
"ticks": 3302
},
"scenario_render_world": "flat at y=64",
"scenario_sha256": "bcc0359289ab20ab3de608bcc130f72d2cf88f9f6fbc470d7b6846e9db5d11df",
"scenario_sha256": "134cb4667691cf9faa639ed37120941d829cfc13ce45e9638582c409d9e0dd29",
"schema": 1,
"status": "passed",
"wasmtime_version": "48.0.7",
"wit_sha256": "14c57b73f144888e04e27b77a6dfa29098c6b0c27c0383bb96aedaccb4c0a1d4"
"wit_sha256": "dded023a150a5f916bc5d935b7f891806728e0118eb7107ad0551d2aad8c70a5"
}