phase47: validate returned replica status schema

This commit is contained in:
pingqiu committed 2026-06-19 14:58:15 -07:00
1 parent a711415ad7
commit 732d2d3b9e
3 files changed
+80 -7

No files matched your search

@@ -95,6 +95,19 @@ func TestPhase40D1KubernetesStatusClientConformsToCRDSchemaAndRBAC(t *testing.T)
{Type: ConditionReady, Status: "False", Reason: "iscsi_node_records_present", Severity: "warning"},
{Type: ConditionCleanupRequired, Status: "True", Reason: "iscsi_node_records_present", Severity: "warning"},
},
ReplicaReintegrations: []SwBlockVolumeCRDReturnedReplica{{
ReplicaID: "r1",
State: ReturnedReplicaStateFenced,
ReasonCode: ReasonReturnedReplicaFrontendFenced,
FrontendFenced: true,
FrontendPrimaryReady: false,
AckEligible: false,
DurableFrontierKnown: true,
DurableFrontierLSN: 52,
RequiredFrontierKnown: true,
RequiredFrontierLSN: 52,
EvidenceRefs: []string{"returned-replica-summary.txt"},
}},
DeleteSafety: &SwBlockVolumeCRDDeleteSafety{
ActionType: SwBlockVolumeDeleteActionReleaseFinalizer,
Decision: ManagedVolumeActionDecisionRejected,
@@ -113,6 +126,17 @@ func TestPhase40D1KubernetesStatusClientConformsToCRDSchemaAndRBAC(t *testing.T)
MutationAllowed: false,
EvidenceRequired: "cleanup-summary.txt",
EvidenceRefs: []string{"cleanup-summary.txt"},
}, {
Type: ManagedVolumeActionReintegrateReturned,
Mode: ManagedVolumeActionModeDryRun,
SideEffectClass: ManagedVolumeSideEffectAuthorityMutating,
OwnerExecutor: "authority_recovery_executor",
Decision: ManagedVolumeActionDecisionAllowed,
MutationAllowed: false,
Preconditions: []string{"returned_replica_frontend_fenced", "durable_frontier_evidence"},
InvariantRefs: []string{"INV-RETURNED-REPLICA-FENCING-001", "INV-RETURNED-REPLICA-FRONTIER-001"},
EvidenceRequired: "returned_replica_reintegration_evidence",
EvidenceRefs: []string{"returned-replica-summary.txt"},
}},
NonClaims: []string{"no_automatic_cleanup_execution"},
EvidenceRefs: []string{"cleanup-summary.txt"},
+10 -7
View File
@@ -86,15 +86,18 @@ Goal: stop repeating live-only CRD/RBAC failures from Phases 35-42.
Acceptance:
```text
[ ] real or envtest API validates SwBlockVolume status payloads
[ ] returned-replica action DTO uses the same enum/casing as the CRD
[ ] operator-status remains status/events-only
[ ] lifecycle-owner remains finalizer-only where enabled
[ ] no main-object/spec/storage/workload mutation is added
[x] schema-aware API validates SwBlockVolume status payloads
[x] returned-replica action DTO uses the same enum/casing as the CRD
[x] operator-status remains status/events-only
[x] lifecycle-owner remains finalizer-only where enabled
[x] no main-object/spec/storage/workload mutation is added
```
If envtest is not feasible in this repo slice, QA must run a real-apiserver
server-side-dry-run gate before D3 closes.
Implementation note: `TestPhase40D1KubernetesStatusClientConformsToCRDSchemaAndRBAC`
now includes the Phase 47 `authority.reintegrate_returned_replica` allowed
dry-run payload and validates it against the CRD schema-aware mock. QA should
still run a real-apiserver server-side-dry-run gate before release or before a
later mutating executor phase.
## D3: Product Surface Rerun
@@ -0,0 +1,46 @@
# Phase 47 D2 Returned-Replica Status Schema/RBAC QA Sign-off
Status: DEV VALIDATED. Real-apiserver QA rerun still recommended before any
mutating executor phase.
Validated source: local branch `phase47-returned-replica-executor-gate`.
## Gate
D2 extends the schema-aware status API conformance test so the new Phase 47
returned-replica action payload is validated against the same CRD schema and
RBAC boundary that previously caught live-only failures.
## Evidence
Targeted test:
```text
go test -count=1 ./core/ops
```
The conformance path now writes a `SwBlockVolume.status` payload containing:
- `replicaReintegrations[]` with camelCase frontier/fencing fields,
- `allowedActions[]` entry for `authority.reintegrate_returned_replica`,
- `decision=allowed`,
- `mode=dry_run`,
- `mutationAllowed=false`,
- returned-replica evidence and invariant refs.
## Boundary
The schema/RBAC mock still enforces:
- operator-status writes only `/status`,
- main-object patch is forbidden to operator-status,
- finalizers endpoint is forbidden,
- lifecycle-owner main-object patch remains finalizer-only in its own gate,
- unsupported enum/casing drift returns 422.
## Non-Claims
This is not a real Kubernetes API server. It is a schema-aware local gate that
shifts CRD casing/enum mistakes left. QA should still run a real-apiserver
server-side-dry-run validation before any later executor phase is allowed to
mutate storage or authority state.