From f5ca43780d8920a2b63d258094cbee6f3a5a0cdd Mon Sep 17 00:00:00 2001 From: pingqiu Date: Thu, 25 Jun 2026 18:36:25 -0700 Subject: [PATCH] phase73: guard frontend publication authority owner --- .../core/ops/authority_executor_controller.go | 4 + ...rontend_publication_executor_controller.go | 21 +++ ...nd_publication_executor_controller_test.go | 52 +++++- seaweed-block/docs/roadmap.md | 66 ++++++-- seaweed-block/internal/docs/current-plan.md | 148 +++++++----------- ...ntend_publication_authority_owner_guard.md | 113 +++++++++++++ ...-publication-authority-owner-qa-signoff.md | 69 ++++++++ ...ontend-publication-authority-owner-gate.sh | 60 +++++++ ...end-publication-authority-owner-chain.yaml | 96 ++++++++++++ 9 files changed, 523 insertions(+), 106 deletions(-) create mode 100644 seaweed-block/internal/docs/finished-plans/phase73_finishedplan_frontend_publication_authority_owner_guard.md create mode 100644 seaweed-block/internal/docs/qa-assignments/phase73-frontend-publication-authority-owner-qa-signoff.md create mode 100644 seaweed-block/scripts/run-phase73-frontend-publication-authority-owner-gate.sh create mode 100644 seaweed-block/testops/scenarios/frontend-publication-authority-owner-chain.yaml diff --git a/seaweed-block/core/ops/authority_executor_controller.go b/seaweed-block/core/ops/authority_executor_controller.go index 1d870e9497..4cbfd37fb1 100644 --- a/seaweed-block/core/ops/authority_executor_controller.go +++ b/seaweed-block/core/ops/authority_executor_controller.go @@ -28,6 +28,10 @@ const ( AuthorityExecutorFrontendPublicationReasonPublished = "frontend_published" ) +const ( + AuthorityExecutorFrontendPublicationReasonAuthorityOwnerRequired = "frontend_publication_requires_authority_owner" +) + type AuthorityExecutorClient interface { ListSwBlockVolumes(ctx context.Context, namespace string) ([]SwBlockVolumeObject, error) ListSwBlockReplicaEligibilities(ctx context.Context, namespace string) ([]SwBlockReplicaEligibilityObject, error) diff --git a/seaweed-block/core/ops/frontend_publication_executor_controller.go b/seaweed-block/core/ops/frontend_publication_executor_controller.go index 4c7e52fb3e..5bb2c59aec 100644 --- a/seaweed-block/core/ops/frontend_publication_executor_controller.go +++ b/seaweed-block/core/ops/frontend_publication_executor_controller.go @@ -101,6 +101,19 @@ func (r FrontendPublicationExecutorReconciler) Reconcile(ctx context.Context) (F func (r FrontendPublicationExecutorReconciler) executeTarget(ctx context.Context, result *FrontendPublicationExecutorReconcileResult, target SwBlockFrontendPublicationObject) error { status := frontendPublicationExecutorDisabledStatus(r.now()(), target) + if frontendPublicationExecutorRequiresAuthorityOwner(target) { + result.InvalidTargetCount++ + status.ReasonCode = AuthorityExecutorFrontendPublicationReasonAuthorityOwnerRequired + status.Conditions[0].Reason = AuthorityExecutorFrontendPublicationReasonAuthorityOwnerRequired + status.Conditions[0].Message = "frontend publication requires an authority/failback owner; primary-unchanged runtime publication is not a valid product side effect" + if !r.DryRun { + if err := r.Client.WriteFrontendPublicationStatus(ctx, target.Ref, status); err != nil { + return err + } + result.StatusWriteCount++ + } + return nil + } if !frontendPublicationExecutorExecutableTarget(target) { result.InvalidTargetCount++ status.ReasonCode = "missing_required_facts" @@ -157,6 +170,14 @@ func (r FrontendPublicationExecutorReconciler) executeTarget(ctx context.Context return nil } +func frontendPublicationExecutorRequiresAuthorityOwner(target SwBlockFrontendPublicationObject) bool { + spec := target.Spec + return spec.FrontendPublicationDecision == AuthorityExecutorPublicationDecisionEnabled && + spec.FrontendPublicationMutationAllowed && + spec.SourceEligibilityName != "" && + spec.PrimaryUnchanged +} + func frontendPublicationExecutorTargetValid(target SwBlockFrontendPublicationObject) bool { spec := target.Spec return spec.VolumeName != "" && diff --git a/seaweed-block/core/ops/frontend_publication_executor_controller_test.go b/seaweed-block/core/ops/frontend_publication_executor_controller_test.go index 17ee60afdb..4c0283f445 100644 --- a/seaweed-block/core/ops/frontend_publication_executor_controller_test.go +++ b/seaweed-block/core/ops/frontend_publication_executor_controller_test.go @@ -110,9 +110,49 @@ func TestFrontendPublicationExecutorExecutionPolicyBlocks(t *testing.T) { } } -func TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled(t *testing.T) { +func TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner(t *testing.T) { target := frontendPublicationExecutorExecutableTargetFixture() client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{target}} + runtime := &fakeFrontendPublicationRuntime{result: FrontendPublicationRuntimeResult{ + FrontendPublished: true, + FailbackStarted: false, + NoStorageMutation: true, + NoCrossVolumeIdentityChange: true, + }} + result, err := (FrontendPublicationExecutorReconciler{ + Namespace: "kube-system", + Client: client, + Runtime: runtime, + ExecutionRequested: true, + ExecutionPolicyEnabled: true, + Now: func() time.Time { return time.Date(2026, 6, 25, 12, 30, 0, 0, time.UTC) }, + }).Reconcile(context.Background()) + if err != nil { + t.Fatalf("reconcile: %v", err) + } + if result.FrontendPublicationAttempts != 0 || + result.FailbackAttempts != 0 || + result.StatusWriteCount != 1 || + result.InvalidTargetCount != 1 || + result.StorageMutationAllowed { + t.Fatalf("result=%+v", result) + } + if len(runtime.requests) != 0 { + t.Fatalf("returned-replica frontend publication must not invoke runtime: %+v", runtime.requests) + } + status := client.writes[0].status + if status.State != FrontendPublicationStateBlocked || + status.ReasonCode != AuthorityExecutorFrontendPublicationReasonAuthorityOwnerRequired || + status.FrontendPublished || + status.FailbackStarted || + !status.NoStorageMutation { + t.Fatalf("status=%+v", status) + } +} + +func TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled(t *testing.T) { + target := frontendPublicationExecutorGenericExecutableTargetFixture() + client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{target}} runtime := &fakeFrontendPublicationRuntime{result: FrontendPublicationRuntimeResult{ FrontendPublished: true, FailbackStarted: false, @@ -160,7 +200,7 @@ func TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled(t *testi } func TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus(t *testing.T) { - client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{frontendPublicationExecutorExecutableTargetFixture()}} + client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{frontendPublicationExecutorGenericExecutableTargetFixture()}} runtime := &fakeFrontendPublicationRuntime{err: errors.New("runtime refused")} result, err := (FrontendPublicationExecutorReconciler{ Namespace: "kube-system", @@ -184,7 +224,7 @@ func TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus(t *testing } func TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence(t *testing.T) { - client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{frontendPublicationExecutorExecutableTargetFixture()}} + client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{frontendPublicationExecutorGenericExecutableTargetFixture()}} runtime := &fakeFrontendPublicationRuntime{result: FrontendPublicationRuntimeResult{ FrontendPublished: true, FailbackStarted: true, @@ -248,6 +288,12 @@ func frontendPublicationExecutorExecutableTargetFixture() SwBlockFrontendPublica return target } +func frontendPublicationExecutorGenericExecutableTargetFixture() SwBlockFrontendPublicationObject { + target := frontendPublicationExecutorExecutableTargetFixture() + target.Spec.SourceEligibilityName = "" + return target +} + type fakeFrontendPublicationExecutorClient struct { targets []SwBlockFrontendPublicationObject writes []fakeFrontendPublicationStatusWrite diff --git a/seaweed-block/docs/roadmap.md b/seaweed-block/docs/roadmap.md index 54973e30d7..93cc44f166 100644 --- a/seaweed-block/docs/roadmap.md +++ b/seaweed-block/docs/roadmap.md @@ -228,13 +228,53 @@ Recommended order from here: 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 +19. Phase 62: authority executor HTTP runtime. **Closed 2026-06-23, QA PASS** + (`internal/docs/finished-plans/phase62_finishedplan_authority_executor_http_runtime.md`). + The executor can call a typed HTTP runtime seam and preserve the + no-frontend/no-failback/non-ACK-mutation boundary. +20. Phase 63: rebuild runtime target contract. **Closed 2026-06-24, QA PASS** + (`internal/docs/finished-plans/phase63_finishedplan_rebuild_runtime_target_contract.md`). + Runtime targets carry the explicit endpoint/session/frontier fields needed + before a blockvolume runtime call can be attempted. +21. Phase 64: blockvolume runtime endpoint. **Closed 2026-06-24, QA PASS** + (`internal/docs/finished-plans/phase64_finishedplan_blockvolume_runtime_endpoint.md`). + The blockvolume status server exposes the bounded `/runtime/rebuild` + endpoint for rebuild/catch-up traffic under explicit opt-in. +22. Phase 65: runtime terminal evidence. **Closed 2026-06-24, QA PASS** + (`internal/docs/finished-plans/phase65_finishedplan_runtime_terminal_evidence.md`). + Rebuild runtime results now distinguish running/caught_up/blocked without + claiming frontend publication or failback. +23. Phase 66: caught-up publication preflight. **Closed 2026-06-24, QA PASS** + (`internal/docs/finished-plans/phase66_finishedplan_caught_up_publication_preflight.md`). + Caught-up rebuild evidence feeds the next publication preflight while + keeping ACK eligibility, frontend publication, and failback disabled. +24. Phase 67: ACK eligibility publication. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase67_finishedplan_ack_eligibility_publication.md`). + Terminal caught-up evidence can now record ACK eligibility, still without + frontend publication, rebuild traffic, or failback. +25. Phase 68: frontend publication preflight. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase68_finishedplan_frontend_publication_preflight.md`). + The product surfaces frontend-publication as an explicit disabled + preflight rather than implying it from ACK eligibility. +26. Phase 69: frontend publication target contract. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase69_finishedplan_frontend_publication_target_contract.md`). + A typed `SwBlockFrontendPublication` target exists, but it creates no + frontend or authority side effect. +27. Phase 70: frontend publication executor boundary. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase70_finishedplan_frontend_publication_executor_boundary.md`). + The executor writes disabled status only. +28. Phase 71: frontend publication live API boundary. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase71_finishedplan_frontend_publication_live_api_boundary.md`). + Live Kubernetes API/RBAC proves the executor remains status-only. +29. Phase 72: frontend publication runtime contract. **Closed 2026-06-25, QA PASS** + (`internal/docs/finished-plans/phase72_finishedplan_frontend_publication_runtime_contract.md`). + A generic typed HTTP runtime seam exists for future publication work. +30. Phase 73: frontend publication authority owner guard. **Closed 2026-06-25, local PASS** + (`internal/docs/finished-plans/phase73_finishedplan_frontend_publication_authority_owner_guard.md`). + The returned-replica pipeline now blocks independent frontend publication + when `primaryUnchanged=true`, because making a returned replica active is an + authority/failback operation, not a standalone runtime status success. +31. 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. @@ -248,12 +288,12 @@ evidence, executor-contract, disabled executor-process bridge, and first 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 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. +any real rebuild/catch-up traffic is enabled. Phases 60-65 prove and wire the +bounded rebuild/catch-up runtime path through terminal evidence. Phases 66-67 +record ACK eligibility after terminal caught-up evidence. Phases 68-73 define +and then deliberately constrain frontend publication: the generic runtime seam +exists, but returned-replica publication remains blocked until a real +authority/failback owner is implemented and gated. The practical rule is: diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 7041bdbd88..a92f451db6 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,109 +1,81 @@ -# Current Plan: Phase 72 Frontend Publication Runtime Contract +# Current Plan: Phase 73 Frontend Publication Authority Owner Guard Status: complete. ## Goal -Phase 71 proved the live Kubernetes API/RBAC boundary for the frontend -publication executor. Phase 72 adds the next code seam: a typed frontend -publication runtime contract and an explicit executor policy gate. - -This phase still does not wire a real blockmaster or blockvolume frontend -publication endpoint. The purpose is to prevent the next implementation from -becoming a fake status-only publish. - -## Delivered - -### D1: Runtime Contract - -Added: +Phase 72 added a generic typed runtime seam for future frontend publication. +Reviewing the actual product topology exposed a tighter rule: ```text -FrontendPublicationRuntime -FrontendPublicationRuntimeRequest -FrontendPublicationRuntimeResult -HTTPFrontendPublicationRuntime +returned-replica frontend publication cannot be a standalone runtime status +success while primaryUnchanged=true. ``` -The HTTP client posts JSON to an explicit runtime endpoint and decodes: +For a returned replica, making it the active frontend is an authority/failback +operation. If the product does not move authority, then claiming +`frontendPublished=true` is a semantic false-positive. If the product does move +authority, that must be owned by a future authority/failback executor, not by a +status-only frontend-publication executor. -```text -frontendPublished -failbackStarted -noStorageMutation -noCrossVolumeIdentityChange -evidenceRefs -``` +## Deliverables -### D2: Explicit Executor Gate +### D1: Returned-Replica Guard -`FrontendPublicationExecutorReconciler` now supports an opt-in execution path: - -```text -ExecutionRequested=true -ExecutionPolicyEnabled=true -``` - -Without both flags, execution is blocked. Default reconciliation remains the -Phase 70/71 status-only disabled path. - -The runtime path requires an explicit target shape: +When a `SwBlockFrontendPublication` target is sourced from ACK eligibility: ```text +sourceEligibilityName != "" frontendPublicationDecision=enabled frontendPublicationMutationAllowed=true -runtimeEndpoint= -ackEligibilityKnown=true -ackEligible=true -frontendFencedAfterExecution=true primaryUnchanged=true -durableFrontierCovered=true -noCrossVolumeIdentityChange=true ``` -### D3: Schema Contract - -`SwBlockFrontendPublication.spec` now admits the future execution contract: +the executor must: ```text -frontendPublicationDecision=enabled -runtimeEndpoint +write status=blocked +reason=frontend_publication_requires_authority_owner +not call runtime +not claim frontendPublished +not start failback +not mutate storage/workload state ``` -The existing target owner still creates only disabled targets, so default -product behavior does not change. +### D2: Preserve Generic Runtime Seam -### D4: Gate +The generic Phase 72 HTTP runtime contract remains covered for non-returned +targets. This keeps the typed request/result seam available while preventing +the returned-replica pipeline from using it as a fake publication. + +### D3: Gate Added: ```text -scripts/run-phase72-frontend-publication-runtime-contract-gate.sh -testops/scenarios/frontend-publication-runtime-contract-chain.yaml +scripts/run-phase73-frontend-publication-authority-owner-gate.sh +testops/scenarios/frontend-publication-authority-owner-chain.yaml ``` The gate proves: ```text -default executor remains disabled -execution policy blocks when not explicitly enabled -enabled target invokes runtime exactly through the typed contract -runtime failure does not claim frontendPublished -HTTP runtime errors surface -failback remains false -storage mutation remains false +returned replica runtime invocations = 0 +returned replica frontend_published=false +generic runtime seam preserved +runtime failure still does not false-publish +invalid terminal evidence still does not false-publish ``` ## Non-Claims -Phase 72 does not claim: +Phase 73 does not implement: ```text -real frontend publication endpoint exists -blockmaster publish target update -blockvolume runtime frontend switch -primary authority change -failback execution +real frontend publication endpoint +authority reassign/failback +blockmaster runtime HTTP/gRPC endpoint +blockvolume frontend switch storage/workload mutation NVMe ANA behavior ``` @@ -111,36 +83,32 @@ NVMe ANA behavior ## Verification ```text +go test ./core/ops -run "TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner|TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled|TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus|TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence|TestHTTPFrontendPublicationRuntime" -count=1 -v go test ./core/ops ./cmd/sw-block -C:\work\swblock.exe validate testops\scenarios\frontend-publication-runtime-contract-chain.yaml -20260625-153846-1bf7 frontend-publication-runtime-contract-chain PASS 24/24 +C:\work\swblock.exe validate testops\scenarios\frontend-publication-authority-owner-chain.yaml +"C:\Program Files\Git\bin\bash.exe" scripts/run-phase73-frontend-publication-authority-owner-gate.sh . ``` Terminal evidence: ```text -phase72_frontend_publication_runtime_contract_status=ok -core_ops_frontend_publication_runtime_tests=pass -frontend_publication_runtime_contract_schema_locked=true -frontend_publication_runtime_endpoint_field=true -frontend_publication_execution_policy_gate=true -frontend_publication_runtime_invoked_only_when_enabled=true -frontend_publication_runtime_failure_no_false_publish=true -frontend_publication_runtime_invalid_terminal_evidence_no_false_publish=true -frontend_publication_attempts=1 -frontend_published=true -failback_started=false -storage_mutation_allowed=false +phase73_frontend_publication_authority_owner_status=ok +core_ops_frontend_publication_authority_owner_tests=pass +returned_replica_frontend_publication_blocked=true +generic_runtime_contract_still_wired=true +runtime_failure_no_false_publish=true +runtime_invalid_terminal_evidence_no_false_publish=true +frontend_publication_requires_authority_owner=true +returned_replica_runtime_invocations=0 +returned_replica_frontend_published=false +generic_runtime_seam_preserved=true +frontend_publication_attempts=0 +failback_attempts=0 ``` ## Next -Phase 73 should implement the real runtime endpoint owner. The key design -decision is still open: - -```text -blockmaster authority endpoint vs blockvolume runtime endpoint -``` - -Do not mark a target as published until a real endpoint performs a real -product-owned side effect and returns terminal evidence. +The next real product capability must choose and implement an authority/failback +owner before enabling returned-replica frontend publication. Until then, the +safe product behavior is to keep frontend publication blocked with explicit +reason `frontend_publication_requires_authority_owner`. diff --git a/seaweed-block/internal/docs/finished-plans/phase73_finishedplan_frontend_publication_authority_owner_guard.md b/seaweed-block/internal/docs/finished-plans/phase73_finishedplan_frontend_publication_authority_owner_guard.md new file mode 100644 index 0000000000..eed3f08531 --- /dev/null +++ b/seaweed-block/internal/docs/finished-plans/phase73_finishedplan_frontend_publication_authority_owner_guard.md @@ -0,0 +1,113 @@ +# Phase 73 Finished Plan: Frontend Publication Authority Owner Guard + +Status: complete. + +## Problem + +Phase 72 added a generic HTTP runtime contract for future frontend publication. +That contract was too permissive for the current returned-replica pipeline: + +```text +ACK eligibility target +-> SwBlockFrontendPublication target +-> runtime reports frontendPublished=true +-> failbackStarted=false +``` + +For a returned replica, making it frontend-active is not a standalone local +runtime action. It is an authority/failback decision. If the product keeps +`primaryUnchanged=true`, it must not claim returned-replica frontend +publication. + +## Implementation + +Added a guard in `FrontendPublicationExecutorReconciler`: + +```text +sourceEligibilityName != "" +frontendPublicationDecision=enabled +frontendPublicationMutationAllowed=true +primaryUnchanged=true +``` + +now writes: + +```text +state=blocked +reasonCode=frontend_publication_requires_authority_owner +frontendPublished=false +failbackStarted=false +noStorageMutation=true +``` + +and does not call the runtime. + +The generic Phase 72 runtime seam remains covered for non-returned targets. +This preserves the typed HTTP request/result contract while preventing the +returned-replica path from using it as a fake product side effect. + +## Gate + +Added: + +```text +scripts/run-phase73-frontend-publication-authority-owner-gate.sh +testops/scenarios/frontend-publication-authority-owner-chain.yaml +``` + +The gate checks: + +```text +returned replica runtime invocations = 0 +returned replica frontend_published=false +generic runtime seam preserved +runtime failure has no false publish +invalid terminal evidence has no false publish +failback attempts = 0 +storage mutation allowed = false +``` + +## Verification + +```text +go test ./core/ops -run "TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner|TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled|TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus|TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence|TestHTTPFrontendPublicationRuntime" -count=1 -v +go test ./core/ops ./cmd/sw-block +C:\work\swblock.exe validate testops\scenarios\frontend-publication-authority-owner-chain.yaml +"C:\Program Files\Git\bin\bash.exe" scripts/run-phase73-frontend-publication-authority-owner-gate.sh . +``` + +Terminal evidence: + +```text +phase73_frontend_publication_authority_owner_status=ok +core_ops_frontend_publication_authority_owner_tests=pass +returned_replica_frontend_publication_blocked=true +generic_runtime_contract_still_wired=true +runtime_failure_no_false_publish=true +runtime_invalid_terminal_evidence_no_false_publish=true +frontend_publication_requires_authority_owner=true +returned_replica_runtime_invocations=0 +returned_replica_frontend_published=false +generic_runtime_seam_preserved=true +frontend_publication_attempts=0 +failback_attempts=0 +``` + +## Non-Claims + +Phase 73 does not implement: + +```text +blockmaster authority/failback endpoint +blockvolume frontend switch +real returned-replica frontend publication +automatic failback +storage/workload mutation +NVMe ANA parity +``` + +## Next + +Returned-replica frontend publication should remain blocked until a future +authority/failback owner owns the side effect and proves terminal evidence +through a live gate. diff --git a/seaweed-block/internal/docs/qa-assignments/phase73-frontend-publication-authority-owner-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase73-frontend-publication-authority-owner-qa-signoff.md new file mode 100644 index 0000000000..14863232a7 --- /dev/null +++ b/seaweed-block/internal/docs/qa-assignments/phase73-frontend-publication-authority-owner-qa-signoff.md @@ -0,0 +1,69 @@ +# Phase 73 Frontend Publication Authority Owner Guard QA Sign-off + +Verdict: PASS. + +## Scope + +Phase 73 validates that a returned-replica sourced +`SwBlockFrontendPublication` target cannot be converted into a fake +`frontendPublished=true` status by the generic runtime seam while +`primaryUnchanged=true`. + +This is a local/runner gate. It does not install Kubernetes resources. + +## Evidence + +Local checks: + +```text +go test ./core/ops -run "TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner|TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled|TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus|TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence|TestHTTPFrontendPublicationRuntime" -count=1 -v +go test ./core/ops ./cmd/sw-block +C:\work\swblock.exe validate testops\scenarios\frontend-publication-authority-owner-chain.yaml +"C:\Program Files\Git\bin\bash.exe" scripts/run-phase73-frontend-publication-authority-owner-gate.sh . +``` + +Gate summary: + +```text +phase73_frontend_publication_authority_owner_status=ok +core_ops_frontend_publication_authority_owner_tests=pass +returned_replica_frontend_publication_blocked=true +generic_runtime_contract_still_wired=true +runtime_failure_no_false_publish=true +runtime_invalid_terminal_evidence_no_false_publish=true +http_runtime_contract_posts_request=true +http_runtime_contract_errors_surface=true +http_runtime_contract_requires_endpoint=true +frontend_publication_requires_authority_owner=true +returned_replica_runtime_invocations=0 +returned_replica_frontend_published=false +generic_runtime_seam_preserved=true +frontend_publication_attempts=0 +failback_attempts=0 +phase73_frontend_publication_authority_owner_status=ok +``` + +## Result + +PASS: + +- Returned-replica frontend publication target writes blocked status. +- Runtime is not invoked for `sourceEligibilityName != ""` plus + `primaryUnchanged=true`. +- No false `frontendPublished=true` claim is produced. +- No failback, storage, workload, or cross-volume mutation is attempted. +- Generic non-returned runtime contract remains tested. + +## Environment Note + +Running the bash gate through `C:\Windows\system32\bash.exe` uses WSL Go +1.18.1 and fails on current gRPC dependencies (`cmp`, `iter`, `maps`, +`math/rand/v2`, `slices`). The gate passes under Git Bash / Windows Go 1.25.6, +and the runner target m02 has a compatible Go toolchain. This is an environment +version issue, not a product failure. + +## Non-Claims + +Phase 73 does not claim real frontend publication, automatic failback, +blockmaster authority mutation, blockvolume frontend switching, storage +mutation, or NVMe ANA parity. diff --git a/seaweed-block/scripts/run-phase73-frontend-publication-authority-owner-gate.sh b/seaweed-block/scripts/run-phase73-frontend-publication-authority-owner-gate.sh new file mode 100644 index 0000000000..9a9a651f23 --- /dev/null +++ b/seaweed-block/scripts/run-phase73-frontend-publication-authority-owner-gate.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +PRODUCT_ROOT="${1:-$(pwd)}" +ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase73-frontend-publication-authority-owner-gate}" +SUMMARY="${ARTIFACT_DIR}/phase73-frontend-publication-authority-owner-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 "phase73_frontend_publication_authority_owner_status=running" +write_summary "phase73_scope=frontend_publication_authority_owner_guard" +write_summary "storage_mutation_allowed=false" +write_summary "failback_started=false" + +OPS_PATTERN="TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner|TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled|TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus|TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence|TestHTTPFrontendPublicationRuntimePostsRequestAndDecodesResult|TestHTTPFrontendPublicationRuntimeReturnsHTTPError|TestHTTPFrontendPublicationRuntimeRequiresEndpoint" + +if (cd "${PRODUCT_ROOT}" && go test ./core/ops -run "${OPS_PATTERN}" -count=1 -v) >"${OPS_LOG}" 2>&1; then + write_summary "core_ops_frontend_publication_authority_owner_tests=pass" +else + write_summary "core_ops_frontend_publication_authority_owner_tests=fail" + cat "${OPS_LOG}" >&2 || true + exit 1 +fi + +require_log "returned_replica_frontend_publication_blocked" "^--- PASS: TestFrontendPublicationExecutorBlocksReturnedReplicaRuntimeWithoutAuthorityOwner" "${OPS_LOG}" +require_log "generic_runtime_contract_still_wired" "^--- PASS: TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled" "${OPS_LOG}" +require_log "runtime_failure_no_false_publish" "^--- PASS: TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus" "${OPS_LOG}" +require_log "runtime_invalid_terminal_evidence_no_false_publish" "^--- PASS: TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence" "${OPS_LOG}" +require_log "http_runtime_contract_posts_request" "^--- PASS: TestHTTPFrontendPublicationRuntimePostsRequestAndDecodesResult" "${OPS_LOG}" +require_log "http_runtime_contract_errors_surface" "^--- PASS: TestHTTPFrontendPublicationRuntimeReturnsHTTPError" "${OPS_LOG}" +require_log "http_runtime_contract_requires_endpoint" "^--- PASS: TestHTTPFrontendPublicationRuntimeRequiresEndpoint" "${OPS_LOG}" + +write_summary "frontend_publication_requires_authority_owner=true" +write_summary "returned_replica_runtime_invocations=0" +write_summary "returned_replica_frontend_published=false" +write_summary "generic_runtime_seam_preserved=true" +write_summary "frontend_publication_attempts=0" +write_summary "failback_attempts=0" +write_summary "phase73_frontend_publication_authority_owner_status=ok" diff --git a/seaweed-block/testops/scenarios/frontend-publication-authority-owner-chain.yaml b/seaweed-block/testops/scenarios/frontend-publication-authority-owner-chain.yaml new file mode 100644 index 0000000000..3c26e08401 --- /dev/null +++ b/seaweed-block/testops/scenarios/frontend-publication-authority-owner-chain.yaml @@ -0,0 +1,96 @@ +# Runner-native Phase 73 gate: returned-replica frontend publication requires +# a real authority/failback owner and must not be faked by runtime status. + +name: frontend-publication-authority-owner-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: frontend_publication_authority_owner_gate + actions: + - action: exec + node: m02 + timeout: 7m + cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner bash scripts/run-phase73-frontend-publication-authority-owner-gate.sh {{ product_root }}" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^phase73_frontend_publication_authority_owner_status=ok$" + save_as: phase73_ok + - action: assert_greater + actual: "{{ phase73_ok }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^frontend_publication_requires_authority_owner=true$" + save_as: authority_owner_required + - action: assert_greater + actual: "{{ authority_owner_required }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^returned_replica_runtime_invocations=0$" + save_as: no_returned_runtime + - action: assert_greater + actual: "{{ no_returned_runtime }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^returned_replica_frontend_published=false$" + save_as: no_false_publish + - action: assert_greater + actual: "{{ no_false_publish }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^generic_runtime_seam_preserved=true$" + save_as: generic_seam_preserved + - action: assert_greater + actual: "{{ generic_seam_preserved }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^frontend_publication_attempts=0$" + save_as: no_publication_attempts + - action: assert_greater + actual: "{{ no_publication_attempts }}" + threshold: "0" + + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner/phase73-frontend-publication-authority-owner-summary.txt" + pattern: "^failback_attempts=0$" + save_as: no_failback_attempts + - action: assert_greater + actual: "{{ no_failback_attempts }}" + threshold: "0" + + - name: collect + always: true + actions: + - action: collect_path + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase73-frontend-publication-authority-owner" + name: "remote-phases" + ignore_error: true