From 39111fc7628b53d97e453b45e265a9cd9679f68f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 17 Jun 2026 16:09:22 -0700 Subject: [PATCH] docs: enable mermaid diagrams in wiki --- seaweed-block/docs/wiki/developer-guide.md | 33 ++++++++++++++++++++++ seaweed-block/docs/wiki/phase-map.md | 16 ++++++++++- seaweed-block/docs/wiki/state-machines.md | 29 ++++++++++++++++++- seaweed-block/mkdocs.yml | 13 +++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/seaweed-block/docs/wiki/developer-guide.md b/seaweed-block/docs/wiki/developer-guide.md index b13e1e0316..959dc7ea8b 100644 --- a/seaweed-block/docs/wiki/developer-guide.md +++ b/seaweed-block/docs/wiki/developer-guide.md @@ -72,3 +72,36 @@ after: mkdocs build ``` +## Diagrams + +Use Mermaid for state machines and sequence diagrams: + +````markdown +```mermaid +stateDiagram-v2 + Ready --> Blocked: evidence fault + Blocked --> Unknown: evidence stale + Unknown --> Ready: fresh verified evidence +``` +```` + +Avoid screenshots for state machines. Mermaid diagrams stay reviewable in Git +and can be updated with the code. + +## Code Links + +For links to Markdown docs inside `docs/`, use normal relative Markdown links. +MkDocs renders those as site links. + +For links to source code under `cmd/`, `core/`, `charts/`, `scripts/`, or +`testops/`, prefer GitHub source links when the target should be clickable in +the built site: + +```markdown +[operator_status_controller.go](https://github.com/seaweedfs/seaweed-block/blob/main/core/ops/operator_status_controller.go) +``` + +MkDocs' default site only serves files under `docs_dir`. It does not render +repo-root source files as pages unless we add a source-link plugin or copy +generated code references into `docs/`. Keep wiki pages as explanations and +link to source-of-truth code rather than duplicating code. diff --git a/seaweed-block/docs/wiki/phase-map.md b/seaweed-block/docs/wiki/phase-map.md index b97ea8e218..96949a0a34 100644 --- a/seaweed-block/docs/wiki/phase-map.md +++ b/seaweed-block/docs/wiki/phase-map.md @@ -38,6 +38,21 @@ failback would add more states than the product can safely explain. Phase 44 closes this path: +```mermaid +flowchart LR + A[Helm install] --> B[First PVC] + B --> C[CSI creates SwBlockVolume CR] + C --> D[lifecycle-owner adds protection finalizer] + D --> E[operator-status writes status and Events] + E --> F[Delete requested] + F --> G{cleanup evidence} + G -->|missing/stale/residue| H[hold finalizer] + G -->|fresh clean| I[release protection finalizer] + H --> E + I --> J[CR deletion completes] + J --> K[uninstall zero residue] +``` + ```text install -> first PVC @@ -68,4 +83,3 @@ Which gate proves no false Ready=True? Returned-replica rebuild/failback is the natural next major product capability because it can reuse the operation-layer model built in Phases 35-44. - diff --git a/seaweed-block/docs/wiki/state-machines.md b/seaweed-block/docs/wiki/state-machines.md index e580090a4a..d5775f6d54 100644 --- a/seaweed-block/docs/wiki/state-machines.md +++ b/seaweed-block/docs/wiki/state-machines.md @@ -54,6 +54,17 @@ masked by CSI pod not ready. Delete-safety is evidence-driven: +```mermaid +stateDiagram-v2 + [*] --> Requested: delete timestamp observed + Requested --> HoldUnknown: cleanup evidence missing or stale + Requested --> HoldBlocked: residue evidence present + HoldUnknown --> Releasable: fresh clean cleanup evidence + HoldBlocked --> Releasable: residue cleared and fresh clean evidence + Releasable --> Released: lifecycle-owner removes protection finalizer + Released --> [*]: CR deletion completes +``` + ```text missing cleanup evidence -> unknown/requested -> hold finalizer stale cleanup evidence -> unknown/requested -> hold finalizer @@ -66,6 +77,23 @@ by operator-status. ## Finalizer Lifecycle +```mermaid +sequenceDiagram + participant CSI + participant CR as SwBlockVolume CR + participant OS as operator-status + participant LO as lifecycle-owner + participant QA as cleanup evidence + + CSI->>CR: create/update identity spec after CreateVolume + LO->>CR: add protection finalizer + OS->>CR: publish Ready status and Events + CR->>OS: deletionTimestamp observed + OS->>QA: read cleanup-summary evidence + OS->>CR: publish deleteSafety hold or releasable status + LO->>CR: remove only protection finalizer if releasable +``` + ```text SwBlockVolume created -> lifecycle-owner adds protection finalizer @@ -93,4 +121,3 @@ detect corruption This is the model for future dirty failures such as partial writes, stale replicas, and returned-replica rebuild. - diff --git a/seaweed-block/mkdocs.yml b/seaweed-block/mkdocs.yml index 256d2772a6..09efa98e5d 100644 --- a/seaweed-block/mkdocs.yml +++ b/seaweed-block/mkdocs.yml @@ -16,6 +16,19 @@ theme: plugins: - search +markdown_extensions: + - admonition + - pymdownx.details + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format + - pymdownx.highlight + - pymdownx.inlinehilite + - toc: + permalink: true + nav: - Home: wiki/index.md - Developer Guide: