diff --git a/seaweed-block/core/ops/authority_executor_controller.go b/seaweed-block/core/ops/authority_executor_controller.go index 44398549d3..97abb84fa9 100644 --- a/seaweed-block/core/ops/authority_executor_controller.go +++ b/seaweed-block/core/ops/authority_executor_controller.go @@ -15,6 +15,9 @@ const ( AuthorityExecutorBlockedTerminalEvidence = "terminal_evidence_missing" AuthorityExecutorReasonAckEligibilityRecorded = "ack_eligibility_recorded" AuthorityExecutorReasonRebuildPlanned = "rebuild_progress_planned" + AuthorityExecutorReasonRebuildRunning = "rebuild_runtime_running" + AuthorityExecutorReasonRebuildCaughtUp = "rebuild_runtime_caught_up" + AuthorityExecutorReasonRebuildRuntimeFailed = "rebuild_runtime_failed" ) type AuthorityExecutorClient interface { @@ -28,12 +31,39 @@ type AuthorityExecutorClient interface { type AuthorityExecutorReconciler struct { Namespace string Client AuthorityExecutorClient + RebuildRuntime AuthorityRebuildRuntime ExecutionRequested bool ExecutionPolicyEnabled bool AllowedMutationClass string Now func() time.Time } +type AuthorityRebuildRuntime interface { + ExecuteRebuild(ctx context.Context, req AuthorityRebuildRuntimeRequest) (AuthorityRebuildRuntimeResult, error) +} + +type AuthorityRebuildRuntimeRequest struct { + VolumeName string + VolumeID string + PVCName string + ReplicaID string + DurableFrontierKnown bool + DurableFrontierLSN uint64 + RequiredFrontierKnown bool + RequiredFrontierLSN uint64 + FrontendFenced bool + FrontendPrimaryReady bool + NoFrontendPublication bool + NoCrossVolumeMutation bool + EvidenceRefs []string +} + +type AuthorityRebuildRuntimeResult struct { + DurableFrontierKnown bool + DurableFrontierLSN uint64 + EvidenceRefs []string +} + type AuthorityExecutorReconcileResult struct { VolumeCount int `json:"volumeCount"` ContractCount int `json:"contractCount"` @@ -160,10 +190,37 @@ func (r AuthorityExecutorReconciler) evaluateRebuildPlanning(ctx context.Context } result.MutationAttemptCount++ result.RebuildProgressMutationAttempts++ - if err := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildPlannedStatus(r.now()(), volume, contract, returned)); err != nil { + if r.RebuildRuntime == nil { + if err := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildPlannedStatus(r.now()(), volume, contract, returned)); err != nil { + result.BlockedReason = "rebuild_status_write_failed" + return fmt.Errorf("write rebuild status: %w", err) + } + return nil + } + if err := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildRunningStatus(r.now()(), volume, contract, returned)); err != nil { result.BlockedReason = "rebuild_status_write_failed" return fmt.Errorf("write rebuild status: %w", err) } + runtimeResult, err := r.RebuildRuntime.ExecuteRebuild(ctx, authorityExecutorRebuildRuntimeRequest(volume, contract, returned)) + if err != nil { + result.BlockedReason = AuthorityExecutorReasonRebuildRuntimeFailed + if writeErr := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildBlockedStatus(r.now()(), volume, contract, returned, runtimeResult, AuthorityExecutorReasonRebuildRuntimeFailed)); writeErr != nil { + return fmt.Errorf("write failed rebuild status after runtime error %v: %w", err, writeErr) + } + return fmt.Errorf("execute rebuild runtime: %w", err) + } + if !runtimeResult.DurableFrontierKnown || !returned.RequiredFrontierKnown || runtimeResult.DurableFrontierLSN < returned.RequiredFrontierLSN { + result.BlockedReason = AuthorityExecutorBlockedTerminalEvidence + if err := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildBlockedStatus(r.now()(), volume, contract, returned, runtimeResult, AuthorityExecutorBlockedTerminalEvidence)); err != nil { + result.BlockedReason = "rebuild_status_write_failed" + return fmt.Errorf("write incomplete rebuild status: %w", err) + } + return nil + } + if err := r.Client.WriteReplicaRebuildStatus(ctx, target.Ref, authorityExecutorRebuildCaughtUpStatus(r.now()(), volume, contract, returned, runtimeResult)); err != nil { + result.BlockedReason = "rebuild_status_write_failed" + return fmt.Errorf("write caught-up rebuild status: %w", err) + } return nil } @@ -338,6 +395,103 @@ func authorityExecutorRebuildPlannedStatus(now time.Time, volume SwBlockVolumeOb } } +func authorityExecutorRebuildRunningStatus(now time.Time, volume SwBlockVolumeObject, contract SwBlockVolumeCRDExecutorContract, returned SwBlockVolumeCRDReturnedReplica) SwBlockReplicaRebuildCRDStatus { + status := authorityExecutorRebuildPlannedStatus(now, volume, contract, returned) + status.State = "running" + status.ReasonCode = AuthorityExecutorReasonRebuildRunning + status.RebuildTrafficStarted = true + status.Conditions = []ObservationCondition{{ + Type: ConditionRecovering, + Status: "True", + Reason: AuthorityExecutorReasonRebuildRunning, + Severity: "info", + Message: "returned-replica rebuild/catch-up runtime was invoked; frontend publication remains disabled", + }} + status.NonClaims = []string{ + "no_frontend_publication", + "no_failback", + "no_primary_authority_change", + "no_cross_volume_mutation", + } + return status +} + +func authorityExecutorRebuildCaughtUpStatus(now time.Time, volume SwBlockVolumeObject, contract SwBlockVolumeCRDExecutorContract, returned SwBlockVolumeCRDReturnedReplica, runtimeResult AuthorityRebuildRuntimeResult) SwBlockReplicaRebuildCRDStatus { + evidenceRefs := appendUniqueStrings(nil, contract.EvidenceRefs...) + evidenceRefs = appendUniqueStrings(evidenceRefs, returned.EvidenceRefs...) + evidenceRefs = appendUniqueStrings(evidenceRefs, runtimeResult.EvidenceRefs...) + return SwBlockReplicaRebuildCRDStatus{ + ObservedAt: now, + Executor: defaultString(contract.OwnerExecutor, "authority_recovery_executor"), + State: "caught_up", + ReasonCode: AuthorityExecutorReasonRebuildCaughtUp, + FrontendFencedBeforeRebuild: returned.FrontendFenced && !returned.FrontendPrimaryReady, + PrimaryUnchanged: returned.FrontendFenced && !returned.FrontendPrimaryReady, + DurableFrontierKnown: runtimeResult.DurableFrontierKnown, + DurableFrontierLSN: runtimeResult.DurableFrontierLSN, + RequiredFrontierKnown: returned.RequiredFrontierKnown, + RequiredFrontierLSN: returned.RequiredFrontierLSN, + DurableFrontierCaughtUp: runtimeResult.DurableFrontierKnown && returned.RequiredFrontierKnown && runtimeResult.DurableFrontierLSN >= returned.RequiredFrontierLSN, + RebuildTrafficStarted: true, + NoFrontendPublication: true, + NoCrossVolumeIdentityChange: true, + Conditions: []ObservationCondition{{ + Type: ConditionRecovered, + Status: "True", + Reason: AuthorityExecutorReasonRebuildCaughtUp, + Severity: "info", + Message: "returned-replica rebuild/catch-up reached the required durable frontier; frontend publication remains disabled", + }}, + EvidenceRefs: evidenceRefs, + NonClaims: []string{ + "no_frontend_publication", + "no_failback", + "no_primary_authority_change", + "no_cross_volume_mutation", + }, + } +} + +func authorityExecutorRebuildBlockedStatus(now time.Time, volume SwBlockVolumeObject, contract SwBlockVolumeCRDExecutorContract, returned SwBlockVolumeCRDReturnedReplica, runtimeResult AuthorityRebuildRuntimeResult, reason string) SwBlockReplicaRebuildCRDStatus { + status := authorityExecutorRebuildRunningStatus(now, volume, contract, returned) + status.State = "blocked" + status.ReasonCode = reason + status.DurableFrontierKnown = runtimeResult.DurableFrontierKnown + if runtimeResult.DurableFrontierKnown { + status.DurableFrontierLSN = runtimeResult.DurableFrontierLSN + } + status.DurableFrontierCaughtUp = runtimeResult.DurableFrontierKnown && returned.RequiredFrontierKnown && runtimeResult.DurableFrontierLSN >= returned.RequiredFrontierLSN + status.EvidenceRefs = appendUniqueStrings(status.EvidenceRefs, runtimeResult.EvidenceRefs...) + status.Conditions = []ObservationCondition{{ + Type: ConditionBlocked, + Status: "True", + Reason: reason, + Severity: "warning", + Message: "returned-replica rebuild/catch-up did not produce terminal durable-frontier evidence", + }} + return status +} + +func authorityExecutorRebuildRuntimeRequest(volume SwBlockVolumeObject, contract SwBlockVolumeCRDExecutorContract, returned SwBlockVolumeCRDReturnedReplica) AuthorityRebuildRuntimeRequest { + evidenceRefs := appendUniqueStrings(nil, contract.EvidenceRefs...) + evidenceRefs = appendUniqueStrings(evidenceRefs, returned.EvidenceRefs...) + return AuthorityRebuildRuntimeRequest{ + VolumeName: volume.Ref.Name, + VolumeID: volume.Status.VolumeID, + PVCName: volume.Status.PVCName, + ReplicaID: contract.ReplicaID, + DurableFrontierKnown: returned.DurableFrontierKnown, + DurableFrontierLSN: returned.DurableFrontierLSN, + RequiredFrontierKnown: returned.RequiredFrontierKnown, + RequiredFrontierLSN: returned.RequiredFrontierLSN, + FrontendFenced: returned.FrontendFenced, + FrontendPrimaryReady: returned.FrontendPrimaryReady, + NoFrontendPublication: true, + NoCrossVolumeMutation: true, + EvidenceRefs: evidenceRefs, + } +} + func (r AuthorityExecutorReconciler) now() func() time.Time { if r.Now != nil { return r.Now diff --git a/seaweed-block/core/ops/authority_executor_controller_test.go b/seaweed-block/core/ops/authority_executor_controller_test.go index ccefe8ddf7..ae7c2f736e 100644 --- a/seaweed-block/core/ops/authority_executor_controller_test.go +++ b/seaweed-block/core/ops/authority_executor_controller_test.go @@ -2,6 +2,7 @@ package ops import ( "context" + "errors" "testing" "time" ) @@ -177,6 +178,103 @@ func TestAuthorityExecutorReconcilerWritesRebuildPlannedStatus(t *testing.T) { } } +func TestAuthorityExecutorReconcilerExecutesRebuildRuntimeAndWritesCaughtUpStatus(t *testing.T) { + client := &fakeAuthorityExecutorClient{ + volumes: []SwBlockVolumeObject{authorityExecutorRebuildVolume(false, false)}, + rebuilds: []SwBlockReplicaRebuildObject{authorityExecutorRebuildTarget()}, + } + runtime := &fakeAuthorityRebuildRuntime{ + result: AuthorityRebuildRuntimeResult{ + DurableFrontierKnown: true, + DurableFrontierLSN: 52, + EvidenceRefs: []string{"runtime-terminal-evidence.txt"}, + }, + } + now := time.Date(2026, 6, 23, 20, 0, 0, 0, time.UTC) + result, err := (AuthorityExecutorReconciler{ + Namespace: "kube-system", + Client: client, + RebuildRuntime: runtime, + ExecutionRequested: true, + ExecutionPolicyEnabled: true, + AllowedMutationClass: AuthorityExecutorAllowedMutationRebuildTraffic, + Now: func() time.Time { return now }, + }).Reconcile(context.Background()) + if err != nil { + t.Fatalf("reconcile: %v", err) + } + if result.MutationAttemptCount != 1 || + result.RebuildProgressMutationAttempts != 1 || + result.BlockedReason != "" || + len(runtime.requests) != 1 || + len(client.rebuildWrites) != 2 { + t.Fatalf("result=%+v runtime=%+v rebuild_writes=%+v", result, runtime.requests, client.rebuildWrites) + } + req := runtime.requests[0] + if req.VolumeName != "rebuild" || + req.VolumeID != "pvc-rebuild" || + req.PVCName != "rebuild-pvc" || + req.ReplicaID != "r1" || + req.DurableFrontierLSN != 51 || + req.RequiredFrontierLSN != 52 || + !req.FrontendFenced || + req.FrontendPrimaryReady || + !req.NoFrontendPublication || + !req.NoCrossVolumeMutation { + t.Fatalf("runtime request=%+v", req) + } + running := client.rebuildWrites[0].status + if running.State != "running" || + running.ReasonCode != AuthorityExecutorReasonRebuildRunning || + !running.RebuildTrafficStarted || + running.DurableFrontierCaughtUp { + t.Fatalf("running status=%+v", running) + } + caughtUp := client.rebuildWrites[1].status + if caughtUp.State != "caught_up" || + caughtUp.ReasonCode != AuthorityExecutorReasonRebuildCaughtUp || + !caughtUp.RebuildTrafficStarted || + !caughtUp.DurableFrontierCaughtUp || + caughtUp.DurableFrontierLSN != 52 || + !caughtUp.NoFrontendPublication || + !caughtUp.NoCrossVolumeIdentityChange || + !authorityExecutorStringSliceContains(caughtUp.EvidenceRefs, "runtime-terminal-evidence.txt") { + t.Fatalf("caught_up status=%+v", caughtUp) + } +} + +func TestAuthorityExecutorReconcilerWritesBlockedStatusWhenRebuildRuntimeFails(t *testing.T) { + client := &fakeAuthorityExecutorClient{ + volumes: []SwBlockVolumeObject{authorityExecutorRebuildVolume(false, false)}, + rebuilds: []SwBlockReplicaRebuildObject{authorityExecutorRebuildTarget()}, + } + runtime := &fakeAuthorityRebuildRuntime{err: errors.New("runtime refused")} + result, err := (AuthorityExecutorReconciler{ + Namespace: "kube-system", + Client: client, + RebuildRuntime: runtime, + ExecutionRequested: true, + ExecutionPolicyEnabled: true, + AllowedMutationClass: AuthorityExecutorAllowedMutationRebuildTraffic, + }).Reconcile(context.Background()) + if err == nil { + t.Fatalf("expected runtime failure, result=%+v", result) + } + if result.BlockedReason != AuthorityExecutorReasonRebuildRuntimeFailed || + result.MutationAttemptCount != 1 || + len(runtime.requests) != 1 || + len(client.rebuildWrites) != 2 { + t.Fatalf("result=%+v runtime=%+v rebuild_writes=%+v", result, runtime.requests, client.rebuildWrites) + } + blocked := client.rebuildWrites[1].status + if blocked.State != "blocked" || + blocked.ReasonCode != AuthorityExecutorReasonRebuildRuntimeFailed || + !blocked.RebuildTrafficStarted || + blocked.DurableFrontierCaughtUp { + t.Fatalf("blocked status=%+v", blocked) + } +} + func TestAuthorityExecutorReconcilerRejectsExecutionWhenPolicyDisabled(t *testing.T) { result, err := (AuthorityExecutorReconciler{ Client: &fakeAuthorityExecutorClient{}, @@ -285,6 +383,17 @@ type fakeAuthorityExecutorClient struct { rebuildWrites []fakeReplicaRebuildWrite } +type fakeAuthorityRebuildRuntime struct { + result AuthorityRebuildRuntimeResult + err error + requests []AuthorityRebuildRuntimeRequest +} + +func (f *fakeAuthorityRebuildRuntime) ExecuteRebuild(_ context.Context, req AuthorityRebuildRuntimeRequest) (AuthorityRebuildRuntimeResult, error) { + f.requests = append(f.requests, req) + return f.result, f.err +} + type fakeReplicaEligibilityWrite struct { ref OperatorObjectRef status SwBlockReplicaEligibilityCRDStatus diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index db7b29e894..54973e30d7 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -221,13 +221,20 @@ Recommended order from here: convergence. This proves the data path beneath the planning model; it does not yet wire the Kubernetes authority executor to trigger that traffic in a live blockvolume pod. -18. Phase 61: executor-to-runtime rebuild call-site. **Next recommended slice**. - Connect the bounded `authority-executor` path to the blockvolume runtime so - `SwBlockReplicaRebuild.status` can move from `planned` to real - running/completed/failed terminal evidence driven by data-path traffic. - Keep frontend publication, failback, and ACK eligibility mutation out of - scope unless separately gated. -19. Add backup/restore and NVMe ANA parity after they can reuse the same action +18. Phase 61: authority executor runtime call-site. **Closed 2026-06-23, QA PASS** + (`internal/docs/finished-plans/phase61_finishedplan_authority_executor_runtime_callsite.md`). + The authority executor now has a bounded `AuthorityRebuildRuntime` seam. + With no runtime it preserves the Phase 59 `planned` behavior; with a + runtime it writes `running`, invokes the runtime, and maps terminal evidence + to `caught_up` or `blocked`. This still does not wire a concrete + blockvolume RPC/HTTP/gRPC transport. +19. Phase 62: concrete blockvolume runtime transport. **Next recommended slice**. + Connect the Phase 61 runtime seam to a live blockvolume runtime transport + and run it against the Phase 60 data-path proof. The target claim should be + limited to `SwBlockReplicaRebuild.status` moving from planned/running to + caught_up/blocked from terminal evidence. Keep frontend publication, + failback, and ACK eligibility mutation out of scope unless separately gated. +20. Add backup/restore and NVMe ANA parity after they can reuse the same action owner, evidence, and status model rather than creating another isolated control plane. @@ -242,9 +249,11 @@ bounded ACK eligibility mutation without allowing frontend publication, rebuild traffic, or failback. Phases 56-59 extend that same pattern to returned-replica rebuild planning: contract, target CR, target owner, and planned status before any real rebuild/catch-up traffic is enabled. Phase 60 proves that the existing -data path underneath that planning model can move bytes and converge replicas; -Phase 61 should connect the executor call-site to that runtime path without -broadening the frontend/failback claims. +data path underneath that planning model can move bytes and converge replicas. +Phase 61 connects the executor call-site seam and terminal-status mapping +without a concrete blockvolume RPC transport. Phase 62 should connect that seam +to the live blockvolume runtime path without broadening the frontend/failback +claims. The practical rule is: diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 0eba5753d6..b4e3a82467 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,4 +1,4 @@ -# Current Plan: Phase 60 Rebuild/Catch-Up Data-Path Gate +# Current Plan: Phase 61 Authority Executor Runtime Call-site Status: complete. @@ -6,152 +6,138 @@ Branch target: `phase54-returned-replica-reintegration-executor` ## Goal -Phases 56-59 closed the returned-replica rebuild planning path: +Phase 60 proved the existing rebuild/catch-up data path below Kubernetes: ```text -rebuild contract - -> target-owner creates SwBlockReplicaRebuild - -> authority-executor writes planned rebuild status +engine / adapter -> transport/recovery -> byte-equal convergence ``` -That path intentionally did not move data. Phase 60 closes the next narrow -question: +Phase 61 connects the authority executor to a runtime call-site seam so rebuild +execution is no longer only a planned status write: ```text -Do the existing rebuild/catch-up data paths actually move bytes, close sessions, -and converge replicas under the engine/adapter/transport/recovery stack? +SwBlockVolume.status.executorContracts[] + -> authority-executor + -> AuthorityRebuildRuntime.ExecuteRebuild(...) + -> SwBlockReplicaRebuild.status running/caught_up/blocked ``` -This phase turns the existing component/transport evidence into a repeatable -TestRunner gate with terminal evidence. - ## Scope In scope: -- Run engine-driven catch-up evidence. -- Run transport catch-up evidence with barrier confirmation. -- Run engine-driven dual-lane rebuild evidence. -- Run post-close durable-ack publication ordering evidence. -- Run live-write-during-rebuild evidence. -- Run same-LBA arbitration evidence. -- Emit terminal key/value evidence that names the observed data-path events. -- Keep the claim honest: this is data-path proof, not Kubernetes executor - call-site wiring. +- Add a narrow `AuthorityRebuildRuntime` interface to the authority executor. +- Preserve Phase 59 behavior when no runtime is provided: write `planned`. +- When a runtime is provided, write `running`, invoke the runtime, then write + `caught_up` if terminal durable-frontier evidence covers the required LSN. +- Write `blocked` if the runtime fails or returns insufficient terminal + evidence. +- Keep non-claims explicit: no frontend publication, no failback, no ACK + eligibility mutation, no blockvolume RPC yet. +- Add a TestRunner gate for the call-site and status mapping. Out of scope: -- No Kubernetes `authority-executor` trigger into a live blockvolume process. -- No `SwBlockReplicaRebuild.status.state=running/completed` driven by real bytes. +- No blockvolume RPC/HTTP/gRPC runtime transport. +- No Kubernetes pod-to-pod rebuild command. +- No RF=3 orchestration. - No frontend publication. - No failback. - No ACK eligibility mutation. -- No cross-volume or RF=3 Kubernetes rebuild orchestration. ## Deliverables -### D1: Data-Path Gate Script +### D1: Runtime Call-site Interface Status: complete. Added: ```text -scripts/run-phase60-rebuild-catchup-datapath-gate.sh +AuthorityRebuildRuntime +AuthorityRebuildRuntimeRequest +AuthorityRebuildRuntimeResult ``` -The script runs targeted Go component/transport tests and records evidence such -as: +The authority executor uses this interface only for +`allowed-mutation-class=rebuild_traffic`. -```text -start_catchup_observed=true -catchup_session_completed_observed=true -start_rebuild_observed=true -dual_lane_rebuild_observed=true -session_closed_completed_observed=true -durable_ack_observed=true -barrier_handshake_observed=true -byte_equal_assertions_passed=true -same_lba_last_write_wins_asserted=true -authority_executor_datapath_callsite=false -``` - -### D2: TestRunner Scenario +### D2: Status Mapping Status: complete. -Added: +Runtime path status flow: ```text -testops/scenarios/rebuild-catchup-datapath-chain.yaml +planned path: no runtime -> state=planned +runtime path: runtime invoked -> state=running -> state=caught_up +failure path: runtime error or insufficient frontier -> state=blocked ``` -The scenario runs the gate on `m02` against `/tmp/seaweed_block` and asserts the -terminal evidence. - -### D3: Local Validation +### D3: Regression Tests Status: PASS. -Run: +Added tests proving: -```text -go test ./core/replication/component ./core/transport -run "" -count=1 -v -C:\work\swblock.exe validate testops\scenarios\rebuild-catchup-datapath-chain.yaml -``` +- planned status is preserved when no runtime exists; +- runtime request carries volume/replica/frontier/fencing evidence; +- successful runtime writes `running` then `caught_up`; +- failed runtime writes `blocked`. -### D4: Live QA Gate +### D4: TestRunner Gate Status: QA PASS. -Sync the current tree to `m02:/tmp/seaweed_block`, then run: +Added: ```text -swblock run testops/scenarios/rebuild-catchup-datapath-chain.yaml +scripts/run-phase61-authority-executor-runtime-callsite-gate.sh +testops/scenarios/authority-executor-runtime-callsite-chain.yaml ``` -Expected terminal evidence: +Live run: ```text -phase60_rebuild_catchup_datapath_status=ok -rebuild_traffic_started=true -catchup_traffic_started=true -byte_equal_assertions_passed=true -authority_executor_datapath_callsite=false +20260623-212206-8afb authority-executor-runtime-callsite-chain PASS 28/28 +``` + +Terminal evidence: + +```text +phase61_authority_executor_runtime_callsite_status=ok +runtime_callsite_invoked=true +rebuild_status_running_written=true +rebuild_status_caught_up_written=true +rebuild_status_blocked_on_runtime_failure=true +rebuild_traffic_started_when_runtime_invoked=true +durable_frontier_caught_up_after_runtime=true +planned_status_preserved_without_runtime=true +blockvolume_rpc_wired=false frontend_publication_allowed=false failback_allowed=false +ack_eligibility_mutation_allowed=false ``` ### D5: Close Docs Status: complete. -On PASS, write: - -```text -internal/docs/qa-assignments/phase60-rebuild-catchup-datapath-qa-signoff.md -internal/docs/finished-plans/phase60_finishedplan_rebuild_catchup_datapath_gate.md -``` - -Updated `docs/roadmap.md` to state that Phase 60 proves the existing -rebuild/catch-up data path, while Phase 61 remains the executor-to-runtime -call-site milestone. - -## Exit - -Phase 60 closed when the live TestRunner gate proved both catch-up and rebuild -traffic paths, byte-equality convergence, session close, durable ack ordering, -and explicitly states that executor/runtime Kubernetes wiring is still out of -scope. - -Result: - -```text -20260623-194022-f4ea rebuild-catchup-datapath-chain PASS 34/34 -``` - Sign-off: ```text -internal/docs/qa-assignments/phase60-rebuild-catchup-datapath-qa-signoff.md +internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md ``` + +Finished plan: + +```text +internal/docs/finished-plans/phase61_finishedplan_authority_executor_runtime_callsite.md +``` + +## Exit + +Phase 61 closed when the live TestRunner gate proved the authority executor can +call a bounded rebuild runtime seam and map terminal evidence into +`SwBlockReplicaRebuild.status`, while explicitly preserving the boundary that +blockvolume RPC wiring remains future work. diff --git a/seaweed-block/internal/docs/finished-plans/phase61_finishedplan_authority_executor_runtime_callsite.md b/seaweed-block/internal/docs/finished-plans/phase61_finishedplan_authority_executor_runtime_callsite.md new file mode 100644 index 0000000000..ab13f25188 --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase61_finishedplan_authority_executor_runtime_callsite.md @@ -0,0 +1,92 @@ +# Phase 61 Finished Plan: Authority Executor Runtime Call-site + +Status: complete. + +QA: PASS. + +## Goal + +Phase 61 connects returned-replica rebuild planning to a bounded executor +runtime seam. Phase 59 could only write `planned`; Phase 60 proved the data path +below Kubernetes. Phase 61 adds the missing call-site shape between those two +layers. + +## Delivered + +Code: + +```text +core/ops/authority_executor_controller.go +core/ops/authority_executor_controller_test.go +``` + +Gate: + +```text +scripts/run-phase61-authority-executor-runtime-callsite-gate.sh +testops/scenarios/authority-executor-runtime-callsite-chain.yaml +``` + +Docs: + +```text +internal/docs/current-plan.md +internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md +docs/roadmap.md +``` + +## Behavior + +The authority executor now supports an optional `AuthorityRebuildRuntime`: + +```text +nil runtime: + SwBlockReplicaRebuild.status.state=planned + +runtime success: + state=running + -> ExecuteRebuild(...) + -> state=caught_up + +runtime failure or insufficient terminal evidence: + state=blocked +``` + +The runtime request carries the volume identity, replica id, durable/required +frontier, fencing facts, and evidence references. The status mapper keeps the +non-claims explicit: + +```text +no_frontend_publication +no_failback +no_primary_authority_change +no_cross_volume_mutation +``` + +## Verification + +Local: + +```text +go test ./core/ops -run "TestAuthorityExecutorReconciler(WritesRebuildPlannedStatus|ExecutesRebuildRuntimeAndWritesCaughtUpStatus|WritesBlockedStatusWhenRebuildRuntimeFails)" -count=1 +C:\work\swblock.exe validate testops\scenarios\authority-executor-runtime-callsite-chain.yaml +``` + +Live: + +```text +20260623-212206-8afb authority-executor-runtime-callsite-chain PASS 28/28 +``` + +Sign-off: + +```text +internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md +``` + +## Boundary + +This phase does not connect a concrete blockvolume RPC/HTTP/gRPC transport. It +proves the executor call-site and terminal-status mapping. Phase 62 should +provide the concrete runtime implementation and run it against the Phase 60 +data path. diff --git a/seaweed-block/internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md new file mode 100644 index 0000000000..d17096744d --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase61-authority-executor-runtime-callsite-qa-signoff.md @@ -0,0 +1,95 @@ +# Phase 61 Authority Executor Runtime Call-site QA Sign-off + +Status: PASS. + +Source branch: `phase54-returned-replica-reintegration-executor` + +QA run: + +```text +20260623-212206-8afb authority-executor-runtime-callsite-chain PASS 28/28 +``` + +## Scope + +Phase 61 validates the authority executor's rebuild runtime call-site seam: + +```text +SwBlockVolume rebuild contract + -> authority-executor + -> AuthorityRebuildRuntime.ExecuteRebuild(...) + -> SwBlockReplicaRebuild.status +``` + +This is not yet a blockvolume RPC integration. The runtime is an interface +boundary that lets the executor map real terminal evidence into the rebuild +target status once a blockvolume runtime transport is connected. + +## Terminal Evidence + +From: + +```text +results/20260623-212206-8afb/artifacts/remote-phases.tgz +``` + +Summary: + +```text +phase61_authority_executor_runtime_callsite_status=ok +phase61_scope=core_authority_executor_runtime_callsite +blockvolume_rpc_wired=false +frontend_publication_allowed=false +failback_allowed=false +ack_eligibility_mutation_allowed=false +core_ops_runtime_callsite_tests=pass +planned_without_runtime_test=true +runtime_callsite_caught_up_test=true +runtime_failure_blocked_test=true +runtime_callsite_invoked=true +rebuild_status_running_written=true +rebuild_status_caught_up_written=true +rebuild_status_blocked_on_runtime_failure=true +rebuild_traffic_started_when_runtime_invoked=true +durable_frontier_caught_up_after_runtime=true +planned_status_preserved_without_runtime=true +``` + +## Gates + +| Gate | Result | Evidence | +| --- | --- | --- | +| Planned fallback | PASS | `planned_without_runtime_test=true`, `planned_status_preserved_without_runtime=true` | +| Runtime call-site | PASS | `runtime_callsite_invoked=true` | +| Running status | PASS | `rebuild_status_running_written=true` | +| Caught-up status | PASS | `rebuild_status_caught_up_written=true`, `durable_frontier_caught_up_after_runtime=true` | +| Runtime failure status | PASS | `rebuild_status_blocked_on_runtime_failure=true` | +| Rebuild traffic boundary | PASS | `rebuild_traffic_started_when_runtime_invoked=true` | +| Non-claims | PASS | `blockvolume_rpc_wired=false`, `frontend_publication_allowed=false`, `failback_allowed=false`, `ack_eligibility_mutation_allowed=false` | + +## Interpretation + +Phase 61 moves the executor from "planned status only" to a real call-site seam. +The executor can now invoke a runtime implementation and translate terminal +frontier evidence into `running`, `caught_up`, or `blocked` status. + +The boundary is intentionally still narrow. The gate does not claim that a +Kubernetes-deployed authority executor can command a live blockvolume pod. That +is the next runtime transport phase. + +## Findings + +Blocking: none. + +Non-blocking: + +- The next phase should connect this interface to a concrete blockvolume runtime + transport and run it against the Phase 60 data path. +- Local Bash on the Windows host still resolves to WSL Go 1.18 and cannot run + current Go module tests. The live m02 gate uses a compatible Go toolchain. + +## Verdict + +Phase 61 PASS. The authority executor has a bounded rebuild runtime call-site +and status mapping. Phase 62 should wire that call-site to the blockvolume +runtime transport. diff --git a/seaweed-block/scripts/run-phase61-authority-executor-runtime-callsite-gate.sh b/seaweed-block/scripts/run-phase61-authority-executor-runtime-callsite-gate.sh new file mode 100644 index 0000000000..7a8f17b4b9 --- /dev/null +++ b/seaweed-block/scripts/run-phase61-authority-executor-runtime-callsite-gate.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash +set -euo pipefail + +PRODUCT_ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase61-authority-executor-runtime-callsite-gate}" +SUMMARY="${ARTIFACT_DIR}/phase61-authority-executor-runtime-callsite-summary.txt" +OPS_LOG="${ARTIFACT_DIR}/core-ops-go-test.log" + +mkdir -p "${ARTIFACT_DIR}" +: >"${SUMMARY}" + +write_summary() { + echo "$*" | tee -a "${SUMMARY}" >/dev/null +} + +require_log() { + local name="$1" + local pattern="$2" + local file="$3" + local found="false" + if grep -Eq -- "${pattern}" "${file}"; then + found="true" + fi + write_summary "${name}=${found}" + if [ "${found}" != "true" ]; then + echo "missing evidence ${name}: pattern ${pattern}" >&2 + return 1 + fi +} + +write_summary "phase61_authority_executor_runtime_callsite_status=running" +write_summary "phase61_scope=core_authority_executor_runtime_callsite" +write_summary "blockvolume_rpc_wired=false" +write_summary "frontend_publication_allowed=false" +write_summary "failback_allowed=false" +write_summary "ack_eligibility_mutation_allowed=false" + +TEST_PATTERN="TestAuthorityExecutorReconcilerWritesRebuildPlannedStatus|TestAuthorityExecutorReconcilerExecutesRebuildRuntimeAndWritesCaughtUpStatus|TestAuthorityExecutorReconcilerWritesBlockedStatusWhenRebuildRuntimeFails" + +if (cd "${PRODUCT_ROOT}" && go test ./core/ops -run "${TEST_PATTERN}" -count=1 -v) >"${OPS_LOG}" 2>&1; then + write_summary "core_ops_runtime_callsite_tests=pass" +else + write_summary "core_ops_runtime_callsite_tests=fail" + cat "${OPS_LOG}" >&2 || true + exit 1 +fi + +require_log "planned_without_runtime_test" "^--- PASS: TestAuthorityExecutorReconcilerWritesRebuildPlannedStatus" "${OPS_LOG}" +require_log "runtime_callsite_caught_up_test" "^--- PASS: TestAuthorityExecutorReconcilerExecutesRebuildRuntimeAndWritesCaughtUpStatus" "${OPS_LOG}" +require_log "runtime_failure_blocked_test" "^--- PASS: TestAuthorityExecutorReconcilerWritesBlockedStatusWhenRebuildRuntimeFails" "${OPS_LOG}" + +write_summary "runtime_callsite_invoked=true" +write_summary "rebuild_status_running_written=true" +write_summary "rebuild_status_caught_up_written=true" +write_summary "rebuild_status_blocked_on_runtime_failure=true" +write_summary "rebuild_traffic_started_when_runtime_invoked=true" +write_summary "durable_frontier_caught_up_after_runtime=true" +write_summary "planned_status_preserved_without_runtime=true" +write_summary "phase61_authority_executor_runtime_callsite_status=ok" diff --git a/seaweed-block/testops/scenarios/authority-executor-runtime-callsite-chain.yaml b/seaweed-block/testops/scenarios/authority-executor-runtime-callsite-chain.yaml new file mode 100644 index 0000000000..1d855dc875 --- /dev/null +++ b/seaweed-block/testops/scenarios/authority-executor-runtime-callsite-chain.yaml @@ -0,0 +1,136 @@ +# Runner-native Phase 61 gate: authority-executor rebuild runtime call-site. + +name: authority-executor-runtime-callsite-chain +timeout: 8m + +env: + product_root: "/tmp/seaweed_block" + ssh_key: "C:\\work\\dev_server\\testdev_key" + +topology: + nodes: + m02: + host: 192.168.1.184 + user: testdev + key: "{{ ssh_key }}" + +phases: + - name: authority_executor_runtime_callsite_gate + actions: + - action: exec + node: m02 + timeout: 7m + cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite bash scripts/run-phase61-authority-executor-runtime-callsite-gate.sh {{ product_root }}" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^phase61_authority_executor_runtime_callsite_status=ok$" + save_as: phase61_ok + - action: assert_greater + actual: "{{ phase61_ok }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^planned_without_runtime_test=true$" + save_as: planned_preserved + - action: assert_greater + actual: "{{ planned_preserved }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^runtime_callsite_caught_up_test=true$" + save_as: runtime_caught_up + - action: assert_greater + actual: "{{ runtime_caught_up }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^runtime_failure_blocked_test=true$" + save_as: runtime_blocked + - action: assert_greater + actual: "{{ runtime_blocked }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^runtime_callsite_invoked=true$" + save_as: callsite_invoked + - action: assert_greater + actual: "{{ callsite_invoked }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^rebuild_status_running_written=true$" + save_as: running_written + - action: assert_greater + actual: "{{ running_written }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^rebuild_status_caught_up_written=true$" + save_as: caught_up_written + - action: assert_greater + actual: "{{ caught_up_written }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^rebuild_status_blocked_on_runtime_failure=true$" + save_as: blocked_written + - action: assert_greater + actual: "{{ blocked_written }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^rebuild_traffic_started_when_runtime_invoked=true$" + save_as: traffic_started + - action: assert_greater + actual: "{{ traffic_started }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^durable_frontier_caught_up_after_runtime=true$" + save_as: frontier_caught_up + - action: assert_greater + actual: "{{ frontier_caught_up }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^blockvolume_rpc_wired=false$" + save_as: rpc_not_wired + - action: assert_greater + actual: "{{ rpc_not_wired }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^frontend_publication_allowed=false$" + save_as: no_frontend + - action: assert_greater + actual: "{{ no_frontend }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite/phase61-authority-executor-runtime-callsite-summary.txt" + pattern: "^failback_allowed=false$" + save_as: no_failback + - action: assert_greater + actual: "{{ no_failback }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase61-authority-executor-runtime-callsite" + name: "remote-phases" + ignore_error: true