From 38f9002844c3b8d2f17e0129dd7c94b2c89921e7 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sat, 2 May 2026 18:39:52 +0200 Subject: [PATCH] fix(simulation): resolve Bevy baseline test panics (#885) Three root causes: SnapshotBuffer hard-dependency in economy.rs (Option-wrapped), TickPhase::configure missing from SimulationPlugin (added idempotent call), and stale golden file after D-192 dropped the version field (regenerated). All 6 previously-failing tests now pass with zero regressions. Co-Authored-By: Claude Opus 4.6 (1M context) --- server/src/simulation/economy.rs | 8 +++++++- server/src/simulation/mod.rs | 5 +++++ server/tests/golden/proof_room_tick_10.json | 1 - 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/src/simulation/economy.rs b/server/src/simulation/economy.rs index 928bf0134..4c6401dc4 100644 --- a/server/src/simulation/economy.rs +++ b/server/src/simulation/economy.rs @@ -299,13 +299,19 @@ pub struct EconQueryBuffer { pub fn serve_econ_state_query( mut query_buf: ResMut, econ_state: Option>, - mut snapshot_buf: ResMut, + snapshot_buf: Option>, ) { let system_id = match query_buf.pending.take() { Some(s) => s, None => return, }; + // SnapshotBuffer only exists when BridgePlugin is loaded (not in standalone tests). + let mut snapshot_buf = match snapshot_buf { + Some(b) => b, + None => return, + }; + let econ_state = match econ_state { Some(s) => s, None => { diff --git a/server/src/simulation/mod.rs b/server/src/simulation/mod.rs index b32c752d2..995f50ed2 100644 --- a/server/src/simulation/mod.rs +++ b/server/src/simulation/mod.rs @@ -24,6 +24,7 @@ pub mod modification; pub mod monologue; pub mod movement; pub mod movement_plugin; +pub mod name_index; pub mod npc_components; pub mod npc_knowledge_transfer; pub mod path_follow; @@ -59,6 +60,10 @@ pub struct SimulationPlugin { impl Plugin for SimulationPlugin { fn build(&self, app: &mut App) { + // Phase ordering must be configured before any system is registered. + // TickPhase::configure is idempotent — safe if main.rs calls it again. + crate::tick_phases::TickPhase::configure(app); + // Tier marker components (D-026) — must register before behavior systems app.add_plugins(tier::TierPlugin); diff --git a/server/tests/golden/proof_room_tick_10.json b/server/tests/golden/proof_room_tick_10.json index 3e4ec9109..f7da9c7d8 100644 --- a/server/tests/golden/proof_room_tick_10.json +++ b/server/tests/golden/proof_room_tick_10.json @@ -38,7 +38,6 @@ "state_hash": 14452262397297540338, "tick": 8, "triangle_crisis_events": [], - "version": 19, "visible_tiles": [ { "tile_kind": "Floor",