Skip to content

⚠️ Refactor bin/arcane_swarm/main.rs: extract BackendRuntime trait + impls (A-1)#45

Open
martinjms wants to merge 1 commit intomainfrom
refactor/extract-backend-runtime-v2
Open

⚠️ Refactor bin/arcane_swarm/main.rs: extract BackendRuntime trait + impls (A-1)#45
martinjms wants to merge 1 commit intomainfrom
refactor/extract-backend-runtime-v2

Conversation

@martinjms
Copy link
Copy Markdown
Collaborator

Summary

Extracts BackendRuntime trait + SpacetimeRuntime + ArcaneRuntime from main.rs into a dedicated runtime.rs module, and extracts the control-mode orchestrator into control.rs.

Changes

  • runtime.rs (new, 349 lines): BackendRuntime trait, SharedHandles struct, SpacetimeRuntime, ArcaneRuntime, and 7 unit tests
  • control.rs (new, 366 lines): run_control_mode and handle_control_connection — the TCP-driven player ramp
  • main.rs (713 → 189 lines): entry point only, well under 350 target
  • spawn_context.rs: updated to reference crate::runtime::BackendRuntime and use SharedHandles for reduced clone boilerplate

Acceptance checklist

  • main.rs is < 350 lines (189)
  • BackendRuntime trait + impls live in runtime.rs
  • At least 4 unit tests cover the runtime module (7 tests)
  • cargo build + cargo test pass (71 tests, all green)
  • cargo fmt --all -- --check clean

Closes #38

- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚠️ Refactor bin/arcane_swarm/main.rs: extract BackendRuntime trait + impls (A-1)

1 participant