fixup! Keep unfinished retarget routes in a bounded job queue (#127)

The relief snapshot was still global: a smart plan finishing while a retarget job waited could replace Sim::known_relief, so the pending route was planned on the newer map. RouteJob now carries Arc<KnownRelief> for its knowledge version; Sim::known_relief keeps the same Arc only to seed new jobs. retarget_relief reads the job's snapshot, and relief sampling, price grids and route caches are keyed by that version. The new regression makes a job wait, swaps the global relief for another grid with a wall, and checks the pending route and sample stay those of the original version; outside its grid is Unknown. Core release, adapter and WASM contract pass.
This commit is contained in:
2026-11-06 12:50:09 +03:00
parent 6f7b041c8b
commit a47812aadd
6 changed files with 162 additions and 41 deletions
+1 -1
View File
@@ -483,7 +483,7 @@ impl Sim {
// Keep the land this plan was worked out over (#127): a retarget later is planned over the same
// known relief, not over ground mapped since.
if plan.smart && !plan.heights.is_empty() {
self.known_relief = Some((plan.grid, std::mem::take(&mut plan.heights)));
self.known_relief = Some(std::sync::Arc::new(ew::KnownRelief::new(plan.grid, std::mem::take(&mut plan.heights))));
}
self.wave = Some(WaveStats {
kills: self.kills,