From cd8bfb21d4a5d039b91dcd1cce71ff67ba5b2e4f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Mon, 30 Mar 2026 23:43:48 -0700 Subject: [PATCH] fix: tighten FC1 new-session assertion and FC4 proof-detail check FC1: now asserts HasActiveSession() after address change AND verifies session_created in log (not just plan_cancelled). FC4: escalation event detail must be >15 chars (contains proof reason with LSN values, not just "needs_rebuild"). Co-Authored-By: Claude Opus 4.6 (1M context) --- .../blockvol/v2bridge/failure_replay_test.go | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/weed/storage/blockvol/v2bridge/failure_replay_test.go b/weed/storage/blockvol/v2bridge/failure_replay_test.go index c1c4ab517..2bcd5b6eb 100644 --- a/weed/storage/blockvol/v2bridge/failure_replay_test.go +++ b/weed/storage/blockvol/v2bridge/failure_replay_test.go @@ -94,15 +94,27 @@ func TestP2_FC1_ChangedAddress(t *testing.T) { t.Fatalf("FC1: endpoint not updated: %s", senderAfter.Endpoint().DataAddr) } + // Verify new session was created after address change. + if !senderAfter.HasActiveSession() { + t.Fatal("FC1: new session must be created after address change") + } + hasCancelled := false + hasNewSession := false for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") { if e.Event == "plan_cancelled" { hasCancelled = true } + if e.Event == "session_created" { + hasNewSession = true + } } if !hasCancelled { t.Fatal("FC1: log must show plan_cancelled") } + if !hasNewSession { + t.Fatal("FC1: log must show session_created after address change") + } } // --- FC2: Stale epoch after failover (integrated engine/storage, control simulated) --- @@ -231,13 +243,21 @@ func TestP2_FC4_UnrecoverableGap_Forced(t *testing.T) { } hasEscalation := false + hasProofDetail := false for _, e := range driver.Orchestrator.Log.EventsFor("vol1/vs2") { if e.Event == "escalated" { hasEscalation = true + // Detail must contain the proof reason with LSN values. + if len(e.Detail) > 15 { + hasProofDetail = true + } } } if !hasEscalation { - t.Fatal("FC4: log must show escalation with gap details") + t.Fatal("FC4: log must show escalation event") + } + if !hasProofDetail { + t.Fatal("FC4: escalation event must contain proof reason with LSN details") } t.Logf("FC4: NeedsRebuild proven — replica=0, tail=%d, proof=%s", state.WALTailLSN, plan.Proof.Reason)