-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
type:refactorCode restructuring without changing external behaviorCode restructuring without changing external behavior
Milestone
Description
Problem
Current lease injection in NodeBuilder::build() uses Arc::get_mut() pattern which is fragile:
// d-engine-server/src/node/builder.rs#L234-259
let mut state_machine: Arc<SM> = self.state_machine.take()?;
if let Some(sm) = Arc::get_mut(&mut state_machine) {
sm.try_inject_lease(lease_config)?;
} else {
// CRITICAL error if Arc is cloned
return Err("State machine Arc must have single ownership");
}Issues:
- Logical contradiction: Comment says "injected before Arc wrapping", but
state_machineis alreadyArc<SM> - Fragile API: Fails with CRITICAL error if Arc is cloned before
build() - Anti-pattern: Violates Rust ownership - shouldn't mutate after Arc wrapping
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:refactorCode restructuring without changing external behaviorCode restructuring without changing external behavior
Type
Projects
Status
Done