⚠️ Refactor bin/arcane_swarm/main.rs: extract BackendRuntime trait + impls (A-1)#45
Open
⚠️ Refactor bin/arcane_swarm/main.rs: extract BackendRuntime trait + impls (A-1)#45
Conversation
- Move BackendRuntime trait, SpacetimeRuntime, and ArcaneRuntime from main.rs to new runtime.rs module (349 lines) - Extract control-mode orchestrator (run_control_mode + handle_control_connection) into control.rs (366 lines) - Introduce SharedHandles struct to reduce repetitive .clone() calls inside each spawn_player implementation - Update spawn_context.rs to use crate::runtime::BackendRuntime and SharedHandles instead of direct PlayerLoopShared passing - Drop main.rs from 713 lines to 189 lines (under 350 target) - Add 7 unit tests for the runtime module covering name(), spawn_read(), snapshot_cache_counters(), and SharedHandles construction Closes #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts
BackendRuntimetrait +SpacetimeRuntime+ArcaneRuntimefrommain.rsinto a dedicatedruntime.rsmodule, and extracts the control-mode orchestrator intocontrol.rs.Changes
runtime.rs(new, 349 lines):BackendRuntimetrait,SharedHandlesstruct,SpacetimeRuntime,ArcaneRuntime, and 7 unit testscontrol.rs(new, 366 lines):run_control_modeandhandle_control_connection— the TCP-driven player rampmain.rs(713 → 189 lines): entry point only, well under 350 targetspawn_context.rs: updated to referencecrate::runtime::BackendRuntimeand useSharedHandlesfor reduced clone boilerplateAcceptance checklist
Closes #38