fix: Batch 3 wiring — production path uses runtime helpers, legacy isolated

H wiring: block_recovery.go now uses runtime.PendingCoordinator
- Removed local pendingRecoveryExecution type + store/take/peek/has/cancel
- ExecutePendingCatchUp/Rebuild delegate to coord.TakeCatchUp/TakeRebuild
- Shutdown uses coord.CancelAll
- Added CancelAll to PendingCoordinator

I wiring: executeCatchUpPlan/executeRebuildPlan replaced
- ExecutePendingCatchUp now calls rt.ExecuteCatchUpPlan with RecoveryManager
  as RecoveryCallbacks (OnCatchUpCompleted/OnRebuildCompleted)
- ExecutePendingRebuild follows same pattern
- Local executeCatchUpPlan/executeRebuildPlan methods removed

J structural: legacy no-core branches extracted
- executeLegacyCatchUp: wraps rt.ExecuteCatchUpPlan for v2Core==nil path
- executeLegacyRebuild: wraps rt.ExecuteRebuildPlan for v2Core==nil path
- Clear "LEGACY NO-CORE COMPATIBILITY" section with structural separation
- runCatchUp/runRebuild now branch cleanly: legacy helper vs core coordinator

Test updates: pendingRecoveryExecution → rt.PendingExecution, field casing,
Plan type assertions.

Validation: all P4, P16B, and ApplyAssignments tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
pingqiu
2026-04-04 01:20:41 -07:00
co-authored by Claude Opus 4.6
parent e075d77619
commit 3a5fbbfded
4 changed files with 337 additions and 132 deletions
@@ -137,3 +137,20 @@ func (pc *PendingCoordinator) Peek(volumeID string) *PendingExecution {
defer pc.mu.Unlock()
return pc.pending[volumeID]
}
// CancelAll cancels and removes all pending executions.
func (pc *PendingCoordinator) CancelAll(reason string) {
pc.mu.Lock()
all := make(map[string]*PendingExecution, len(pc.pending))
for k, v := range pc.pending {
all[k] = v
}
pc.pending = make(map[string]*PendingExecution)
pc.mu.Unlock()
if pc.cancelFn != nil {
for _, pe := range all {
pc.cancelFn(pe, reason)
}
}
}