fix: add RecoveryOrchestrator as real integrated entry path

New: orchestrator.go — RecoveryOrchestrator drives recovery lifecycle
from assignment through execution to completion/escalation:
- ProcessAssignment: reconcile + session creation + auto-log
- ExecuteRecovery: connect → handshake from RetainedHistory → outcome
- CompleteCatchUp: begin catch-up → progress → complete + auto-log
- CompleteRebuild: connect → handshake → history-driven source →
  transfer → tail replay → complete + auto-log
- InvalidateEpoch: invalidate stale sessions + auto-log

All integration tests rewritten to use orchestrator as entry path.
No direct sender API calls in recovery lifecycle.

SessionSnapshot now includes: TruncateRequired/ToLSN/Recorded,
RebuildSource, RebuildPhase.

RecoveryLog is auto-populated by orchestrator at every transition.

7 integration tests via orchestrator:
- ChangedAddress, NeedsRebuild→Rebuild, EpochBump, MultiReplica
- Observability: session snapshot, rebuild snapshot, auto-populated log

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 4.6 committed 2026-03-30 00:25:58 -07:00
1 parent 7436b3b79c
commit 47238df0d7
3 files changed
+419 -203

No files matched your search

+18 -1
View File
@@ -47,7 +47,7 @@ func (s *Sender) SessionSnapshot() *SessionSnapshot {
if s.session == nil {
return nil
}
return &SessionSnapshot{
snap := &SessionSnapshot{
ID: s.session.id,
ReplicaID: s.session.replicaID,
Epoch: s.session.epoch,
@@ -59,7 +59,15 @@ func (s *Sender) SessionSnapshot() *SessionSnapshot {
FrozenTargetLSN: s.session.frozenTargetLSN,
RecoveredTo: s.session.recoveredTo,
Active: s.session.Active(),
TruncateRequired: s.session.truncateRequired,
TruncateToLSN: s.session.truncateToLSN,
TruncateRecorded: s.session.truncateRecorded,
}
if s.session.rebuild != nil {
snap.RebuildSource = s.session.rebuild.Source
snap.RebuildPhase = s.session.rebuild.Phase
}
return snap
}
// SessionSnapshot is a read-only copy of session state for external inspection.
@@ -75,6 +83,15 @@ type SessionSnapshot struct {
FrozenTargetLSN uint64
RecoveredTo uint64
Active bool
// Truncation state.
TruncateRequired bool
TruncateToLSN uint64
TruncateRecorded bool
// Rebuild state (nil if not a rebuild session).
RebuildSource RebuildSource
RebuildPhase RebuildPhase
}
// SessionID returns the current session ID, or 0 if no session.