fix: true mid-executor invalidation test via OnStep hook

CatchUpExecutor.OnStep: optional callback fired between executor-managed
progress steps. Enables deterministic fault injection (epoch bump)
between steps without racing or manual sender calls.

E2_EpochBump_MidExecutorLoop:
- Executor runs 5 progress steps
- OnStep hook bumps epoch after step 1 (after 2 successful steps)
- Executor's own loop detects invalidation at step 2's check
- Resources released by executor's release path (not manual cancel)
- Log shows session_invalidated + exec_resources_released

This closes the remaining FC2 gap: invalidation is now detected
and cleaned up by the executor itself, not by external code.

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 15:51:21 -07:00
1 parent 5b63d34d6b
commit 4df61f290b
2 files changed
+35 -34

No files matched your search

+10
View File
@@ -16,6 +16,11 @@ type CatchUpExecutor struct {
replicaID string
sessID uint64
released bool
// OnStep is an optional callback invoked between executor-managed steps.
// Used for deterministic fault injection in tests (e.g., epoch bump).
// step is the 0-based index of the completed step.
OnStep func(step int)
}
// NewCatchUpExecutor creates an executor from a plan. The plan's resources
@@ -68,6 +73,11 @@ func (e *CatchUpExecutor) Execute(progressLSNs []uint64, startTick uint64) error
return err
}
// Fire step callback (test hook for fault injection).
if e.OnStep != nil {
e.OnStep(i)
}
// Check budget after each step.
v, err := s.CheckBudget(e.sessID, tick)
if err != nil {