The points budget first gated on (recording tick - first) % step, but a strike
carrier's samples fall on its flight-age grid, offset from the recording's
ticks — the gate skipped them (physical_strike_track_keeps_muzzle... failed).
Count the sampling calls per track instead (Track::due): at STEP it pushes
every call exactly as before, and the thinning doubles the interval without
touching the track's phase. Track::points_len exposes the count for diagnostics.
tests/ground_oom.rs gains the continuous extreme load (eight overlapping
40-Oreshnik waves, 1118 objects airborne at once — well past the crash's >200):
peak 26.3 MiB steady + 5.5 MiB rehash transient, the flight tracks thin to
step 16 (91k points, 2.3 MiB) under their 2 MiB budget, the journal and poses
stay within theirs, and the fight still resolves (157 intercepts). The radar
picture itself (11.5 MiB at 1118 airborne) scales with the sky — it is the
simulation's state, not a cache, and is ~3 MiB at the crash's >200 load.
The WASM budget fixture's final /airdef stats pin was stale at the base commit
already: it was measured on engine 8e711f969, and the base pins acfb379aa,
whose host answers shift the two late Smart raids (417/2463, 7 in the air).
Verified identical on the pristine base and on this branch — the memory bounds
do not move that fight; the tick-2102 checkpoint (184/325/2011) is unchanged.
Re-pinned to the measured string and updated BUDGET_ASSERTED_SHA256 so the
raid/snapshot assertions stay active. test-budgets: 283 steps ok, tick fuel
max 184.7M/300M, 0 failures.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>
The fullscreen-map OOM (rust_oom in hashbrown reserve_rehash under
Ground::answer during a large raid): the mod's whole state shares one
64 MiB linear memory, and three consumers grew without an effective bound.
Measured on a native replica of the crash load (tests/ground_oom.rs: 64
complexes, six all-sides Oreshnik raids plus a smart raid over 10000 ticks,
304 objects airborne at once, a wide map query walk; render answers exactly
as the WASM host gives them): peak 45.5 MiB steady + 21.9 MiB rehash
transient = 67 MiB, over the cap. The bulk: kept replays 23.2 MiB (the scene
journal 4.6 MiB each, filled with per-radar track transitions), Ground.known
10.9 MiB (277k columns; the old sweep only ran above 300k and kept everything
younger than 2000 ticks, so a wide query pattern grew it without bound and
the next rehash doubled the table), the live recording 7.5 MiB, radar tracks
3.2 MiB.
Bounds, derived from the 64 MiB budget (Sim::memory reports each consumer):
- Ground.known: KNOWN_MAX 100_000 columns (~2.7 MiB steady, ~8.2 MiB through
a rehash at 24 B + control byte per entry, 7/8 load). Over the cap the
oldest answers go down to three quarters (a sweep is not every tick),
ordered by (age, column) so the sweep is deterministic; heights past
SWEEP_AGE go with them. Evicted columns are asked again when next needed —
the cache is reconstructible, no target, frequency or precision is cut.
- Scene journal: MAX_SCENE_EVENTS 65_536 -> 24_576 (~1.7 MiB), and the track
transitions (acquire/handoff/lock/lost — they grow with systems x contacts,
the journal's bulk under a large raid) get their own 8_192 budget; beyond
it the later ones are not recorded. Launches, fires and outcomes keep the
rest of the journal; chains() already tolerates missing steps.
- Flight track points: MAX_TRACK_POINTS 2 MiB per recording; over it every
other point is kept and the ticks between points double (Track::step, the
#142 decimation pattern for the systems' poses). Replay readers use the
track's own step.
Replica peak after: 24.5 MiB steady + 5.5 MiB transient = 30 MiB, under the
48 MiB headroom target; the fight resolves (376 intercepts, sky clears) and
the same seed replays the same ordered trace. The saturation checkpoint is
untouched (314 / 2022 / 184): its cache stays under the cap.
Co-Authored-By: Kimi Code <noreply@moonshot.ai>