docs: open phase39 delete safety plan

This commit is contained in:
pingqiu committed 2026-06-10 12:24:07 -07:00
1 parent b0ad2f4322
commit 8b012a67e5
3 files changed
+175 -164

No files matched your search

+6 -6
View File
@@ -84,6 +84,9 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop:
not become false `Ready=True`.
- Cleanup verification for Kubernetes, iSCSI, multipath, process, and hostPath
residue.
- Executable lifecycle action contracts: dry-run actions can be allowed with
evidence, unsafe/future-mutating actions are rejected with stable reasons, and
CRD/report/dashboard/operator-snapshot surfaces agree on the decision.
The product model is converging around one read-only control-plane pattern:
truth owners publish facts, the status layer aggregates judgment, executors stay
@@ -92,12 +95,9 @@ preserve that model rather than add isolated scripts or separate status systems.
Recommended order from here:
1. Define and test the lifecycle action model before adding mutating operator
behavior. This must include executable dry-run and rejected-action gates, not
only a document.
2. Add finalizer/delete safety as the first mutating operator slice.
3. Add upgrade/rollback drift status before upgrade execution.
4. Add returned-replica rebuild/failback, backup/restore, and NVMe ANA parity
1. Add finalizer/delete safety as the first mutating operator slice.
2. Add upgrade/rollback drift status before upgrade execution.
3. Add returned-replica rebuild/failback, backup/restore, and NVMe ANA parity
only after the status/action model stays stable.
## Future Non-Kubernetes Adapters
+154 -141
View File
@@ -1,183 +1,215 @@
# Current Plan: Phase 38 - Lifecycle Action Model Executable Contract
# Current Plan: Phase 39 - Finalizer / Delete Safety
Status: closed, 100% complete. Started on 2026-06-09; closed on 2026-06-10.
Status: active, 0% complete. Started on 2026-06-10.
Branch: `phase33-testops-failure-hardening`
Previous phase: Phase 37 is closed in
`internal/docs/finished-plans/phase37_finishedplan_live_node_evidence_hardening.md`.
Previous phase: Phase 38 is closed in
`internal/docs/finished-plans/phase38_finishedplan_lifecycle_action_model_executable_contract.md`.
## Product Goal
Turn safe next-step/action hints into an executable contract before adding
mutating operator behavior.
Add the first narrow mutating operator path: safe finalizer/delete behavior for
Seaweed Block lifecycle objects.
Phase 35-37 made status trustworthy and visible. Phase 38 makes action
eligibility explicit: a future executor must be able to explain why an action is
allowed as read-only/dry-run, rejected for missing facts, or blocked because it
would mutate storage/authority without a product gate.
Phases 35-38 established read-only CRD status, Events, live node evidence,
support/cleanup visibility, and executable action decisions. Phase 39 validates
that model with one real mutation: the operator may protect and release a
`SwBlockVolume` finalizer only when its preconditions and cleanup evidence say
the object can be safely deleted.
The hard exit statement:
```text
Every surfaced action has a typed contract, required facts, policy gate,
executor, invariant/evidence refs, and a testable allow/reject decision. No
operator mutation is added in this phase.
Deleting a managed SwBlockVolume either completes safely with no residue or is
blocked with explicit status, reason, evidence, and a non-mutating next step.
The operator mutates only finalizer metadata and status/events in this phase.
```
## Scope Contract
| In | Out |
|---|---|
| action registry / typed contracts | finalizers/delete safety |
| executable allow/reject evaluator | automatic cleanup |
| dry-run action proof | repair/rebuild/failback |
| rejected-action proof | backup/snapshot/restore |
| CRD/report/dashboard/operator-snapshot agreement | NVMe ANA parity |
| TestOps or unit/component action gates | new mutating RBAC |
| QA assignment for strict action validation | dashboard mutation buttons |
| SwBlockVolume finalizer contract | PVC finalizer ownership |
| delete-requested status projection | automatic cleanup execution |
| bounded finalizer add/remove mutation | iSCSI/multipath/hostPath deletion by operator |
| idempotent reconcile and retry behavior | promotion/fencing/rebuild/failback |
| cleanup verifier evidence consumption | backup/snapshot/restore |
| Kubernetes Events for blocked/released delete | NVMe ANA parity |
| RBAC narrowed to finalizers + status + events | dashboard mutation buttons |
| TestOps delete-safety gates | broad production delete lifecycle |
Allowed implementation rule:
```text
Phase 38 may evaluate actions and emit read-only/dry-run/scripted status.
Phase 39 may patch SwBlockVolume metadata.finalizers, SwBlockVolume/status,
and Kubernetes Events.
Phase 38 must not patch spec, delete objects, run cleanup, import images,
change Helm releases, promote/fence/rebuild/failback, or mutate storage.
Phase 39 must not delete PVC/PV/Pods/Deployments/StorageClasses, run cleanup
scripts, change Helm releases, import images, touch iSCSI/multipath/dmsetup,
remove hostPath data, promote/fence/rebuild/failback, or mutate storage.
```
## D1: Action Contract Inventory
## D1: Delete-Safety Contract Review
Goal: pin the current action vocabulary and identify which actions are
read-only, dry-run, scripted, disabled, or future-mutating.
Goal: define exactly what the finalizer owns and which facts are required before
it can release deletion.
Status: complete.
Status: pending.
Acceptance:
```text
[x] every action type has owner executor
[x] every action type has side-effect class
[x] every action type has required facts
[x] every non-observe action has policy gate
[x] no action has mutation_allowed=true
[ ] SwBlockVolume finalizer name is defined
[ ] delete states are defined: not_requested, requested, blocked, releasable,
released
[ ] required facts are defined: volume identity, PVC/PV linkage, cleanup
summary, active sessions, multipath/dmsetup state, generated workload
residue, hostPath residue
[ ] action contract maps delete release/block to Phase 38 evaluator language
[ ] non-claims explicitly exclude automatic cleanup and PVC finalizer ownership
```
Verification:
```text
go test ./core/ops
internal review of finalizer/delete contract doc
```
## D2: Executable Allow/Reject Evaluator
## D2: Status-Only Delete Projection
Goal: add a code-level evaluator that turns action contracts plus current facts
into an allow/reject decision without performing side effects.
Goal: before adding finalizer mutation, prove delete-requested and
delete-blocked states project correctly from evidence.
Status: complete.
Status: pending.
Acceptance:
```text
[x] dry-run action with required facts returns allowed
[x] missing required facts returns rejected with missing_facts
[x] disabled authority mutation returns rejected
[x] unknown action returns rejected
[x] evaluator output includes mode, side-effect class, executor,
invariant refs, and evidence requirement
```
Verification:
```text
go test ./core/ops
```
## D3: Surface Agreement For Action Decisions
Goal: ensure report, operator-snapshot, CRD status, and dashboard do not diverge
on the action contract.
Status: complete.
Acceptance:
```text
[x] operator-snapshot exposes the same action fields as the evaluator contract
[x] SwBlockVolume.status.allowedActions remains camelCase and schema-valid
[x] blocked path still has dry-run/read-only actions only
[x] no surface shows mutationAllowed=true
[x] action reasons/evidence refs survive from-bundle replay
[ ] deletionTimestamp-like evidence projects DeletionRequested/Blocked status
[ ] residue evidence projects CleanupRequired=True and reason=cleanup_required
[ ] clean evidence projects delete releasable, not false blocked
[ ] report, explain, dashboard, operator-snapshot, and CRD status agree
[ ] no finalizer mutation is enabled yet
```
Verification:
```text
go test ./core/ops ./cmd/sw-block
server-side dry-run or live CRD status patch check
from-bundle replay for clean and residue delete evidence
```
## D4: Rejected-Action Gate
## D3: Finalizer Mutation Boundary
Goal: prove unsafe or underspecified actions fail closed before any executor can
run.
Goal: add the minimum RBAC and code path for finalizer metadata mutation, with
no storage/workload mutation.
Status: complete.
Status: pending.
Acceptance:
```text
[x] authority.request_promotion is rejected under current policy
[x] action with missing required facts is rejected with a stable reason
[x] rejected action is visible as not executable, not silently omitted
[x] Kubernetes RBAC remains status/events/read-only only
```
Verification:
```text
go test ./core/ops
TestOps/QA replay gate for rejected action evidence
```
## D5: Dry-Run Action Gate
Goal: prove one non-mutating dry-run action is executable as a dry-run decision
and still does not mutate the cluster.
Status: complete.
Acceptance:
```text
[x] safe_k8s.reinstall_external_iscsi can evaluate allowed in dry-run mode
[x] evaluation names preconditions, executor, invariant refs, evidence refs
[x] no Helm release, Deployment, PVC/PV, image, iSCSI, multipath, or hostPath
mutation occurs
[x] report/dashboard/operator-snapshot agree on the dry-run boundary
[ ] operator can patch SwBlockVolume metadata.finalizers only
[ ] operator cannot patch spec, PVC/PV, pods, deployments, storageclasses,
secrets, nodes, iSCSI, multipath, hostPath, or Helm resources
[ ] finalizer is added idempotently to managed SwBlockVolume objects
[ ] finalizer removal requires a releasable delete decision
[ ] all finalizer decisions emit status and Events
```
Verification:
```text
go test ./core/ops ./cmd/sw-block
TestOps loopback-cross-node dry-run action replay
helm template/lint with updated RBAC
kubectl auth can-i boundary sweep
```
## D6: Close Gate
## D4: Delete Block Gate
Goal: close the action model as a real product foundation for Phase 39
finalizer/delete safety.
Goal: prove deletion is held when residue or insufficient evidence exists.
Status: complete.
Status: pending.
Acceptance:
```text
[x] D1-D5 pass
[x] no new mutating RBAC is introduced
[x] QA assignment records non-claims and follow-ups
[x] QA validates dry-run and rejected-action evidence
[ ] deleting SwBlockVolume with active/residue evidence keeps finalizer
[ ] status shows blocked or cleanup_required with stable reason
[ ] safe next step is observe.verify_cleanup or collect bundle, mutation=false
[ ] no Ready=True or released event appears while blocked
[ ] repeated reconcile does not add duplicate finalizers or unbounded Events
```
Verification:
```text
TestOps/from-bundle delete-residue scenario
live CRD delete attempt if lab is available
```
## D5: Delete Release Gate
Goal: prove deletion completes only when cleanup evidence is clean.
Status: pending.
Acceptance:
```text
[ ] deleting SwBlockVolume with clean evidence removes finalizer
[ ] object deletion completes
[ ] final status/event records release decision before deletion when possible
[ ] repeated reconcile is idempotent
[ ] final cleanup verifier returns cleanup_status=ok
```
Verification:
```text
TestOps live delete clean scenario
cleanup verifier on m01/m02/tp01 if lab is healthy
```
## D6: Multi-Volume Isolation Gate
Goal: prove delete-safety for one volume does not affect unrelated volumes.
Status: pending.
Acceptance:
```text
[ ] deleting volume A does not change volume B/C status, finalizers, publish
targets, or ManagedVolume identity
[ ] blocked delete on volume A does not block status publication for volume B/C
[ ] clean delete on volume A does not trigger cleanup or action on volume B/C
[ ] no cross-volume Events or reason-code mix-up
```
Verification:
```text
TestOps multi-volume delete-safety scenario
```
## D7: Close Gate
Goal: close Phase 39 only after the first mutating operator path is proven
bounded, idempotent, observable, and residue-safe.
Status: pending.
Acceptance:
```text
[ ] D1-D6 pass
[ ] RBAC grants only finalizer/status/event writes
[ ] no storage/workload/host mutation is introduced
[ ] QA validates blocked-delete, clean-delete, and multi-volume isolation gates
[ ] finished plan records non-claims and follow-ups
```
Verification:
@@ -189,44 +221,25 @@ helm lint charts/seaweed-block
helm template sw-block charts/seaweed-block --namespace kube-system --include-crds \
--set operatorStatus.create=true --set operatorStatus.dryRun=false
git diff --check
QA strict rerun or replay from clean bundle
QA strict rerun from clean lab
```
## Current Progress
- 0%: Phase 38 opened. Scope is action eligibility only; no operator mutation.
- 18%: D1/D2 completed. `core/ops` now has an executable
`EvaluateManagedVolumeAction` contract that allows dry-run actions only when
required facts exist, rejects missing facts with `missing_required_facts`,
rejects disabled authority mutation with `policy_disabled`, and rejects
unknown actions. Unit tests cover allowed dry-run, missing facts, disabled
authority mutation, and unknown action rejection.
- 42%: D3 completed. ManagedVolume actions now carry evaluator decisions
(`allowed`/`rejected`), rejection reasons, missing facts, invariant refs, and
evidence requirements through projection text, operator-snapshot, and
SwBlockVolume CRD status. The CRD schema and status DTO use camelCase fields
(`decisionReason`, `missingFacts`, `evidenceRequired`) to avoid live schema
rejection.
- 60%: D4 completed. The action evaluator now has a rejected-action evidence
renderer. Unit gates prove every action contract is covered by the evaluator,
`authority.request_promotion` stays rejected with `policy_disabled`, and the
rendered evidence names side-effect class, executor, evidence requirement,
and `mutation_allowed=false`.
- 78%: D5 completed. A cross-node loopback bundle now proves
`safe_k8s.reinstall_external_iscsi` evaluates `allowed` in `dry_run` mode
while the operator contract and snapshot keep `mutation_allowed=false`.
`summary.txt`, explain text, dashboard `/operator-snapshot.json`, and the
operator snapshot agree on the decision and required evidence.
- 88%: D6 moved to QA. The Phase 38 QA assignment defined strict local,
replay, optional live RBAC, and non-mutation gates for rejected and dry-run
action evidence.
- 100%: Phase 38 closed. QA passed G1-G5 on `ea1618d`: local contract tests,
rejected-action evidence, dry-run loopback action evidence, CRD/RBAC boundary,
non-mutation, and cleanup. Finished plan:
`internal/docs/finished-plans/phase38_finishedplan_lifecycle_action_model_executable_contract.md`.
- 0%: Phase 39 opened. Scope is limited to `SwBlockVolume` finalizer/delete
safety as the first mutating operator path. PVC finalizers, automatic cleanup,
repair/rebuild/failback, backup/restore, and NVMe remain out of scope.
## Prerequisites / Risks
- QA reported `tp01` as `NotReady`/unreachable during Phase 38 sign-off. Restore
`tp01` before D6 multi-volume or any 3-node delete-safety gate.
- This phase must not become a cleanup executor. If residue exists, the correct
behavior is to block deletion with evidence and a safe next step.
- Finalizer behavior must be idempotent; retries and repeated reconciles are
expected.
## Next Step
Open Phase 39 for finalizer/delete safety as the first narrow mutating operator
path. Restore lab node `tp01` before any Phase 39 multi-node delete-safety
scenario.
Start D1: write the delete-safety contract and map finalizer decisions onto the
Phase 38 action model before implementing finalizer mutation.
+15 -17
View File
@@ -511,20 +511,16 @@ Still incomplete:
The operations work can continue forever unless the next phases are bounded by
product risk. The recommended order is:
1. **Phase 37: Live node evidence hardening.**
Highest ROI and lowest mutation risk. It makes the read-only status model
trustworthy before any lifecycle action depends on it. It should cover
only Kubernetes Ready/SchedulingDisabled, CSI node pod readiness,
CSIDriver/node-plugin registration, required image presence or image-pull
status, iSCSI/multipath prerequisite evidence, and loopback target
cross-node blockers.
2. **Phase 38: Lifecycle action model executable contract.**
Define and test the contract for future mutating actions before implementing
them: facts required, preconditions, invariants, allowed executor,
rollback/failure behavior, and evidence emitted. This phase must include at
least one dry-run action test and one rejected-action test; documentation
alone is not enough.
3. **Finalizer/delete safety.**
1. **Phase 37: Live node evidence hardening.** Closed.
Kubernetes Ready/SchedulingDisabled, CSI node pod readiness,
CSIDriver/node-plugin registration, image-pull status, host-prereq replay,
and loopback target cross-node blockers are now projected through the shared
status surfaces.
2. **Phase 38: Lifecycle action model executable contract.** Closed.
Future actions now have facts, preconditions, invariants, allowed executor,
policy gate, evidence, and allow/reject decisions. It includes both a dry-run
action gate and a rejected-action gate.
3. **Phase 39: Finalizer/delete safety.** Active.
First mutating lifecycle slice. It should remove or block deletion with clear
status when PVC/CRD teardown would leave iSCSI, multipath, hostPath, or
generated workload residue.
@@ -572,10 +568,12 @@ Approximate engineering effort if scope remains tight:
node readiness, support evidence pointers, cleanup visibility, and surface
agreement are QA-validated under the read-only control-plane model. Live
negative node evidence remains Phase 37.
- Active work is Phase 37 Live Node Evidence Hardening.
- Phase 37 Live Node Evidence Hardening is closed.
- Phase 38 Lifecycle Action Model Executable Contract is closed.
- Active work is Phase 39 Finalizer/Delete Safety.
- Do not start NVMe ANA parity, rebuild/failback, backup/restore, or mutating
operator workflows by extending Phase 36. Pick those as separate gated
phases.
operator workflows by extending Phase 39. Pick those as separate gated
phases after finalizer/delete safety closes.
- When the current plan closes, move it to `internal/docs/finished-plans/`
with a phase/topic filename such as
`phase1_finishedplan_frontend_protocol_readiness.md`.