Implements the full Sprint 34 economics pipeline across four tickets:
#810 (EventPort / D-180) — EconEvent struct with Target/Effect/Duration/Visibility variants; EventPort typed input queue for external disruptions; D-179 Test 3 upgraded from placeholder to real CapacityMultiplier shock injection (max_dev 4.1%, within ±5% spec)
#821 (server tick integration) — econ-sim extracted as library crate (lib.rs + sim.rs); Simulation stateful runner; EconSimResource + EconStateResource (7 D-181 signals per active node); tick_economy_simulation Bevy system advances 1 economy tick per 10 game ticks (D-031); graceful no-op when systems.db absent
- Widen EventPort tick methods from u32 to u64 (prevents overflow)
- Add is_identity() guard on hot-path String allocation in modifiers
- Replace Vec::remove(0) with VecDeque::pop_front() in price history
- Add .after(tick_economy_simulation) ordering for debug commands
- Fix stale PROTOCOL_VERSION assertion (20 → 21) in serialization test
- Add D-181 Phase 2 visibility scope comment on serve_econ_state_query
- Eliminate double lookup in rebuild_signals via single-pass extraction
- Track economy seed TODO with backlog ticket reference
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Implements the full Sprint 34 economics pipeline across four tickets:
EconEventstruct with Target/Effect/Duration/Visibility variants;EventPorttyped input queue for external disruptions; D-179 Test 3 upgraded from placeholder to real CapacityMultiplier shock injection (max_dev 4.1%, within ±5% spec)lib.rs+sim.rs);Simulationstateful runner;EconSimResource+EconStateResource(7 D-181 signals per active node);tick_economy_simulationBevy system advances 1 economy tick per 10 game ticks (D-031); graceful no-op whensystems.dbabsentEconStateQueryPlayerAction variant;EconomySnapshot/EconNodeSnapshotwire types;EconQueryBuffer+serve_econ_state_querysystem;economy_snapshotfield onObserverSnapshotInjectEconEvent(fires D-180 events from console),SetEconParam(runtime α/β tuning — ALPHA/BETA promoted topub const+Simulationfields),GetEconState(7-signal human-readable dump);EconDebugEffectandEconParamKindenumsTest plan
cargo check— zero errors, zero warningscargo clippy— cleancargo fmt— appliedcargo test --lib)cargo test --test integration_layer3)systems.dbpresent (validatestry_load_economyhot path)EconStateQuery{system_id: "sol"}and verifyeconomy_snapshotappears🤖 Generated with Claude Code
Review: sprint-34/server -> main (type: code)
PR #125 —
feat(simulation): economics integration — D-180 event port, D-181 signals, IPC bridge, debug commands (#810 #821 #822 #823)4 tickets, 19 files, 1465 insertions
Pre-checks: Cargo clippy clean (zero warnings). No runtime smoke test mentioned.
Hoshe (Code Quality): REQUEST_CHANGES
Solid, well-structured integration — clean architecture, graceful degradation throughout, thorough D-180/D-181 spec coverage. Four issues.
server/tests/serialization.rsL363PROTOCOL_VERSION == 20but PR bumped to 21. Will fail CI.econ-sim/src/sim.rs~L107u64→u32truncation.self.tick as u32foractivate_scheduledwraps atu32::MAX. WidenEventPortmethods tou64or add overflow handling.econ-sim/src/events.rsL293-314demand_for/productivity_for/capacity_forallocate two Strings per call. Guard withis_identity()or restructure.server/src/simulation/mod.rsL171try_load_economy(0)—#TODOwithout ticket.StartupMessagehasworld_seed. Create ticket or wire it now.Tyre (Architecture): REQUEST_CHANGES
Architecturally solid — clean library extraction, D-010 BTreeMap discipline, D-180 lifecycle matches documented sequence. Five issues.
econ-sim/src/sim.rsL106u64→u32. (Same as Hoshe #2.) WidenEventPorttou64.economy.rsL221-223Vec::remove(0)as ring buffer. Change toVecDequewithpop_front().bridge/mod.rs+simulation/mod.rshandle_debug_commandsunordered vstick_economy_simulation.GetEconStatereturns stale signals same-tick. Add.after(tick_economy_simulation).economy.rsserve_econ_state_queryeconomy.rsrebuild_signalsL231-248Verdict: CHANGES REQUESTED
2/2 reviewers request changes. 8 unique actionable issues (1 shared between reviewers).
Review: sprint-34/server -> main — Round 2
Hoshe (Code Quality): APPROVE
All 8 fixes verified correct. u64 widening consistent, VecDeque correct, is_empty() guards properly placed, protocol assertion updated, ticket reference added.
Tyre (Architecture): APPROVE
All 5 architectural fixes clean. u64 type runs unbroken from sim to wire. No cycle risk in ordering. D-181 comment accurate. No double lookups remain.
Verdict: APPROVED
2/2 reviewers approve. Ready to merge.
Pull request closed