diff --git a/seaweed-block/internal/docs/current-plan.md b/seaweed-block/internal/docs/current-plan.md index 8d088cfcdf..5797760163 100644 --- a/seaweed-block/internal/docs/current-plan.md +++ b/seaweed-block/internal/docs/current-plan.md @@ -1,6 +1,6 @@ # Current Plan: Phase 50 Returned-Replica Executor Preflight Status Schema -Status: complete; local validation PASS. +Status: complete; local validation PASS; live gate wrapper updated. Working branch: `phase50-test-validation-hygiene` @@ -86,13 +86,30 @@ Acceptance: [x] no spec/finalizer/storage mutation is added ``` -## D4: Validation +## D4: Live Gate Wrapper + +Goal: extend the existing returned-replica status/RBAC live gate so QA can +server-side dry-run `executorPreflights[]` against a real CRD schema and the +operator-status RBAC boundary. + +Acceptance: + +```text +[x] valid status patch includes executorPreflights[] +[x] server-side dry-run output contains executorPreflights +[x] forbiddenMutationClass is projected +[x] snake_case executor preflight payload is rejected +[x] unsupported executor preflight mode is rejected +``` + +## D5: Validation Validation completed: ```text [x] go test -count=1 ./cmd/sw-block [x] go test -count=1 ./core/ops +[x] swblock validate testops/scenarios/returned-replica-status-schema-rbac-chain.yaml ``` ## Next Phase Candidate diff --git a/seaweed-block/internal/docs/finished-plans/phase50_finishedplan_returned_replica_preflight_status_schema.md b/seaweed-block/internal/docs/finished-plans/phase50_finishedplan_returned_replica_preflight_status_schema.md index bfa923a083..822fb89ec0 100644 --- a/seaweed-block/internal/docs/finished-plans/phase50_finishedplan_returned_replica_preflight_status_schema.md +++ b/seaweed-block/internal/docs/finished-plans/phase50_finishedplan_returned_replica_preflight_status_schema.md @@ -21,6 +21,8 @@ ACK eligibility, frontend publication, or failback. - Added `SwBlockVolumeCRDExecutorPreflight` as the camelCase CRD DTO. - Added OpenAPI schema for `status.executorPreflights[]`. - Extended status writer, reconciler, conformance, and command tests. +- Extended the returned-replica live status/RBAC gate so server-side dry-run + validates `executorPreflights[]` against the real CRD schema. - Fixed a time-sensitive delete-safety test fixture so package tests remain deterministic. @@ -33,6 +35,8 @@ CRD schema includes actionType/decision/reason/mode/executor/frontier fields CRD schema rejects snake_case field drift writer emits camelCase status payload reconciler publishes preflight from ManagedVolume projection +live gate valid patch includes executorPreflights +live gate rejects snake_case/mode drift for executorPreflights mutation_allowed remains false ``` @@ -41,6 +45,7 @@ mutation_allowed remains false ```text go test -count=1 ./cmd/sw-block go test -count=1 ./core/ops +swblock validate testops/scenarios/returned-replica-status-schema-rbac-chain.yaml ``` Both passed. diff --git a/seaweed-block/internal/docs/qa-assignments/phase50-returned-replica-preflight-status-schema-qa-signoff.md b/seaweed-block/internal/docs/qa-assignments/phase50-returned-replica-preflight-status-schema-qa-signoff.md index ed6936ed43..1238eb2a29 100644 --- a/seaweed-block/internal/docs/qa-assignments/phase50-returned-replica-preflight-status-schema-qa-signoff.md +++ b/seaweed-block/internal/docs/qa-assignments/phase50-returned-replica-preflight-status-schema-qa-signoff.md @@ -14,16 +14,18 @@ Kubernetes mutation gate was added in this phase. | G3 writer payload | PASS | status writer emits `executorPreflights`, `actionType`, `mutationAllowed`, `durableFrontierLsn`, not snake_case | | G4 reconciler | PASS | operator-status reconciler writes preflight into `SwBlockVolumeCRDStatus` | | G5 command surfaces | PASS | returned-replica bundle test sees preflight in report, explain, and operator-snapshot/dashboard JSON | -| G6 package baseline | PASS | `cmd/sw-block` and `core/ops` package tests pass | +| G6 live gate wrapper | PASS | `returned-replica-status-schema-rbac-chain.yaml` now asserts valid `executorPreflights[]` server-side dry-run and forbidden drift | +| G7 package baseline | PASS | `cmd/sw-block` and `core/ops` package tests pass | ## Commands ```text go test -count=1 ./cmd/sw-block go test -count=1 ./core/ops +swblock validate testops/scenarios/returned-replica-status-schema-rbac-chain.yaml ``` -Both passed. +All passed locally. Full live execution of the wrapper remains a QA/lab step. ## Boundary diff --git a/seaweed-block/scripts/run-phase47-returned-replica-status-schema-rbac-gate.sh b/seaweed-block/scripts/run-phase47-returned-replica-status-schema-rbac-gate.sh index 0ca40ab5af..2223be6cf3 100644 --- a/seaweed-block/scripts/run-phase47-returned-replica-status-schema-rbac-gate.sh +++ b/seaweed-block/scripts/run-phase47-returned-replica-status-schema-rbac-gate.sh @@ -182,6 +182,27 @@ cat >"${ARTIFACT_DIR}/valid-status-patch.json" <<'JSON' "evidenceRefs": ["returned-replica-summary.txt"] } ], + "executorPreflights": [ + { + "actionType": "authority.reintegrate_returned_replica", + "replicaID": "r1", + "decision": "ready", + "reason": "preconditions_satisfied", + "mode": "dry_run", + "sideEffectClass": "authority_mutating", + "ownerExecutor": "authority_recovery_executor", + "mutationAllowed": false, + "frontendFenced": true, + "ackEligible": false, + "durableFrontierKnown": true, + "durableFrontierLsn": 52, + "requiredFrontierKnown": true, + "requiredFrontierLsn": 52, + "evidenceRequired": "returned_replica_reintegration_evidence", + "evidenceRefs": ["returned-replica-summary.txt"], + "forbiddenMutationClass": ["ack_eligibility", "frontend_publication", "rebuild_traffic", "failback"] + } + ], "allowedActions": [ { "type": "authority.reintegrate_returned_replica", @@ -211,6 +232,14 @@ cat >"${ARTIFACT_DIR}/snake-status-patch.json" <<'JSON' "mode": "dry_run", "mutation_allowed": false } + ], + "executorPreflights": [ + { + "action_type": "authority.reintegrate_returned_replica", + "decision": "ready", + "mode": "dry_run", + "mutation_allowed": false + } ] } } @@ -226,6 +255,21 @@ cat >"${ARTIFACT_DIR}/bad-mode-status-patch.json" <<'JSON' "mode": "execute", "mutationAllowed": false } + ], + "executorPreflights": [ + { + "actionType": "authority.reintegrate_returned_replica", + "decision": "ready", + "reason": "preconditions_satisfied", + "mode": "execute", + "sideEffectClass": "authority_mutating", + "ownerExecutor": "authority_recovery_executor", + "mutationAllowed": false, + "frontendFenced": true, + "ackEligible": false, + "durableFrontierKnown": true, + "requiredFrontierKnown": true + } ] } } @@ -236,6 +280,10 @@ run_expect_success valid-status-server-dry-run \ --subresource=status --type=merge --patch-file "${ARTIFACT_DIR}/valid-status-patch.json" \ --dry-run=server -o yaml --as "${SA_USER}" write_summary "valid_returned_replica_status_server_dry_run=true" +grep -q "executorPreflights:" "${ARTIFACT_DIR}/valid-status-server-dry-run.stdout.txt" +write_summary "valid_executor_preflight_status_server_dry_run=true" +grep -q "forbiddenMutationClass:" "${ARTIFACT_DIR}/valid-status-server-dry-run.stdout.txt" +write_summary "executor_preflight_forbidden_mutation_class_projected=true" run_expect_failure snake-status-server-dry-run \ "${KUBECTL}" patch swblockvolume phase47-returned -n "${NAMESPACE}" \ diff --git a/seaweed-block/testops/scenarios/returned-replica-status-schema-rbac-chain.yaml b/seaweed-block/testops/scenarios/returned-replica-status-schema-rbac-chain.yaml index 0308c32aab..6de68f0014 100644 --- a/seaweed-block/testops/scenarios/returned-replica-status-schema-rbac-chain.yaml +++ b/seaweed-block/testops/scenarios/returned-replica-status-schema-rbac-chain.yaml @@ -37,6 +37,22 @@ phases: - action: assert_greater actual: "{{ phase47_valid_status_count }}" threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase47-status-schema-rbac/phase47-returned-replica-status-schema-rbac-summary.txt" + pattern: "^valid_executor_preflight_status_server_dry_run=true$" + save_as: phase50_valid_preflight_count + - action: assert_greater + actual: "{{ phase50_valid_preflight_count }}" + threshold: "0" + - action: grep_log + node: m02 + path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase47-status-schema-rbac/phase47-returned-replica-status-schema-rbac-summary.txt" + pattern: "^executor_preflight_forbidden_mutation_class_projected=true$" + save_as: phase50_forbidden_mutation_class_count + - action: assert_greater + actual: "{{ phase50_forbidden_mutation_class_count }}" + threshold: "0" - action: grep_log node: m02 path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase47-status-schema-rbac/phase47-returned-replica-status-schema-rbac-summary.txt"