Compare commits

..
Author SHA1 Message Date
pingqiu 58347a55f0 ci(block): refuse workspace aliases before cleanup 2026-12-05 00:34:43 -08:00
pingqiu 12b9f2f037 ci(block): pin merge evidence and refuse control changes 2026-12-05 00:16:07 -08:00
pingqiu 9bdd7f25e0 ci(block): bound runner disk use and clean job workspaces 2026-12-04 23:56:51 -08:00
pingqiu 35c6faf789 ci: use the integrated root documentation link checker 2026-12-04 19:32:20 -08:00
Chris LuandClaude Opus 5.5 ed7592dc4d ci: run the block documentation link check from root scripts
The Relative documentation links step called .github/scripts/doc-links-check.py
and its test inside seaweed-block/, but neither the imported module nor
upstream seaweed-block has them, so the unit suite would fail once the step
runs. Add the checker and its test under .github/block/scripts/ with the
other port scripts and point the step and its contract test there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:22:24 -08:00
Chris LuandClaude Opus 5.5 915909cf6b ci: refuse a block release without notes before pushing images
The notes file was first checked in the last step, after both images
(and, for the highest stable tag, :alpha) were already pushed to GHCR, so
a tag without docs/releases/vX.Y.Z.md left the images published and no
GitHub release. Check it with the tag format, before anything is pushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:21:27 -08:00
Chris LuandClaude Opus 5.5 fef4dbaaac ci: publish block releases from hosted runners
The release job holds contents: write and packages: write and logs in to
GHCR, and builds its images with the runner's Docker. Following
BLOCK_RUNNER_LABEL put it on the persistent pool that same-repository PR
test jobs also use, whose Docker and build cache those jobs can leave
state in, and whose Docker setup is still listed as unvalidated. The
source repository published from ubuntu-latest; keep that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:21:26 -08:00
Chris LuandClaude Opus 5.5 ed6d649794 ci: keep the block post-merge-review check on hosted runners
The job's own comment records that it ended in 'Set up job' with no log on
every self-hosted runner, and the source repository ran it on ubuntu-latest.
The port made it follow BLOCK_RUNNER_LABEL, so setting the variable would
bring that failure back for every labelled same-repository PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 19:21:25 -08:00
pingqiu 1776005e5b ci: check block documentation relative links 2026-12-04 19:12:07 -08:00
pingqiu b699a0dd01 ci: preserve policy self-exclusion at the root path 2026-12-04 19:06:49 -08:00
pingqiu 4762c84e43 ci: port block workflows to the shared repository 2026-12-04 19:06:49 -08:00
149 changed files with 13355 additions and 886 deletions

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
# Block CI in the shared repository
The block module stays in `seaweed-block/` with its own `go.mod` and unchanged module path. Root `block-*.yml` workflows run shell commands there; action inputs name the subdirectory explicitly. The imported subtree is unchanged: every port file lives under root `.github/`. Existing module scripts and data remain base-owned inputs; only the Git adapters, unit-group coordinator and relative documentation link check live in root `.github/block/scripts/`. The existing nested workflows are inert because GitHub only discovers root workflows.
PR and master-push workflows select `seaweed-block/**` and their root block workflow files. All jobs default to `ubuntu-latest`. Set the repository variable `BLOCK_RUNNER_LABEL` only after the corresponding dedicated runner label is registered and available; same-repository/trusted events of the test, spec-trace and known-bugs jobs then use that label. The post-merge-review paths check and the release always run hosted. Fork PRs always use GitHub-hosted runners. GitHub Actions cannot fall back after requesting an unavailable label, so an unset variable is the explicit safe default. Unset it again if the registered pool is withdrawn. Runner discovery would require runner-management API access that the read-only workflow token does not have; no new credential is requested.
The unit check keeps `go test (linux)` and `process-level tests (real binaries)` under workflow `Block Test`. Module-relative diff/blob adapters preserve the block model map and allow list. Root block workflow/Docker recipe changes still pass the block trace/public-text checks; unrelated host code is excluded. No imported module paths or product formats change.
## Read-only merge checks
From a trusted current master checkout, run inside the module:
```sh
python3 ../.github/block/scripts/safe-merge-check.py 123
```
It requires an open, ready, mergeable PR, the latest successful `Block Test` run at its exact head against current master, both successful named jobs, and the base-owned spec-trace/public-text checks. It rechecks head/base after inspection. It never merges or comments. The manager performs the authorized squash merge with `--match-head-commit`.
For a batch, preserve its builder's exact order in a local manifest:
```json
{"base":"BASE_SHA","batch_pr":123,"head":"BATCH_SHA","prs":[{"number":121,"head":"HEAD_121","evidence":"evidence/121.txt"},{"number":122,"head":"HEAD_122","evidence":"evidence/122.txt"}]}
```
```sh
python3 ../.github/block/scripts/safe-merge-check.py --batch batch.json
# After the authorized ordered squash merges, compare master with the printed tested tree:
python3 ../.github/block/scripts/safe-merge-check.py --verify-tree TESTED_TREE_SHA
```
The manifest and acceptance files are operator inputs from the batch builder, never files supplied by a PR. Batch readiness refuses a moved master/head, changed order or missing evidence and runs each member's base-owned local checks. Building/pushing a batch and merging remain manager operations.
## Releases
Only `seaweed-block/vX.Y.Z[-pre]` tags publish. Image tags omit the namespace and retain the existing block/CSI image names. Only block stable tags decide whether `alpha` advances. Root-context Docker recipes preserve Git revision metadata while building the nested module and retain the lab-binary refusal.
The Linux amd64 tarball contains `blockmaster`, `blockvolume` and `sw-block` copied from the exact published image digest, with `SHA256SUMS`. The GitHub release uses the namespaced tag and does not replace the shared repository's latest release. Release notes must already exist in the module. No tag, image or release is created by preparation or local tests.
## Move-window checks
This revision targets the v1.1.0 import branch. Do not edit files under `seaweed-block/` here; development stays in its source repository until the v1.1.1 history update. The root unit-group helpers project the qualified #1001 source; refresh root CI adapters against the corresponding source when that later import arrives. Run the normal Test workflow, base-owned checks and a controlled nonproduction release rehearsal before enabling real publication. Validate organization runner registration, Docker, GHCR package access, and existing repository rulesets/check names. Existing host workflows are unchanged; their broad Go filters may also select a block-only PR. The first import needs its own reviewed bootstrap evidence: a pre-import master has no block scripts, so neither the new pull_request_target gates nor the base-owned local checker can qualify that initial import from an absent base module. Once the import/port is on the trusted base, subsequent block PRs use these checks.
+212
View File
@@ -0,0 +1,212 @@
"""Local-only checks for the nested-module CI port; no Go suites or publishing."""
from pathlib import Path
import copy
import importlib.util
import os
import subprocess
import tempfile
import unittest
from unittest.mock import patch
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[2]
class PortTests(unittest.TestCase):
def test_relative_documentation_links_are_checked(self):
text = (ROOT / ".github/workflows/block-test.yml").read_text()
marker = " - name: Relative documentation links\n"
self.assertEqual(text.count(marker), 1)
step = text.split(marker, 1)[1].split("\n - name:", 1)[0]
self.assertIn("if: matrix.suite == 'unit'", step)
self.assertIn("python3 -B ../.github/block/scripts/doc-links-check-test.py", step)
self.assertIn("python3 -I ../.github/block/scripts/doc-links-check.py .", step)
self.assertNotIn("continue-on-error", step)
self.assertNotIn("|| true", step)
def test_root_workflows_use_module_run_and_action_paths(self):
for name in ("test", "spec-trace", "post-merge-review", "known-bugs"):
text = (ROOT / (".github/workflows/block-" + name + ".yml")).read_text()
self.assertIn("working-directory: seaweed-block", text)
if name == "post-merge-review":
self.assertIn("runs-on: ubuntu-latest", text)
self.assertNotIn("BLOCK_RUNNER_LABEL", text)
else:
self.assertIn("vars.BLOCK_RUNNER_LABEL", text)
self.assertIn("|| 'ubuntu-latest'", text)
if "go-version-file:" in text: self.assertIn("go-version-file: seaweed-block/go.mod", text)
if name != "known-bugs":
self.assertIn('"seaweed-block/**"', text)
self.assertIn('".github/workflows/block-*.yml"', text)
test = (ROOT / ".github/workflows/block-test.yml").read_text()
self.assertIn("- master", test)
self.assertIn("git diff --relative --name-only HEAD^1 HEAD -- .", test)
self.assertIn("go test (linux)", test)
self.assertIn("process-level tests (real binaries)", test)
post = (ROOT / ".github/workflows/block-post-merge-review.yml").read_text()
self.assertIn("working-directory: ${{ github.workspace }}", post)
def test_release_tag_namespace_and_artifact_identity(self):
text = (ROOT / ".github/workflows/block-release.yml").read_text()
self.assertIn('"seaweed-block/v*"', text)
self.assertNotIn('tags:\n - "v*"', text)
self.assertIn("git tag -l 'seaweed-block/v*'", text)
self.assertIn('docker pull "${BLOCK_IMAGE}@${BLOCK_DIGEST}"', text)
self.assertIn('gh release create "$GITHUB_REF_NAME"', text)
self.assertIn('--latest=false', text)
self.assertIn("runs-on: ubuntu-latest", text)
self.assertNotIn("BLOCK_RUNNER_LABEL", text)
self.assertIn('sw-block-${version}-linux-amd64.tar.gz', text)
self.assertNotIn("go build", text)
self.assertLess(text.index("refusing to publish: release notes"), text.index("docker/build-push-action"))
for name in ("sw-block", "blockcsi"):
recipe = (ROOT / (".github/dockerfiles/block-" + name + ".Dockerfile")).read_text()
self.assertIn("WORKDIR /src/seaweed-block", recipe)
self.assertIn("COPY . /src", recipe)
self.assertGreater(recipe.index("RUN bash scripts/refuse-lab-binary.sh"), recipe.rindex("go build"))
def test_nested_git_paths_and_blobs_stay_module_relative(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp); module = root / "seaweed-block"; module.mkdir()
def git(*args):
return subprocess.check_output(["git", *args], cwd=root, timeout=15)
git("init", "-b", "master")
git("config", "user.name", "Example"); git("config", "user.email", "example@example.invalid")
git("config", "commit.gpgsign", "false")
(module / "core").mkdir(); (module / "docs").mkdir()
code = module / "core/a.go"; code.write_text("package a\nconst N=1\n")
(root / "host.go").write_text("package host\n")
git("add", "."); git("commit", "-m", "base")
base = git("rev-parse", "HEAD").decode().strip()
(module / "docs/a.md").write_text("documentation\n")
git("add", "."); git("commit", "-m", "docs")
docs = git("rev-parse", "HEAD").decode().strip()
def run(name, *args):
return subprocess.check_output(["bash", str(HERE / name), *args], cwd=module, timeout=20)
self.assertEqual(run("docs-only-scope.sh", base, docs), b"docs_only 1\n")
code.write_text("package a\nconst N=2\n")
(root / "host.go").write_text("package host\nconst Changed=true\n")
git("add", "."); git("commit", "-m", "code")
head = git("rev-parse", "HEAD").decode().strip()
self.assertEqual(run("post-merge-review-changed.sh", docs, head), b"M\0core/a.go\0")
self.assertTrue(run("chunkstore-scope.sh", docs, head).startswith(b"skip 1"))
blobs = root / "blobs"
run("changed-go-blobs.sh", docs, head, str(blobs))
self.assertEqual((blobs / "old/core/a.go").read_text(), "package a\nconst N=1\n")
self.assertEqual((blobs / "new/core/a.go").read_text(), "package a\nconst N=2\n")
self.assertFalse((blobs / "new/host.go").exists())
control = root / ".github/workflows/block-test.yml"
control.parent.mkdir(parents=True)
control.write_text("name: Block Test\n")
git("add", ".github"); git("commit", "-m", "CI control")
control_head = git("rev-parse", "HEAD").decode().strip()
self.assertIn(b".github/workflows/block-test.yml\0", run("post-merge-review-changed.sh", docs, control_head))
self.assertTrue(run("docs-only-scope.sh", base, control_head).startswith(b"run "))
checker = root / ".github/block/scripts/public-text-check.sh"
checker.parent.mkdir(parents=True)
checker.write_text("pattern='disk" + "station'\n")
git("add", ".github"); git("commit", "-m", "checker pattern")
pattern_head = git("rev-parse", "HEAD").decode().strip()
title, body = root / "title.txt", root / "body.txt"
title.write_text("CI scope"); body.write_text("Checker patterns")
self.assertEqual(run("public-text-check.sh", control_head, pattern_head, str(title), str(body)), b"public-text: clean\n")
def test_safe_merge_refuses_wrong_head_base_and_incomplete_jobs(self):
spec = importlib.util.spec_from_file_location("safe_merge", HERE / "safe-merge-check.py")
check = importlib.util.module_from_spec(spec); spec.loader.exec_module(check)
pr = {"number": 1, "state": "open", "draft": False, "mergeable": True, "base": {"ref": "master"}, "head": {"sha": "head"}}
run = {"path": ".github/workflows/block-test.yml", "name": "Block Test", "head_sha": "head", "status": "completed", "conclusion": "success", "pull_requests": [{"number": 1, "base": {"sha": "base"}}]}
jobs = [{"name": n, "conclusion": "success"} for n in check.JOBS]
check.validate(pr, run, jobs, "base")
for key, value in (("head_sha", "other"), ("conclusion", "cancelled"), ("name", "Other Test")):
wrong = copy.deepcopy(run); wrong[key] = value
with self.assertRaises(ValueError): check.validate(pr, wrong, jobs, "base")
with self.assertRaises(ValueError): check.validate(pr, run, jobs, "moved")
with self.assertRaises(ValueError): check.validate(pr, run, jobs[:1], "base")
failed = copy.deepcopy(jobs); failed[0]["conclusion"] = "failure"
with self.assertRaises(ValueError): check.validate(pr, run, failed, "base")
def test_same_named_workflow_cannot_satisfy_the_gate(self):
spec = importlib.util.spec_from_file_location("safe_merge", HERE / "safe-merge-check.py")
check = importlib.util.module_from_spec(spec); spec.loader.exec_module(check)
pr = {"number": 1, "state": "open", "draft": False, "mergeable": True, "base": {"ref": "master"}, "head": {"sha": "head"}}
run = {"id": 1, "created_at": "1", "path": ".github/workflows/block-test.yml", "name": "Block Test", "head_sha": "head", "status": "completed", "conclusion": "success", "pull_requests": [{"number": 1, "base": {"sha": "base"}}]}
jobs = [{"name": n, "conclusion": "success"} for n in check.JOBS]
duplicate = dict(run, id=2, created_at="2", path=".github/workflows/pretend.yml")
with self.assertRaises(ValueError): check.validate(pr, duplicate, jobs, "base")
missing = dict(run); del missing["path"]
with self.assertRaises(ValueError): check.validate(pr, missing, jobs, "base")
import json
with patch.object(check, "api", return_value={"workflow_runs": [run, duplicate]}), patch.object(check.subprocess, "check_output", return_value=json.dumps([{"jobs": jobs}]).encode()):
self.assertEqual(check.successful_run(pr, "base")["id"], 1)
with patch.object(check, "api", return_value={"workflow_runs": [duplicate]}):
with self.assertRaises(ValueError): check.successful_run(pr, "base")
def test_control_path_changes_need_independent_workflow_review(self):
spec = importlib.util.spec_from_file_location("safe_merge", HERE / "safe-merge-check.py")
check = importlib.util.module_from_spec(spec); spec.loader.exec_module(check)
real_output = subprocess.check_output
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
def git(*args): return real_output(["git", *args], cwd=root, timeout=15)
git("init", "-b", "master"); git("config", "user.name", "Example"); git("config", "user.email", "example@example.invalid"); git("config", "commit.gpgsign", "false")
(root / "code.go").write_text("package example")
git("add", "."); git("commit", "-m", "base")
base = git("rev-parse", "HEAD").decode().strip()
for name in (".github/workflows/pretend.yml", ".github/block/scripts/check.py", ".github/dockerfiles/block-image.Dockerfile", "seaweed-block/.github/scripts/record-go-test.sh"):
path = root / name; path.parent.mkdir(parents=True, exist_ok=True); path.write_text("control")
git("add", "."); git("commit", "-m", "control")
added = git("rev-parse", "HEAD").decode().strip()
with patch.object(check.subprocess, "check_output", side_effect=lambda args, **kw: real_output(args, cwd=root, **kw)):
with self.assertRaisesRegex(ValueError, "workflow_review_required"):
check.check_control_paths(base, added)
git("rm", name); git("commit", "-m", "remove")
removed = git("rev-parse", "HEAD").decode().strip()
with patch.object(check.subprocess, "check_output", side_effect=lambda args, **kw: real_output(args, cwd=root, **kw)):
with self.assertRaisesRegex(ValueError, "workflow_review_required"):
check.check_control_paths(added, removed)
(root / "code.go").write_text("package example\nconst N=2")
git("add", "."); git("commit", "-m", "code")
head = git("rev-parse", "HEAD").decode().strip()
with patch.object(check.subprocess, "check_output", side_effect=lambda args, **kw: real_output(args, cwd=root, **kw)):
check.check_control_paths(base, head)
with patch.object(check, "check_control_paths", side_effect=ValueError("workflow_review_required")), patch.object(check.subprocess, "check_output", side_effect=["base", "head"]), patch.object(check.subprocess, "run") as run:
with self.assertRaisesRegex(ValueError, "workflow_review_required"):
check.local_checks({"number": 1, "body": "body", "title": "title", "head": {"sha": "head"}}, "base")
self.assertEqual(run.call_count, 1) # fetch only; no checker certification
def test_fork_runner_guard_is_required_not_only_the_fallback(self):
expected = "${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && vars.BLOCK_RUNNER_LABEL || 'ubuntu-latest' }}"
for name in ("test", "spec-trace", "known-bugs"):
text = (ROOT / (".github/workflows/block-" + name + ".yml")).read_text()
lines = [line.strip() for line in text.splitlines() if line.strip().startswith("runs-on:")]
self.assertEqual(lines, ["runs-on: " + expected])
def test_batch_preserves_pinned_base_heads_order_and_evidence(self):
spec = importlib.util.spec_from_file_location("safe_merge", HERE / "safe-merge-check.py")
check = importlib.util.module_from_spec(spec); spec.loader.exec_module(check)
with tempfile.TemporaryDirectory() as tmp:
evidence = Path(tmp) / "acceptance"; evidence.write_text("review accepted")
prs = [{"number": n, "state": "open", "draft": False, "base": {"ref": "master"}, "head": {"sha": str(n)}} for n in (1, 2)]
manifest = {"base": "base", "head": "batch", "prs": [{"number": p["number"], "head": p["head"]["sha"], "evidence": str(evidence)} for p in prs]}
check.validate_batch(manifest, prs, "base")
with self.assertRaises(ValueError): check.validate_batch(manifest, prs, "moved")
with self.assertRaises(ValueError): check.validate_batch(manifest, list(reversed(prs)), "base")
wrong = copy.deepcopy(prs); wrong[0]["head"]["sha"] = "new"
with self.assertRaises(ValueError): check.validate_batch(manifest, wrong, "base")
batch_manifest = dict(manifest, batch_pr=3)
manifest_path = Path(tmp) / "batch.json"
import json
manifest_path.write_text(json.dumps(batch_manifest))
replies = {"git/ref/heads/master": {"object": {"sha": "base"}}, "pulls/1": prs[0], "pulls/2": prs[1], "pulls/3": {"number": 3, "head": {"sha": "batch"}}}
with patch.object(check, "api", side_effect=lambda path: replies[path]), patch.object(check, "fetch_review_head", side_effect=ValueError("workflow_review_required")) as fetch, patch.object(check, "successful_run") as run:
with self.assertRaisesRegex(ValueError, "workflow_review_required"):
check.main(["--batch", str(manifest_path)])
fetch.assert_called_once_with(replies["pulls/3"], "base")
run.assert_not_called()
evidence.write_text("")
with self.assertRaises(ValueError): check.validate_batch(manifest, prs, "base")
if __name__ == "__main__": unittest.main()
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Writes the old and new blob of each changed non-test Go file between two
# commits under <out>/old/<path> and <out>/new/<path>, for the spec trace's
# kind DOCS (objects only; nothing from the PR is built or run).
#
# usage: changed-go-blobs.sh <merge-base> <head> <out>
#
# The paths come from the PR's tree objects, which git does not check when it
# prints a diff. A path that is absolute or has an empty, '.' or '..'
# component would write outside <out>, so it is refused before anything is
# written (exit 1).
set -euo pipefail
mb=$1 head=$2 out=$3
prefix=$(git rev-parse --show-prefix)
mkdir -p "$out"
git diff --relative --name-only --no-renames -z "$mb" "$head" -- "*.go" ":(exclude)*_test.go" >"$out/.paths"
while IFS= read -r -d "" p; do
case "/$p/" in
*//* | */./* | */../*)
printf 'changed-go-blobs: refusing path %q\n' "$p" >&2
exit 1
;;
esac
done <"$out/.paths"
while IFS= read -r -d "" p; do
mkdir -p "$out/old/$(dirname "$p")" "$out/new/$(dirname "$p")"
git show "$mb:$prefix$p" >"$out/old/$p" 2>/dev/null || rm -f "$out/old/$p"
git show "$head:$prefix$p" >"$out/new/$p" 2>/dev/null || rm -f "$out/new/$p"
done <"$out/.paths"
rm -f "$out/.paths"
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# Run only from a trusted base checkout; HEAD code is inspected as Git objects.
set -euo pipefail
here=$(cd "$(dirname "$0")" && pwd)
base=${1:?BASE}; head=${2:?HEAD}; body=${3:?BODY}; title=${4:?TITLE}
[ "$(git rev-parse HEAD)" = "$(git rev-parse "$base")" ] || { echo "refusing: checkout is not the trusted base" >&2; exit 2; }
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
mb=$(git merge-base "$base" "$head")
bash "$here/post-merge-review-changed.sh" "$mb" "$head" >"$work/changed.bin"
bash "$here/changed-go-blobs.sh" "$mb" "$head" "$work/blobs"
bash .github/scripts/spec-trace-check.sh "$body" "$work/blobs" .github/model-code-trace.tsv <"$work/changed.bin"
bash "$here/public-text-check.sh" "$mb" "$head" "$title" "$body"
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# chunkstore-scope.sh BASE HEAD: decides whether a pull request runs the
# real-filer integration tests. It prints one line:
# "run N FIRST" at least one of the N changed files is under
# core/frontend/chunkstore/, core/storage/ or
# core/frontend/durable/ (FIRST is one)
# "skip N" none of the N changed files is
# and exits 0. Any error (git fails, the list cannot be read) exits nonzero,
# and the caller then runs the tests: an error never selects skip.
#
# The NUL-delimited list is written to a file first and read to its end, so
# no pipe can stop early and leave a writer's error looking like an answer.
set -euo pipefail
[ "$#" -eq 2 ] || { echo "usage: chunkstore-scope.sh BASE HEAD" >&2; exit 2; }
list=$(mktemp)
trap 'rm -f "$list"' EXIT
if ! git diff --relative --name-only --no-renames -z "$1" "$2" -- . >"$list"; then
echo "chunkstore-scope: git diff $1 $2 failed" >&2
exit 2
fi
n=0
hit=""
while IFS= read -r -d '' f; do
n=$((n + 1))
case $f in
core/frontend/chunkstore/* | core/storage/* | core/frontend/durable/*) [ -n "$hit" ] || hit=$f ;;
esac
done <"$list"
if [ -n "$hit" ]; then
echo "run $n $hit"
else
echo "skip $n"
fi
@@ -0,0 +1,71 @@
"""Relative Markdown links must resolve; code, anchors and URLs are not paths."""
import contextlib
import importlib.util
import io
from pathlib import Path
import tempfile
import unittest
spec = importlib.util.spec_from_file_location("links", Path(__file__).with_name("doc-links-check.py"))
links = importlib.util.module_from_spec(spec)
spec.loader.exec_module(links)
class DocLinksTests(unittest.TestCase):
def check(self, files):
with tempfile.TemporaryDirectory() as root:
for name, text in files.items():
path = Path(root, name)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(text)
return [(source, target) for source, _, target in links.broken_links(root)]
def test_existing_targets_pass(self):
broken = self.check({
"README.md": "[guide](docs/guide.md#start) ![d](docs/d.svg) [dir](docs/) [ref][r]\n\n[r]: <docs/a b.md>\n",
"docs/guide.md": "[up](../README.md) [root](/docs/d.svg) [esc](a%20b.md)\n",
"docs/d.svg": "",
"docs/a b.md": "",
})
self.assertEqual(broken, [])
def test_missing_targets_fail(self):
broken = self.check({
"README.md": "[gone](docs/gone.md) [nested [x]](docs/x.md#a)\n\n[r]: missing.md\n",
"docs/guide.md": "[up](../nope.md)\n",
})
self.assertCountEqual(broken, [
("README.md", "docs/gone.md"),
("README.md", "docs/x.md#a"),
("README.md", "missing.md"),
("docs/guide.md", "../nope.md"),
])
def test_urls_anchors_and_code_are_not_checked(self):
broken = self.check({
"README.md": "\n".join([
"[web](https://example.invalid/x) [mail](mailto:a@example.invalid) [top](#top) [proto](//host/x)",
"`[code](gone.md)` and ``[code](gone.md)``",
"```",
"[fenced](gone.md)",
"```",
"~~~md",
"[tilde](gone.md)",
"~~~",
]) + "\n",
})
self.assertEqual(broken, [])
def test_main_exit_status(self):
out = io.StringIO()
with tempfile.TemporaryDirectory() as root, contextlib.redirect_stdout(out), contextlib.redirect_stderr(out):
Path(root, "README.md").write_text("[gone](gone.md)\n")
self.assertEqual(links.main(["doc-links-check.py", root]), 1)
Path(root, "gone.md").write_text("")
self.assertEqual(links.main(["doc-links-check.py", root]), 0)
self.assertEqual(links.main(["doc-links-check.py"]), 2)
self.assertIn("README.md:1: broken relative link gone.md", out.getvalue())
if __name__ == "__main__":
unittest.main()
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env python3
"""Fail when a Markdown file links to a relative path that does not exist.
Usage: doc-links-check.py <root>
"""
import os
import re
import sys
import urllib.parse
SKIP_DIRS = {".git", "node_modules", "vendor"}
FENCE = re.compile(r"^\s*(```|~~~)")
INLINE_CODE = re.compile(r"(`+)(?:(?!\1).)+?\1")
INLINE_LINK = re.compile(r"!?\[(?:[^\[\]]|\[[^\[\]]*\])*\]\(\s*(<[^>]*>|[^\s)]+)")
REFERENCE = re.compile(r"^\s{0,3}\[[^\]]+\]:\s*(<[^>]*>|\S+)")
SCHEME = re.compile(r"^[A-Za-z][A-Za-z0-9+.-]*:")
def link_targets(text):
fence = None
for lineno, line in enumerate(text.splitlines(), 1):
m = FENCE.match(line)
if m:
if fence is None:
fence = m.group(1)
elif m.group(1) == fence:
fence = None
continue
if fence is not None:
continue
line = INLINE_CODE.sub("", line)
for m in INLINE_LINK.finditer(line):
yield lineno, m.group(1)
m = REFERENCE.match(line)
if m:
yield lineno, m.group(1)
def local_path(target):
if target.startswith("<") and target.endswith(">"):
target = target[1:-1]
if not target or target.startswith(("#", "//")) or SCHEME.match(target):
return None
path = urllib.parse.unquote(target.split("#", 1)[0].split("?", 1)[0])
return path or None
def broken_links(root):
root = os.path.abspath(root)
for dirpath, dirnames, filenames in os.walk(root):
dirnames[:] = sorted(d for d in dirnames if d not in SKIP_DIRS)
for name in sorted(filenames):
if not name.endswith(".md"):
continue
source = os.path.join(dirpath, name)
with open(source, encoding="utf-8", errors="replace") as f:
text = f.read()
for lineno, target in link_targets(text):
path = local_path(target)
if path is None:
continue
if path.startswith("/"):
resolved = os.path.join(root, path.lstrip("/"))
else:
resolved = os.path.join(dirpath, path)
if not os.path.exists(resolved):
yield os.path.relpath(source, root), lineno, target
def main(argv):
if len(argv) != 2:
print(__doc__.strip(), file=sys.stderr)
return 2
broken = list(broken_links(argv[1]))
for source, lineno, target in broken:
print(f"{source}:{lineno}: broken relative link {target}")
return 1 if broken else 0
if __name__ == "__main__":
sys.exit(main(sys.argv))
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# docs-only-scope.sh BASE HEAD: classifies the files changed between BASE and
# HEAD for the process-level suite. It prints one line:
# "docs_only N" every one of the N changed files is under docs/
# "run N [FIRST-OTHER]" no file changed, or at least one is elsewhere
# and exits 0. Any error (git fails, the list cannot be read) exits nonzero,
# and the caller then runs the tests: an error never selects docs_only.
#
# The NUL-delimited list is written to a file first and read to its end, so
# no pipe can stop early and leave a writer's error looking like an answer.
set -euo pipefail
[ "$#" -eq 2 ] || { echo "usage: docs-only-scope.sh BASE HEAD" >&2; exit 2; }
list=$(mktemp)
trap 'rm -f "$list"' EXIT
if ! git diff --relative --name-only --no-renames -z "$1" "$2" -- . >"$list"; then
echo "docs-only-scope: git diff $1 $2 failed" >&2
exit 2
fi
if [ -n "$(git rev-parse --show-prefix)" ]; then
git -C "$(git rev-parse --show-toplevel)" diff --name-only --no-renames -z "$1" "$2" -- '.github/workflows/block-*.yml' '.github/dockerfiles/block-*.Dockerfile' '.github/block/**' >>"$list"
fi
n=0
other=""
while IFS= read -r -d '' f; do
n=$((n + 1))
case $f in
docs/*) ;;
*) [ -n "$other" ] || other=$f ;;
esac
done <"$list"
if [ "$n" -gt 0 ] && [ -z "$other" ]; then
echo "docs_only $n"
else
echo "run $n${other:+ $other}"
fi
+121
View File
@@ -0,0 +1,121 @@
"""Check that every code and test anchor of the invariants ledger exists at a git ref.
usage: python -I ledger_check.py <repo-dir> <git-ref> [<ledger path in repo>]
A ledger row is a table line whose first cell holds `INV-...`. In its cells, a
backticked token that ends in .go is a FILE; a backticked identifier (or
Type.Method) is a SYMBOL of the nearest file named before it in the same cell,
or, in the test cell, of any file named in that cell. A file must exist at the
ref; a symbol must occur in its file as a whole word (for a test: `func Name(`).
A symbol with no file in its cell is looked up in the whole tree. A file may
be a glob (`volume_lock*.go`). A lower-case token with an underscore (a build
tag, a JSON key, a reason string) is not a Go symbol and is not checked.
Prints one line per missing anchor and a summary. It reads; it changes nothing.
Exit: 0 when every anchor exists; 1 when one is missing; 2 when git fails or no
row or anchor was found (an error is never read as a pass).
"""
import re
import subprocess
import sys
def git(repo, *args):
"""git's output. A git failure ends the check with exit 2: an error must
never read as "no anchors". `git grep` finding nothing (exit 1) is not one."""
r = subprocess.run(["git", "-C", repo] + list(args), capture_output=True, text=True,
encoding="utf-8", errors="replace")
if r.returncode != 0 and not (args and args[0] == "grep" and r.returncode == 1):
print("ledger_check: git %s failed (exit %d): %s" % (" ".join(args[:2]), r.returncode, r.stderr.strip()[:300]),
file=sys.stderr)
sys.exit(2)
return r.stdout
def main():
repo, ref = sys.argv[1], sys.argv[2]
ledger = sys.argv[3] if len(sys.argv) > 3 else "docs/design/invariants.md"
text = git(repo, "show", "%s:%s" % (ref, ledger))
prefix = sys.argv[4] if len(sys.argv) > 4 else ""
files = set(git(repo, "ls-tree", "-r", "--name-only", ref, "--", prefix or ".").split("\n"))
cache = {}
def body(path):
if path not in cache:
cache[path] = git(repo, "show", "%s:%s" % (ref, path))
return cache[path]
def resolve(tok):
"""A file token may be a full path or a bare file name."""
if tok in files:
return [tok]
if "*" in tok:
rx = re.compile("^(.*/)?" + "[^/]*".join(re.escape(x) for x in tok.split("*")) + "$")
return [f for f in files if rx.match(f)]
if "/" not in tok:
return [f for f in files if f.endswith("/" + tok)]
# a path with a directory matches whole path components only
return [f for f in files if f.endswith("/" + tok)]
ident = re.compile(r"^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?(\(\))?$")
go_all = None
rows = missing = anchors = 0
for n, line in enumerate(text.split("\n"), 1):
if not line.startswith("|"):
continue
cells = [c.strip() for c in line.strip().strip("|").split("|")]
m = re.match(r"`(INV-[A-Z0-9-]+)`", cells[0]) if cells else None
if not m or len(cells) < 6:
continue
rows += 1
inv, status = m.group(1), cells[-1]
if "ARCHIVED" in status:
continue
for ci, kind in ((3, "code"), (4, "test")):
toks = re.findall(r"`([^`]+)`", cells[ci])
cell_files = []
for t in toks:
if t.endswith(".go"):
cell_files.append(t)
cur = None
for t in toks:
if t.endswith(".go"):
cur = t
anchors += 1
if not resolve(t):
missing += 1
print("%s (line %d, %s, %s): file %s does not exist" % (inv, n, kind, status, t))
continue
if not ident.match(t):
continue
sym = t.rstrip("()").split(".")[-1]
if sym in ("nil", "true", "false") or sym.isupper() or len(sym) < 3:
continue
if "_" in sym and sym == sym.lower():
# a build tag, a JSON key or a reason string: not a Go symbol
continue
scope = [cur] if (cur and kind == "code") else cell_files
paths = [p for f in scope for p in resolve(f)]
anchors += 1
if kind == "test" and sym.startswith(("Test", "Fuzz", "Benchmark")):
pat = re.compile(r"func %s\(" % re.escape(sym))
else:
pat = re.compile(r"\b%s\b" % re.escape(sym))
if paths:
ok = any(pat.search(body(p)) for p in paths)
else:
if go_all is None:
go_all = git(repo, "grep", "-h", "-E", r"^(func|type|var|const|\s+[A-Za-z_]+\s)", ref, "--", prefix + "*.go")
ok = bool(pat.search(go_all))
if not ok:
missing += 1
where = ", ".join(scope) if scope else "the tree"
print("%s (line %d, %s, %s): %s not found in %s" % (inv, n, kind, status, t, where))
print("%d rows, %d anchors, %d missing at %s" % (rows, anchors, missing, ref))
if rows == 0 or anchors == 0:
print("ledger_check: no ledger rows or anchors found: refusing to pass", file=sys.stderr)
sys.exit(2)
sys.exit(1 if missing else 0)
if __name__ == "__main__":
main()
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Usage: post-merge-review-changed.sh BASE HEAD
#
# Writes what a PR changes (BASE...HEAD) as NUL-separated STATUS, PATH pairs,
# unquoted, so any byte in a name reaches the check as itself. --no-renames
# reports a move as a delete of the old name and an add of the new one.
set -euo pipefail
base=${1:?usage: post-merge-review-changed.sh BASE HEAD}
head=${2:?usage: post-merge-review-changed.sh BASE HEAD}
git diff --relative -z --name-status --no-renames "$base...$head" -- .
if [ -n "$(git rev-parse --show-prefix)" ]; then
git -C "$(git rev-parse --show-toplevel)" diff -z --name-status --no-renames "$base...$head" -- '.github/workflows/block-*.yml' '.github/dockerfiles/block-*.Dockerfile' '.github/block/**'
fi
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# Refuses internal names in what a pull request makes public: the lines it
# adds, its commit messages, its title and its description. This repository is
# public; internal seat names and internal file-share paths do not belong in it.
#
# Usage: public-text-check.sh MERGE_BASE HEAD TITLE_FILE BODY_FILE
# Exit 0: clean. Exit 1: at least one hit (each printed). Exit 2: usage.
#
# The patterns live only here and in this check's own test; both files are
# excluded from the scan of added lines.
set -euo pipefail
[ "$#" -eq 4 ] || { echo "usage: public-text-check.sh MERGE_BASE HEAD TITLE_FILE BODY_FILE" >&2; exit 2; }
mb=$1; head=$2; title=$3; body=$4
for f in "$title" "$body"; do
[ -f "$f" ] && [ -r "$f" ] || { echo "public-text: cannot read $f" >&2; exit 2; }
done
git rev-parse -q --verify "$mb^{commit}" >/dev/null && git rev-parse -q --verify "$head^{commit}" >/dev/null ||
{ echo "public-text: unknown commit $mb or $head" >&2; exit 2; }
# match: a grep error fails the check instead of reading as "no hit".
match() { local rc=0; grep -E -i -- "$pat" "$@" || rc=$?; [ "$rc" -le 1 ] || { echo "public-text: grep failed ($rc)" >&2; exit 2; }; }
pat='(claude|codex)0[0-9]|share[/\]rdma|V:[/\]share|diskstation'
out=$(mktemp); trap 'rm -f "$out"' EXIT
report() { # report WHERE < matching lines
local where=$1 line
while IFS= read -r line; do
printf 'public-text: %s: %s
' "$where" "${line:0:160}" >>"$out"
done
}
# Added lines of the diff, with file and line number.
{
git diff --relative --no-color --no-renames -U0 "$mb" "$head" -- . \
':(exclude).github/scripts/public-text-check.sh' ':(exclude).github/scripts/public-text-check-test.sh'
if [ -n "$(git rev-parse --show-prefix)" ]; then
git -C "$(git rev-parse --show-toplevel)" diff --no-color --no-renames -U0 "$mb" "$head" -- '.github/workflows/block-*.yml' '.github/dockerfiles/block-*.Dockerfile' '.github/block/**' ':(exclude).github/block/scripts/public-text-check.sh'
fi
} |
awk '
/^diff --git / { hdr = 1; next }
hdr && /^\+\+\+ / { f = substr($0, 7); next }
/^@@ / { hdr = 0; split($3, a, ","); n = substr(a[1], 2) + 0; next }
!hdr && /^\+/ { print f ":" n ": " substr($0, 2); n++ }
' | match | report "added line"
# Commit messages (subjects and bodies) of the pull request.
git log --format='%h %s%n%b' "$mb..$head" | match | report "commit message"
match "$title" | report "title"
match "$body" | report "description"
hits=$(wc -l <"$out" | tr -d ' ')
if [ "$hits" -gt 0 ]; then
cat "$out"
echo "public-text: $hits hit(s). Say what the code or test does instead of who asked for it; keep internal paths out." >&2
exit 1
fi
echo "public-text: clean"
@@ -0,0 +1,144 @@
"""Run fake recorders through the real group executor, without product tests."""
from pathlib import Path
import json
import os
import subprocess
import time
import sys
import tempfile
import unittest
from unittest.mock import Mock, patch
import importlib.util
import signal
SCRIPT = Path(__file__).with_name("run-unit-groups.py")
FAKE = r'''import json, os, sys, time
from pathlib import Path
out = Path(sys.argv[1]); group = out.parent.name
root = Path(os.environ["FIXTURE_ROOT"])
(root / (group + ".started")).write_text("started")
deadline = time.monotonic() + 5
while not all((root / (g + ".started")).exists() for g in os.environ["EXPECTED_GROUPS"].split()):
if time.monotonic() >= deadline: sys.exit(17)
time.sleep(.01)
flags = sys.argv[2:]
assert "-p=" + ("4" if group == "g3" else "1") in flags
assert "-short" in flags and "-count=1" in flags and "20m" in flags
if sys.platform == "linux":
wal = Path(os.environ["TMPDIR"]) / "v1.bin"
with wal.open("w") as descriptor:
assert os.readlink(f"/proc/self/fd/{descriptor.fileno()}") == str(wal), "fixture WAL descriptor not found"
else:
assert Path(os.environ["TMPDIR"]) == Path(os.environ["TMPDIR"]).resolve(), "TMPDIR must identify the canonical directory"
out.write_text(json.dumps({"Action":"pass", "Package":group}) + "\n")
out.with_suffix(".stderr").write_text("fixture stderr")
(root / (group + ".finished")).write_text("finished")
sys.exit(7 if os.environ.get("FAIL_GROUP") == group else 0)
'''
class GroupRunnerTests(unittest.TestCase):
def run_groups(self, fail="", empty=False, alias=False):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp); plan = root / "plan"; plan.mkdir()
for group in ("g1", "g2", "g3"):
(plan / (group + ".txt")).write_text("" if empty and group != "g3" else "example/" + group + "\n")
fake = root / "fake.py"; fake.write_text(FAKE)
env = dict(os.environ, FIXTURE_ROOT=str(root), EXPECTED_GROUPS="g3" if empty else "g1 g2 g3", FAIL_GROUP=fail)
scratch = root / "tmp"
if alias:
scratch.mkdir()
link = root / "runner-temp"
link.symlink_to(scratch, target_is_directory=True)
scratch = link
result = subprocess.run([sys.executable, str(SCRIPT), str(plan), str(root / "evidence"), str(scratch), sys.executable, str(fake)], env=env, text=True, capture_output=True, timeout=20)
self.assertEqual(result.returncode, 1 if fail else 0, result.stdout + result.stderr)
expected = ["g3"] if empty else ["g1", "g2", "g3"]
for group in expected:
self.assertTrue((root / (group + ".finished")).exists(), result.stdout + result.stderr)
self.assertTrue((root / "evidence" / group / "go-test.stderr").exists())
self.assertTrue((root / "tmp" / group).is_dir())
events = [json.loads(line) for line in (root / "evidence" / "go-test.json").read_text().splitlines()]
self.assertCountEqual([e["Package"] for e in events], expected)
statuses = json.loads((root / "evidence" / "unit-groups.json").read_text())
self.assertEqual(statuses["groups"]["g2"]["status"], 7 if fail == "g2" else 0)
@unittest.skipUnless(os.name == "posix", "Linux runner temp symlink control")
def test_runner_temp_symlink_passes_canonical_scratch_paths(self): self.run_groups(alias=True)
def test_all_groups_overlap_and_keep_separate_events(self): self.run_groups()
def test_failure_fails_job_after_every_group_finishes(self): self.run_groups(fail="g2")
def test_scope_empty_groups_launch_no_recorder(self): self.run_groups(empty=True)
def test_cancel_escalates_even_after_group_leader_exits(self):
spec = importlib.util.spec_from_file_location("unit_groups", SCRIPT)
module = importlib.util.module_from_spec(spec); spec.loader.exec_module(module)
leader = Mock(pid=12345)
leader.wait.return_value = 0
with patch.object(module.signal, "SIGKILL", 9, create=True), patch.object(module.os, "name", "posix"), patch.object(module.os, "killpg", create=True) as killpg, patch.object(module.time, "monotonic", side_effect=[0, 6]):
module.terminate([leader])
self.assertIn(unittest.mock.call(12345, signal.SIGTERM), killpg.call_args_list)
self.assertIn(unittest.mock.call(12345, 9), killpg.call_args_list)
leader.wait.assert_called()
@unittest.skipUnless(os.name == "posix", "process-group cancellation is a Linux runner control")
def test_cancel_kills_resistant_child_after_recorder_exits(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp); plan = root / "plan"; plan.mkdir()
for group in ("g1", "g2", "g3"):
(plan / (group + ".txt")).write_text("example/g1\n" if group == "g1" else "")
child = root / "child.py"
child.write_text("import os,signal,sys,time\nfrom pathlib import Path\nsignal.signal(signal.SIGTERM,signal.SIG_IGN)\np=Path(sys.argv[1])\np.with_suffix('.tmp').write_text(str(os.getpid()))\np.with_suffix('.tmp').replace(p)\nwhile True: time.sleep(.1)\n")
fake = root / "recorder.py"
fake.write_text("import subprocess,sys,time\nsubprocess.Popen([sys.executable,sys.argv[1],sys.argv[2]])\nwhile True: time.sleep(.1)\n")
marker = root / "child"
runner = subprocess.Popen([sys.executable, str(SCRIPT), str(plan), str(root / "evidence"), str(root / "tmp"), sys.executable, str(fake), str(child), str(marker)], stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
pid = None
try:
deadline = time.monotonic() + 5
while not marker.exists():
if time.monotonic() >= deadline: self.fail("resistant child did not start")
time.sleep(.01)
pid = int(marker.read_text())
runner.terminate()
self.assertEqual(runner.wait(timeout=12), 130)
deadline = time.monotonic() + 2
while True:
stat = Path(f"/proc/{pid}/stat")
if not stat.exists() or stat.read_text().split(") ", 1)[1].startswith("Z"): break
if time.monotonic() >= deadline: self.fail("resistant child survived cancellation")
time.sleep(.01)
finally:
if pid is not None:
try: os.kill(pid, signal.SIGKILL)
except ProcessLookupError: pass
if runner.poll() is None: runner.kill()
runner.communicate(timeout=5)
@unittest.skipUnless(os.name == "posix", "process-group cancellation is a Linux runner control")
def test_cancel_joins_every_started_group(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp); plan = root / "plan"; plan.mkdir()
for group in ("g1", "g2", "g3"):
(plan / (group + ".txt")).write_text("example/" + group + "\n")
fake = root / "held.py"
fake.write_text("import os,sys,time\nfrom pathlib import Path\np=Path(sys.argv[1]).parent\n(p/'process.tmp').write_text(str(os.getpid()))\n(p/'process.tmp').replace(p/'process')\nwhile True: time.sleep(.1)\n")
runner = subprocess.Popen([sys.executable, str(SCRIPT), str(plan), str(root / "evidence"), str(root / "tmp"), sys.executable, str(fake)], stdout=subprocess.DEVNULL, stderr=subprocess.PIPE)
try:
deadline = time.monotonic() + 5
markers = [root / "evidence" / g / "process" for g in ("g1", "g2", "g3")]
while not all(p.exists() for p in markers):
if time.monotonic() >= deadline: self.fail("groups did not start")
time.sleep(.01)
children = [int(p.read_text()) for p in markers]
runner.terminate()
self.assertEqual(runner.wait(timeout=10), 130)
for child in children:
with self.assertRaises(ProcessLookupError): os.kill(child, 0)
finally:
if runner.poll() is None: runner.terminate()
runner.communicate(timeout=10)
if __name__ == "__main__": unittest.main()
+123
View File
@@ -0,0 +1,123 @@
"""Run the three default unit groups concurrently on the current runner.
Usage: run-unit-groups.py PLAN_DIR EVIDENCE_DIR TMP_DIR RECORDER [RECORDER_ARG ...]
The recorder accepts OUTPUT followed by go-test flags and packages. Each group
owns its logs/events; they are combined only after all group processes exit.
"""
from contextlib import ExitStack
import json
import os
from pathlib import Path
import signal
import subprocess
import sys
import time
def stop(_signum, _frame):
raise KeyboardInterrupt
def terminate(processes):
for process in processes:
try:
if os.name == "posix": os.killpg(process.pid, signal.SIGTERM)
elif process.poll() is None: process.terminate()
except ProcessLookupError:
pass
if os.name == "posix":
# The leader may exit on TERM while its descendants remain in the group.
# Bound the grace period by group lifetime, never by leader lifetime.
deadline = time.monotonic() + 5
remaining = list(processes)
while remaining and time.monotonic() < deadline:
alive = []
for process in remaining:
process.poll() # Reap an exited leader without forgetting its PGID.
try:
os.killpg(process.pid, 0)
alive.append(process)
except ProcessLookupError:
pass
remaining = alive
if remaining: time.sleep(.05)
for process in remaining:
try: os.killpg(process.pid, signal.SIGKILL)
except ProcessLookupError: pass
for process in processes:
try:
process.wait(timeout=5)
except subprocess.TimeoutExpired:
process.kill()
process.wait(timeout=5)
def run(plan, evidence, temp, recorder):
groups = {g: (plan / (g + ".txt")).read_text().splitlines() for g in ("g1", "g2", "g3")}
evidence.mkdir(parents=True, exist_ok=True)
started = time.monotonic()
processes, results, times = {}, {}, {}
with ExitStack() as files:
try:
for group, packages in groups.items():
results[group] = {"packages": len(packages), "status": 0, "elapsed_seconds": 0}
if not packages:
print(f"{group}: no packages selected by scope", flush=True)
continue
out = evidence / group; out.mkdir(parents=True, exist_ok=True)
scratch = temp / group; scratch.mkdir(parents=True, exist_ok=True)
# /proc/self/fd exposes resolved paths; preserve fixture identity even
# when the runner temp directory is a symlink to its data disk.
scratch = scratch.resolve(strict=True)
log = files.enter_context((out / "console.log").open("w", encoding="utf-8"))
command = recorder + [str(out / "go-test.json"), "-p=" + ("4" if group == "g3" else "1"), "-short", "-count=1", "-timeout", "20m", *packages]
times[group] = time.monotonic()
processes[group] = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT, stdin=subprocess.DEVNULL,
env=dict(os.environ, TMPDIR=str(scratch)), start_new_session=os.name == "posix")
print(f"{group}: started {len(packages)} packages", flush=True)
remaining = set(processes)
while remaining:
for group in tuple(remaining):
status = processes[group].poll()
if status is not None:
results[group]["status"] = status
results[group]["elapsed_seconds"] = round(time.monotonic() - times[group], 3)
remaining.remove(group)
if remaining: time.sleep(.05)
except BaseException:
signal.signal(signal.SIGTERM, signal.SIG_IGN)
signal.signal(signal.SIGINT, signal.SIG_IGN)
terminate(processes.values())
raise
for group in processes:
print(f"--- {group} ---", flush=True)
print((evidence / group / "console.log").read_text(errors="replace"), flush=True)
summary = {"elapsed_seconds": round(time.monotonic() - started, 3), "groups": results}
try:
(evidence / "unit-groups.json").write_text(json.dumps(summary, indent=2) + "\n", encoding="utf-8")
with (evidence / "go-test.json").open("ab") as combined:
for group in processes:
events = evidence / group / "go-test.json"
if events.exists(): combined.write(events.read_bytes())
except OSError as error:
print(f"test evidence unavailable: {error}", file=sys.stderr)
print(json.dumps(summary), flush=True)
return int(any(r["status"] != 0 for r in results.values()))
def main(argv):
if len(argv) < 5:
print(__doc__.strip(), file=sys.stderr)
return 2
signal.signal(signal.SIGTERM, stop)
try:
return run(Path(argv[1]), Path(argv[2]), Path(argv[3]), argv[4:])
except KeyboardInterrupt:
return 130
except (OSError, ValueError) as error:
print(f"unit groups: {error}", file=sys.stderr)
return 2
if __name__ == "__main__": sys.exit(main(sys.argv))
@@ -0,0 +1,106 @@
"""Exercise the actual pre-checkout and always-run cleanup workflow bodies."""
import contextlib
import io
import os
from pathlib import Path
import shutil
import tempfile
import textwrap
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[3]
WORKFLOWS = sorted((ROOT / ".github/workflows").glob("block-*.yml"))
def step(text, name):
marker = " - name: " + name + "\n"
if text.count(marker) != 1:
raise AssertionError("missing or duplicate " + name)
return text.split(marker, 1)[1].split("\n - name:", 1)[0]
def code(block):
return textwrap.dedent(block.split(" run: |\n", 1)[1]).split("\n", 1)[1].rsplit("\nPY", 1)[0]
def execute(source, workspace, temp, free=None):
output = io.StringIO()
with patch.dict(os.environ, {"GITHUB_WORKSPACE": str(workspace), "RUNNER_TEMP": str(temp)}), contextlib.redirect_stdout(output):
with contextlib.ExitStack() as stack:
if free is not None:
stack.enter_context(patch("shutil.disk_usage", return_value=shutil._ntuple_diskusage(100_000_000_000, 0, free)))
try:
exec(compile(source, "<workflow>", "exec"), {})
except SystemExit as err:
return err.code, output.getvalue()
return 0, output.getvalue()
class RunnerWorkspaceTests(unittest.TestCase):
def test_every_job_checks_before_checkout_and_cleans_last_even_on_failure(self):
for path in WORKFLOWS:
text = path.read_text()
before = step(text, "Runner free space")
after = step(text, "Clean job workspace")
self.assertLess(text.index("- name: Runner free space"), text.index("- name: Checkout"), path.name)
self.assertIn("if: always() && runner.environment == 'self-hosted'", after)
self.assertNotIn("continue-on-error", after)
self.assertNotIn("- name:", text.split("- name: Clean job workspace", 1)[1])
self.assertIn("working-directory: ${{ runner.temp }}", before)
self.assertIn("working-directory: ${{ runner.temp }}", after)
self.assertIn("python3 -I -", before)
self.assertIn("python3 -I -", after)
def test_low_space_refuses_and_boundary_admits(self):
for path in WORKFLOWS:
source = code(step(path.read_text(), "Runner free space"))
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
rc, out = execute(source, root, root, 9_999_999_999)
self.assertEqual(rc, 75)
self.assertIn("runner_disk_low", out)
self.assertIn("required_bytes=10000000000", out)
self.assertEqual(execute(source, root, root, 10_000_000_000)[0], 0)
with patch("shutil.disk_usage", side_effect=[shutil._ntuple_diskusage(100, 0, 10_000_000_000), shutil._ntuple_diskusage(100, 0, 1)]):
rc, out = execute(source, root / "work", root / "temp")
self.assertEqual(rc, 75)
self.assertIn("runner_disk_low", out)
with patch("shutil.disk_usage", side_effect=OSError("probe failed")):
rc, out = execute(source, root, root)
self.assertEqual(rc, 75)
self.assertIn("runner_disk_check_failed", out)
def test_cleanup_removes_hidden_and_build_files_but_not_symlink_targets(self):
for path in WORKFLOWS:
source = code(step(path.read_text(), "Clean job workspace"))
with tempfile.TemporaryDirectory() as temp:
root = Path(temp); work = root / "repo/repo"; work.mkdir(parents=True)
(work / ".git").mkdir(); (work / ".git/config").write_text("config")
(work / "binary").write_bytes(b"build")
outside = root / "outside"; outside.mkdir(); (outside / "keep").write_text("keep")
(work / "link").symlink_to(outside, target_is_directory=True)
rc, out = execute(source, work, root)
self.assertEqual(rc, 0, out)
self.assertEqual(list(work.iterdir()), [])
self.assertTrue((outside / "keep").is_file())
self.assertEqual(execute(source, root, root)[0], 1)
self.assertEqual(execute(source, Path(root.anchor), root)[0], 1)
alias = root / "alias"; alias.symlink_to(work, target_is_directory=True)
self.assertEqual(execute(source, alias, root)[0], 1)
def test_cleanup_refuses_symlinked_ancestors_and_preserves_external_sentinel(self):
for path in WORKFLOWS:
with self.subTest(workflow=path.name), tempfile.TemporaryDirectory() as temp:
base = Path(temp)
external = base / "external/repo/repo"; external.mkdir(parents=True)
sentinel = external / "keep"; sentinel.write_text("outside checkout")
alias = base / "alias"; alias.symlink_to(base / "external", target_is_directory=True)
source = code(step(path.read_text(), "Clean job workspace"))
rc, out = execute(source, alias / "repo/repo", base)
self.assertTrue(sentinel.is_file(), "cleanup followed a workspace ancestor outside the checkout")
self.assertEqual(rc, 1, out)
self.assertIn("runner_workspace_cleanup_refused", out)
if __name__ == "__main__": unittest.main()
+122
View File
@@ -0,0 +1,122 @@
"""Read-only block merge readiness check. Run from a trusted master checkout.
Usage (inside seaweed-block/): python3 ../.github/block/scripts/safe-merge-check.py PR
Never merges, posts comments, changes account config or pushes refs.
"""
import json
import subprocess
import sys
import tempfile
from pathlib import Path
REPO = "seaweedfs/seaweedfs"
WORKFLOW_PATH = ".github/workflows/block-test.yml"
JOBS = {"go test (linux)", "process-level tests (real binaries)"}
def validate(pr, run, jobs, current):
if pr["state"] != "open" or pr["draft"] or pr["mergeable"] is not True:
raise ValueError("PR must be open, ready and mergeable")
if pr["base"]["ref"] != "master": raise ValueError("expected master base")
if run.get("path") != WORKFLOW_PATH or run["name"] != "Block Test" or run["head_sha"] != pr["head"]["sha"]:
raise ValueError("wrong workflow or head")
if run["status"] != "completed" or run["conclusion"] != "success":
raise ValueError("Block Test is not successful")
bases = [p["base"]["sha"] for p in run["pull_requests"] if p["number"] == pr["number"]]
if bases != [current]: raise ValueError("tested base is not current master")
required = [j for j in jobs if j["name"] in JOBS]
if len(required) != 2 or {j["name"] for j in required} != JOBS or any(j["conclusion"] != "success" for j in required):
raise ValueError("both block test jobs must succeed")
def api(path):
return json.loads(subprocess.check_output(["gh", "api", "repos/" + REPO + "/" + path]))
def successful_run(pr, current):
runs = api("actions/runs?head_sha=" + pr["head"]["sha"] + "&event=pull_request&per_page=100")["workflow_runs"]
runs = [r for r in runs if r.get("path") == WORKFLOW_PATH and r["name"] == "Block Test"]
if not runs: raise ValueError("no Block Test run")
run = max(runs, key=lambda r: (r["created_at"], r["id"]))
pages = json.loads(subprocess.check_output(["gh", "api", "--paginate", "--slurp", "repos/" + REPO + "/actions/runs/" + str(run["id"]) + "/jobs?per_page=100"]))
validate(pr, run, [j for page in pages for j in page["jobs"]], current)
return run
def check_control_paths(base, head):
# Inspect both sides of renames and fail on enumeration errors. These PRs
# need independent workflow review; their own Actions results cannot waive it.
paths = subprocess.check_output(["git", "diff", "--no-renames", "--name-only", "-z", base, head]).split(b"\0")
controls = [p.decode("utf-8", errors="replace") for p in paths if p.startswith((b".github/workflows/", b".github/block/", b".github/dockerfiles/block-", b"seaweed-block/.github/"))]
if controls:
raise ValueError("workflow_review_required: CI controls changed: " + ", ".join(controls))
def fetch_review_head(pr, current):
if subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip() != current:
raise ValueError("run from trusted current master checkout")
subprocess.run(["git", "-c", "fetch.fsckObjects=true", "fetch", "--no-tags", "origin", "+refs/pull/" + str(pr["number"]) + "/head:refs/remotes/block-review/head"], check=True)
actual = subprocess.check_output(["git", "rev-parse", "refs/remotes/block-review/head"], text=True).strip()
if actual != pr["head"]["sha"]: raise ValueError("PR head moved; recheck")
check_control_paths(current, actual)
return actual
def local_checks(pr, current):
actual = fetch_review_head(pr, current)
with tempfile.TemporaryDirectory() as tmp:
body, title = Path(tmp) / "body", Path(tmp) / "title"
body.write_text(pr["body"] or "", encoding="utf-8")
title.write_text(pr["title"], encoding="utf-8")
subprocess.run(["bash", str(Path(__file__).resolve().with_name("check-pr-base.sh")), current, actual, str(body), str(title)], check=True)
def validate_batch(manifest, prs, current):
if manifest["base"] != current: raise ValueError("master moved since batch creation")
if not manifest["head"] or len(manifest["prs"]) < 2: raise ValueError("expected pinned batch and at least two PRs")
numbers = [p["number"] for p in manifest["prs"]]
if len(set(numbers)) != len(numbers) or numbers != [p["number"] for p in prs]:
raise ValueError("batch PR order differs or repeats")
for saved, pr in zip(manifest["prs"], prs):
if pr["state"] != "open" or pr["draft"] or pr["base"]["ref"] != "master" or pr["head"]["sha"] != saved["head"]:
raise ValueError("batch member is not ready or its head changed")
if not Path(saved["evidence"]).is_file() or not Path(saved["evidence"]).read_text().strip():
raise ValueError("batch member has no acceptance evidence")
def main(args):
current = api("git/ref/heads/master")["object"]["sha"]
if len(args) == 2 and args[0] == "--verify-tree":
tree = api("git/commits/" + current)["tree"]["sha"]
if tree != args[1]: raise ValueError("master tree differs from the tested batch")
print(json.dumps({"tree_matches": True, "master": current, "tree": tree}))
return
if len(args) == 2 and args[0] == "--batch":
manifest = json.loads(Path(args[1]).read_text())
prs = [api("pulls/" + str(p["number"])) for p in manifest["prs"]]
validate_batch(manifest, prs, current)
batch = api("pulls/" + str(manifest["batch_pr"]))
if batch["head"]["sha"] != manifest["head"]: raise ValueError("batch head changed")
fetch_review_head(batch, current)
run = successful_run(batch, current)
for pr in prs: local_checks(pr, current)
if api("git/ref/heads/master")["object"]["sha"] != current: raise ValueError("master moved; recheck")
for pr in prs + [batch]:
if api("pulls/" + str(pr["number"]))["head"]["sha"] != pr["head"]["sha"]: raise ValueError("head moved; recheck")
print(json.dumps({"ready": True, "base": current, "head": manifest["head"], "run": run["id"], "tree": api("git/commits/" + manifest["head"])["tree"]["sha"], "order": [p["number"] for p in prs]}))
return
if len(args) != 1 or not args[0].isdecimal(): raise ValueError("expected PR, --batch MANIFEST or --verify-tree TREE")
pr = api("pulls/" + args[0])
run = successful_run(pr, current)
local_checks(pr, current)
if api("git/ref/heads/master")["object"]["sha"] != current or api("pulls/" + args[0])["head"]["sha"] != pr["head"]["sha"]:
raise ValueError("base or head moved; recheck")
print(json.dumps({"ready": True, "head": pr["head"]["sha"], "base": current, "run": run["id"], "merge_mode": "squash"}))
if __name__ == "__main__":
try:
main(sys.argv[1:])
except (IndexError, KeyError, ValueError, OSError, subprocess.SubprocessError) as error:
print("REFUSED: " + str(error), file=sys.stderr)
sys.exit(1)
@@ -0,0 +1,52 @@
"""Exact coverage before scope selection; old heavy-package rules afterward."""
import importlib.util
from pathlib import Path
import unittest
spec = importlib.util.spec_from_file_location("planner", Path(__file__).with_name("unit-test-shards.py"))
planner = importlib.util.module_from_spec(spec)
spec.loader.exec_module(planner)
MODULE = "example.invalid/product"
HEAVY = ("core/storage", "core/frontend/durable", "core/host/master", "core/authority")
class UnitShardTests(unittest.TestCase):
def setUp(self):
self.packages = [MODULE + "/" + p for p in (*HEAVY, "cmd/sw-block", "core/frontend/chunkstore", "internal/newpackage", "core/storage/child")]
self.groups = planner.partition(MODULE, self.packages)
def test_exact_cover_and_stable_order(self):
flat = [p for group in self.groups.values() for p in group]
self.assertCountEqual(flat, self.packages)
self.assertEqual(len(flat), len(set(flat)))
self.assertEqual(self.groups, planner.partition(MODULE, list(reversed(self.packages))))
self.assertEqual(self.groups["g1"], [MODULE + "/core/storage"])
self.assertEqual(self.groups["g2"], [MODULE + "/" + p for p in HEAVY[1:]])
self.assertIn(MODULE + "/internal/newpackage", self.groups["g3"])
self.assertIn(MODULE + "/core/storage/child", self.groups["g3"])
def test_existing_heavy_scope_on_main_train_and_prs(self):
all_changed = [p + "/changed.go" for p in HEAVY]
for event, ref in (("push", ""), ("pull_request", "train/next")):
selected = planner.select(MODULE, self.groups, event, ref, all_changed)
self.assertEqual(selected["g1"], [])
self.assertEqual(selected["g2"], [])
self.assertEqual(selected["g3"], self.groups["g3"])
self.assertEqual(planner.select(MODULE, self.groups, "pull_request", "fix/x", all_changed), self.groups)
for path in HEAVY:
selected = planner.select(MODULE, self.groups, "pull_request", "fix/x", [path + "/x.go"])
heavy = selected["g1"] + selected["g2"]
self.assertEqual(heavy, [MODULE + "/" + path])
nested = planner.select(MODULE, self.groups, "pull_request", "fix/x", ["core/storage/child/x.go", "core/storage/"])
self.assertEqual(nested["g1"], [])
self.assertEqual(nested["g2"], [])
self.assertEqual(nested["g3"], self.groups["g3"])
def test_invalid_inventory_is_refused(self):
for packages in ([], self.packages + [self.packages[0]], self.packages[1:], self.packages + ["other/pkg"]):
with self.subTest(packages=packages), self.assertRaises(ValueError):
planner.partition(MODULE, packages)
if __name__ == "__main__":
unittest.main()
+55
View File
@@ -0,0 +1,55 @@
"""Plan the default unit groups from the full go-list inventory.
Usage: go list ./... | python3 unit-test-shards.py MODULE OUT_DIR EVENT HEAD_REF CHANGED_FILE
The complete partition covers every package exactly once. Existing scope rules
then select heavy packages only on ordinary PRs that touch their direct files.
"""
from pathlib import Path
import sys
HEAVY = ("core/storage", "core/frontend/durable", "core/host/master", "core/authority")
def partition(module, packages):
if not module or any(c.isspace() for c in module):
raise ValueError("expected one module path")
if not packages or len(packages) != len(set(packages)):
raise ValueError("empty package list or duplicate package")
if any(p != module and not p.startswith(module + "/") for p in packages):
raise ValueError("package outside the selected module")
heavy = [module + "/" + p for p in HEAVY]
if not set(heavy) <= set(packages):
raise ValueError("required heavy packages missing from go list")
return {"g1": heavy[:1], "g2": heavy[1:], "g3": sorted(set(packages) - set(heavy))}
def select(module, groups, event, head_ref, changed):
selected = set()
if event != "push" and not head_ref.startswith("train/"):
for p in HEAVY:
if any(f.startswith(p + "/") and f[len(p) + 1:] and "/" not in f[len(p) + 1:] for f in changed):
selected.add(module + "/" + p)
return {name: [p for p in packages if name == "g3" or p in selected]
for name, packages in groups.items()}
def main(argv):
if len(argv) != 6:
print(__doc__.strip(), file=sys.stderr)
return 2
try:
groups = partition(argv[1], sys.stdin.read().split())
groups = select(argv[1], groups, argv[3], argv[4], Path(argv[5]).read_text().splitlines())
out = Path(argv[2])
out.mkdir(parents=True, exist_ok=True)
for name, packages in groups.items():
(out / (name + ".txt")).write_text("".join(p + "\n" for p in packages), encoding="utf-8")
print(f"{name}: {len(packages)} packages")
except (OSError, ValueError) as error:
print(f"unit-test-shards: {error}", file=sys.stderr)
return 2
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))
@@ -0,0 +1,27 @@
FROM golang:1.25-bookworm AS build
WORKDIR /src/seaweed-block
COPY seaweed-block/go.mod seaweed-block/go.sum ./
RUN go mod download
COPY . /src
RUN CGO_ENABLED=0 go build -o /out/blockcsi ./cmd/blockcsi
# No lab build reaches an image (scripts/refuse-lab-binary.sh): refuse it before the
# runtime stage, so neither a build nor a push of this image can complete.
RUN bash scripts/refuse-lab-binary.sh /out/blockcsi
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
e2fsprogs \
kmod \
multipath-tools \
nvme-cli \
open-iscsi \
sg3-utils \
util-linux && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /out/blockcsi /usr/local/bin/blockcsi
ENTRYPOINT ["/usr/local/bin/blockcsi"]
@@ -0,0 +1,24 @@
FROM golang:1.25-bookworm AS build
WORKDIR /src/seaweed-block
COPY seaweed-block/go.mod seaweed-block/go.sum ./
RUN go mod download
COPY . /src
RUN CGO_ENABLED=0 go build -o /out/blockmaster ./cmd/blockmaster && \
CGO_ENABLED=0 go build -o /out/blockvolume ./cmd/blockvolume && \
CGO_ENABLED=0 go build -o /out/sw-block ./cmd/sw-block
# No lab build reaches an image (scripts/refuse-lab-binary.sh): refuse it before the
# runtime stage, so neither a build nor a push of this image can complete.
RUN bash scripts/refuse-lab-binary.sh /out/blockmaster /out/blockvolume /out/sw-block
FROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends kmod && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /out/blockmaster /usr/local/bin/blockmaster
COPY --from=build /out/blockvolume /usr/local/bin/blockvolume
COPY --from=build /out/sw-block /usr/local/bin/sw-block
USER 65532:65532
+141
View File
@@ -0,0 +1,141 @@
name: Block known bugs
# Nightly: every open-issue reproduction that is skipped by default (t.Skip unless
# SEAWEED_KNOWN_BUGS=1) runs and is EXPECTED TO FAIL. If one passes, its bug is
# fixed but its skip is still in place: this job fails and names it, so the skip
# is removed in the fix PR (or right after). A fix PR removes the test's line here
# together with its skip.
on:
schedule:
- cron: "17 6 * * *"
workflow_dispatch:
defaults:
run:
working-directory: seaweed-block
permissions:
contents: read
jobs:
known-bugs:
name: known-bug reproductions still fail
runs-on: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && vars.BLOCK_RUNNER_LABEL || 'ubuntu-latest' }}
timeout-minutes: 15
env:
CGO_ENABLED: "0"
SEAWEED_KNOWN_BUGS: "1"
steps:
- name: Runner free space
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
import shutil
import sys
required = 10_000_000_000
for path in dict.fromkeys((os.environ["GITHUB_WORKSPACE"], os.environ["RUNNER_TEMP"])):
try:
free = shutil.disk_usage(path).free
except OSError as err:
print(f"runner_disk_check_failed path={path!r} error={err}")
sys.exit(75)
if free < required:
print(f"runner_disk_low path={path!r} free_bytes={free} required_bytes={required}")
sys.exit(75)
print(f"runner_disk_ok path={path!r} free_bytes={free} required_bytes={required}")
PY
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Runner disk is NVMe
# A self-hosted runner whose work, temp or Go cache directory sits on a
# SATA system disk times the process-level tests out under disk load;
# this names the runner and stops the job before it starts.
if: runner.environment == 'self-hosted'
run: |
bash .github/scripts/require-nvme-test.sh
bash .github/scripts/require-nvme.sh "$GITHUB_WORKSPACE" "$RUNNER_TEMP" "${TMPDIR:-/tmp}" "${GOCACHE:-$HOME/.cache/go-build}"
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: seaweed-block/go.mod
cache: false
- name: Each reproduction still fails
run: |
set -u
ok=1
while read -r issue pkg test; do
[ -n "$issue" ] || continue
if go test -count=1 -run "^${test}\$" "$pkg" > "out-${test}.txt" 2>&1; then
echo "::error::${test} (${pkg}) now PASSES: ${issue} looks fixed, remove its skip"
ok=0
elif grep -q "^--- FAIL: ${test} " "out-${test}.txt"; then
echo "${test} (${issue}) still fails, as expected"
else
echo "::error::${test} (${pkg}) did not run or failed to build:"; tail -20 "out-${test}.txt"
ok=0
fi
done <<'LIST'
#186 ./cmd/blockmaster/ TestChartOptInLoopbackFlagIsAcceptedByBlockmaster
#187 ./cmd/blockmaster/ TestChartDefaultAuthorityStateSurvivesPodReplacement
#188 ./core/ops/ TestDeleteSafety_UntimedCleanupCannotProveFreshness
#189 ./core/storage/ TestMultiBlockRecordsRequireDistinctOnDiskImplVersion
LIST
[ "$ok" = 1 ]
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in
# a post action and still needs the checkout. Persistent runners do not
# upload that cache, and must release their checkout/build files here.
if: always() && runner.environment == 'self-hosted'
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["GITHUB_WORKSPACE"])
# Refuse aliases rather than resolving them. Open EVERY component without
# following symlinks, then keep cleanup anchored to the verified directory fd.
if not root.is_absolute() or ".." in root.parts or root == Path(root.anchor) or root.name != root.parent.name or root == Path(os.environ["RUNNER_TEMP"]):
print(f"runner_workspace_cleanup_refused path={str(root)!r}")
sys.exit(1)
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
fd = os.open(root.anchor, flags)
previous = os.open(".", flags)
errors = []
try:
for part in root.parts[1:]:
child = os.open(part, flags, dir_fd=fd)
os.close(fd)
fd = child
if not shutil.rmtree.avoids_symlink_attacks:
raise OSError("descriptor-safe directory removal is unavailable")
os.fchdir(fd)
for entry in os.scandir("."):
try:
if entry.is_dir(follow_symlinks=False):
shutil.rmtree(entry.name)
else:
os.unlink(entry.name)
except OSError as err:
errors.append(f"{entry.name}: {err}")
except OSError as err:
print(f"runner_workspace_cleanup_refused path={str(root)!r} error={err}")
sys.exit(1)
finally:
os.fchdir(previous)
os.close(previous)
os.close(fd)
if errors:
print("runner_workspace_cleanup_failed " + "; ".join(errors))
sys.exit(1)
print(f"runner_workspace_clean path={str(root)!r}")
PY
@@ -0,0 +1,137 @@
name: Block post-merge-review paths
# A PR labelled "post-merge-review" may merge before its full review only if
# every changed file is allowed by .github/post-merge-review-allow.txt.
# This check fails such a PR otherwise; without the label it passes.
#
# pull_request_target: the workflow, the allow list and the script all come
# from the base branch, so a PR cannot change its own check. The PR's code is
# never checked out or run: only its commit is fetched, for the file list.
on:
pull_request_target:
paths:
- "seaweed-block/**"
- ".github/workflows/block-*.yml"
- ".github/block/**"
- ".github/dockerfiles/block-*.Dockerfile"
# edited: a retarget changes the base, and with it the diff.
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
defaults:
run:
working-directory: seaweed-block
permissions:
contents: read
concurrency:
group: block-post-merge-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
paths:
name: post-merge-review paths
# GitHub-hosted: on the self-hosted runners this job ended in 'Set up
# job' with no log on every runner (2026-11-29), while spec trace, on the
# same runners, passes. Unlabelled PRs only echo here, so the hosted
# queue costs little; the merge gate does not wait for it unless the PR
# is labelled.
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Runner free space
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
import shutil
import sys
required = 10_000_000_000
for path in dict.fromkeys((os.environ["GITHUB_WORKSPACE"], os.environ["RUNNER_TEMP"])):
try:
free = shutil.disk_usage(path).free
except OSError as err:
print(f"runner_disk_check_failed path={path!r} error={err}")
sys.exit(75)
if free < required:
print(f"runner_disk_low path={path!r} free_bytes={free} required_bytes={required}")
sys.exit(75)
print(f"runner_disk_ok path={path!r} free_bytes={free} required_bytes={required}")
PY
- name: Not labelled
if: ${{ !contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
working-directory: ${{ github.workspace }}
run: echo "no post-merge-review label; nothing to check"
- name: Checkout base
if: ${{ contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0
persist-credentials: false
- name: Check changed paths
if: ${{ contains(github.event.pull_request.labels.*.name, 'post-merge-review') }}
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
PR: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
bash .github/scripts/post-merge-review-check-test.sh
git -c fetch.fsckObjects=true fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head"
bash ../.github/block/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin
bash .github/scripts/post-merge-review-check.sh .github/post-merge-review-allow.txt <changed.bin
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in
# a post action and still needs the checkout. Persistent runners do not
# upload that cache, and must release their checkout/build files here.
if: always() && runner.environment == 'self-hosted'
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["GITHUB_WORKSPACE"])
# Refuse aliases rather than resolving them. Open EVERY component without
# following symlinks, then keep cleanup anchored to the verified directory fd.
if not root.is_absolute() or ".." in root.parts or root == Path(root.anchor) or root.name != root.parent.name or root == Path(os.environ["RUNNER_TEMP"]):
print(f"runner_workspace_cleanup_refused path={str(root)!r}")
sys.exit(1)
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
fd = os.open(root.anchor, flags)
previous = os.open(".", flags)
errors = []
try:
for part in root.parts[1:]:
child = os.open(part, flags, dir_fd=fd)
os.close(fd)
fd = child
if not shutil.rmtree.avoids_symlink_attacks:
raise OSError("descriptor-safe directory removal is unavailable")
os.fchdir(fd)
for entry in os.scandir("."):
try:
if entry.is_dir(follow_symlinks=False):
shutil.rmtree(entry.name)
else:
os.unlink(entry.name)
except OSError as err:
errors.append(f"{entry.name}: {err}")
except OSError as err:
print(f"runner_workspace_cleanup_refused path={str(root)!r} error={err}")
sys.exit(1)
finally:
os.fchdir(previous)
os.close(previous)
os.close(fd)
if errors:
print("runner_workspace_cleanup_failed " + "; ".join(errors))
sys.exit(1)
print(f"runner_workspace_clean path={str(root)!r}")
PY
+194
View File
@@ -0,0 +1,194 @@
name: Publish block release
on:
workflow_dispatch:
push:
tags:
- "seaweed-block/v*"
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
BLOCK_IMAGE: ghcr.io/seaweedfs/seaweed-block
CSI_IMAGE: ghcr.io/seaweedfs/seaweed-block-csi
jobs:
publish:
# Publish only from a version tag; a manual run from a branch must not move :alpha.
if: startsWith(github.ref, 'refs/tags/seaweed-block/v')
runs-on: ubuntu-latest
steps:
- name: Runner free space
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
import shutil
import sys
required = 10_000_000_000
for path in dict.fromkeys((os.environ["GITHUB_WORKSPACE"], os.environ["RUNNER_TEMP"])):
try:
free = shutil.disk_usage(path).free
except OSError as err:
print(f"runner_disk_check_failed path={path!r} error={err}")
sys.exit(75)
if free < required:
print(f"runner_disk_low path={path!r} free_bytes={free} required_bytes={required}")
sys.exit(75)
print(f"runner_disk_ok path={path!r} free_bytes={free} required_bytes={required}")
PY
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # the tag list decides whether :alpha moves
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Compute image tags
id: tags
shell: bash
run: |
set -euo pipefail
# vX.Y.Z-pre (a release candidate) publishes only its own version tag. A stable vX.Y.Z also
# publishes sha-*, and moves :alpha only when it is the highest stable version tag, so a later
# patch on an older line never moves :alpha back.
short_sha="${GITHUB_SHA::12}"
version="${GITHUB_REF_NAME#seaweed-block/}"
if [[ ! "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
echo "refusing to publish: tag ${version} is not vX.Y.Z or vX.Y.Z-pre" >&2
exit 1
fi
notes="seaweed-block/docs/releases/${version%%-*}.md"
if [[ ! -s "${notes}" ]]; then
echo "refusing to publish: release notes ${notes} are missing or empty" >&2
exit 1
fi
echo "notes=${notes}" >> "$GITHUB_OUTPUT"
stable=false
move_alpha=false
if [[ "${version}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
stable=true
highest="$(git tag -l 'seaweed-block/v*' | sed 's|^seaweed-block/||' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)"
if [[ "${version}" == "${highest}" ]]; then
move_alpha=true
fi
fi
{
echo "block_tags<<EOF"
echo "${BLOCK_IMAGE}:${version}"
if [[ "${stable}" == true ]]; then echo "${BLOCK_IMAGE}:sha-${short_sha}"; fi
if [[ "${move_alpha}" == true ]]; then echo "${BLOCK_IMAGE}:alpha"; fi
echo "EOF"
echo "csi_tags<<EOF"
echo "${CSI_IMAGE}:${version}"
if [[ "${stable}" == true ]]; then echo "${CSI_IMAGE}:sha-${short_sha}"; fi
if [[ "${move_alpha}" == true ]]; then echo "${CSI_IMAGE}:alpha"; fi
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Build and push block image
id: block
uses: docker/build-push-action@v6
with:
context: .
file: .github/dockerfiles/block-sw-block.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.block_tags }}
- name: Build and push CSI image
uses: docker/build-push-action@v6
with:
context: .
file: .github/dockerfiles/block-blockcsi.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.tags.outputs.csi_tags }}
- name: Publish matching binary tarball
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BLOCK_DIGEST: ${{ steps.block.outputs.digest }}
NOTES: ${{ steps.tags.outputs.notes }}
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#seaweed-block/}"
out="$RUNNER_TEMP/block-release"
mkdir -p "$out/bin"
docker pull "${BLOCK_IMAGE}@${BLOCK_DIGEST}"
container=$(docker create "${BLOCK_IMAGE}@${BLOCK_DIGEST}")
trap 'docker rm "$container" >/dev/null' EXIT
for binary in blockmaster blockvolume sw-block; do
docker cp "$container:/usr/local/bin/$binary" "$out/bin/$binary"
done
bash seaweed-block/scripts/refuse-lab-binary.sh "$out/bin/"*
asset="sw-block-${version}-linux-amd64.tar.gz"
tar -C "$out/bin" -czf "$out/$asset" blockmaster blockvolume sw-block
(cd "$out" && sha256sum "$asset" >SHA256SUMS)
args=(--repo "$GITHUB_REPOSITORY" --verify-tag --latest=false --title "Seaweed Block $version" --notes-file "$NOTES")
if [[ "$version" == *-* ]]; then args+=(--prerelease); fi
gh release create "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" "${args[@]}"
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in
# a post action and still needs the checkout. Persistent runners do not
# upload that cache, and must release their checkout/build files here.
if: always() && runner.environment == 'self-hosted'
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["GITHUB_WORKSPACE"])
# Refuse aliases rather than resolving them. Open EVERY component without
# following symlinks, then keep cleanup anchored to the verified directory fd.
if not root.is_absolute() or ".." in root.parts or root == Path(root.anchor) or root.name != root.parent.name or root == Path(os.environ["RUNNER_TEMP"]):
print(f"runner_workspace_cleanup_refused path={str(root)!r}")
sys.exit(1)
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
fd = os.open(root.anchor, flags)
previous = os.open(".", flags)
errors = []
try:
for part in root.parts[1:]:
child = os.open(part, flags, dir_fd=fd)
os.close(fd)
fd = child
if not shutil.rmtree.avoids_symlink_attacks:
raise OSError("descriptor-safe directory removal is unavailable")
os.fchdir(fd)
for entry in os.scandir("."):
try:
if entry.is_dir(follow_symlinks=False):
shutil.rmtree(entry.name)
else:
os.unlink(entry.name)
except OSError as err:
errors.append(f"{entry.name}: {err}")
except OSError as err:
print(f"runner_workspace_cleanup_refused path={str(root)!r} error={err}")
sys.exit(1)
finally:
os.fchdir(previous)
os.close(previous)
os.close(fd)
if errors:
print("runner_workspace_cleanup_failed " + "; ".join(errors))
sys.exit(1)
print(f"runner_workspace_clean path={str(root)!r}")
PY
+164
View File
@@ -0,0 +1,164 @@
name: Block spec trace
# Every PR description carries the spec trace (see the PR template); this
# check fails a PR whose description does not.
#
# pull_request_target: the workflow and the script come from the base branch,
# so a PR cannot change its own check. The PR's code is never checked out or
# run: only its commit is fetched, for the file list. The description is read
# from the event through an environment variable, never interpolated.
on:
pull_request_target:
paths:
- "seaweed-block/**"
- ".github/workflows/block-*.yml"
- ".github/block/**"
- ".github/dockerfiles/block-*.Dockerfile"
# edited: the check reads the description and the base.
types: [opened, synchronize, reopened, edited]
defaults:
run:
working-directory: seaweed-block
permissions:
contents: read
concurrency:
group: block-spec-trace-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
trace:
name: spec trace
# The base-owned check defaults to a disposable hosted runner. Only a
# same-repository PR may opt into the registered BLOCK_RUNNER_LABEL.
runs-on: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && vars.BLOCK_RUNNER_LABEL || 'ubuntu-latest' }}
timeout-minutes: 5
steps:
- name: Runner free space
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
import shutil
import sys
required = 10_000_000_000
for path in dict.fromkeys((os.environ["GITHUB_WORKSPACE"], os.environ["RUNNER_TEMP"])):
try:
free = shutil.disk_usage(path).free
except OSError as err:
print(f"runner_disk_check_failed path={path!r} error={err}")
sys.exit(75)
if free < required:
print(f"runner_disk_low path={path!r} free_bytes={free} required_bytes={required}")
sys.exit(75)
print(f"runner_disk_ok path={path!r} free_bytes={free} required_bytes={required}")
PY
- name: Checkout base
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
# github.sha is the tip of the base branch when the event fires; the
# PR's base.sha can predate this workflow's own scripts.
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
# spec-trace-check.sh builds the trusted sametokens.go; a self-hosted
# runner has no Go on its PATH unless the job sets it up.
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: seaweed-block/go.mod
cache: false
- name: Check spec trace
env:
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
PR: ${{ github.event.pull_request.number }}
BODY: ${{ github.event.pull_request.body }}
TITLE: ${{ github.event.pull_request.title }}
run: |
set -euo pipefail
bash .github/scripts/spec-trace-check-test.sh
python3 -B .github/scripts/model-trace-check-test.py
bash .github/scripts/changed-go-blobs-test.sh
# fsckObjects: a PR's objects are checked as they arrive, so a tree
# with a '..' or '.git' entry is refused here.
git -c fetch.fsckObjects=true fetch --no-tags origin "+refs/pull/${PR}/head:refs/remotes/pr/head"
printf '%s' "$BODY" >body.txt
bash ../.github/block/scripts/post-merge-review-changed.sh "$BASE" "$HEAD" >changed.bin
# Old and new blobs of each changed non-test Go file, for kind DOCS
# (objects only; a path that would leave blobs/ is refused).
mb=$(git merge-base "$BASE" "$HEAD")
bash ../.github/block/scripts/changed-go-blobs.sh "$mb" "$HEAD" blobs
# Mapping and validator come from the trusted base checkout above.
bash .github/scripts/spec-trace-check.sh body.txt blobs .github/model-code-trace.tsv <changed.bin
# Internal names stay out of this public repository: added lines,
# commit messages, title and description (no PR code is run).
bash .github/scripts/public-text-check-test.sh
printf '%s' "$TITLE" >title.txt
bash ../.github/block/scripts/public-text-check.sh "$mb" "$HEAD" title.txt body.txt
- name: Invariants ledger anchors (report only)
# Every code and test anchor of docs/design/invariants.md must exist at
# the PR's commit (git objects only; nothing from the PR is run). It
# reports and does not fail the check while the known imprecise
# anchors are being corrected; then this step becomes gating.
continue-on-error: true
env:
HEAD: ${{ github.event.pull_request.head.sha }}
run: python3 -I ../.github/block/scripts/ledger_check.py "$GITHUB_WORKSPACE" "$HEAD" seaweed-block/docs/design/invariants.md seaweed-block/ || true
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in
# a post action and still needs the checkout. Persistent runners do not
# upload that cache, and must release their checkout/build files here.
if: always() && runner.environment == 'self-hosted'
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["GITHUB_WORKSPACE"])
# Refuse aliases rather than resolving them. Open EVERY component without
# following symlinks, then keep cleanup anchored to the verified directory fd.
if not root.is_absolute() or ".." in root.parts or root == Path(root.anchor) or root.name != root.parent.name or root == Path(os.environ["RUNNER_TEMP"]):
print(f"runner_workspace_cleanup_refused path={str(root)!r}")
sys.exit(1)
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
fd = os.open(root.anchor, flags)
previous = os.open(".", flags)
errors = []
try:
for part in root.parts[1:]:
child = os.open(part, flags, dir_fd=fd)
os.close(fd)
fd = child
if not shutil.rmtree.avoids_symlink_attacks:
raise OSError("descriptor-safe directory removal is unavailable")
os.fchdir(fd)
for entry in os.scandir("."):
try:
if entry.is_dir(follow_symlinks=False):
shutil.rmtree(entry.name)
else:
os.unlink(entry.name)
except OSError as err:
errors.append(f"{entry.name}: {err}")
except OSError as err:
print(f"runner_workspace_cleanup_refused path={str(root)!r} error={err}")
sys.exit(1)
finally:
os.fchdir(previous)
os.close(previous)
os.close(fd)
if errors:
print("runner_workspace_cleanup_failed " + "; ".join(errors))
sys.exit(1)
print(f"runner_workspace_clean path={str(root)!r}")
PY
+444
View File
@@ -0,0 +1,444 @@
name: Block Test
on:
pull_request:
paths:
- "seaweed-block/**"
- ".github/workflows/block-*.yml"
- ".github/block/**"
- ".github/dockerfiles/block-*.Dockerfile"
# ready_for_review: a Draft runs no Go suite (below); marking it ready starts one.
types: [opened, synchronize, reopened, ready_for_review]
push:
paths:
- "seaweed-block/**"
- ".github/workflows/block-*.yml"
- ".github/block/**"
- ".github/dockerfiles/block-*.Dockerfile"
branches:
- master
defaults:
run:
working-directory: seaweed-block
permissions:
contents: read
# One run per PR (or per branch for pushes). A new push to a PR cancels the
# superseded run; runs on main are never cancelled so every merge gets a result.
concurrency:
group: block-test-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
# One job, two suites, one runner selection. 'unit' is the Go suite below;
# 'process' runs the process-level tests: real blockmaster, blockvolume and
# sw-block against a pinned SeaweedFS release. Those tests are named in
# .github/process-level-tests.txt, and every one must PASS, so a test that
# skips, fails, never starts or is cut off by the timeout fails the suite.
# Tests that need root or systemd are not in the list (see its header).
strategy:
fail-fast: false
matrix:
suite: [unit, process]
name: ${{ matrix.suite == 'unit' && 'go test (linux)' || 'process-level tests (real binaries)' }}
# The suite writes heavily to the runner disk (real files, fsync), so a
# Draft PR skips it; its author tests locally until the PR is ready.
if: github.event_name == 'push' || !github.event.pull_request.draft
# Hosted by default until this repository has a registered block pool.
# Set BLOCK_RUNNER_LABEL only for an available dedicated label. Forks
# always stay on disposable GitHub-hosted runners.
runs-on: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && vars.BLOCK_RUNNER_LABEL || 'ubuntu-latest' }}
# process: 44 tests in 4 parallel shards of about 13 min each (55 min in sequence).
timeout-minutes: ${{ matrix.suite == 'unit' && 60 || 90 }}
env:
# Pure-Go build: no package in the default build needs cgo, and the
# hosted runner should not depend on a C toolchain being present.
CGO_ENABLED: "0"
steps:
- name: Runner free space
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
import shutil
import sys
required = 10_000_000_000
for path in dict.fromkeys((os.environ["GITHUB_WORKSPACE"], os.environ["RUNNER_TEMP"])):
try:
free = shutil.disk_usage(path).free
except OSError as err:
print(f"runner_disk_check_failed path={path!r} error={err}")
sys.exit(75)
if free < required:
print(f"runner_disk_low path={path!r} free_bytes={free} required_bytes={required}")
sys.exit(75)
print(f"runner_disk_ok path={path!r} free_bytes={free} required_bytes={required}")
PY
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
# Two commits: the PR merge commit and its base parent, so the test
# step can see which packages the PR touches.
fetch-depth: 2
- name: Nested module CI contracts
run: |
python3 -I ../.github/block/scripts/block-ci-port-test.py
python3 -B ../.github/block/scripts/runner-workspace-test.py
- name: Relative documentation links
if: matrix.suite == 'unit'
run: |
python3 -B ../.github/block/scripts/doc-links-check-test.py
python3 -I ../.github/block/scripts/doc-links-check.py .
- name: Runner disk is NVMe
# A self-hosted runner whose work, temp or Go cache directory sits on a
# SATA system disk times the process-level tests out under disk load;
# this names the runner and stops the job before it starts.
if: runner.environment == 'self-hosted'
run: |
bash .github/scripts/require-nvme-test.sh
bash .github/scripts/require-nvme.sh "$GITHUB_WORKSPACE" "$RUNNER_TEMP" "${TMPDIR:-/tmp}" "${GOCACHE:-$HOME/.cache/go-build}"
- name: Start whole-job load evidence
# Begins after checkout, before toolchain setup/build/tests. No host
# installation or privileged reads. A job-sized lifetime also bounds
# the sampler if cancellation prevents the stop step.
continue-on-error: true
env:
CI_EVIDENCE_DIR: ${{ runner.temp }}/ci-${{ matrix.suite }}-${{ github.run_id }}-${{ github.run_attempt }}
run: |
echo "CI_EVIDENCE_DIR=$CI_EVIDENCE_DIR" >>"$GITHUB_ENV"
mkdir -p "$CI_EVIDENCE_DIR"
: >"$CI_EVIDENCE_DIR/go-test.json"
python3 -I .github/scripts/ci-load.py start "$CI_EVIDENCE_DIR/load.tsv" --duration ${{ matrix.suite == 'unit' && 2400 || 5400 }}
- name: Self-test evidence capture
run: |
python3 -B .github/scripts/ci-load-test.py
bash .github/scripts/record-go-test-test.sh
- name: Docs-only pull request
id: scope
if: matrix.suite == 'process' && github.event_name == 'pull_request'
# A pull request that changes only files under docs/ runs no product
# code the process-level tests could exercise, so they are skipped and
# the job still reports success. HEAD is the merge commit, HEAD^1 its
# base parent (fetch-depth 2 above). Pushes to main always run them, and
# so does any error of the check (../.github/block/scripts/docs-only-scope.sh).
run: |
set -euo pipefail
bash .github/scripts/docs-only-scope-test.sh
if out=$(bash ../.github/block/scripts/docs-only-scope.sh HEAD^1 HEAD); then
case $out in
"docs_only "*)
echo "skipped: docs only (${out#docs_only } files under docs/); the process-level tests run on the merge to main"
echo "docs_only=1" >>"$GITHUB_OUTPUT" ;;
*) echo "process-level tests run: $out" ;;
esac
else
echo "process-level tests run: the docs-only check failed"
fi
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: seaweed-block/go.mod
# The self-hosted runner keeps GOCACHE/GOMODCACHE on its own disk;
# uploading them as an Actions cache (~4 GB) in the post step
# outlasted the job timeout after every test had passed. Only the
# GitHub-hosted (fork PR) runner uses the Actions cache.
cache: ${{ runner.environment == 'github-hosted' }}
cache-dependency-path: seaweed-block/go.sum
- name: Go version
if: matrix.suite == 'unit'
run: go version
- name: Build
if: matrix.suite == 'unit'
run: go build ./...
- name: Vet
if: matrix.suite == 'unit'
run: go vet ./...
- name: Lab build tags stay out of images and releases
if: matrix.suite == 'unit'
# swblock_lab_bigvol lifts the 1 TiB create cap and the local
# headroom refusal for scale rehearsals only; swblock_v11_format turns
# on the draft v1.1 store format. The default test run pins the
# release cap (TestReleaseBuildKeepsTheCreateCap) and the release
# format. This step checks the tags' allowlist and that every image
# Dockerfile refuses a lab binary (scripts/refuse-lab-binary.sh) after
# its build, with controls, then tests each tag alone and both.
run: |
set -euo pipefail
bash .github/scripts/lab-tag-check.sh .
bash .github/scripts/lab-tag-check-test.sh
for tags in swblock_lab_bigvol swblock_v11_format swblock_lab_bigvol,swblock_v11_format; do
go vet -tags "$tags" ./core/geometry/ ./core/frontend/durable/ ./internal/buildinfo/ ./core/storage/
bash .github/scripts/record-go-test.sh "$CI_EVIDENCE_DIR/go-test.json" -count=1 -tags "$tags" -run 'Lab|Headroom|Revision|LegacyBound' ./core/geometry/ ./core/frontend/durable/ ./internal/buildinfo/
bash .github/scripts/record-go-test.sh "$CI_EVIDENCE_DIR/go-test.json" -count=1 -tags "$tags" -run 'TestV11FormatFollowsItsOwnTagAlone' ./core/storage/
done
- name: Test default configuration
if: matrix.suite == 'unit'
# Preserve the existing scope: main/train omit the four heavy packages;
# ordinary PRs add each only when its direct package files are touched.
# Three subprocesses share this ONE runner: storage, durable plus touched
# master/authority, and the remaining selected packages at -p=4.
env:
EVENT: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
run: |
set -euo pipefail
python3 -I ../.github/block/scripts/unit-test-shards-test.py
python3 -I ../.github/block/scripts/run-unit-groups-test.py
plan="$RUNNER_TEMP/unit-groups"
mkdir -p "$plan"
go list ./... >"$plan/all.txt"
mod=$(go list -m)
# Main pushes need no changed-path list; a shallow initial push may
# have no parent. Ordinary PRs use the merge commit's base parent.
: >"$plan/changed.txt"
if [ "$EVENT" != push ] && [[ "$HEAD_REF" != train/* ]]; then
git diff --relative --name-only HEAD^1 HEAD -- . >"$plan/changed.txt"
fi
python3 -I ../.github/block/scripts/unit-test-shards.py "$mod" "$plan" "$EVENT" "$HEAD_REF" "$plan/changed.txt" <"$plan/all.txt"
python3 -I ../.github/block/scripts/run-unit-groups.py "$plan" "$CI_EVIDENCE_DIR" "$RUNNER_TEMP/unit-group-tmp" \
bash .github/scripts/record-go-test.sh
- name: Format v3 tagged tests
if: matrix.suite == 'unit'
# The swblock_format_v3_test tests of the four packages that carry them.
# Five durable tests are skipped by name: each installs a BASE on a chunk
# store, which no production path does (its invariant row is DORMANT);
# they are rewritten at the start of the next release, then this skip
# goes.
run: |
set -euo pipefail
skip='^(TestDurableProviderV3_AttachesCompletedChunkBASE|TestDurableProviderV3_CompletedBASEDoesNotRestoreOlderHEAD|TestDurableProviderV3_DefersBASERetirementUntilLocalPresence|TestDurableProviderV3_FreshMarkerCrashKeepsCompletedBASE|TestDurableProviderV3_FreshMarkerCaptureCrashKeepsCompletedBASE)$'
bash .github/scripts/record-go-test.sh "$CI_EVIDENCE_DIR/go-test.json" -p=1 -count=1 -timeout 20m -tags swblock_format_v3_test -skip "$skip" \
./core/frontend/durable/ ./core/recovery/ ./core/replication/ ./core/transport/
- name: Self-test of the required-tests gate
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
# The gate must fail on a skip, a failure, a test that never ran, one
# cut off mid-run, and one that reports PASS and then exits nonzero or
# hangs; this proves it before it judges the real run.
run: |
python3 -I .github/scripts/required-tests-check-test.py
bash .github/scripts/chunkstore-scope-test.sh
bash .github/scripts/run-named-tests-test.sh
python3 -I .github/scripts/shard-named-tests-test.py
- name: Pinned SeaweedFS
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
# The release archive is checked against its sha256 before every use,
# also when taken from the runner's cache; a mismatch fails the step.
# Nothing else is fetched.
env:
WEED_VERSION: "4.53"
WEED_SHA256: d1a7dec9f48d8b33895a0ea8951971defc2dc5312906dcc76fa5a5f74a6ee90d
run: |
set -euo pipefail
cache="${RUNNER_TOOL_CACHE:-$RUNNER_TEMP}/seaweedfs-weed/$WEED_VERSION"
tgz="$cache/linux_amd64.tar.gz"
mkdir -p "$cache"
if ! echo "$WEED_SHA256 $tgz" | sha256sum -c --status - 2>/dev/null; then
part="$tgz.$$.part"
curl -fsSL --retry 3 -o "$part" "https://github.com/seaweedfs/seaweedfs/releases/download/$WEED_VERSION/linux_amd64.tar.gz"
echo "$WEED_SHA256 $part" | sha256sum -c - || { rm -f "$part"; exit 1; }
mv -f "$part" "$tgz"
fi
bin="$RUNNER_TEMP/weed-$WEED_VERSION"
mkdir -p "$bin"
tar -xzf "$tgz" -C "$bin" weed
echo "CHUNKSTORE_WEED=$bin/weed" >>"$GITHUB_ENV"
- name: Real-filer integration tests
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
# The chunkstore_integration tests run against the pinned weed above
# (master, volume and filer as real processes): the conditional HEAD
# writes, cut uploads and object deletes of the chunk store, and the
# layout sync crash cases of the durable provider. They fail, never
# skip, without the binary. Pushes to main and train PRs always run
# them; another PR runs them when it touches core/frontend/chunkstore/,
# core/storage/ or core/frontend/durable/.
env:
EVENT: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
# ../.github/block/scripts/chunkstore-scope.sh decides; an error of that check
# runs the tests. Each filtered run must PASS at least one test, so a
# filter that matches nothing fails instead of passing empty.
run: |
set -euo pipefail
if [ "$EVENT" != push ] && [[ "$HEAD_REF" != train/* ]]; then
if out=$(bash ../.github/block/scripts/chunkstore-scope.sh HEAD^1 HEAD); then
case $out in
"skip "*) echo "skipped: the PR touches neither core/frontend/chunkstore/ nor core/storage/ ($out)"; exit 0 ;;
*) echo "real-filer integration tests run: $out" ;;
esac
else
echo "real-filer integration tests run: the scope check failed"
fi
fi
for spec in "./core/frontend/chunkstore/ ^TestIntegration" "./core/frontend/durable/ ^TestQD1LayoutSync"; do
pkg=${spec%% *}; filter=${spec#* }
log="$RUNNER_TEMP/integration-$(basename "$pkg").log"
bash .github/scripts/record-go-test.sh "$CI_EVIDENCE_DIR/go-test.json" -count=1 -v -timeout 20m -tags chunkstore_integration -run "$filter" "$pkg" 2>&1 | tee "$log"
grep -q '^--- PASS: ' "$log" || { echo "no test of $pkg matched $filter"; exit 1; }
done
- name: Build the binaries and the test binary once
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
run: |
set -euo pipefail
bins="$RUNNER_TEMP/swblock-bins"
mkdir -p "$bins"
for b in blockmaster blockvolume sw-block; do go build -o "$bins/$b" "./cmd/$b"; done
go test -c -tags 'subprocess chunkstore_integration' -o "$bins/blockvolume.test" ./cmd/blockvolume
go test -c -o "$bins/blockcsi.test" ./cmd/blockcsi
# The known-zero acceptance's first-start crash step holds a test-only
# blockvolume (build tag kzhold, never released) at a chosen point.
go build -tags kzhold -o "$RUNNER_TEMP/blockvolume-kzhold" ./cmd/blockvolume
echo "SWBLOCK_TEST_BINS=$bins" >>"$GITHUB_ENV"
echo "KZ_HOLD_BIN=$RUNNER_TEMP/blockvolume-kzhold" >>"$GITHUB_ENV"
- name: Run the named process-level tests
if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'
# Each named test in its own process of the one test binary, in
# sequence, so a panic or a hang in one cannot hide the others; each
# is bounded (TEST_TIMEOUT, then killed) and its exit status is kept:
# the gate needs a PASS event AND exit 0 for every named test. The known-zero acceptance
# runs its small shape (1 GiB, user-space client, no device); the
# 1 TiB run is lab only.
env:
KZ_RUN: "1"
KZ_SIZE: 1G
F1_RUN: "1"
TEST_TIMEOUT: 15m
# A failed test copies each daemon's whole log here (keepFullLog);
# the step below keeps them as the run's artifact.
SWBLOCK_TEST_LOG_DIR: ${{ env.CI_EVIDENCE_DIR }}/daemon-logs
run: |
set -euo pipefail
# SHARDS parallel shards, balanced by their last measured times
# (.github/process-level-seconds.txt). Each shard is its own sequence
# of test processes with its own slice of the test port ranges
# (SWBLOCK_TEST_PORT_SHARD) and its own TMPDIR; the gate judges every
# named test from all the shards together.
names=.github/process-level-tests.txt
# The manifest tags CSI entries; every other name uses blockvolume.test.
# The final checker still requires the complete, unsplit manifest.
awk '!/# package=blockcsi/' "$names" > "$RUNNER_TEMP/blockvolume-names.txt"
awk '/# package=blockcsi/ {sub(/#.*/, ""); if ($0 ~ /[^[:space:]]/) print}' "$names" > "$RUNNER_TEMP/blockcsi-names.txt"
test -s "$RUNNER_TEMP/blockcsi-names.txt"
shards=4
python3 -I .github/scripts/shard-named-tests.py "$RUNNER_TEMP/blockvolume-names.txt" .github/process-level-seconds.txt "$shards" "$RUNNER_TEMP/shard"
pids=()
for k in $(seq 1 "$shards"); do
mkdir -p "$RUNNER_TEMP/tmp-$k"
SWBLOCK_TEST_PORT_SHARD=$k SWBLOCK_TEST_PORT_SHARDS=$shards TMPDIR="$RUNNER_TEMP/tmp-$k" \
bash .github/scripts/run-named-tests.sh "$SWBLOCK_TEST_BINS/blockvolume.test" "$RUNNER_TEMP/shard/$k.txt" \
"$RUNNER_TEMP/process-level-$k.json" "$RUNNER_TEMP/process-level-$k.status" "$TEST_TIMEOUT" cmd/blockvolume \
>"$RUNNER_TEMP/process-level-$k.log" 2>&1 &
pids+=($!)
done
for p in "${pids[@]}"; do wait "$p" || true; done
for k in $(seq 1 "$shards"); do sed "s/^/[shard $k] /" "$RUNNER_TEMP/process-level-$k.log"; done
# CSI uses the same per-case isolation, timeout and verdict as the shards.
TEST_PKG=github.com/seaweedfs/seaweed-block/cmd/blockcsi \
bash .github/scripts/run-named-tests.sh "$SWBLOCK_TEST_BINS/blockcsi.test" "$RUNNER_TEMP/blockcsi-names.txt" \
"$RUNNER_TEMP/process-level-csi.json" "$RUNNER_TEMP/process-level-csi.status" "$TEST_TIMEOUT" cmd/blockcsi \
>"$RUNNER_TEMP/process-level-csi.log" 2>&1 || true
cat "$RUNNER_TEMP/process-level-csi.log"
cat "$RUNNER_TEMP"/process-level-*.status >"$RUNNER_TEMP/process-level.status"
python3 -I .github/scripts/required-tests-check.py --status "$RUNNER_TEMP/process-level.status" \
"$names" "$RUNNER_TEMP"/process-level-*.json
- name: Stop load evidence and collect raw process events
if: always()
continue-on-error: true
env:
SUITE: ${{ matrix.suite }}
run: |
if [ -z "${CI_EVIDENCE_DIR:-}" ]; then exit 0; fi
python3 -I .github/scripts/ci-load.py stop "$CI_EVIDENCE_DIR/load.tsv" || true
if [ "$SUITE" = process ]; then
mkdir -p "$CI_EVIDENCE_DIR/shards"
shopt -s nullglob
for file in "$RUNNER_TEMP"/process-level-*.json "$RUNNER_TEMP"/process-level-*.log "$RUNNER_TEMP"/process-level*.status; do
cp "$file" "$CI_EVIDENCE_DIR/shards/"
done
for file in "$CI_EVIDENCE_DIR"/shards/*.json; do cat "$file" >>"$CI_EVIDENCE_DIR/go-test.json"; done
fi
- name: Keep failed-job tests, load, daemon logs and shard results
# Both suites retain timed events and whole-job load. Process evidence
# also retains the original shard receipts and full daemon logs.
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ci-${{ matrix.suite }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ env.CI_EVIDENCE_DIR }}
retention-days: 14
if-no-files-found: warn
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in
# a post action and still needs the checkout. Persistent runners do not
# upload that cache, and must release their checkout/build files here.
if: always() && runner.environment == 'self-hosted'
working-directory: ${{ runner.temp }}
run: |
python3 -I - <<'PY'
import os
from pathlib import Path
import shutil
import sys
root = Path(os.environ["GITHUB_WORKSPACE"])
# Refuse aliases rather than resolving them. Open EVERY component without
# following symlinks, then keep cleanup anchored to the verified directory fd.
if not root.is_absolute() or ".." in root.parts or root == Path(root.anchor) or root.name != root.parent.name or root == Path(os.environ["RUNNER_TEMP"]):
print(f"runner_workspace_cleanup_refused path={str(root)!r}")
sys.exit(1)
flags = os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW
fd = os.open(root.anchor, flags)
previous = os.open(".", flags)
errors = []
try:
for part in root.parts[1:]:
child = os.open(part, flags, dir_fd=fd)
os.close(fd)
fd = child
if not shutil.rmtree.avoids_symlink_attacks:
raise OSError("descriptor-safe directory removal is unavailable")
os.fchdir(fd)
for entry in os.scandir("."):
try:
if entry.is_dir(follow_symlinks=False):
shutil.rmtree(entry.name)
else:
os.unlink(entry.name)
except OSError as err:
errors.append(f"{entry.name}: {err}")
except OSError as err:
print(f"runner_workspace_cleanup_refused path={str(root)!r} error={err}")
sys.exit(1)
finally:
os.fchdir(previous)
os.close(previous)
os.close(fd)
if errors:
print("runner_workspace_cleanup_failed " + "; ".join(errors))
sys.exit(1)
print(f"runner_workspace_clean path={str(root)!r}")
PY
+1 -1
View File
@@ -34,7 +34,7 @@ jobs:
# Draft PR skips it; its author tests locally until the PR is ready.
if: github.event_name == 'push' || !github.event.pull_request.draft
# Pull requests run on GitHub-hosted runners (free for this public repo, many
# jobs in parallel); pushes to main keep the team's self-hosted runner (seaweed.slice,
# jobs in parallel); pushes to main keep the team's tp04 runner (seaweed.slice,
# capped at 8 cores / 8 GiB) as the self-hosted signal. A train PR (branch
# train/* of this repository, a few a day) also runs on the team's runners:
# it is the merge gate, and the organization's shared GitHub-hosted queue held
@@ -12,7 +12,6 @@ import (
"runtime"
"strings"
"sync"
"syscall"
"testing"
"time"
@@ -26,7 +25,7 @@ import (
type storeRecordMaster struct {
control.UnimplementedLifecycleServiceServer
mu sync.Mutex
mode string // "creating", "ended", "older", "unreadable", "unavailable"
mode string // "creating", "ended", "older", "unavailable"
}
func (m *storeRecordMaster) set(mode string) { m.mu.Lock(); m.mode = mode; m.mu.Unlock() }
@@ -43,8 +42,6 @@ func (m *storeRecordMaster) GetReplicaStore(_ context.Context, q *control.GetRep
return &control.GetReplicaStoreResponse{Listed: true, CreationEnded: true}, nil
case "older":
return nil, status.Error(codes.Unimplemented, "unknown method GetReplicaStore")
case "unreadable":
return nil, status.Error(codes.FailedPrecondition, "the replica's store record is unreadable")
}
return nil, status.Error(codes.Unavailable, "lifecycle store unavailable")
}
@@ -105,10 +102,7 @@ func runHolder(t *testing.T, bin, master, root, locks string, until func() bool,
// the volume is creating an empty state directory creates the store; once
// creation ended, a store other than the recorded one, and a wiped state
// directory, exit 78 store_lost; an older master (no GetReplicaStore) and an
// unreadable record exit 75 with an empty state directory left empty. A
// master that gives no reply is waited out inside the process, writing
// nothing, so a start during an outage does not burn the unit's start limit;
// once it answers creating, the same process creates its store.
// unreadable record exit 75 with an empty state directory left empty.
func TestBlockvolumeAsksTheMasterBeforeCreatingItsStore(t *testing.T) {
if testing.Short() {
t.Skip("builds and runs the blockvolume binary")
@@ -190,64 +184,11 @@ func TestBlockvolumeAsksTheMasterBeforeCreatingItsStore(t *testing.T) {
}
empty(t)
for mode, reason := range map[string]string{"older": "master_too_old", "unreadable": "store_record_unreadable"} {
for mode, reason := range map[string]string{"older": "master_too_old", "unavailable": "store_record_unreadable"} {
m.set(mode)
if code, _, out := runHolder(t, bin, ln.Addr().String(), root, locks, nil, 60*time.Second); code != exitWorkspaceRetry || !strings.Contains(out, reason) {
t.Fatalf("%s master, empty state: exit %d, want 75 %s\n%s", mode, code, reason, out)
}
empty(t)
}
// No reply for longer than the old 10 s read bound plus the unit's 5 s
// restart delay: the process stays, writes nothing, and creates its
// store once the master answers creating.
m.set("unavailable")
start, answered := time.Now(), false
answer := func() bool {
if !answered && time.Since(start) > 25*time.Second {
if entries, err := os.ReadDir(root); err != nil || len(entries) != 0 {
t.Errorf("the waiting holder wrote into its state directory: %v %v", entries, err)
}
m.set("creating")
answered = true
}
return created()
}
if code, running, out := runHolder(t, bin, ln.Addr().String(), root, locks, answer, 90*time.Second); !running || !created() || !strings.Contains(out, "waiting for the master at "+ln.Addr().String()) {
t.Fatalf("a master with no reply, then creating: exit %d running %v created %v\n%s", code, running, created(), out)
}
// A stop during the wait is a clean stop: exit 0, nothing created.
if runtime.GOOS == "windows" {
return // no SIGTERM to another process
}
if err := os.RemoveAll(root); err != nil {
t.Fatal(err)
}
if err := os.MkdirAll(root, 0o755); err != nil {
t.Fatal(err)
}
m.set("unavailable")
var buf bytes.Buffer
cmd := exec.Command(bin, "--master", ln.Addr().String(), "--server-id", "s1", "--volume-id", "v1", "--replica-id", "r1",
"--data-addr", "127.0.0.1:0", "--ctrl-addr", "127.0.0.1:0", "--durable-root", root, "--durable-impl", "walstore",
"--durable-blocks", "64", "--"+volumeLockDirTestOnlyFlag, locks)
cmd.Stdout, cmd.Stderr = &buf, &buf
if err := cmd.Start(); err != nil {
t.Fatal(err)
}
done := make(chan error, 1)
go func() { done <- cmd.Wait() }()
time.Sleep(5 * time.Second)
_ = cmd.Process.Signal(syscall.SIGTERM)
select {
case err := <-done:
if err != nil || !strings.Contains(buf.String(), "stopped while waiting for the master") {
t.Fatalf("SIGTERM during the wait: %v\n%s", err, buf.String())
}
case <-time.After(30 * time.Second):
killAndJoin(cmd, done)
t.Fatalf("SIGTERM did not end the wait\n%s", buf.String())
}
empty(t)
}
+3 -19
View File
@@ -17,7 +17,6 @@ import (
"path/filepath"
"strconv"
"strings"
"sync/atomic"
"time"
"github.com/seaweedfs/seaweed-block/core/adapter"
@@ -927,24 +926,9 @@ func runVolume(f flags, exits *processExit) int {
if xErr == nil && f.durableImpl != "walstore-chunk" {
// A plain walstore store is the volume's only copy: ask the master
// before anything is created or written (GetReplicaStore).
var storeWait atomic.Bool
if status != nil {
status.SetStartupWait(storeWait.Load)
}
rec, qerr := readReplicaStore(exits.parent, f.masterAddr, h.ReplicaStoreRecord, log.Printf, storeWait.Store)
if exits.parent.Err() != nil {
// Stopped while waiting for the master: nothing was opened or
// created, and a stop is not a failure.
fmt.Fprintln(os.Stderr, "blockvolume: stopped while waiting for the master's store record; nothing was created")
_ = closeProviderAfterSnapshotOperations(status, dp.Close)
if status != nil {
shutCtx, shutCancel := context.WithTimeout(context.Background(), 2*time.Second)
_ = status.Close(shutCtx)
shutCancel()
}
_ = h.Close()
return 0
}
qctx, qcancel := context.WithTimeout(context.Background(), replicaStoreQueryTimeout)
rec, qerr := h.ReplicaStoreRecord(qctx)
qcancel()
admission, refuse := decideStoreAdmission(rec, qerr, exists)
if refuse != nil {
fmt.Fprintln(os.Stderr, "blockvolume: durable storage open refused:", refuse.reason, refuse.detail)
@@ -1,157 +0,0 @@
//go:build linux && subprocess && chunkstore_integration && systemd_integration
package main_test
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
"time"
)
// A plain walstore holder started under the shipped unit's restart policy and
// start limit while blockmaster gives no reply (nothing listens on its
// address) waits inside the process for its store record: through a
// 5-minute outage the unit stays active with no restart, /status says
// waiting_for_master and the journal names the wait; once blockmaster
// starts, the volume serves with no restart. Before, the start exited 75 at
// once, the unit restarted every RestartSec, and after StartLimitBurst
// starts it stayed failed even once the master came back.
//
// A runtime unit file (/run/systemd/system) stands for the installed unit.
func TestWalstoreUnitWaitsForAnUnreachableMasterWithoutBurningItsStartLimit(t *testing.T) {
if os.Getenv("GAP1_SYSTEMD_AUTHORIZED") != "1" {
t.Fatal("explicit real-systemd qualification authorization required; no skip counts as proof")
}
if os.Geteuid() != 0 {
t.Fatal("systemd qualification needs root")
}
shipped := gap1ShippedPolicy(t)
interval, burst := shippedStartLimit(t)
exe := filepath.Join(t.TempDir(), "blockvolume")
if d := os.Getenv("SWBLOCK_TEST_BINS"); d != "" {
exe = filepath.Join(d, "blockvolume")
} else {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
out, err := exec.CommandContext(ctx, "go", "build", "-o", exe, "github.com/seaweedfs/seaweed-block/cmd/blockvolume").CombinedOutput()
cancel()
if err != nil {
t.Fatalf("build blockvolume: %v %s", err, out)
}
}
masterBin := filepath.Join(filepath.Dir(exe), "blockmaster")
if os.Getenv("SWBLOCK_TEST_BINS") == "" {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
out, err := exec.CommandContext(ctx, "go", "build", "-o", masterBin, "github.com/seaweedfs/seaweed-block/cmd/blockmaster").CombinedOutput()
cancel()
if err != nil {
t.Fatalf("build blockmaster: %v %s", err, out)
}
}
master, data, ctrl, statusAddr, nvme := handoffAddress(t), handoffAddress(t), handoffAddress(t), handoffAddress(t), handoffAddress(t)
// nothing listens at master until blockmaster starts below
unit := fmt.Sprintf("swb-c04-walstore-wait-%d.service", os.Getpid())
writeRuntimeUnit(t, unit, exe, []string{"--master", master, "--server-id", "s1", "--volume-id", "v1", "--replica-id", "r1",
"--data-addr", data, "--ctrl-addr", ctrl, "--status-addr", statusAddr, "--durable-root", t.TempDir(), "--durable-impl", "walstore",
"--durable-blocks", "64", "--nvme-listen", nvme, "--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:v1"}, []string{
"StartLimitIntervalSec=" + interval,
"StartLimitBurst=" + burst,
}, []string{
"Restart=on-failure",
"RestartSec=" + shipped["RestartSec"],
"RestartPreventExitStatus=" + shipped["RestartPreventExitStatus"],
"TimeoutStopSec=" + shipped["TimeoutStopSec"],
})
if out, err := runSystemctl("start", unit); err != nil {
t.Fatalf("start %s: %v %s", unit, err, out)
}
// A 5-minute outage: on the old behaviour the unit has failed after
// StartLimitBurst starts RestartSec apart, well before this.
window := 5 * time.Minute
started := time.Now()
var state map[string]string
for time.Since(started) < window {
time.Sleep(2 * time.Second)
s, err := gap1ReadUnit(unit)
if err != nil {
continue
}
state = s
if s["ActiveState"] == "failed" {
t.Fatalf("the unit gave up %v into the master outage: NRestarts %s Result %s; journal: %s",
time.Since(started).Round(time.Second), s["NRestarts"], s["Result"], lastLines(unitJournal(unit), 15))
}
}
journal := unitJournal(unit)
t.Logf("walstore unit after %v with no master: ActiveState %s NRestarts %s", window, state["ActiveState"], state["NRestarts"])
if state["ActiveState"] != "active" || state["NRestarts"] != "0" {
t.Fatalf("after %v: ActiveState %s NRestarts %s; want active with no restart; journal: %s", window, state["ActiveState"], state["NRestarts"], lastLines(journal, 15))
}
if !strings.Contains(journal, "waiting for the master at "+master+" to answer this replica's store record: no reply for") {
t.Fatalf("the journal does not name the wait: %s", lastLines(journal, 15))
}
if reason := statusNotReadyReason(statusAddr, "v1"); reason != "waiting_for_master" {
t.Fatalf("/status NotReadyReason %q during the wait; want waiting_for_master", reason)
}
// blockmaster starts: the waiting process goes on and serves, with no restart.
dir := t.TempDir()
topo := filepath.Join(dir, "topology.yaml")
nl := string(rune(10))
if err := os.WriteFile(topo, []byte("volumes:"+nl+" - volume_id: v1"+nl+" slots:"+nl+" - replica_id: r1"+nl+" server_id: s1"+nl), 0o644); err != nil {
t.Fatal(err)
}
mlog, err := os.Create(filepath.Join(dir, "blockmaster.log"))
if err != nil {
t.Fatal(err)
}
mc := exec.Command(masterBin, "--authority-store", filepath.Join(dir, "master"), "--listen", master, "--topology", topo, "--expected-slots-per-volume", "1")
mc.Stdout, mc.Stderr = mlog, mlog
if err := mc.Start(); err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = mc.Process.Kill(); _ = mc.Wait(); mlog.Close() })
back := time.Now()
for !volumeFrontendReady(statusAddr, "v1") {
if time.Since(back) > 2*time.Minute {
b, _ := os.ReadFile(mlog.Name())
t.Fatalf("v1 never served after blockmaster started; journal: %s; blockmaster: %s", lastLines(unitJournal(unit), 15), lastLines(string(b), 10))
}
time.Sleep(time.Second)
}
s, _ := gap1ReadUnit(unit)
t.Logf("walstore unit served %v after blockmaster started: ActiveState %s NRestarts %s", time.Since(back).Round(time.Second), s["ActiveState"], s["NRestarts"])
if s["ActiveState"] != "active" || s["NRestarts"] != "0" {
t.Fatalf("after serving: ActiveState %s NRestarts %s; want active with no restart", s["ActiveState"], s["NRestarts"])
}
}
// statusNotReadyReason is /status's NotReadyReason for vol ("" when unreadable).
func statusNotReadyReason(statusAddr, vol string) string {
resp, err := http.Get("http://" + statusAddr + "/status?volume=" + vol)
if err != nil {
return ""
}
defer resp.Body.Close()
var p struct{ NotReadyReason string }
if json.NewDecoder(resp.Body).Decode(&p) != nil {
return ""
}
return p.NotReadyReason
}
func lastLines(s string, n int) string {
lines := strings.Split(strings.TrimSpace(s), string(rune(10)))
if len(lines) > n {
lines = lines[len(lines)-n:]
}
return strings.Join(lines, " | ")
}
@@ -1,10 +1,8 @@
package main
import (
"context"
"time"
"github.com/seaweedfs/seaweed-block/core/host/volume"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
"github.com/seaweedfs/seaweed-block/core/storage"
"google.golang.org/grpc/codes"
@@ -15,57 +13,6 @@ import (
// its durable open.
const replicaStoreQueryTimeout = 10 * time.Second
// replicaStoreRetryEvery paces the store record read while blockmaster gives
// no reply, and replicaStoreWaitLogEvery its log line. Vars only so a test
// can shorten them.
var (
replicaStoreRetryEvery = 2 * time.Second
replicaStoreWaitLogEvery = 30 * time.Second
)
// readReplicaStore reads the master's record of this replica's store. While
// blockmaster gives no reply (volume.MasterCallClass: neither contact nor a
// credentials refusal) the process waits and reads again, with no bound, so
// a start during a master outage does not exit and burn the unit's start
// limit. It runs before the store is opened or created, so nothing is
// written meanwhile; waiting reports the wait (for /status) and the log
// repeats it every replicaStoreWaitLogEvery with the master's address and the
// time waited. Any answer, a credentials refusal, or ctx's end returns the
// last result.
func readReplicaStore(ctx context.Context, master string, read func(context.Context) (*control.GetReplicaStoreResponse, error), logf func(string, ...any), waiting func(bool)) (*control.GetReplicaStoreResponse, error) {
var since, logged time.Time
defer func() {
if !since.IsZero() {
waiting(false)
}
}()
for {
qctx, cancel := context.WithTimeout(ctx, replicaStoreQueryTimeout)
rec, err := read(qctx)
cancel()
contact, credentials := volume.MasterCallClass(err)
if contact || credentials || ctx.Err() != nil {
if !since.IsZero() && ctx.Err() == nil {
logf("blockvolume: the master at %s answered this replica's store record after %s", master, time.Since(since).Round(time.Second))
}
return rec, err
}
if since.IsZero() {
since = time.Now()
waiting(true)
}
if logged.IsZero() || time.Since(logged) >= replicaStoreWaitLogEvery {
logged = time.Now()
logf("blockvolume: waiting for the master at %s to answer this replica's store record: no reply for %s (%v); nothing is created or written meanwhile", master, time.Since(since).Round(time.Second), err)
}
select {
case <-ctx.Done():
return rec, err
case <-time.After(replicaStoreRetryEvery):
}
}
}
// storeAdmission is how the durable open may treat the local store: with
// mustExist it never creates one (a missing store is refused at the open
// itself), and a nonzero id is the store it must find.
@@ -80,8 +27,7 @@ type storeAdmission struct {
// exists:
//
// answer store present store absent
// no reply (waited out in-process by readReplicaStore; only a shutdown ends the wait)
// other error refuse 75 refuse 75
// error / timeout refuse 75 refuse 75
// older master (Unimplemented) open as before refuse 75 master_too_old
// not listed open as before refuse 75 volume_not_listed
// listed, replicated, non-primary open or create (peer rebuild path, as before)
@@ -1,82 +0,0 @@
package main
import (
"context"
"errors"
"testing"
"time"
control "github.com/seaweedfs/seaweed-block/core/rpc/control"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// The store record read waits inside the process while blockmaster gives no
// reply (Unavailable, DeadlineExceeded, a timed-out read), logging once, and
// returns the first answer; any other result returns at once (a credentials
// refusal, an older master, an answered error), and so does a shutdown.
func TestReadReplicaStoreWaitsOnlyWhileTheMasterGivesNoReply(t *testing.T) {
prev := replicaStoreRetryEvery
replicaStoreRetryEvery = time.Millisecond
t.Cleanup(func() { replicaStoreRetryEvery = prev })
want := &control.GetReplicaStoreResponse{Listed: true}
script := func(errs ...error) (func(context.Context) (*control.GetReplicaStoreResponse, error), *int) {
calls := 0
return func(context.Context) (*control.GetReplicaStoreResponse, error) {
calls++
if calls <= len(errs) {
return nil, errs[calls-1]
}
return want, nil
}, &calls
}
logs := 0
logf := func(string, ...any) { logs++ }
var states []bool
waiting := func(w bool) { states = append(states, w) }
read, calls := script(status.Error(codes.Unavailable, "connection refused"), status.Error(codes.DeadlineExceeded, "deadline"), context.DeadlineExceeded)
if rec, err := readReplicaStore(context.Background(), "127.0.0.1:9180", read, logf, waiting); err != nil || rec != want || *calls != 4 || logs != 2 {
t.Fatalf("no reply three times, then an answer: rec %v err %v calls %d logs %d (want the answer after 4 reads, 2 log lines)", rec, err, *calls, logs)
}
if len(states) != 2 || !states[0] || states[1] {
t.Fatalf("the wait was reported %v; want waiting, then not", states)
}
// The log line repeats at its cadence, not at every read.
prevLog := replicaStoreWaitLogEvery
replicaStoreWaitLogEvery = 50 * time.Millisecond
t.Cleanup(func() { replicaStoreWaitLogEvery = prevLog })
logs, slow := 0, 0
slowRead := func(context.Context) (*control.GetReplicaStoreResponse, error) {
slow++
if slow > 60 {
return want, nil
}
time.Sleep(5 * time.Millisecond)
return nil, status.Error(codes.Unavailable, "down")
}
if _, err := readReplicaStore(context.Background(), "m", slowRead, logf, func(bool) {}); err != nil || logs < 3 || logs > 12 {
t.Fatalf("about 300 ms of no reply at a 50 ms cadence logged %d lines (err %v); want a few, not one per read", logs, err)
}
for _, e := range []error{status.Error(codes.Unauthenticated, "bad cert"), status.Error(codes.Unimplemented, "older"), status.Error(codes.Internal, "boom"), errors.New("plain")} {
read, calls := script(e)
if _, err := readReplicaStore(context.Background(), "m", read, logf, func(bool) {}); !errors.Is(err, e) || *calls != 1 {
t.Fatalf("%v: waited (%d reads) instead of returning it", e, *calls)
}
}
ctx, cancel := context.WithCancel(context.Background())
never := func(context.Context) (*control.GetReplicaStoreResponse, error) {
cancel()
return nil, status.Error(codes.Unavailable, "down")
}
done := make(chan error, 1)
go func() { _, err := readReplicaStore(ctx, "m", never, logf, func(bool) {}); done <- err }()
select {
case err := <-done:
if status.Code(err) != codes.Unavailable {
t.Fatalf("a shutdown during the wait: %v", err)
}
case <-time.After(5 * time.Second):
t.Fatal("a shutdown did not end the wait")
}
}
@@ -1,6 +1,6 @@
# The wrong-size local store a 1.0 first start left (3402e0dd, the 1.0 RC):
# v2 restored with a 65536-block record, started with --durable-blocks 32768;
# captured from that run on a lab host (archive sha256
# captured from that run on tp04 (archive sha256
# 0905c3af83b3a1dc226b417fa5acf7071907cc3e53478bc14a531481b717c5c1).
# "file <name> <size> <octal mode>", then "<offset> <hex>" for each run of
# non-zero bytes; every other byte is zero.
+57 -57
View File
@@ -250,11 +250,11 @@ func TestOpsOperatorStatusDryRunFromBundle(t *testing.T) {
},
Replicas: []ops.ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
}},
CSIStages: []ops.CSIStageFact{{NodeName: "node-b", Target: "192.168.1.184:3260"}},
CSIStages: []ops.CSIStageFact{{NodeName: "m02", Target: "192.168.1.184:3260"}},
Workload: &ops.WorkloadCheckFact{WriterVerified: true, ReaderVerified: true},
})}
raw, err := ops.MarshalObservationJSON(cluster)
@@ -296,11 +296,11 @@ func TestOpsOperatorStatusWritesCRDStatusWhenDryRunDisabled(t *testing.T) {
},
Replicas: []ops.ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
}},
CSIStages: []ops.CSIStageFact{{NodeName: "node-b", Target: "192.168.1.184:3260"}},
CSIStages: []ops.CSIStageFact{{NodeName: "m02", Target: "192.168.1.184:3260"}},
Workload: &ops.WorkloadCheckFact{WriterVerified: true, ReaderVerified: true},
})}
raw, err := ops.MarshalObservationJSON(cluster)
@@ -1894,7 +1894,7 @@ func TestOpsClusterMasterAPIUsesSharedInClusterNodeEvidenceEnrichment(t *testing
}
out := stdout.String()
for _, want := range []string{
`"kubernetes_node": "node-b"`,
`"kubernetes_node": "m02"`,
`"ready": false`,
`"reason": "node_not_ready"`,
} {
@@ -1926,7 +1926,7 @@ func TestOpsReportMasterAPIUsesSharedInClusterNodeEvidenceEnrichment(t *testing.
}
out := string(raw)
for _, want := range []string{
`"kubernetes_node": "node-b"`,
`"kubernetes_node": "m02"`,
`"ready": false`,
`"reason": "node_not_ready"`,
} {
@@ -1956,7 +1956,7 @@ func TestLoadObservationVolumeUsesSharedInClusterNodeEvidenceEnrichment(t *testi
if code != ops.VolumeStatusExitOK {
t.Fatalf("exit=%d stderr=%s cluster=%+v", code, stderr.String(), cluster)
}
if len(cluster.Nodes) != 1 || cluster.Nodes[0].KubernetesNode != "node-b" {
if len(cluster.Nodes) != 1 || cluster.Nodes[0].KubernetesNode != "m02" {
t.Fatalf("cluster nodes=%+v", cluster.Nodes)
}
if !cmdConditionReason(cluster.Nodes[0].Conditions, ops.ReasonNodeNotReady) {
@@ -2051,7 +2051,7 @@ func TestOpsDashboardMasterAPIUsesSharedInClusterNodeEvidenceEnrichment(t *testi
}()
body := waitForHTTPContains(t, "http://"+addr+"/cluster-evidence.json", `"reason": "node_not_ready"`)
if !strings.Contains(body, `"kubernetes_node": "node-b"`) || !strings.Contains(body, `"ready": false`) {
if !strings.Contains(body, `"kubernetes_node": "m02"`) || !strings.Contains(body, `"ready": false`) {
t.Fatalf("dashboard cluster evidence missing enriched node:\n%s", body)
}
select {
@@ -2123,8 +2123,8 @@ type fakeNodeEvidenceEnricher struct{}
func (fakeNodeEvidenceEnricher) EnrichNodeEvidence(_ context.Context, _ string, cluster ops.ClusterEvidence) (ops.ClusterEvidence, error) {
cluster.Nodes = []ops.NodeEvidence{{
NodeName: "node-b",
KubernetesNode: "node-b",
NodeName: "m02",
KubernetesNode: "m02",
Ready: false,
Schedulable: true,
Conditions: []ops.ObservationCondition{{
@@ -2538,7 +2538,7 @@ func TestOpsGenerateHelmValuesSingleNodeFromKubernetes(t *testing.T) {
code := run([]string{
"ops", "generate-helm-values",
"--out", outPath,
"--target-node", "node-b",
"--target-node", "m02",
"--node-limit", "1",
"--image", "ghcr.io/seaweedfs/seaweed-block:sha-test",
"--csi-image", "ghcr.io/seaweedfs/seaweed-block-csi:sha-test",
@@ -2551,7 +2551,7 @@ func TestOpsGenerateHelmValuesSingleNodeFromKubernetes(t *testing.T) {
"network_mode=loopback",
"ready_kubernetes_nodes=1",
"discovered_kubernetes_nodes=3",
"target_node=node-b",
"target_node=m02",
"restart_persistence_mode=hostpath",
"state_hostpath=/var/lib/sw-block/k8s",
} {
@@ -2575,8 +2575,8 @@ func TestOpsGenerateHelmValuesSingleNodeFromKubernetes(t *testing.T) {
"stateHostPath: /var/lib/sw-block/k8s",
"expectedSlotsPerVolume: 1",
"enabled: false",
"name: node-b",
"kubernetesNode: node-b",
"name: m02",
"kubernetesNode: m02",
"internalIP: 127.0.0.1",
"dataPort: 19101",
"controlPort: 19102",
@@ -2641,15 +2641,15 @@ func TestOpsGenerateHelmValuesMultiNodeExternalISCSI(t *testing.T) {
"stateHostPath: /var/lib/sw-block/k8s",
"enabled: true",
"secret: fixed-chap-secret",
"name: node-a",
"name: m01",
"internalIP: 192.168.1.181",
"dataPort: 19101",
"controlPort: 19102",
"name: node-b",
"name: m02",
"internalIP: 192.168.1.184",
"dataPort: 19103",
"controlPort: 19104",
"name: node-c",
"name: tp01",
"internalIP: 192.168.1.188",
"dataPort: 19105",
"controlPort: 19106",
@@ -2709,11 +2709,11 @@ func TestOpsGenerateHelmValuesMultiNodeExternalNVMe(t *testing.T) {
"enabled: false",
"create: false",
"secret: \"\"",
"name: node-a",
"name: m01",
"internalIP: 192.168.1.181",
"name: node-b",
"name: m02",
"internalIP: 192.168.1.184",
"name: node-c",
"name: tp01",
"internalIP: 192.168.1.188",
} {
if !strings.Contains(string(values), want) {
@@ -2739,7 +2739,7 @@ func TestOpsGenerateHelmValuesMultiNodeNVMeFrontendIPMap(t *testing.T) {
"--out", outPath,
"--replication-factor", "3",
"--protocol", "nvme",
"--frontend-ip-map", "node-a=10.0.0.181,node-b=10.0.0.184,node-c=10.0.0.188",
"--frontend-ip-map", "m01=10.0.0.181,m02=10.0.0.184,tp01=10.0.0.188",
"--frontend-network-class", "100gbe_tcp",
}, &stdout, &stderr)
if code != ops.VolumeStatusExitOK {
@@ -2747,7 +2747,7 @@ func TestOpsGenerateHelmValuesMultiNodeNVMeFrontendIPMap(t *testing.T) {
}
for _, want := range []string{
"network_mode=external-nvme",
"frontend_ip_map=node-a=10.0.0.181,node-b=10.0.0.184,node-c=10.0.0.188",
"frontend_ip_map=m01=10.0.0.181,m02=10.0.0.184,tp01=10.0.0.188",
"frontend_network_class=100gbe_tcp",
} {
if !strings.Contains(stdout.String(), want) {
@@ -2759,16 +2759,16 @@ func TestOpsGenerateHelmValuesMultiNodeNVMeFrontendIPMap(t *testing.T) {
t.Fatal(err)
}
for _, want := range []string{
"name: node-a",
"name: m01",
"internalIP: 192.168.1.181",
"managementIP: 192.168.1.181",
"frontendIP: 10.0.0.181",
"frontendNetworkClass: 100gbe_tcp",
"name: node-b",
"name: m02",
"internalIP: 192.168.1.184",
"managementIP: 192.168.1.184",
"frontendIP: 10.0.0.184",
"name: node-c",
"name: tp01",
"internalIP: 192.168.1.188",
"managementIP: 192.168.1.188",
"frontendIP: 10.0.0.188",
@@ -2791,7 +2791,7 @@ func TestPhase165_OpsGenerateHelmValuesNVMERDMA(t *testing.T) {
code := run([]string{
"ops", "generate-helm-values", "--out", outPath, "--replication-factor", "1",
"--protocol", "nvme", "--nvme-transport", "rdma",
"--frontend-ip-map", "node-a=10.0.0.181,node-b=10.0.0.184,node-c=10.0.0.188",
"--frontend-ip-map", "m01=10.0.0.181,m02=10.0.0.184,tp01=10.0.0.188",
"--frontend-network-class", "100gbe_roce",
}, &stdout, &stderr)
if code != ops.VolumeStatusExitOK {
@@ -2817,7 +2817,7 @@ func TestPhase165_OpsGenerateHelmValuesNVMERDMARequiresRoCEMap(t *testing.T) {
for _, args := range [][]string{
{"--protocol", "iscsi", "--nvme-transport", "rdma"},
{"--protocol", "nvme", "--nvme-transport", "rdma"},
{"--protocol", "nvme", "--nvme-transport", "rdma", "--frontend-ip-map", "node-a=10.0.0.181", "--frontend-network-class", "100gbe_tcp"},
{"--protocol", "nvme", "--nvme-transport", "rdma", "--frontend-ip-map", "m01=10.0.0.181", "--frontend-network-class", "100gbe_tcp"},
} {
var stdout, stderr bytes.Buffer
base := []string{"ops", "generate-helm-values", "--out", filepath.Join(t.TempDir(), "values.yaml")}
@@ -2841,20 +2841,20 @@ func TestOpsGenerateHelmValuesRejectsIncompleteFrontendIPMap(t *testing.T) {
"--out", filepath.Join(t.TempDir(), "values.yaml"),
"--replication-factor", "3",
"--protocol", "nvme",
"--frontend-ip-map", "node-a=10.0.0.181,node-b=10.0.0.184",
"--frontend-ip-map", "m01=10.0.0.181,m02=10.0.0.184",
"--frontend-network-class", "100gbe_tcp",
}, &stdout, &stderr)
if code != ops.VolumeStatusExitInvalid {
t.Fatalf("exit=%d want invalid stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
if !strings.Contains(stderr.String(), `--frontend-ip-map missing selected node "node-c"`) {
if !strings.Contains(stderr.String(), `--frontend-ip-map missing selected node "tp01"`) {
t.Fatalf("stderr=%s", stderr.String())
}
}
func TestNodeEvidenceFromWirePreservesFrontendAddress(t *testing.T) {
node := nodeEvidenceFromWire(&control.NodeEvidence{
NodeName: "node-a",
NodeName: "m01",
InternalIp: "192.168.1.181",
FrontendIp: "10.0.0.1",
FrontendNetworkClass: "100gbe_tcp",
@@ -2887,7 +2887,7 @@ func TestOpsGenerateHelmValuesRestartPersistenceHostPath(t *testing.T) {
code := run([]string{
"ops", "generate-helm-values",
"--out", outPath,
"--target-node", "node-b",
"--target-node", "m02",
"--node-limit", "1",
"--restart-persistence", "hostpath",
"--state-hostpath", "/var/lib/sw-block",
@@ -2945,7 +2945,7 @@ func TestOpsGenerateHelmValuesRejectsRFAboveSelectedNodes(t *testing.T) {
code := run([]string{
"ops", "generate-helm-values",
"--out", filepath.Join(t.TempDir(), "values.yaml"),
"--target-node", "node-b",
"--target-node", "m02",
"--replication-factor", "3",
}, &stdout, &stderr)
if code != ops.VolumeStatusExitInvalid {
@@ -2966,7 +2966,7 @@ func TestOpsDescribeVolumeFromBundle(t *testing.T) {
for _, want := range []string{
"cluster status=degraded volumes=1",
"volume pvc-observed status=ok rf=3 ack=sync-quorum",
"primary r2 on node-b frontend=192.168.1.184:3260",
"primary r2 on m02 frontend=192.168.1.184:3260",
} {
if !strings.Contains(stdout.String(), want) {
t.Fatalf("stdout missing %q:\n%s", want, stdout.String())
@@ -2984,7 +2984,7 @@ func TestOpsDescribeVolumeFromBundlePrefersProductClusterEvidence(t *testing.T)
for _, want := range []string{
"cluster status=ok volumes=1 nodes=1",
"volume pvc-product status=ok rf=3 ack=sync-quorum",
"primary r2 on node-b frontend=192.168.1.184:3260",
"primary r2 on m02 frontend=192.168.1.184:3260",
} {
if !strings.Contains(stdout.String(), want) {
t.Fatalf("stdout missing %q:\n%s", want, stdout.String())
@@ -3341,7 +3341,7 @@ func TestOpsReportFromBundleSkipsCorruptClusterEvidenceCandidate(t *testing.T) {
ReplicationFactor: 1,
Status: ops.ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
}}
raw, err := ops.MarshalObservationJSON(cluster)
@@ -3513,7 +3513,7 @@ func TestOpsExplainVolumeFromBundleBlockedImagePull(t *testing.T) {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(dir, "demo", ops.KubeSystemPodsDeploysArtifact), []byte(`NAME READY STATUS RESTARTS AGE IP NODE
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 node-b
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 m02
deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:local
`), 0o644); err != nil {
t.Fatal(err)
@@ -3525,7 +3525,7 @@ deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:loca
}
for _, want := range []string{
"volume pvc-blocked status=blocked rf=3 reason=csi_node_image_pull_failed",
"waiting=ImagePullBackOff on node node-b image sw-block-csi:local",
"waiting=ImagePullBackOff on node m02 image sw-block-csi:local",
} {
if !strings.Contains(stdout.String(), want) {
t.Fatalf("stdout missing %q:\n%s", want, stdout.String())
@@ -3551,7 +3551,7 @@ func TestOpsDescribeVolumeLiveInventory(t *testing.T) {
"cluster status=ok volumes=1 nodes=0",
"volume pvc-live status=ok rf=1 ack=best-effort",
"pvc default/app-live",
"primary r1 on node-b frontend=127.0.0.1:3260",
"primary r1 on m02 frontend=127.0.0.1:3260",
} {
if !strings.Contains(stdout.String(), want) {
t.Fatalf("stdout missing %q:\n%s", want, stdout.String())
@@ -3583,7 +3583,7 @@ func TestOpsClusterAndVolumesLiveInventory(t *testing.T) {
if code != ops.VolumeStatusExitOK {
t.Fatalf("volumes exit=%d stderr=%s stdout=%s", code, volumesErr.String(), volumesOut.String())
}
if !strings.Contains(volumesOut.String(), "volume pvc-live status=ok rf=1 primary=r1 node=node-b frontend=127.0.0.1:3260") {
if !strings.Contains(volumesOut.String(), "volume pvc-live status=ok rf=1 primary=r1 node=m02 frontend=127.0.0.1:3260") {
t.Fatalf("volumes output missing evidence:\n%s", volumesOut.String())
}
}
@@ -3601,9 +3601,9 @@ func cleanCmdResidueCommand(_ context.Context, name string, args ...string) ([]b
}
}
const cmdHelmNodeWide = `node-a Ready worker 10d v1.34.4+k3s1 192.168.1.181 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
node-b Ready control-plane 10d v1.34.4+k3s1 192.168.1.184 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
node-c Ready worker 10d v1.34.4+k3s1 192.168.1.188 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
const cmdHelmNodeWide = `m01 Ready worker 10d v1.34.4+k3s1 192.168.1.181 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
m02 Ready control-plane 10d v1.34.4+k3s1 192.168.1.184 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
tp01 Ready worker 10d v1.34.4+k3s1 192.168.1.188 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
bad1 Ready,SchedulingDisabled worker 10d v1.34.4+k3s1 192.168.1.199 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
bad2 NotReady worker 10d v1.34.4+k3s1 192.168.1.200 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
bad3 Ready worker 10d v1.34.4+k3s1 127.0.0.1 <none> Ubuntu 24.04 6.8.0 containerd://2.0.0
@@ -3630,7 +3630,7 @@ const cmdSingleDeploymentListJSON = `{
"labels":{"app":"sw-blockvolume","sw-block.seaweedfs.com/volume":"pvc-live","sw-block.seaweedfs.com/replica":"r1"},
"ownerReferences":[{"kind":"PersistentVolumeClaim","name":"app-live","uid":"uid-live"}]
},
"spec":{"template":{"spec":{"nodeSelector":{"kubernetes.io/hostname":"node-b"},"containers":[{"name":"blockvolume","args":["--server-id=node-b","--volume-id=pvc-live","--replica-id=r1","--data-addr=127.0.0.1:19101","--ctrl-addr=127.0.0.1:19102","--status-addr=127.0.0.1:23260","--iscsi-listen=127.0.0.1:3260","--iscsi-iqn=iqn.2026-05.io.seaweedfs:pvc-live"]}]}}},
"spec":{"template":{"spec":{"nodeSelector":{"kubernetes.io/hostname":"m02"},"containers":[{"name":"blockvolume","args":["--server-id=m02","--volume-id=pvc-live","--replica-id=r1","--data-addr=127.0.0.1:19101","--ctrl-addr=127.0.0.1:19102","--status-addr=127.0.0.1:23260","--iscsi-listen=127.0.0.1:3260","--iscsi-iqn=iqn.2026-05.io.seaweedfs:pvc-live"]}]}}},
"status":{"replicas":1,"readyReplicas":1}
}
]
@@ -3655,7 +3655,7 @@ func writeCmdObservationBundle(t *testing.T) string {
{
ReplicaID: "r2",
ServerID: "node-loss-r2",
NodeName: "node-b",
NodeName: "m02",
Observed: true,
Protocol: "iscsi",
FrontendAddress: "192.168.1.184:3260",
@@ -3677,7 +3677,7 @@ func writeCmdObservationBundle(t *testing.T) string {
{
ReplicaID: "r3",
ServerID: "node-loss-r3",
NodeName: "node-c",
NodeName: "tp01",
Observed: true,
Protocol: "iscsi",
FrontendAddress: "192.168.1.188:3260",
@@ -3705,7 +3705,7 @@ func writeCmdObservationBundle(t *testing.T) string {
if err := os.WriteFile(filepath.Join(dir, "demo", ops.NodeLossRecoverySummaryArtifact), []byte(strings.Join([]string{
"result=promoted",
"ack_profile=sync-quorum",
"promoted=r2@node-b",
"promoted=r2@m02",
"before_frontend=192.168.1.181:3260",
"after_frontend=192.168.1.184:3260",
"reader_verified=true",
@@ -3731,7 +3731,7 @@ func writeCmdProductClusterBundle(t *testing.T) string {
cluster.ProductRevision = "product-cluster-rev"
cluster.Status = ops.ObservationStatusOK
cluster.Nodes = []ops.NodeEvidence{{
NodeName: "node-b",
NodeName: "m02",
InternalIP: "192.168.1.184",
Schedulable: true,
Ready: true,
@@ -3748,11 +3748,11 @@ func writeCmdProductClusterBundle(t *testing.T) string {
ObservedReplicas: 3,
Status: ops.ObservationStatusOK,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Replicas: []ops.ReplicaEvidence{{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
FrontendAddr: "192.168.1.184:3260",
@@ -3796,7 +3796,7 @@ func writeCmdReturnedReplicaBundle(t *testing.T) string {
ReplicationFactor: 2,
Status: ops.ObservationStatusRecovering,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
@@ -3804,7 +3804,7 @@ func writeCmdReturnedReplicaBundle(t *testing.T) string {
RequiredFrontierLSN: 4241,
Replicas: []ops.ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "previous_primary",
ReplicationRole: "replica_ready",
@@ -3818,7 +3818,7 @@ func writeCmdReturnedReplicaBundle(t *testing.T) string {
SupportBundlePath: "returned-replica-summary.txt",
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
Healthy: true,
@@ -3856,7 +3856,7 @@ func writeCmdReturnedReplicaRebuildBundle(t *testing.T) string {
ReplicationFactor: 3,
Status: ops.ObservationStatusRecovering,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 3,
EndpointVersion: 7,
@@ -3864,7 +3864,7 @@ func writeCmdReturnedReplicaRebuildBundle(t *testing.T) string {
RequiredFrontierLSN: 4241,
Replicas: []ops.ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "previous_primary",
ReplicationRole: "replica_behind",
@@ -3878,7 +3878,7 @@ func writeCmdReturnedReplicaRebuildBundle(t *testing.T) string {
SupportBundlePath: "returned-replica-rebuild-summary.txt",
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
Healthy: true,
@@ -4004,7 +4004,7 @@ func (cmdFakeClusterEvidenceServer) GetClusterStatus(context.Context, *control.G
ObservedReplicas: 3,
Status: ops.ObservationStatusOK,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
@@ -4014,7 +4014,7 @@ func (cmdFakeClusterEvidenceServer) GetClusterStatus(context.Context, *control.G
EventTime: timestamppb.Now(),
VolumeId: "v1",
ReplicaId: "r2",
NodeName: "node-b",
NodeName: "m02",
EventType: ops.EventTypeCSIReattachObserved,
Severity: "info",
Message: "CSI staged volume on node",
@@ -49,7 +49,7 @@ func TestEphemeralStateIsAnOptInThatSaysItLosesData(t *testing.T) {
t.Helper()
var stdout, stderr bytes.Buffer
path := filepath.Join(t.TempDir(), "values.yaml")
args := append([]string{"ops", "generate-helm-values", "--out", path, "--target-node", "node-b", "--node-limit", "1",
args := append([]string{"ops", "generate-helm-values", "--out", path, "--target-node", "m02", "--node-limit", "1",
"--image", "ghcr.io/seaweedfs/seaweed-block:sha-test", "--csi-image", "ghcr.io/seaweedfs/seaweed-block-csi:sha-test"}, extra...)
if code := run(args, &stdout, &stderr); code != ops.VolumeStatusExitOK {
t.Fatalf("generate %v: %d %s", extra, code, stderr.String())
@@ -64,7 +64,7 @@ func TestEphemeralStateIsAnOptInThatSaysItLosesData(t *testing.T) {
if !strings.Contains(out, "restart_persistence_mode=hostpath") || !strings.Contains(out, "master_state_hostpath=/var/lib/sw-block/k8s/master") || !strings.Contains(out, "volume_state_hostpath=/var/lib/sw-block/k8s/volumes") || strings.Contains(out, sentence) {
t.Fatalf("default generate output:\n%s", out)
}
if !strings.Contains(vals, "stateHostPath: /var/lib/sw-block/k8s/master") || !strings.Contains(vals, "stateHostPath: /var/lib/sw-block/k8s/volumes") || !strings.Contains(vals, "kubernetes.io/hostname: node-b") {
if !strings.Contains(vals, "stateHostPath: /var/lib/sw-block/k8s/master") || !strings.Contains(vals, "stateHostPath: /var/lib/sw-block/k8s/volumes") || !strings.Contains(vals, "kubernetes.io/hostname: m02") {
t.Fatalf("default values do not pin blockmaster with its state path:\n%s", vals)
}
out, vals = gen("--restart-persistence", "ephemeral")
@@ -216,7 +216,7 @@ func TestNVMePairedFlushCrashRecovery(t *testing.T) {
}
}
// Opt-in serial lab-host proxy; neither a guest filesystem benchmark nor a gate.
// Opt-in serial tp04 proxy; neither a guest filesystem benchmark nor a gate.
func TestNVMePairedFlushLatency(t *testing.T) {
if os.Getenv("SW_BLOCK_SYNC_PERF") != "1" {
t.Skip("opt-in file-backed latency characterization")
@@ -21,7 +21,7 @@ func TestMasterTimeline_RecordsPlacementVerified(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -42,7 +42,7 @@ func TestMasterTimeline_RecordsPromotionCandidateEvaluation(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("initial product tick: %v", err)
@@ -65,7 +65,7 @@ func TestMasterTimeline_RecordsPromotionCandidateEvaluation(t *testing.T) {
},
},
})
ingestRF3ObservationForServersWithReady(t, h, "pvc-a", "node-a", "node-b", "node-c",
ingestRF3ObservationForServersWithReady(t, h, "pvc-a", "m01", "m02", "tp01",
false, false,
true, true,
true, true)
@@ -91,7 +91,7 @@ func TestMasterTimeline_RecordsAuthorityPublishedAfterMint(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -114,7 +114,7 @@ func TestClusterEvidenceService_WatchClusterEventsCursor(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -164,7 +164,7 @@ func TestClusterEvidenceService_WatchClusterEventsStreamsNewEvents(t *testing.T)
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -198,7 +198,7 @@ func TestClusterEvidenceService_WatchClusterEventsStreamsNewEvents(t *testing.T)
EventType: "csi_reattach_observed",
Severity: "info",
VolumeId: "pvc-a",
NodeName: "node-b",
NodeName: "m02",
NewValue: "10.0.0.2:3260",
}); err != nil {
t.Fatalf("report event: %v", err)
@@ -174,7 +174,7 @@ func (h *Host) formatLevel() uint32 { return h.format.v.Load() }
// formatEligible reports whether server may be GRANTED work (an authority
// line published to it, and with it its lease) at the cluster's format
// level: its own report says its binary reads that level; no report means
// no grant (NoStrand holds at the grant). At level 0 every server is.
// no grant (r2.875: NoStrand holds at grant). At level 0 every server is.
func (h *Host) formatEligible(server string) bool {
level := h.formatLevel()
if level == 0 {
@@ -277,7 +277,7 @@ func (h *Host) grantWaits(now time.Time) map[string][]grantWaitEntry {
// placementTooOld names why server may not be chosen as a placement target
// (create, move, restore target, a failover candidate), or "" when it may:
// only a KNOWN-old report refuses. An unknown server is placeable,
// only a KNOWN-old report refuses (r2.875). An unknown server is placeable,
// since with one process per volume and create-then-start a placement target
// cannot have reported yet; the grant (formatTooOld) still needs its report.
func (h *Host) placementTooOld(server string) string {
@@ -47,7 +47,7 @@ func binaryTooOld(err error) bool {
}
// Every binary's heartbeat is taken and its read level recorded, at level 0
// and at level 1 alike (the refusal is at the grant, never at the
// and at level 1 alike (r2.881: the refusal is at the grant, never at the
// heartbeat); at level 1 a host whose process reads only level 0 is then
// known old, so placement skips it (its grant is refused at the publication
// boundary: TestThePublicationBoundaryRefusesAnAskForAnOldServer).
@@ -95,7 +95,7 @@ func TestFormatGateRefusesPlacementAndMoveOntoAnOldHost(t *testing.T) {
TargetServerId: "node-b", TargetDataAddr: "127.0.0.1:19301", TargetCtrlAddr: "127.0.0.1:19302", Kind: "clean"})
if level == 0 || !reported {
// level 0, or an unknown (silent) host at level 1: placeable
// (placement refuses only a known-old report; the
// (r2.875: placement refuses only a known-old report; the
// grant needs the holder's report).
if placeErr != nil {
t.Fatalf("%s: placement refused: %v", name, placeErr)
@@ -142,7 +142,7 @@ func TestFormatGateRefusesPlacementAndMoveOntoAnOldHost(t *testing.T) {
// At level 1 the product loop never places a new volume on a host known to
// read a lower level, and does on one that reads it, or that has not
// reported yet (unknown is placeable; the grant waits for its report).
// reported yet (r2.875: unknown is placeable; the grant waits for its report).
func TestFormatGateProductLoopPlacesOnlyOnHostsThatReadTheLevel(t *testing.T) {
const silent = ^uint32(0)
for _, reads := range []uint32{0, 1, silent} {
@@ -74,7 +74,7 @@ func TestANewClusterStartsAtTheCurrentFormatLevel(t *testing.T) {
// placement) and shows as awaiting report; it is not granted until its own
// report: the publication of its line is refused and its publish never runs;
// after its first heartbeat (reads level 1) the line is published and the
// condition is gone.
// condition is gone (r2.875).
func TestANewClusterPlacesAnUnreportedNodeAndGrantsAfterItsReport(t *testing.T) {
r := newIsolationRig(t, false, t.TempDir(), t.TempDir())
if r.m.formatLevel() != 1 {
@@ -206,7 +206,7 @@ func TestTheGrantReadsTheHoldersOwnReportNotASiblings(t *testing.T) {
// On a new cluster an idle unreported host is info: the cluster stays ok. A
// host that holds a placed volume waiting for its grant past the startup
// window is a warning: the nodes degrade the cluster and the condition names
// the volume and its wait. Before the window it is still info.
// the volume and its wait (r2.877). Before the window it is still info.
func TestAnIdleUnreportedHostLeavesTheClusterOKALateGrantDegradesIt(t *testing.T) {
r := newIsolationRig(t, false, t.TempDir(), t.TempDir())
if _, err := r.m.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{ServerID: "node-b", DataAddr: "127.0.0.1:19321", CtrlAddr: "127.0.0.1:19322"}); err != nil {
@@ -68,8 +68,8 @@ func TestGetReplicaStoreAnswersFromTheMastersCreationFact(t *testing.T) {
}
for _, bad := range []string{"zz", "00000000000000000000000000000000"} {
seed(&attestedStores{Stores: map[string]string{"r1": bad}})
if r, err := ask("vol"); status.Code(err) != codes.FailedPrecondition {
t.Fatalf("an invalid recorded id %q: %+v %v, want FailedPrecondition (an answer, never creating)", bad, r, err)
if r, err := ask("vol"); status.Code(err) != codes.Unavailable {
t.Fatalf("an invalid recorded id %q: %+v %v, want Unavailable (never creating)", bad, r, err)
}
}
}
+1 -1
View File
@@ -326,7 +326,7 @@ func New(cfg Config) (*Host, error) {
_ = boot.Close()
return nil, fmt.Errorf("master.New: lifecycle stores: %w", err)
}
// A new cluster starts at the current level: with no prior
// A new cluster starts at the current level (r2.869): with no prior
// state in any master store (no authority record reloaded or skipped, no
// attestation file, no volume, node, placement or deletion in the
// lifecycle stores), the master writes the level-1 envelope durably now,
@@ -21,7 +21,7 @@ func TestClusterEvidenceService_GetClusterStatusSharesObservationSnapshot(t *tes
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
@@ -57,7 +57,7 @@ func TestClusterEvidenceService_GetClusterStatusSharesObservationSnapshot(t *tes
func TestNodeEvidenceToWirePreservesFrontendAddress(t *testing.T) {
wire := nodeEvidenceToWire(ops.NodeEvidence{
NodeName: "node-a",
NodeName: "m01",
InternalIP: "192.168.1.181",
FrontendIP: "10.0.0.1",
FrontendNetworkClass: "100gbe_tcp",
@@ -84,7 +84,7 @@ func TestClusterEvidenceService_GRPCRegistered(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
@@ -113,7 +113,7 @@ func TestClusterEvidenceService_ListVolumesAndGetVolumeStatus(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, false)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
@@ -176,7 +176,7 @@ func TestObservationService_ReportClusterEventAppearsInVolumeTimeline(t *testing
EventTime: timestamppb.New(time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)),
VolumeId: "pvc-a",
ReplicaId: "r2",
NodeName: "node-b",
NodeName: "m02",
EventType: "csi_reattach_observed",
Severity: "warning",
Message: "authority_published spoof",
@@ -232,7 +232,7 @@ func TestObservationService_ReportClusterEventRejectsAuthorityOwnedType(t *testi
_, err := newServices(h).ReportClusterEvent(context.Background(), &control.ClusterEvent{
VolumeId: "pvc-a",
NodeName: "node-b",
NodeName: "m02",
EventType: "authority_published",
Severity: "info",
})
@@ -246,7 +246,7 @@ func TestObservationService_ReportClusterEventRejectsCSIEventWithoutVolumeOrNode
defer closeTestMaster(t, h)
_, err := newServices(h).ReportClusterEvent(context.Background(), &control.ClusterEvent{
NodeName: "node-b",
NodeName: "m02",
EventType: "csi_reattach_observed",
Severity: "info",
})
@@ -37,7 +37,7 @@ func (h *Host) ObservationSnapshot(now time.Time) ops.ClusterEvidence {
}
// Info while the node is idle or its placed volumes wait within their
// startup window; a warning (the cluster degraded) once one has waited
// for its grant past the window. Each wait is shown, before
// for its grant past the window (r2.877). Each wait is shown, before
// it is late too.
severity := "info"
message := fmt.Sprintf("awaiting report: no grant to a process of this node before its own report (cluster format level %d)", h.formatLevel())
@@ -15,7 +15,7 @@ func TestMasterObservationSnapshot_RF3HealthyReadOnly(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -66,17 +66,17 @@ func TestMasterObservationSnapshot_SeparatesManagementAndFrontendNodeAddress(t *
h := newTestMaster(t, t.TempDir())
defer closeTestMaster(t, h)
if _, err := h.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{
ServerID: "node-a",
ServerID: "m01",
DataAddr: "10.0.0.181:19101",
CtrlAddr: "192.168.1.181:19102",
Labels: map[string]string{
lifecycle.KubernetesNodeNameLabel: "node-a",
lifecycle.KubernetesNodeNameLabel: "m01",
lifecycle.ManagementIPLabel: "192.168.1.181",
lifecycle.FrontendIPLabel: "10.0.0.181",
lifecycle.FrontendNetworkClassLabel: "100gbe_tcp",
},
Pools: []lifecycle.StoragePool{{
PoolID: "pool-node-a",
PoolID: "pool-m01",
TotalBytes: 1 << 30,
FreeBytes: 1 << 30,
BlockSize: 4096,
@@ -104,7 +104,7 @@ func TestMasterObservationSnapshot_MissingReplicaIsDegraded(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, false)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -139,7 +139,7 @@ func TestMasterObservationSnapshot_PrimaryMustConfirmReadiness(t *testing.T) {
})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
@@ -203,7 +203,7 @@ func TestMasterObservationSnapshot_PreservesNVMeFrontendIdentityInVolumeEvidence
DesiredRF: 1,
Candidates: []lifecycle.PlacementCandidate{{
VolumeID: "pvc-nvme",
ServerID: "node-a",
ServerID: "m01",
ReplicaID: "r1",
Source: lifecycle.PlacementSourceExistingReplica,
}},
@@ -211,7 +211,7 @@ func TestMasterObservationSnapshot_PreservesNVMeFrontendIdentityInVolumeEvidence
t.Fatalf("apply placement: %v", err)
}
if err := ingestV11(h, authority.Observation{
ServerID: "node-a",
ServerID: "m01",
ObservedAt: time.Now().UTC(),
Server: authority.ServerFact{Reachable: true, Eligible: true},
Slots: []authority.SlotFact{{
@@ -264,9 +264,9 @@ func seedObservationSnapshotVolume(t *testing.T, h *Host) {
serverID string
ip string
}{
{serverID: "node-a", ip: "192.168.1.181"},
{serverID: "node-b", ip: "192.168.1.184"},
{serverID: "node-c", ip: "192.168.1.188"},
{serverID: "m01", ip: "192.168.1.181"},
{serverID: "m02", ip: "192.168.1.184"},
{serverID: "tp01", ip: "192.168.1.188"},
} {
if _, err := h.Lifecycle().Nodes.RegisterNode(lifecycle.NodeRegistration{
ServerID: node.serverID,
@@ -312,9 +312,9 @@ func ingestObservationSnapshotReplica(t *testing.T, h *Host, replica string, rea
ip string
score uint64
}{
"r1": {serverID: "node-a", ip: "192.168.1.181", score: 30},
"r2": {serverID: "node-b", ip: "192.168.1.184", score: 29},
"r3": {serverID: "node-c", ip: "192.168.1.188", score: 28},
"r1": {serverID: "m01", ip: "192.168.1.181", score: 30},
"r2": {serverID: "m02", ip: "192.168.1.184", score: 29},
"r3": {serverID: "tp01", ip: "192.168.1.188", score: 28},
}[replica]
if !ok {
t.Fatalf("unknown replica %s", replica)
@@ -166,7 +166,7 @@ func TestPortalAndPrimaryComeFromTheLineServerNotTheFreshestHeartbeat(t *testing
h := newTestMasterWithControllerConfig(t, t.TempDir(), authority.TopologyControllerConfig{ExpectedSlotsPerVolume: 3})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
@@ -179,7 +179,7 @@ func TestPortalAndPrimaryComeFromTheLineServerNotTheFreshestHeartbeat(t *testing
}
holderAddr := own.Frontends[0].Addr
stale := ""
for _, server := range []string{"node-a", "node-b", "node-c"} { // the fixture's placement servers
for _, server := range []string{"m01", "m02", "tp01"} { // the fixture's placement servers
if server != holder {
stale = server
break
@@ -348,7 +348,7 @@ func TestCSIPublishesNoTargetWhenThePrimaryFrontendIsMissingOrRejected(t *testin
h := newTestMasterWithControllerConfig(t, t.TempDir(), authority.TopologyControllerConfig{ExpectedSlotsPerVolume: 3})
defer closeTestMaster(t, h)
seedObservationSnapshotVolume(t, h)
seedRF3PlacementForServers(t, h, "pvc-a", "node-a", "node-b", "node-c")
seedRF3PlacementForServers(t, h, "pvc-a", "m01", "m02", "tp01")
ingestObservationSnapshotRF3(t, h, true, true, true)
if _, err := h.RunLifecycleProductTick(); err != nil {
t.Fatalf("product tick: %v", err)
+1 -1
View File
@@ -555,7 +555,7 @@ func (s *services) ReportHeartbeat(ctx context.Context, r *control.HeartbeatRepo
return nil, status.Error(codes.FailedPrecondition, err.Error())
}
// The format gate: the reporting process's read level is recorded and
// the heartbeat accepted whatever it reads. An old binary is
// the heartbeat accepted whatever it reads (r2.881). An old binary is
// refused where it matters: placement skips a host known to read a
// lower level, and the grant (publication) refuses a holder process
// whose own report is below the cluster's level, typed binary_too_old.
@@ -108,7 +108,7 @@ func loadStoreAttestations(dir string) (*storeAttestations, error) {
// newClusterAtStart says a starting master holds no prior state in any of
// its stores: no authority record reloaded or skipped, no attestation file,
// and empty lifecycle stores. Only then does it start at the current format
// level (FormatGate Init); any existing state reads its own level
// level (r2.869, FormatGate Init); any existing state reads its own level
// (an upgrade starts at 0; an empty authority store over an existing
// inventory is not new).
func newClusterAtStart(reloaded, skipped int, attestationAbsent, lifecycleEmpty bool) bool {
@@ -609,7 +609,7 @@ func (s *services) GetReplicaStore(ctx context.Context, q *control.GetReplicaSto
state, id := s.host.ReplicaStoreState(q.GetVolumeId(), q.GetReplicaId())
switch state {
case replicaStoreUnknown:
return nil, status.Error(codes.FailedPrecondition, "the replica's store record is unreadable (an invalid recorded store id)")
return nil, status.Error(codes.Unavailable, "the replica's store record is unreadable (an invalid recorded store id)")
case replicaStoreEnded:
out.CreationEnded = true
if !id.IsZero() {
@@ -5,7 +5,7 @@ import "github.com/seaweedfs/seaweed-block/core/authority"
// ingestV11 ingests obs as a v1.1 volume host's heartbeat delivers it: the
// facts, and the reads_level (1) of each slot's process, which the
// heartbeat carries and a direct ingest skips. A new cluster starts at
// format level 1, where a server with no reported level counts as
// format level 1 (r2.869), where a server with no reported level counts as
// old; the tests' fake hosts are v1.1 hosts unless a test says otherwise.
func ingestV11(h *Host, obs authority.Observation) error {
server := obs.ServerID
@@ -281,7 +281,7 @@ func (h *Host) admitWorkspacePublicationNow(ask authority.AssignmentAsk, publish
epoch = line.Epoch
}
server := h.workspaceSourceHost(ask.VolumeID, ask.ReplicaID, epoch)
// The format gate at the grant: an authority line is published
// The format gate at the grant (r2.875): an authority line is published
// only to a server whose own report reads the cluster's level; no report
// means no grant (the ask waits for it), and an ask decided on
// observations taken before its server reported a lower level is not
@@ -464,7 +464,7 @@ func (s *services) workspaceMoveCheckLocked(q *control.WorkspaceMove) (req autho
case !replay && s.host.colocatedTargetRefused(target.ServerID):
refusal.text = fmt.Sprintf("move target node %q shares the authority store's file system (strict journal isolation)", target.ServerID)
case !replay && s.host.placementTooOld(target.ServerID) != "":
// Only a known-old report refuses a move target; the
// Only a known-old report refuses a move target (r2.875); the
// target's line is granted only after its own report.
refusal = moveRefusal{"move target " + s.host.placementTooOld(target.ServerID), s.host.formatTooOldReason(target.ServerID)}
case !matched:
@@ -65,11 +65,11 @@ func newMasterWait(now func() time.Time, logf func(string, ...any)) *masterWait
return &masterWait{now: now, logf: logf}
}
// MasterCallClass sorts a call result: a reply produced by blockmaster's
// masterCallClass sorts a call result: a reply produced by blockmaster's
// handler (any status but the transport codes) is contact; Unavailable,
// DeadlineExceeded and Canceled are no reply; Unauthenticated and
// PermissionDenied are a credentials refusal.
func MasterCallClass(err error) (contact, credentials bool) {
func masterCallClass(err error) (contact, credentials bool) {
if err == nil {
return true, false
}
@@ -95,7 +95,7 @@ func MasterCallClass(err error) (contact, credentials bool) {
// assignment to accept). The heartbeat does not check identity, so its
// answers alone do not end it sooner.
func (w *masterWait) call(err error) {
contact, credentials := MasterCallClass(err)
contact, credentials := masterCallClass(err)
identity := ""
r := leaseRefusalDetail(err)
if r != nil && r.GetKind() == control.WorkspaceLeaseRefusal_IDENTITY {
@@ -485,21 +485,3 @@ func TestRecordedRevocationFinalRequiresTypedFailedPrecondition(t *testing.T) {
t.Fatal("log text became a terminal verdict")
}
}
// While the start waits for blockmaster's first answer, /status says
// waiting_for_master, ahead of any other reason, and is not ready.
func TestStatusSaysWaitingForMasterDuringTheStartupWait(t *testing.T) {
p := stubProjector{p: engine.ReplicaProjection{Mode: engine.ModeHealthy, Epoch: 1, EndpointVersion: 1}}
view := NewAdapterProjectionView(p, "v1", "r1", nil)
s := NewStatusServer(view)
s.SetDurableStatusSource(stubDurableStatusSource{vols: []durable.VolumeStatus{{VolumeID: "v1", Operational: true}}})
waiting := true
s.SetStartupWait(func() bool { return waiting })
if got := s.statusProjection(); got.FrontendPrimaryReady || got.NotReadyReason != NotReadyWaitingForMaster {
t.Fatalf("during the wait: ready %v reason %q", got.FrontendPrimaryReady, got.NotReadyReason)
}
waiting = false
if got := s.statusProjection(); got.NotReadyReason == NotReadyWaitingForMaster {
t.Fatalf("after the wait: reason %q", got.NotReadyReason)
}
}
@@ -68,7 +68,6 @@ type StatusServer struct {
peerSource peerStatusSource
durableSource durableStatusSource
masterWait func() *MasterWait // why a workspace primary holds no grant; nil: not wired
startupWait func() bool // true while the start waits for blockmaster's first answer; nil: not wired
nvmeSource nvmeStatusSource
guestSources map[string]func() int // frontend -> guests connected now
ublkSource ublkStatusSource
@@ -620,17 +619,6 @@ func (s *StatusServer) handleStatusNVMe(w http.ResponseWriter, r *http.Request)
// the lease-readiness gate (no claim, no listen, not ready).
const NotReadyLeaseNotHeld = "lease_not_held"
// NotReadyWaitingForMaster: the start waits for blockmaster to answer before
// it opens or creates the volume's store (blockmaster gives no reply).
const NotReadyWaitingForMaster = "waiting_for_master"
// SetStartupWait wires whether the start is waiting for blockmaster's answer.
func (s *StatusServer) SetStartupWait(f func() bool) {
s.mu.Lock()
s.startupWait = f
s.mu.Unlock()
}
func (s *StatusServer) statusProjection() StatusProjection {
p := s.authorityProjection()
authorityReady := p.FrontendPrimaryReady
@@ -640,7 +628,6 @@ func (s *StatusServer) statusProjection() StatusProjection {
p.FrontendPrimaryReady = p.FrontendPrimaryReady && !nvmePending
src := s.durableSource
masterWait := s.masterWait
startupWait := s.startupWait
s.mu.Unlock()
// INV-FE-PRIMARY-READY-OPERATIONAL-001: not FrontendPrimaryReady while the
// local backend admits no I/O (before the storage claim of a chunk volume,
@@ -672,14 +659,8 @@ func (s *StatusServer) statusProjection() StatusProjection {
if backendReason != "" || leaseNotHeld || profileRefusal != "" {
p.FrontendPrimaryReady = false
}
waiting := startupWait != nil && startupWait()
if waiting {
p.FrontendPrimaryReady = false
}
if !p.FrontendPrimaryReady {
switch {
case waiting:
p.NotReadyReason = NotReadyWaitingForMaster
case profileRefusal != "":
p.NotReadyReason = profileRefusal
case leaseNotHeld:
@@ -14,23 +14,23 @@ func TestPhase37D2KubernetesNodeEvidenceEnrichesReadyAndBlockedNodes(t *testing.
switch r.URL.Path {
case "/api/v1/nodes":
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"node-a"},"spec":{},"status":{"addresses":[{"type":"InternalIP","address":"192.168.1.181"}],"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"node-b"},"spec":{"unschedulable":true},"status":{"addresses":[{"type":"InternalIP","address":"192.168.1.184"}],"conditions":[{"type":"Ready","status":"False"}]}}
{"metadata":{"name":"m01"},"spec":{},"status":{"addresses":[{"type":"InternalIP","address":"192.168.1.181"}],"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"m02"},"spec":{"unschedulable":true},"status":{"addresses":[{"type":"InternalIP","address":"192.168.1.184"}],"conditions":[{"type":"Ready","status":"False"}]}}
]}`))
case "/api/v1/namespaces/kube-system/pods":
if got := r.URL.Query().Get("labelSelector"); got != "app=sw-block-csi-node" {
t.Fatalf("labelSelector=%q", got)
}
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"csi-node-a"},"spec":{"nodeName":"node-a"},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"csi-node-b"},"spec":{"nodeName":"node-b"},"status":{"conditions":[{"type":"Ready","status":"True"}]}}
{"metadata":{"name":"csi-m01"},"spec":{"nodeName":"m01"},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"csi-m02"},"spec":{"nodeName":"m02"},"status":{"conditions":[{"type":"Ready","status":"True"}]}}
]}`))
case "/apis/storage.k8s.io/v1/csidrivers/block.csi.seaweedfs.com":
_, _ = w.Write([]byte(`{"metadata":{"name":"block.csi.seaweedfs.com"}}`))
case "/apis/storage.k8s.io/v1/csinodes":
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"node-a"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}},
{"metadata":{"name":"node-b"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}}
{"metadata":{"name":"m01"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}},
{"metadata":{"name":"m02"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}}
]}`))
default:
t.Fatalf("unexpected Kubernetes API path %s", r.URL.String())
@@ -42,8 +42,8 @@ func TestPhase37D2KubernetesNodeEvidenceEnrichesReadyAndBlockedNodes(t *testing.
cluster := ClusterEvidence{
CapturedAt: time.Date(2026, 6, 6, 12, 0, 0, 0, time.UTC),
Nodes: []NodeEvidence{{
NodeName: "node-a",
KubernetesNode: "node-a",
NodeName: "m01",
KubernetesNode: "m01",
LastHeartbeatAt: time.Date(2026, 6, 6, 11, 59, 0, 0, time.UTC),
ReplicaCount: 1,
}},
@@ -56,32 +56,32 @@ func TestPhase37D2KubernetesNodeEvidenceEnrichesReadyAndBlockedNodes(t *testing.
if len(enriched.Nodes) != 2 {
t.Fatalf("nodes=%+v", enriched.Nodes)
}
nodeA := nodeByKubernetesName(t, enriched.Nodes, "node-a")
if !nodeA.Ready || !nodeA.Schedulable || nodeA.InternalIP != "192.168.1.181" || nodeA.ReplicaCount != 1 {
t.Fatalf("nodeA evidence=%+v", nodeA)
m01 := nodeByKubernetesName(t, enriched.Nodes, "m01")
if !m01.Ready || !m01.Schedulable || m01.InternalIP != "192.168.1.181" || m01.ReplicaCount != 1 {
t.Fatalf("m01 evidence=%+v", m01)
}
status, reason := classifyNodeReadiness(nodeA)
status, reason := classifyNodeReadiness(m01)
if status != ManagedVolumeStatusReady || reason != ReasonNodeReady {
t.Fatalf("nodeA status=%s reason=%s", status, reason)
t.Fatalf("m01 status=%s reason=%s", status, reason)
}
nodeB := nodeByKubernetesName(t, enriched.Nodes, "node-b")
if nodeB.Ready || nodeB.Schedulable {
t.Fatalf("nodeB raw facts=%+v", nodeB)
m02 := nodeByKubernetesName(t, enriched.Nodes, "m02")
if m02.Ready || m02.Schedulable {
t.Fatalf("m02 raw facts=%+v", m02)
}
status, reason = classifyNodeReadiness(nodeB)
status, reason = classifyNodeReadiness(m02)
if status != ManagedVolumeStatusUnknown || reason != ReasonNodeNotReady {
t.Fatalf("nodeB status=%s reason=%s", status, reason)
t.Fatalf("m02 status=%s reason=%s", status, reason)
}
if !conditionReason(nodeB.Conditions, ReasonNodeNotReady) || !conditionReason(nodeB.Conditions, ReasonNodeSchedulingDisabled) {
t.Fatalf("nodeB conditions=%+v", nodeB.Conditions)
if !conditionReason(m02.Conditions, ReasonNodeNotReady) || !conditionReason(m02.Conditions, ReasonNodeSchedulingDisabled) {
t.Fatalf("m02 conditions=%+v", m02.Conditions)
}
assertCRDSafeNodeConditions(t, nodeB.Conditions)
assertCRDSafeNodeConditions(t, m02.Conditions)
}
func TestPhase37D2NodeNotReadyTakesPrecedenceOverCSIPodSymptoms(t *testing.T) {
node := NodeEvidence{
NodeName: "node-c",
KubernetesNode: "node-c",
NodeName: "tp01",
KubernetesNode: "tp01",
Ready: false,
Schedulable: true,
Conditions: []ObservationCondition{
@@ -104,20 +104,20 @@ func TestPhase37D2KubernetesNodeEvidenceProjectsCSIRegistrationBlockers(t *testi
switch r.URL.Path {
case "/api/v1/nodes":
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"node-a"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"node-b"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}
{"metadata":{"name":"m01"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"m02"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}
]}`))
case "/api/v1/namespaces/kube-system/pods":
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"csi-node-a"},"spec":{"nodeName":"node-a"},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"csi-node-b"},"spec":{"nodeName":"node-b"},"status":{"conditions":[{"type":"Ready","status":"False"}]}}
{"metadata":{"name":"csi-m01"},"spec":{"nodeName":"m01"},"status":{"conditions":[{"type":"Ready","status":"True"}]}},
{"metadata":{"name":"csi-m02"},"spec":{"nodeName":"m02"},"status":{"conditions":[{"type":"Ready","status":"False"}]}}
]}`))
case "/apis/storage.k8s.io/v1/csidrivers/block.csi.seaweedfs.com":
_, _ = w.Write([]byte(`{"metadata":{"name":"block.csi.seaweedfs.com"}}`))
case "/apis/storage.k8s.io/v1/csinodes":
_, _ = w.Write([]byte(`{"items":[
{"metadata":{"name":"node-a"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}},
{"metadata":{"name":"node-b"},"spec":{"drivers":[]}}
{"metadata":{"name":"m01"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}},
{"metadata":{"name":"m02"},"spec":{"drivers":[]}}
]}`))
default:
t.Fatalf("unexpected Kubernetes API path %s", r.URL.String())
@@ -130,21 +130,21 @@ func TestPhase37D2KubernetesNodeEvidenceProjectsCSIRegistrationBlockers(t *testi
if err != nil {
t.Fatalf("enrich: %v", err)
}
nodeB := nodeByKubernetesName(t, enriched.Nodes, "node-b")
if !conditionReason(nodeB.Conditions, ReasonCSIDriverNotRegistered) || !conditionReason(nodeB.Conditions, ReasonCSINodePodNotReady) {
t.Fatalf("nodeB conditions=%+v", nodeB.Conditions)
m02 := nodeByKubernetesName(t, enriched.Nodes, "m02")
if !conditionReason(m02.Conditions, ReasonCSIDriverNotRegistered) || !conditionReason(m02.Conditions, ReasonCSINodePodNotReady) {
t.Fatalf("m02 conditions=%+v", m02.Conditions)
}
status, reason := classifyNodeReadiness(nodeB)
status, reason := classifyNodeReadiness(m02)
if status != ManagedVolumeStatusBlocked || reason != ReasonCSIDriverNotRegistered {
t.Fatalf("nodeB status=%s reason=%s conditions=%+v", status, reason, nodeB.Conditions)
t.Fatalf("m02 status=%s reason=%s conditions=%+v", status, reason, m02.Conditions)
}
crd := swBlockNodeStatuses([]NodeEvidence{nodeB})[0]
crd := swBlockNodeStatuses([]NodeEvidence{m02})[0]
if crd.Status != ManagedVolumeStatusBlocked || crd.ReasonCode != ReasonCSIDriverNotRegistered {
t.Fatalf("CRD node status=%+v", crd)
}
assertCondition(t, crd.Conditions, ConditionReady, "False", ReasonCSIDriverNotRegistered)
assertCondition(t, crd.Conditions, ConditionBlocked, "True", ReasonCSIDriverNotRegistered)
if len(crd.EvidenceRefs) == 0 || !strings.Contains(strings.Join(crd.EvidenceRefs, ","), "kubernetes/csinode/node-b") {
if len(crd.EvidenceRefs) == 0 || !strings.Contains(strings.Join(crd.EvidenceRefs, ","), "kubernetes/csinode/m02") {
t.Fatalf("missing CRD evidence refs: %+v", crd.EvidenceRefs)
}
assertCRDSafeNodeConditions(t, crd.Conditions)
@@ -154,13 +154,13 @@ func TestPhase37D2KubernetesNodeEvidenceProjectsMissingCSIDriver(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/api/v1/nodes":
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"node-a"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"m01"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
case "/api/v1/namespaces/kube-system/pods":
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"csi-node-a"},"spec":{"nodeName":"node-a"},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"csi-m01"},"spec":{"nodeName":"m01"},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
case "/apis/storage.k8s.io/v1/csidrivers/block.csi.seaweedfs.com":
http.NotFound(w, r)
case "/apis/storage.k8s.io/v1/csinodes":
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"node-a"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}}]}`))
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"m01"},"spec":{"drivers":[{"name":"block.csi.seaweedfs.com"}]}}]}`))
default:
t.Fatalf("unexpected Kubernetes API path %s", r.URL.String())
}
@@ -172,11 +172,11 @@ func TestPhase37D2KubernetesNodeEvidenceProjectsMissingCSIDriver(t *testing.T) {
if err != nil {
t.Fatalf("enrich: %v", err)
}
nodeA := nodeByKubernetesName(t, enriched.Nodes, "node-a")
if status, reason := classifyNodeReadiness(nodeA); status != ManagedVolumeStatusBlocked || reason != ReasonCSIDriverNotRegistered {
t.Fatalf("nodeA status=%s reason=%s conditions=%+v", status, reason, nodeA.Conditions)
m01 := nodeByKubernetesName(t, enriched.Nodes, "m01")
if status, reason := classifyNodeReadiness(m01); status != ManagedVolumeStatusBlocked || reason != ReasonCSIDriverNotRegistered {
t.Fatalf("m01 status=%s reason=%s conditions=%+v", status, reason, m01.Conditions)
}
assertCRDSafeNodeConditions(t, nodeA.Conditions)
assertCRDSafeNodeConditions(t, m01.Conditions)
}
func TestPhase37D3KubernetesNodeEvidenceProjectsCSIImagePullBlocker(t *testing.T) {
@@ -184,12 +184,12 @@ func TestPhase37D3KubernetesNodeEvidenceProjectsCSIImagePullBlocker(t *testing.T
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/api/v1/nodes":
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"node-b"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"m02"},"spec":{},"status":{"conditions":[{"type":"Ready","status":"True"}]}}]}`))
case "/api/v1/namespaces/kube-system/pods":
_, _ = w.Write([]byte(`{"items":[{
"metadata":{"name":"sw-block-csi-node-b"},
"metadata":{"name":"sw-block-csi-node-m02"},
"spec":{
"nodeName":"node-b",
"nodeName":"m02",
"initContainers":[{"image":"ghcr.io/seaweedfs/seaweed-block-csi:registrar"}],
"containers":[{"image":"` + missingImage + `"}]
},
@@ -201,7 +201,7 @@ func TestPhase37D3KubernetesNodeEvidenceProjectsCSIImagePullBlocker(t *testing.T
case "/apis/storage.k8s.io/v1/csidrivers/block.csi.seaweedfs.com":
_, _ = w.Write([]byte(`{"metadata":{"name":"block.csi.seaweedfs.com"}}`))
case "/apis/storage.k8s.io/v1/csinodes":
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"node-b"},"spec":{"drivers":[]}}]}`))
_, _ = w.Write([]byte(`{"items":[{"metadata":{"name":"m02"},"spec":{"drivers":[]}}]}`))
default:
t.Fatalf("unexpected Kubernetes API path %s", r.URL.String())
}
@@ -213,7 +213,7 @@ func TestPhase37D3KubernetesNodeEvidenceProjectsCSIImagePullBlocker(t *testing.T
if err != nil {
t.Fatalf("enrich: %v", err)
}
node := nodeByKubernetesName(t, enriched.Nodes, "node-b")
node := nodeByKubernetesName(t, enriched.Nodes, "m02")
if len(node.MissingImages) != 1 || node.MissingImages[0] != missingImage {
t.Fatalf("missing images=%+v", node.MissingImages)
}
@@ -233,7 +233,7 @@ func TestPhase37D3KubernetesNodeEvidenceProjectsCSIImagePullBlocker(t *testing.T
}
assertCondition(t, crd.Conditions, ConditionReady, "False", ReasonImageMissingOnNode)
assertCondition(t, crd.Conditions, ConditionBlocked, "True", ReasonImageMissingOnNode)
if !strings.Contains(strings.Join(crd.EvidenceRefs, ","), "kubernetes/pod/kube-system/sw-block-csi-node-b") {
if !strings.Contains(strings.Join(crd.EvidenceRefs, ","), "kubernetes/pod/kube-system/sw-block-csi-node-m02") {
t.Fatalf("missing pod evidence refs: %+v", crd.EvidenceRefs)
}
assertCRDSafeNodeConditions(t, crd.Conditions)
@@ -22,7 +22,7 @@ func TestManagedVolumeProjection_HealthyFirstVolumeReady(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
DurableFrontierKnown: true,
@@ -30,7 +30,7 @@ func TestManagedVolumeProjection_HealthyFirstVolumeReady(t *testing.T) {
FrontendAddr: "127.0.0.1:3260",
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "127.0.0.1:3260",
}},
Workload: &WorkloadCheckFact{
@@ -161,7 +161,7 @@ func TestManagedVolumeProjection_BlocksMissingNVMeMultipath(t *testing.T) {
FrontendNSID: 1,
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "/var/lib/kubelet/plugins/kubernetes.io/csi",
}},
Workload: &WorkloadCheckFact{
@@ -220,18 +220,18 @@ func TestManagedVolumeProjection_LoopbackCrossNodeBlocked(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "primary",
Observed: true,
FrontendAddr: "127.0.0.1:3260",
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "127.0.0.1:3260",
}},
PodMounts: []PodMountFact{{
PodName: "writer",
NodeName: "node-b",
NodeName: "m02",
Phase: "Pending",
}},
})
@@ -271,7 +271,7 @@ func TestManagedVolumeProjection_NVMeLoopbackCrossNodeBlocked(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendProtocol: "nvme",
@@ -280,12 +280,12 @@ func TestManagedVolumeProjection_NVMeLoopbackCrossNodeBlocked(t *testing.T) {
FrontendNSID: 1,
}},
CSIStages: []CSIStageFact{{
NodeName: "node-a",
NodeName: "m01",
Target: "127.0.0.1:4420",
}},
PodMounts: []PodMountFact{{
PodName: "writer",
NodeName: "node-a",
NodeName: "m01",
Phase: "Pending",
}},
})
@@ -349,7 +349,7 @@ func TestManagedVolumeProjection_WriterFailedMountBlocked(t *testing.T) {
},
PodMounts: []PodMountFact{{
PodName: "writer",
NodeName: "node-b",
NodeName: "m02",
Phase: "Pending",
Reason: ReasonWriterMountFailed,
Message: "MountVolume.MountDevice failed",
@@ -374,7 +374,7 @@ func TestManagedVolumeProjection_CSINodeImagePullBlocked(t *testing.T) {
Phase: "Bound",
},
KubernetesNodes: []KubernetesNodeFact{{
NodeName: "node-b",
NodeName: "m02",
Ready: true,
CSINodeReady: false,
Reason: ReasonCSINodeImagePullFailed,
@@ -414,24 +414,24 @@ func TestManagedVolumeProjection_TransparentISCSIALUARecovered(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "unavailable",
Observed: false,
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3261",
}, {
ReplicaID: "r3",
KubernetesNode: "node-c",
KubernetesNode: "tp01",
Role: "replica",
Observed: true,
}},
HostPaths: []HostPathFact{{
NodeName: "node-b",
NodeName: "m02",
Protocol: "iscsi",
Target: "192.168.1.184:3261",
State: HostPathStateActiveOptimized,
@@ -468,7 +468,7 @@ func TestManagedVolumeProjection_MissingMultipathBlocksTransparentClaim(t *testi
PublishTarget: "192.168.1.184:3261",
},
HostPaths: []HostPathFact{{
NodeName: "node-b",
NodeName: "m02",
Protocol: "iscsi",
Target: "192.168.1.184:3261",
State: HostPathStateSinglePath,
@@ -503,7 +503,7 @@ func TestManagedVolumeProjection_NVMeANASeamDoesNotInferTransparentRecovery(t *t
PublishTarget: "10.0.0.1:4420",
},
HostPaths: []HostPathFact{{
NodeName: "node-b",
NodeName: "m02",
Protocol: "nvme",
Target: "nqn.2026-05.io.seaweedfs:pvc-nvme",
State: HostPathStateANAOptimized,
@@ -530,19 +530,19 @@ func TestManagedVolumeProjection_FactOrderIndependent(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "unavailable",
Observed: false,
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3260",
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "192.168.1.184:3260",
Reattach: true,
}},
@@ -569,11 +569,11 @@ func TestManagedVolumeProjection_ActionInvariantRefs(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "primary",
Observed: true,
}},
CSIStages: []CSIStageFact{{NodeName: "node-b", Target: "127.0.0.1:3260"}},
CSIStages: []CSIStageFact{{NodeName: "m02", Target: "127.0.0.1:3260"}},
})
action := findManagedVolumeAction(blocked.Actions, ManagedVolumeActionReinstallExternalISCSI)
@@ -644,13 +644,13 @@ func TestManagedVolumeProjection_NodeLossReattachRecovered(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "unavailable",
Observed: false,
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
DurableFrontierKnown: true,
@@ -658,14 +658,14 @@ func TestManagedVolumeProjection_NodeLossReattachRecovered(t *testing.T) {
FrontendAddr: "192.168.1.184:3260",
}, {
ReplicaID: "r3",
KubernetesNode: "node-c",
KubernetesNode: "tp01",
Role: "replica",
Observed: true,
DurableFrontierKnown: true,
DurableFrontierLSN: 52,
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
@@ -709,7 +709,7 @@ func TestManagedVolumeProjection_ReturnedPreviousPrimaryStaysFrontendFenced(t *t
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "replica",
ReplicationRole: "ready",
@@ -722,7 +722,7 @@ func TestManagedVolumeProjection_ReturnedPreviousPrimaryStaysFrontendFenced(t *t
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
DurableFrontierKnown: true,
@@ -777,7 +777,7 @@ func TestManagedVolumeProjection_ReturnedReplicaFailbackActionAfterAckEligibilit
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
DurableFrontierKnown: true,
@@ -843,19 +843,19 @@ func TestManagedVolumeProjection_InvalidDualPrimaryBeatsReady(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.181:3260",
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3260",
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "192.168.1.181:3260",
}},
Workload: &WorkloadCheckFact{
@@ -30,7 +30,7 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
{
ReplicaID: "r1",
ServerID: "node-loss-r1",
NodeName: "node-a",
NodeName: "m01",
Observed: true,
Protocol: "iscsi",
FrontendAddress: "192.168.1.181:3260",
@@ -42,7 +42,7 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
{
ReplicaID: "r2",
ServerID: "node-loss-r2",
NodeName: "node-b",
NodeName: "m02",
Observed: true,
Protocol: "iscsi",
FrontendAddress: "192.168.1.184:3260",
@@ -64,7 +64,7 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
{
ReplicaID: "r3",
ServerID: "node-loss-r3",
NodeName: "node-c",
NodeName: "tp01",
Observed: true,
Protocol: "iscsi",
FrontendAddress: "192.168.1.188:3260",
@@ -87,9 +87,9 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
"node_loss_recovery_summary_version=1",
"result=promoted",
"ack_profile=sync-quorum",
"before_primary=r1@node-a",
"failed=r1@node-a",
"promoted=r2@node-b",
"before_primary=r1@m01",
"failed=r1@m01",
"promoted=r2@m02",
"before_frontend=192.168.1.181:3260",
"after_frontend=192.168.1.184:3260",
"pod_recreate_used=true",
@@ -111,7 +111,7 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
text := RenderObservationExplainText(cluster)
for _, want := range []string{
"volume pvc-node-loss status=ok rf=3 ack=sync-quorum",
"primary r2 on node-b frontend=192.168.1.184:3260",
"primary r2 on m02 frontend=192.168.1.184:3260",
"CSI target changed 192.168.1.181:3260 -> 192.168.1.184:3260",
"old primary stale I/O success count is 0",
"timeline:",
@@ -133,7 +133,7 @@ func TestObservationBundle_RendersNodeLossRecoveryStory(t *testing.T) {
func TestObservationBundle_RendersImagePullBlockedStoryWithoutInventory(t *testing.T) {
dir := t.TempDir()
mustWrite(t, filepath.Join(dir, "demo", KubeSystemPodsDeploysArtifact), `NAME READY STATUS RESTARTS AGE IP NODE
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 node-b
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 m02
deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:local`)
cluster, err := BuildObservationFromBundle(ObservationBundleOptions{Dir: dir, VolumeID: "pvc-blocked"})
@@ -144,7 +144,7 @@ deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:loca
for _, want := range []string{
"cluster status=blocked volumes=1 nodes=0",
"volume pvc-blocked status=blocked rf=3 reason=csi_node_image_pull_failed",
"waiting=ImagePullBackOff on node node-b image sw-block-csi:local",
"waiting=ImagePullBackOff on node m02 image sw-block-csi:local",
"next action: import sw-block-csi:local to the blocked node",
} {
if !strings.Contains(text, want) {
@@ -211,7 +211,7 @@ func TestObservationBundle_ReplaysReturnedReplicaProjection(t *testing.T) {
RequiredFrontierLSN: 52,
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "replica",
ReplicationRole: "ready",
@@ -222,7 +222,7 @@ func TestObservationBundle_ReplaysReturnedReplicaProjection(t *testing.T) {
SupportBundlePath: "returned-replica-summary.txt",
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
DurableFrontierKnown: true,
@@ -280,7 +280,7 @@ func TestObservationBundle_ReturnedReplicaProjectionIsVolumeScoped(t *testing.T)
RequiredFrontierLSN: 42,
Replicas: []ReplicaEvidence{{
ReplicaID: "a-r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "previous_primary",
ReplicationRole: "replica_ready",
@@ -290,7 +290,7 @@ func TestObservationBundle_ReturnedReplicaProjectionIsVolumeScoped(t *testing.T)
StalePrimaryFenced: true,
}, {
ReplicaID: "a-r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
Healthy: true,
@@ -312,7 +312,7 @@ func TestObservationBundle_ReturnedReplicaProjectionIsVolumeScoped(t *testing.T)
EndpointVersion: 1,
Replicas: []ReplicaEvidence{{
ReplicaID: "b-r1",
KubernetesNode: "node-c",
KubernetesNode: "tp01",
Observed: true,
Role: "primary",
Healthy: true,
@@ -376,7 +376,7 @@ func TestObservationBundle_ManagedVolumeUsesPrimaryFailureArtifactHints(t *testi
PublishTarget: "192.168.1.184:3261",
Replicas: []ReplicaEvidence{{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3261",
@@ -421,7 +421,7 @@ func TestObservationBundle_D7PrefersNewestRestartClusterEvidence(t *testing.T) {
AckProfile: "sync-quorum",
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Epoch: 1,
}}
@@ -434,7 +434,7 @@ func TestObservationBundle_D7PrefersNewestRestartClusterEvidence(t *testing.T) {
AckProfile: "sync-quorum",
Status: ObservationStatusOK,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 2,
}}
@@ -449,11 +449,11 @@ func TestObservationBundle_D7PrefersNewestRestartClusterEvidence(t *testing.T) {
t.Fatalf("volumes=%+v", out.Volumes)
}
volume := out.Volumes[0]
if volume.PrimaryReplica != "r2" || volume.PrimaryNode != "node-b" || volume.PublishTarget != "192.168.1.184:3260" || volume.Epoch != 2 {
if volume.PrimaryReplica != "r2" || volume.PrimaryNode != "m02" || volume.PublishTarget != "192.168.1.184:3260" || volume.Epoch != 2 {
t.Fatalf("expected post-restart evidence, got %+v", volume)
}
summary := RenderObservationReportSummary(out)
if !strings.Contains(summary, "primary=r2@node-b frontend=192.168.1.184:3260") {
if !strings.Contains(summary, "primary=r2@m02 frontend=192.168.1.184:3260") {
t.Fatalf("summary used stale primary:\n%s", summary)
}
}
@@ -533,20 +533,20 @@ func TestObservationBundle_CarriesHostPrereqEvidenceIntoNodeStatus(t *testing.T)
dir := t.TempDir()
cluster := NewClusterEvidence(time.Date(2026, 6, 8, 13, 0, 0, 0, time.UTC))
cluster.Nodes = []NodeEvidence{{
NodeName: "node-b",
KubernetesNode: "node-b",
NodeName: "m02",
KubernetesNode: "m02",
Ready: true,
Schedulable: true,
}, {
NodeName: "node-c",
KubernetesNode: "node-c",
NodeName: "tp01",
KubernetesNode: "tp01",
Ready: true,
Schedulable: true,
}}
writeClusterEvidenceArtifact(t, filepath.Join(dir, "status", ClusterEvidenceArtifact), cluster)
mustWrite(t, filepath.Join(dir, "host", ObservationHostPrereqArtifact), strings.Join([]string{
"node=node-b iscsi_prereq=missing multipath_prereq=ok command_iscsiadm=missing",
"node=node-c iscsi_prereq=ok multipath_prereq=missing command_multipath=missing",
"node=m02 iscsi_prereq=missing multipath_prereq=ok command_iscsiadm=missing",
"node=tp01 iscsi_prereq=ok multipath_prereq=missing command_multipath=missing",
}, "\n"))
out, err := BuildObservationFromBundle(ObservationBundleOptions{Dir: dir})
@@ -559,16 +559,16 @@ func TestObservationBundle_CarriesHostPrereqEvidenceIntoNodeStatus(t *testing.T)
}
if snapshot.Cluster.Nodes[0].Status != ManagedVolumeStatusBlocked ||
snapshot.Cluster.Nodes[0].ReasonCode != ReasonISCSIPrereqMissing {
t.Fatalf("node-b node=%+v", snapshot.Cluster.Nodes[0])
t.Fatalf("m02 node=%+v", snapshot.Cluster.Nodes[0])
}
if snapshot.Cluster.Nodes[1].Status != ManagedVolumeStatusBlocked ||
snapshot.Cluster.Nodes[1].ReasonCode != ReasonMultipathPrereqMissing {
t.Fatalf("node-c node=%+v", snapshot.Cluster.Nodes[1])
t.Fatalf("tp01 node=%+v", snapshot.Cluster.Nodes[1])
}
summary := RenderObservationReportSummary(out)
for _, want := range []string{
"node=node-b k8s=node-b status=blocked reason=iscsi_prereq_missing",
"node=node-c k8s=node-c status=blocked reason=multipath_prereq_missing",
"node=m02 k8s=m02 status=blocked reason=iscsi_prereq_missing",
"node=tp01 k8s=tp01 status=blocked reason=multipath_prereq_missing",
} {
if !strings.Contains(summary, want) {
t.Fatalf("summary missing %q:\n%s", want, summary)
@@ -585,11 +585,11 @@ func TestObservationBundle_CarriesUnsupportedLoopbackAttachIntoManagedStatus(t *
ReplicationFactor: 1,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "127.0.0.1:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "127.0.0.1:3260",
@@ -597,8 +597,8 @@ func TestObservationBundle_CarriesUnsupportedLoopbackAttachIntoManagedStatus(t *
}})
mustWrite(t, filepath.Join(dir, "demo", ObservationLoopbackAttachArtifact), strings.Join([]string{
"issue=unsupported_cross_node_loopback_attach",
"app_node=node-b",
"blockvolume_node=node-a",
"app_node=m02",
"blockvolume_node=m01",
"frontend=127.0.0.1:3260",
"volume_id=pvc-loopback",
"replica_id=r1",
@@ -655,7 +655,7 @@ func TestObservationBundle_CarriesUnsupportedLoopbackAttachIntoManagedStatus(t *
summary := RenderObservationReportSummary(cluster)
for _, want := range []string{
"volume=pvc-loopback status=blocked pvc=default/demo-pvc primary=r1@node-a frontend=127.0.0.1:3260",
"volume=pvc-loopback status=blocked pvc=default/demo-pvc primary=r1@m01 frontend=127.0.0.1:3260",
"managed_volume=pvc-loopback status=blocked reason=publish_target_loopback_cross_node",
"managed_volume_condition=Ready status=False reason=publish_target_loopback_cross_node severity=warning",
"managed_volume_action=safe_k8s.reinstall_external_iscsi mode=dry_run side_effect=safe_k8s executor=installer_or_operator decision=allowed",
@@ -695,11 +695,11 @@ func TestObservationBundle_DeleteSafetyBlocksWithResidue(t *testing.T) {
ReplicationFactor: 1,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "192.168.1.181:3260",
@@ -780,11 +780,11 @@ func TestObservationBundle_DeleteSafetyUnknownWithoutCleanupEvidence(t *testing.
ReplicationFactor: 1,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "192.168.1.181:3260",
@@ -843,11 +843,11 @@ func TestObservationBundle_DeleteSafetyUnknownWithStaleCleanupEvidence(t *testin
ReplicationFactor: 1,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "192.168.1.181:3260",
@@ -912,11 +912,11 @@ func TestObservationBundle_DeleteSafetyReleasableWithCleanCleanupEvidence(t *tes
ReplicationFactor: 1,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "192.168.1.181:3260",
@@ -973,7 +973,7 @@ func TestObservationBundle_LoopbackAttachTargetsNamedVolume(t *testing.T) {
PVCName: "pvc-a",
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
},
{
@@ -982,14 +982,14 @@ func TestObservationBundle_LoopbackAttachTargetsNamedVolume(t *testing.T) {
PVCName: "pvc-b",
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "127.0.0.1:3260",
},
})
mustWrite(t, filepath.Join(dir, "demo", ObservationLoopbackAttachArtifact), strings.Join([]string{
"issue=unsupported_cross_node_loopback_attach",
"app_node=node-b",
"blockvolume_node=node-a",
"app_node=m02",
"blockvolume_node=m01",
"frontend=127.0.0.1:3260",
"volume_id=pvc-b",
"replica_id=r1",
@@ -1023,11 +1023,11 @@ func TestManagedVolumeFactsFromEvidence_AllowsSameNodeLoopback(t *testing.T) {
PVCName: "demo-pvc",
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "127.0.0.1:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Observed: true,
Role: "primary",
FrontendAddr: "127.0.0.1:3260",
@@ -1060,7 +1060,7 @@ func TestObservationBundle_D6ReplayGate_FirstVolumeBlockedAndRecovery(t *testing
name: "blocked-image-pull",
build: func(t *testing.T, dir string) {
mustWrite(t, filepath.Join(dir, "demo", KubeSystemPodsDeploysArtifact), `NAME READY STATUS RESTARTS AGE IP NODE
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 node-b
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 m02
deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:local`)
},
wantStatus: ManagedVolumeStatusBlocked,
@@ -1088,7 +1088,7 @@ deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:loca
PublishTarget: "192.168.1.184:3261",
Replicas: []ReplicaEvidence{{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3261",
@@ -1182,7 +1182,7 @@ func TestObservationBundle_DashboardReplayGate_FirstVolumeBlockedAndRecovery(t *
name: "blocked-image-pull",
build: func(t *testing.T, dir string) {
mustWrite(t, filepath.Join(dir, "demo", KubeSystemPodsDeploysArtifact), `NAME READY STATUS RESTARTS AGE IP NODE
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 node-b
pod/sw-block-csi-node-n948t 0/2 Init:ErrImagePull 0 2m3s 192.168.1.184 m02
deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:local`)
},
wantHTML: ReasonCSINodeImagePullFailed,
@@ -1212,7 +1212,7 @@ deployment.apps/sw-block-csi-controller 1/1 1 1 2m3s block-csi sw-block-csi:loca
PublishTarget: "192.168.1.184:3261",
Replicas: []ReplicaEvidence{{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
FrontendAddr: "192.168.1.184:3261",
@@ -1347,7 +1347,7 @@ func writeStatusEndpointUnreachableInventory(t *testing.T, dir string) {
Replicas: []VolumeInventoryReplicaInput{{
ReplicaID: "r1",
ServerID: "node-r1",
NodeName: "node-a",
NodeName: "m01",
Protocol: "iscsi",
FrontendAddress: "192.168.1.181:3260",
StatusAddress: "192.168.1.181:23260",
+16 -16
View File
@@ -13,8 +13,8 @@ func TestObservation_RenderHealthyVolumeTextAndJSON(t *testing.T) {
text := RenderVolumeEvidenceText(volume)
for _, want := range []string{
"volume pvc-healthy status=ok rf=3 ack=sync-quorum",
"primary r1 on node-a frontend=192.168.1.181:3260",
"r2 node-b unknown replica_ready durable_lsn=44 candidate_ready=true",
"primary r1 on m01 frontend=192.168.1.181:3260",
"r2 m02 unknown replica_ready durable_lsn=44 candidate_ready=true",
"next action: none",
} {
if !strings.Contains(text, want) {
@@ -50,14 +50,14 @@ func TestObservation_RenderRecoveringNodeLossStory(t *testing.T) {
Status: ObservationStatusRecovering,
Reason: ReasonPrimaryNodeLost,
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
Replicas: []ReplicaEvidence{
{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "unavailable",
ReplicationRole: "unavailable",
StalePrimaryFenced: true,
@@ -71,7 +71,7 @@ func TestObservation_RenderRecoveringNodeLossStory(t *testing.T) {
},
{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
ReplicationRole: "none",
DurableFrontierKnown: true,
@@ -91,8 +91,8 @@ func TestObservation_RenderRecoveringNodeLossStory(t *testing.T) {
text := RenderVolumeEvidenceText(volume)
for _, want := range []string{
"volume pvc-recovering status=recovering rf=3 ack=sync-quorum reason=primary_node_lost",
"primary r2 on node-b frontend=192.168.1.184:3260",
"r1 node-a unavailable unavailable stale_primary_fenced=true",
"primary r2 on m02 frontend=192.168.1.184:3260",
"r1 m01 unavailable unavailable stale_primary_fenced=true",
"condition Recovery severity=info reason=primary_node_lost CSI target changed 192.168.1.181:3260 -> 192.168.1.184:3260",
"next action: wait for app pod readiness, then collect support bundle if stuck",
} {
@@ -106,8 +106,8 @@ func TestObservation_RenderBlockedImagePullStory(t *testing.T) {
cluster := NewClusterEvidence(time.Date(2026, 5, 16, 16, 3, 6, 0, time.UTC))
cluster.Status = ObservationStatusBlocked
cluster.Nodes = []NodeEvidence{{
NodeName: "node-b",
KubernetesNode: "node-b",
NodeName: "m02",
KubernetesNode: "m02",
InternalIP: "192.168.1.184",
Schedulable: true,
Ready: true,
@@ -118,7 +118,7 @@ func TestObservation_RenderBlockedImagePullStory(t *testing.T) {
Status: "false",
Reason: ReasonImageMissingOnNode,
Severity: "error",
Message: "node node-b missing image sw-block-csi:local",
Message: "node m02 missing image sw-block-csi:local",
}},
}}
cluster.Volumes = []VolumeEvidence{{
@@ -135,7 +135,7 @@ func TestObservation_RenderBlockedImagePullStory(t *testing.T) {
Severity: "error",
Message: "pod kube-system/sw-block-csi-node-abc waiting=ImagePullBackOff",
}},
NextActions: []string{"import the image to node-b or use a registry reachable by all nodes"},
NextActions: []string{"import the image to m02 or use a registry reachable by all nodes"},
}}
text := RenderClusterEvidenceText(cluster)
@@ -143,7 +143,7 @@ func TestObservation_RenderBlockedImagePullStory(t *testing.T) {
"cluster status=blocked volumes=1 nodes=1",
"volume pvc-blocked status=blocked rf=3 reason=csi_node_image_pull_failed",
"condition Attach severity=error reason=csi_node_image_pull_failed pod kube-system/sw-block-csi-node-abc waiting=ImagePullBackOff",
"next action: import the image to node-b or use a registry reachable by all nodes",
"next action: import the image to m02 or use a registry reachable by all nodes",
} {
if !strings.Contains(text, want) {
t.Fatalf("text missing %q:\n%s", want, text)
@@ -202,14 +202,14 @@ func healthyObservationVolume() VolumeEvidence {
ObservedReplicas: 3,
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "192.168.1.181:3260",
Epoch: 1,
EndpointVersion: 1,
Replicas: []ReplicaEvidence{
{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "primary",
ReplicationRole: "none",
DurableFrontierKnown: true,
@@ -217,7 +217,7 @@ func healthyObservationVolume() VolumeEvidence {
},
{
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "unknown",
ReplicationRole: "replica_ready",
DurableFrontierKnown: true,
@@ -227,7 +227,7 @@ func healthyObservationVolume() VolumeEvidence {
},
{
ReplicaID: "r3",
KubernetesNode: "node-c",
KubernetesNode: "tp01",
Role: "unknown",
ReplicationRole: "replica_ready",
DurableFrontierKnown: true,
@@ -94,11 +94,11 @@ func TestOperatorFoundationSnapshot_BlockedVolumeCarriesWarningEvent(t *testing.
Status: ObservationStatusBlocked,
Reason: ReasonPublishTargetLoopbackCrossNode,
PrimaryReplica: "r1",
PrimaryNode: "node-a",
PrimaryNode: "m01",
PublishTarget: "127.0.0.1:3260",
Replicas: []ReplicaEvidence{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Observed: true,
Role: "primary",
FrontendAddr: "127.0.0.1:3260",
@@ -154,16 +154,16 @@ func TestOperatorFoundationSnapshot_CountsStaleEvidenceVolumes(t *testing.T) {
func TestOperatorFoundationSnapshot_IncludesNodeReadiness(t *testing.T) {
cluster := NewClusterEvidence(time.Date(2026, 6, 5, 16, 30, 0, 0, time.UTC))
cluster.Nodes = []NodeEvidence{{
NodeName: "node-b",
KubernetesNode: "node-b",
NodeName: "m02",
KubernetesNode: "m02",
InternalIP: "192.168.1.184",
Schedulable: true,
Ready: true,
ReplicaCount: 1,
RequiredImages: []string{"sw-block:local"},
}, {
NodeName: "node-c",
KubernetesNode: "node-c",
NodeName: "tp01",
KubernetesNode: "tp01",
InternalIP: "192.168.1.188",
Schedulable: true,
Ready: true,
@@ -19,7 +19,7 @@ func TestPhase32D3ReadyStatusSurfacesAgree(t *testing.T) {
AckProfile: "best-effort",
Status: ObservationStatusOK,
PrimaryReplica: "r1",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "127.0.0.1:3260",
Epoch: 1,
EndpointVersion: 1,
@@ -38,7 +38,7 @@ func TestPhase32D3ReadyStatusSurfacesAgree(t *testing.T) {
Epoch: 1,
EndpointVersion: 1,
},
CSIStages: []CSIStageFact{{NodeName: "node-b", Target: "127.0.0.1:3260"}},
CSIStages: []CSIStageFact{{NodeName: "m02", Target: "127.0.0.1:3260"}},
Workload: &WorkloadCheckFact{WriterVerified: true, ReaderVerified: true},
EvidenceRefs: []string{"writer.log", "reader.log"},
})}
@@ -104,7 +104,7 @@ func TestPhase32D4BlockedStatusSurfacesAgree(t *testing.T) {
PVCName: "demo-pvc",
PVC: &PVCFact{Phase: "Bound"},
KubernetesNodes: []KubernetesNodeFact{{
NodeName: "node-b",
NodeName: "m02",
Ready: true,
Schedulable: true,
CSINodeReady: false,
@@ -178,7 +178,7 @@ func TestPhase32D5RestartPromotionStatusSurfacesAgree(t *testing.T) {
Status: ObservationStatusOK,
Reason: "authority_persisted",
PrimaryReplica: "r2",
PrimaryNode: "node-b",
PrimaryNode: "m02",
PublishTarget: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
@@ -202,13 +202,13 @@ func TestPhase32D5RestartPromotionStatusSurfacesAgree(t *testing.T) {
},
Replicas: []ReplicaFact{{
ReplicaID: "r1",
KubernetesNode: "node-a",
KubernetesNode: "m01",
Role: "unavailable",
Observed: false,
StalePrimaryFenced: true,
}, {
ReplicaID: "r2",
KubernetesNode: "node-b",
KubernetesNode: "m02",
Role: "primary",
Observed: true,
DurableFrontierKnown: true,
@@ -216,14 +216,14 @@ func TestPhase32D5RestartPromotionStatusSurfacesAgree(t *testing.T) {
FrontendAddr: "192.168.1.184:3260",
}, {
ReplicaID: "r3",
KubernetesNode: "node-c",
KubernetesNode: "tp01",
Role: "replica",
Observed: true,
DurableFrontierKnown: true,
DurableFrontierLSN: 52,
}},
CSIStages: []CSIStageFact{{
NodeName: "node-b",
NodeName: "m02",
Target: "192.168.1.184:3260",
Epoch: 2,
EndpointVersion: 1,
@@ -235,7 +235,7 @@ func TestPhase32D5RestartPromotionStatusSurfacesAgree(t *testing.T) {
summary := RenderObservationReportSummary(cluster)
for _, want := range []string{
"volume=pvc-restart status=ok pvc=default/demo-pvc primary=r2@node-b frontend=192.168.1.184:3260 rf=3 ack=sync-quorum",
"volume=pvc-restart status=ok pvc=default/demo-pvc primary=r2@m02 frontend=192.168.1.184:3260 rf=3 ack=sync-quorum",
"managed_volume=pvc-restart status=recovered reason=csi_reattach_recovered",
"managed_volume_condition=Ready status=True reason=csi_reattach_recovered severity=info",
"managed_volume_condition=Recovered status=True reason=csi_reattach_recovered severity=info",
@@ -261,9 +261,9 @@ func TestPhase32D5RestartPromotionStatusSurfacesAgree(t *testing.T) {
func TestPhase32D6MultiVolumeStatusSurfacesKeepVolumesIndependent(t *testing.T) {
cluster := NewClusterEvidence(time.Date(2026, 5, 25, 22, 15, 0, 0, time.UTC))
cluster.Volumes = []VolumeEvidence{
phase32VolumeEvidence("pvc-a", "app-a", "r1", "node-a", "192.168.1.181:3260"),
phase32VolumeEvidence("pvc-b", "app-b", "r2", "node-b", "192.168.1.184:3260"),
phase32VolumeEvidence("pvc-c", "app-c", "r3", "node-c", "192.168.1.188:3260"),
phase32VolumeEvidence("pvc-a", "app-a", "r1", "m01", "192.168.1.181:3260"),
phase32VolumeEvidence("pvc-b", "app-b", "r2", "m02", "192.168.1.184:3260"),
phase32VolumeEvidence("pvc-c", "app-c", "r3", "tp01", "192.168.1.188:3260"),
}
cluster.ManagedVolumes = []ManagedVolumeProjection{
phase32ReadyManagedProjection("pvc-a", "app-a", "r1", "192.168.1.181:3260"),
@@ -298,9 +298,9 @@ func TestPhase32D6MultiVolumeStatusSurfacesKeepVolumesIndependent(t *testing.T)
summary := RenderObservationReportSummary(cluster)
for _, want := range []string{
"volume=pvc-a status=ok pvc=default/app-a primary=r1@node-a frontend=192.168.1.181:3260 rf=3 ack=sync-quorum",
"volume=pvc-b status=ok pvc=default/app-b primary=r2@node-b frontend=192.168.1.184:3260 rf=3 ack=sync-quorum",
"volume=pvc-c status=ok pvc=default/app-c primary=r3@node-c frontend=192.168.1.188:3260 rf=3 ack=sync-quorum",
"volume=pvc-a status=ok pvc=default/app-a primary=r1@m01 frontend=192.168.1.181:3260 rf=3 ack=sync-quorum",
"volume=pvc-b status=ok pvc=default/app-b primary=r2@m02 frontend=192.168.1.184:3260 rf=3 ack=sync-quorum",
"volume=pvc-c status=ok pvc=default/app-c primary=r3@tp01 frontend=192.168.1.188:3260 rf=3 ack=sync-quorum",
} {
if !strings.Contains(summary, want) {
t.Fatalf("summary missing %q:\n%s", want, summary)
@@ -326,7 +326,7 @@ func TestAFreshStoreAtLevelOneRunsNoUpgradePass(t *testing.T) {
}
}
// A store created at level 1 is born v1.1: its compare record is
// A store created at level 1 is born v1.1 (r2.882): its compare record is
// written as done, so a restart before its first cut (no longer created
// this start) runs no pass either and its first cut is not held.
func TestAStoreCreatedAtLevelOneNeverRunsTheUpgradePass(t *testing.T) {
@@ -55,7 +55,7 @@ func (l *chunkLayerImpl) openChunkRecordV11() (*chunkRecordShadow, error) {
seed := &upgradeSeed{proof: l.cfg.CleanStop, head: l.head, ref: l.headRef, zero: l.zeroChunkSum()}
err = upgradeChunkRecordSeeded(l.ctx, s, epoch, seed, l.attachProgress.add)
}
// A store this start created is born v1.1: there is nothing to
// A store this start created is born v1.1 (r2.882): there is nothing to
// compare (every chunk known-zero or absent), so its compare record is
// written as done and the upgrade pass never runs for it, on this start
// or a later one. A crash before this write leaves the upgrade's first
@@ -28,7 +28,7 @@ func chunkRecordStateCode(k chunkkernel.Kind) (uint8, error) {
// kindByCode is chunkRecordKind for a code the runtime itself stored (every
// one valid): the record keeps each chunk's state as its one-byte page code,
// not the kernel's string (16 B a chunk).
// not the kernel's string (16 B a chunk; r2.735).
var kindByCode = [6]chunkkernel.Kind{1: chunkkernel.Absent, 2: chunkkernel.Partial, 3: chunkkernel.Unknown, 4: chunkkernel.HashUnpublished, 5: chunkkernel.HashPublished}
func chunkRecordKind(code uint8) (chunkkernel.Kind, error) {
@@ -12,7 +12,7 @@ import (
var errRefBeyondVolume = errors.New("storage: chunk reference beyond the volume")
// refTable is the holder's copy of the references HEAD names, one entry a
// chunk, in fixed width: what the flat chunk map held, without a
// chunk, in fixed width (r2.777): what the flat chunk map held, without a
// per-entry key string or map overhead. It sits behind a narrow interface
// (Get, Set, Delete, FillSegment, Len) so that a paged form can replace it
// without touching its readers.
@@ -37,7 +37,7 @@ type refTable struct {
const prefixOther = ^uint16(0)
// chunkRefs is the narrow interface the layer reads HEAD's references
// through: a paged form can replace refTable behind it without
// through (r2.777): a paged form can replace refTable behind it without
// touching a reader. Get, Set and Delete are O(1); FillSegment is O(its
// range); Len is O(1).
type chunkRefs interface {
@@ -141,7 +141,7 @@ func TestSpaceMeasurementControls(t *testing.T) {
}
}
// The SPACE baseline (V4-B PR 4's red): the holder's heap per
// The SPACE baseline (V4-B PR 4's red, r2.736/r2.777): the holder's heap per
// chunk for a 1 TiB volume's chunk count (262,144; one-block chunks, which
// TestSpaceMeasurementControls shows stand for 4 MiB ones), every chunk
// named by HEAD with canonical keys owned by the layer, after GC once the
+1 -1
View File
@@ -13,7 +13,7 @@ It is intentionally small:
- iSCSI mount into a pod
- CSI `DeleteVolume` cleanup path exercised by the alpha smoke harness
The verified lab path is a single-node k3s cluster. Treat this as an alpha MVP for
The verified lab path is M02 single-node k3s. Treat this as an alpha MVP for
evaluation and contributor onboarding, not production storage.
## Current Storage Path
@@ -123,7 +123,7 @@ side payloads and preservation of other-prefix files/directories.
## Backend proxy result
The source-identical `BenchmarkCutCOWProxy` was run parent/candidate interleaved
three times, each row with three cuts, on a lab host (i7-13700, Go reports GOMAXPROCS
three times, each row with three cuts, on tp04 (i7-13700, Go reports GOMAXPROCS
24; actual work stays under the runner's quota). Parent is main d0e3895a plus
only the benchmark, ref 3faecbd4. Candidate timing head is ee6c6f3b. Staging is
disabled, copy/upload concurrency is 8, chunks are 4 MiB and each released
+5 -5
View File
@@ -1083,7 +1083,7 @@ Notes:
| `INV-WS-FORCED-CONFIRM-NO-BYPASS-001` | No force-move flag bypasses the confirmation, and `--dry-run` is never a confirmation: it sends only a preview, which needs the same confirmation. | M2 lease: Expired → Moved (forced) (the explicit-force guard) | `cmd/sw-block/workspace.go` `runWorkspaceForceMove`, `workspacePreview`; `core/rpc/wsclient/wsclient.go` `PreviewForcedMove` | `TestWorkspaceForceMove_Row2_DryRunPreview`, `TestWorkspaceHelpText` (`cmd/sw-block/workspace_test.go`) | — | ACTIVE |
| `INV-ATTACH-ASSIGNMENT-BOUND-001` | Without a master wait, the assignment allowance is checked between attach attempts; it never cancels a granted attempt's manifest read. Per-fetch bounds, recovery progress and provider Close still apply. | M1 Recovering to Serving (wait scheduling only) | `DurableProvider.chunkAuthorityWait` | `TestDefaultAttachAt262144EntriesOutlivesAssignmentWait`, `TestDefaultGrantedAttachFailureEndsAtAssignmentAllowance` (`core/frontend/durable/default_attach_attempt_test.go`); `TestRestoreDeferredAssignmentWaitEndsOnDeadlineAndClose` (`core/frontend/durable/provider_assignment_test.go`) | none (scheduling; authority guards unchanged) | ACTIVE |
| `INV-WS-STARTUP-RETRY-001` | A workspace primary exits 75 on assignment timeout or lease expiry after bounded cleanup. A master fact newer than nonzero observed-own, or an exact foreign HEAD at/above the assigned epoch, permits 78. Newer HEAD/store format: 78. ACK and signal keep normal exit; lease and claim gates never relax. | M2 restart | `cmd/blockvolume/process_exit.go` `superviseProcess`, `workspaceRetryOutcome`; `core/frontend/durable/provider_layout.go` `startLayoutRoot`; `core/frontend/durable/provider_startup.go` `ChunkStartupIdentityRefused`, `ChunkStartupNewerVersion`, `endChunkStartup`; `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`, `durableOpenFatalExit` | `TestANewerHeadVersionExits78NotRestartable`, `TestAStoreOfANewerFormatExits78` (`cmd/blockvolume/newer_version_exit_test.go`); `TestChunkStartupNewerVersionIsGenerationBound` (`core/frontend/durable/provider_startup_internal_test.go`); `TestChunkAssignmentTimeoutExposesCurrentRecoveryOutcome` (`core/frontend/durable/provider_startup_outcome_test.go`); `TestChunkStartupOutcomeRejectsOldGenerationAndCoalescesWake` (`core/frontend/durable/provider_startup_internal_test.go`); `TestWorkspaceDisplacedClaimUsesAssignedEpoch`, `TestWorkspaceRetryUsesNewestOwnAssignment`, `TestWorkspaceForeignHeadClaimChoosesNoRetry`, `TestWorkspaceOldLocalHolderForeignHeadChoosesNoRetry` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceExitFirstOutcomeIsLatched`, `TestWorkspaceExitDoesNotWaitForBlockedFrontendClose`, `TestWorkspacePlannedStopKeepsSuccess` (`cmd/blockvolume/process_exit_test.go`) | Existing WorkspaceRegrant restart transition; no new grant rule | ACTIVE |
| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestReadReplicaStoreWaitsOnlyWhileTheMasterGivesNoReply` (`cmd/blockvolume/store_record_wait_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB |
| `INV-WALSTORE-NO-EMPTY-STORE-001` | A plain walstore holder (single replica, or a replicated volume's line primary) creates its store only on the master's creating answer. Once its store is recorded, or its volume predates attestation, a missing store exits 78 store_lost; an unreadable record exits 75. Neither writes anything. | Holder startup, before the durable open | `cmd/blockvolume/store_admission.go` `decideStoreAdmission`; `cmd/blockvolume/main.go` `runVolume` (before `InitReplicaFloor`); `core/host/master/store_attestation.go` `GetReplicaStore`, `ReplicaStoreState`; `core/frontend/durable/provider.go` `openOrCreate` (`ErrLostStore`) | `TestRF1HolderOnAWipedStateDirectoryRefusesStoreLost` (`cmd/blockvolume/rf1_store_lost_test.go`, process-level); `TestBlockvolumeAsksTheMasterBeforeCreatingItsStore` (`cmd/blockvolume/lost_store_exit_test.go`); `TestStoreAdmissionCreatesOnlyOnAnExplicitCreatingAnswer` (`cmd/blockvolume/store_admission_test.go`); `TestRF3WipedPrimaryRefusesAndASurvivorServesItsData` (`cmd/blockvolume/rf3_primary_store_lost_test.go`, process-level); `TestGetReplicaStoreAnswersFromTheMastersCreationFact` (`core/host/master/get_replica_store_test.go`); `TestGetReplicaStoreAnswersAReplicatedPrimaryFromItsOwnStore` (`core/host/master/primary_store_answer_test.go`); `TestAnEndedVolumeWithoutItsStoreRefusesAndCreatesNothing` (`core/frontend/durable/lost_store_test.go`) | MasterCreate NoEmptyHeadOverLineage projected onto the holder's local store (mutant RecreateWhenReady, here recreate_when_ended); CreateEvid2 creation fact; KnownZero (walstore has no HEAD to hydrate from). A replicated volume's non-primary replica keeps the peer rebuild: a fresh store has no durable LSN and is not the recorded store, so it never counts as a survivor or a promotion candidate | STUB |
| `INV-WS-SERVE-AFTER-OWN-STORE-001` | A new volume's primary acknowledges no write until the master has recorded every initial replica's store, its own included (a single-replica volume waits for its own). So a replica's recorded store precedes every write it acknowledges. | Volume creation: stores awaited, then Serving | `core/host/master/store_attestation.go` `awaited`; `core/host/master/services.go` `assignmentFact`; `core/host/volume/workspace_startup.go` `ReplicaStoresAwaited`; `core/host/volume/projection_bridge.go` `replicaStoresAwaited` | `TestAnRF1PrimaryAwaitsItsOwnStoreBeforeServing` (`core/host/master/primary_store_answer_test.go`); `TestNewVolumeAssignmentWaitsForReplicaAttestations` (`core/host/master/store_record_wait_test.go`); `TestNewVolumePrimaryServesNothingBeforeReplicaAttestations` (`core/host/volume/replica_stores_wait_test.go`) | CreateEvid2: a recorded store may hold acknowledged data, which is what lets `INV-WALSTORE-NO-EMPTY-STORE-001` read a recorded store as creation ended | ACTIVE |
| `INV-WS-MASTER-WAIT-001` | Startup waits without a bound while the master gives no reply or refuses credentials or identity; after contact it ends 30 s beyond the later of recovery's first reply or the master barrier. Typed MOVED or DELETED ends it with 78, including a confirmed moved source without an own assignment. | M2 Awaiting assignment → Process exited | `core/host/volume/master_wait.go` `masterWait` (contact from heartbeat, stream and renewal results; the refusal kind from the status detail only); `core/frontend/durable/provider_chunk.go` `chunkAuthorityWait` (`ChunkMasterWait`); `cmd/blockvolume/process_exit.go` `chooseChunkStartupExit`; `core/host/master/workspace_service.go` `leaseRefusal`, `renewalMoved`; `core/authority/workspace.go` `WorkspaceSourceMoved`; `core/host/master/services.go` `SubscribeAssignments`; `core/authority/workspace_lease_view.go` `LeaseBarrierError`; `core/host/volume/workspace_lease.go` `renewDelay` (sleeps until just past the barrier time, jittered, at most 2 min; then a 200 ms poll for 5 s); `core/rpc/link/link.go` `MasterReconnect` | `TestChunkAuthorityWaitStartsAtFirstContact`, `TestLeaseGuardSleepsUntilTheBarrier`, `TestStatusShowsTheMasterWait`, `TestCredentialsRefusedForAnHourWaitsAndLogs`, `TestHeartbeatLogsTheMasterWait`, `TestFlappingMasterNeverExpiresEarly` (`core/host/volume/master_wait_test.go`); `TestMasterLinkReconnectsWithinTwoSeconds` (`core/host/volume/master_reconnect_test.go`); `TestChunkAuthorityWaitFollowsTheMasterWait`, `TestChunkAuthorityWaitPassesItsOwnStart`, `TestChunkGrantedAttachThatKeepsFailingIsBounded`, `TestChunkAuthorityWaitAttachesAGrantOnTheBoundsTick` (`core/frontend/durable/provider_master_wait_test.go`); `TestIdentityRefusalWaitsVisibly`, `TestChunkAuthorityWaitAfterASlowOpenGetsItsFullLimit`, `TestIdentityRefusalEndsAndDecays` (`core/host/volume/master_wait_test.go`); `TestIdentityRefusalEndsOnADeliveredAssignment` (`cmd/blockvolume/process_exit_authority_test.go`); `TestIdentityRefusalIsTyped` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestLeaseRefusalKinds`, `TestRenewalReplicaMismatchAtOlderLineEpochIsOther` (`core/host/master/workspace_lease_refusal_kind_test.go`); `TestChunkStartupExitFinalGives78`, `TestRestartedMovedSourceExits78WithoutAnOwnLine` (`cmd/blockvolume/process_exit_authority_test.go`); `TestWorkspaceSourceMovedProof`, `TestMovedSourceProofCallers`, `TestMasterWaitFinalSites`, `TestMovedAssignmentStreamIsFinalWithoutAnyOwnAssignment`; also in `core/authority/workspace_source_moved_test.go`, `core/host/master/workspace_moved_source_guard_test.go` | Real systemd moved-source and prestarted-target controls remain qualification gates. | ACTIVE |
@@ -1165,8 +1165,8 @@ Notes:
| `INV-HOST-CUT-BUDGET-001` | A cooperating cut process holds a host OS slot from its admission, before staging or the capture barrier: see M7 free → admitted. | M7 free → admitted | `core/hostlimit/limiter.go` `Admit`; `core/storage/chunk_cut_budget.go`; blockvolume host-limit flags | `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`); `TestHostCutLimitDoesNotGateGuestIO` (`core/frontend/durable/host_limit_test.go`) | `HostBudget` HeldUntilJoined/PayloadBound/SpillBound (bounded OS-lock abstraction; fallback excluded) | ACTIVE |
| `INV-HOST-CUT-BUDGET-RESERVE-001` | Each admitted slot, urgent included, carries at most PayloadBytes of cut payload and at most COWBytes of COW side bytes; a reservation beyond COWBytes revokes the slot and aborts its cut. | M7 admitted | `core/hostlimit/limiter.go` `Admit`, `ReserveCOW`; `core/storage/chunk_cut_budget.go` | `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`); `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`) | `HostBudget` PayloadBound/SpillBound | ACTIVE |
| `INV-HOST-CUT-BUDGET-SETTLE-001` | A slot's OS lock is released only after its cut's workers settle and Release is called; cancellation, hold expiry and limiter Close abort the cut but keep the slot until then. | M7 draining → joined → released | `core/hostlimit/limiter.go` `Release`, `releaseLoop`, `revoke`, `Close`; `core/storage/chunk_layer.go` `captureLocked` | `TestCOWAbortHoldsSlotUntilWorkerSettlement`, `TestHoldExpiryAndCloseDoNotSteal`, `TestKilledProcessReleasesButLiveHolderDoesNot` (`core/hostlimit/limiter_test.go`); `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`) | `HostBudget` HeldUntilJoined | ACTIVE |
| `INV-MAINTENANCE-BATCH-001` | Cleaning releases HEAD activity after min(1000 decisions, 5 s), checked between decisions. Preparation normally stays outside; re-entry validates its HEAD. Unknown close settles before cursor advancement. Busy answers are typed retryable layout_busy. | M8 Running → Running | `core/frontend/chunkstore/clean_b.go` `endCleanBatch`; `core/frontend/chunkstore/layout/remove.go` `ResetReachability` | `TestMaintenanceFiveSecondBatchLetsSnapshotDeleteFinish`, `TestMaintenanceSlowPreparationDoesNotHoldSession`, `TestMaintenanceBatchRefusesPublicationAfterPreparation`, `TestMaintenanceBatchPreparationAbsentHeadRefuses`, `TestMaintenanceLongPassReleasesLayoutBetweenBatches`, `TestMaintenanceBatchDropsReachabilityAfterPublication`, `TestMaintenanceBatchSettlesUnknownCloseBeforeReentry`, `TestMaintenanceDelayedClosePublicationInvalidatesNextPage`, `TestSnapshotDeleteLayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLILayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLIRetriesBusyWithSameIdentityWithinWindow` | SnapshotRemoval BeginClean/EndClean; StaleClean r2 159-161 | STUB |
| `INV-MAINTENANCE-LIVENESS-001` | Three refusals without advancing the stuck page arm activity-held preparation for every revisit until that position advances. Its reads share the session hold cap. A waiting same-catalog publisher enters before the next batch; cancellation withdraws its mark. | M8 Running -> Running | `core/frontend/chunkstore/clean_b.go` `RemoveUnreachableAll`; `core/frontend/chunkstore/clean_admission.go`; `core/frontend/chunkstore/layout_remote.go` `beginSessionLocked` | `TestMaintenanceRepeatedPreparationPublicationFallsBackAfterThreeRefusals`, `TestMaintenanceFallbackPreparationSharesSessionCap`, `TestMaintenanceWaitingPublisherRunsBeforeNextBatch`, `TestMaintenanceCancelledPublisherWithdrawsItsMark`, `TestMaintenanceRetainPublisherPrecedesANewCleanPass`, `TestMaintenanceNestedCatalogPublishersDoNotSelfDeadlock`, `TestMaintenancePartialMultiVolumeAdmissionUnwindsOnCancellation`, `TestMaintenanceReleasedBatchContextCannotBypassANewBatch`, `TestMaintenanceCrossVolumeCallbackDoesNotWaitWhileHoldingAClean`, `TestBCatalog_OperatorSnapshotDeleteDuringACleaning` | CleanBatch r2 NoStarve / HoldCap / PubWaitOne | STUB |
| `INV-MAINTENANCE-BATCH-001` | Cleaning releases HEAD activity after min(1000 decisions, 5 s), checked between decisions. Preparation normally stays outside; re-entry validates its HEAD. Unknown close settles before cursor advancement. Busy answers are typed retryable layout_busy. | M8 Running → Running | `core/frontend/chunkstore/clean_b.go` `endCleanBatch`; `core/frontend/chunkstore/layout/remove.go` `ResetReachability` | `TestMaintenanceFiveSecondBatchLetsSnapshotDeleteFinish`, `TestMaintenanceSlowPreparationDoesNotHoldSession`, `TestMaintenanceBatchRefusesPublicationAfterPreparation`, `TestMaintenanceBatchPreparationAbsentHeadRefuses`, `TestMaintenanceLongPassReleasesLayoutBetweenBatches`, `TestMaintenanceBatchDropsReachabilityAfterPublication`, `TestMaintenanceBatchSettlesUnknownCloseBeforeReentry`, `TestMaintenanceDelayedClosePublicationInvalidatesNextPage`, `TestSnapshotDeleteLayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLILayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLIRetriesBusyWithSameIdentityWithinWindow` | SnapshotRemoval BeginClean/EndClean; StaleClean r2 159-161; r2.950(2), r2.955 | STUB |
| `INV-MAINTENANCE-LIVENESS-001` | Three refusals without advancing the stuck page arm activity-held preparation for every revisit until that position advances. Its reads share the session hold cap. A waiting same-catalog publisher enters before the next batch; cancellation withdraws its mark. | M8 Running -> Running | `core/frontend/chunkstore/clean_b.go` `RemoveUnreachableAll`; `core/frontend/chunkstore/clean_admission.go`; `core/frontend/chunkstore/layout_remote.go` `beginSessionLocked` | `TestMaintenanceRepeatedPreparationPublicationFallsBackAfterThreeRefusals`, `TestMaintenanceFallbackPreparationSharesSessionCap`, `TestMaintenanceWaitingPublisherRunsBeforeNextBatch`, `TestMaintenanceCancelledPublisherWithdrawsItsMark`, `TestMaintenanceRetainPublisherPrecedesANewCleanPass`, `TestMaintenanceNestedCatalogPublishersDoNotSelfDeadlock`, `TestMaintenancePartialMultiVolumeAdmissionUnwindsOnCancellation`, `TestMaintenanceReleasedBatchContextCannotBypassANewBatch`, `TestMaintenanceCrossVolumeCallbackDoesNotWaitWhileHoldingAClean`, `TestBCatalog_OperatorSnapshotDeleteDuringACleaning` | CleanBatch r2 NoStarve / HoldCap / PubWaitOne; r2.956 | STUB |
| `INV-MAINTENANCE-NO-PROGRESS-001` | Maintenance has no total deadline. Only a strict advance of the finite (phase, cursor) work position renews its window; requests are separately bounded. No progress for the window fails typed no_progress; cancellation joins before release and the existing cursor resumes later. | M8 Running → Armed | `core/frontend/durable/maintenance_progress.go` `maintenancePass`; `core/frontend/chunkstore/layout/remove.go` `removePlanned`; `core/frontend/chunkstore/maintenance_request.go` `maintenanceCall` | `TestMaintenanceProgressingPastOneMinuteCompletes`, `TestMaintenanceRepeatedPositionDoesNotHideAStall`, `TestMaintenanceSilentPassReturnsTypedNoProgress`, `TestCleaningReportsProcessedObjects`, `TestRealMaintenanceProgressingPastOneMinuteCompletes`, `TestRealMaintenancePreparationAndRemovalEachOutliveWindow`, `TestMaintenanceListPreparationReportsOnlyAuthenticatedPages`, `TestMaintenanceReachabilityProgressesAcrossTheWindow`, `TestMaintenanceLookupRetriesItsOwnDeadlineWithoutProgress`, `TestMaintenanceReplayedPhaseCannotRenewWindow`, `TestMaintenanceFiniteStagesCanCompleteAcrossWindow`, `TestMaintenanceTagPositionCountsCompletedWorkOnly`, `TestMaintenanceIntentCursorAdvancesAcrossPages`, `TestMaintenanceProgressStateDoesNotAllocatePerObject`, `TestMaintenanceProgressRetainedBytesStayBounded`, `TestMaintenanceFenceWithNilSettlementDoesNotCountSuccess`, `TestMaintenanceUnknownCreateKeepsLinkedUploadAndSettles`, `TestMaintenanceBlobPutDoesNotRepeatUnknownAssignment` | CutTime window rule; GRID-v11-r8 maintenance pass × wall time | STUB |
| `INV-HOST-HOLD-NO-PROGRESS-001` | A held slot is revoked only after its no-progress window passes with no reported progress of its work (a chunk compared, staged or uploaded by its cut): work that keeps progressing is never revoked, and a stalled hold is revoked within the window. | M7 admitted → draining (revoked) | `core/hostlimit/limiter.go` `Admit`, `Progress`, `expire`; `core/storage/chunk_cut_budget.go` `BudgetProgress`, `budgetProgress`; `core/storage/chunk_cut_observation.go` `progressed`; `core/storage/chunk_layer.go` `captureLocked` | `TestStalledHoldIsRevokedWithinTheWindow`, `TestProgressRenewsTheHold` (`core/hostlimit/limiter_progress_test.go`); `TestProgressRacingTheExpiryIsHonoured`, `TestProgressDoesNotWaitForTheLimiterLock`, `TestProgressStampIsMonotonicElapsed` (`core/hostlimit/limiter_review_test.go`); `TestCutReportsProgressToItsBudget` (`core/storage/chunk_cut_hold_progress_test.go`) | SlotShare (its progress-window rule; the share rule is a later change) | ACTIVE |
| `INV-HOST-FETCH-CAP-001` | A chunk fetch holds one of the host's FetchSlots across its remote read only; a limiter's first fetch checks the host configuration (ErrConfig on a mismatch). With all held it waits, never refused: unordered, bounded by its context alone. Only non-blocking tries: an ended wait leaves nothing. | M7 (fetch slots, beside the cut slots) | `core/hostlimit/fetch.go` `HoldFetch`, `checkFetchConfig`, `waitFetch`; `core/hostlimit/limiter.go` `configGuard`; `core/storage/chunk_layer.go` `fillOnce`; `core/storage/chunk_cut_budget.go` `BudgetFetch` | `TestHoldFetchTakesAFreeSlotAtOnce`, `TestHoldFetchCapHoldsAcrossLimiters`, `TestHoldFetchAWaiterThatGivesUpLeavesNoSlotHeld`, `TestHoldFetchTakesAnotherSlotThatFreesFirst` (`core/hostlimit/fetch_test.go`); `TestHoldFetchFirstFetchChecksTheHostConfiguration`, `TestHoldFetchSlotDiesWithItsProcess`, `TestHoldFetchEndedWaitsLeaveNothingBehind`, `TestHoldFetchCancelledAtTheHandoffHoldsNothing`, `TestHoldFetchAPassedWaiterEndsByItsDeadline` (`core/hostlimit/fetch_review_test.go`); `TestChunkFetchHoldsAHostSlotAroundItsRemoteRead` (`core/storage/chunk_fetch_cap_test.go`) | — (a resource cap with no state of its own) | ACTIVE |
@@ -1215,7 +1215,7 @@ Notes:
| `INV-CLI-DELETE-RETRY-001` | Only the final lease barrier after a committed volume-delete reservation permits retryable true/exit 75 at its horizon. A live-holder Reserve refusal requires stopping the volume first (not_admitted, non-retryable, exit 1). No lease guard is bypassed. | M9 delete admission result projection | `cmd/sw-block/chunk_volume_delete.go` `authorityErr`; `cmd/sw-block/chunk.go` `chunkResult` | `TestVolumeDeleteAdmissionRetryAnswer`; `TestOpsChunkVolumeDeleteRefusalSaysNothingWasPersisted` | MoveAdmission.DelRead; MoveAdmission.DelMark (unchanged guards) | STUB |
| `INV-SNAPSHOT-REPLAY-FLAG-001` | A successful same-ID snapshot admission reports replayed true without changing HEAD or its retained outcome. First creation reports false; the flag decorates only the response. | M9 snapshot outcome projection | `core/host/volume/snapshot_operation.go`, `chunk_control.go`; `cmd/sw-block/snapshot_operation.go` | `TestSnapshotReplayFlagDoesNotRewriteOutcome`, `TestSnapshotCLIUsesReplayedAdmissionAnswer` | SnapOps.Poll; SnapOps.Start (no transition change) | STUB |
| `INV-CLI-UNSENT-REQUEST-001` | An observed operation's initial typed dial failure sends no admission and is remote_unavailable (75) through the shared classifier. A lost answer after send, or a dial failure while polling an admitted handle, retains outcome_unknown. | CLI pre-admission error projection; no server transition | `cmd/sw-block/cut_progress_poll.go` `chunkObserveHandle`; `chunkTransportFailure`, `chunkFail` | `TestPlainDetachRefusedDialIsRemoteUnavailable`, `TestPlainDetachLostAnswerAfterSendStaysUnknown`, `TestPlainDetachPollDialFailureKeepsAdmittedOutcomeUnknown`, `TestOpsChunk_ErrorsAreJSONOnStdout` | CutTime Poll/CliGiveUp boundary; pre-admission transport proof | ACTIVE |
| `INV-CLI-CATALOG-ERROR-001` | The chunk CLI reports filer/master transport failures as retryable remote_unavailable (exit 75), including census, dial, resolve and read failures; configuration refusals stay distinct. An absent v1.1 delete reports snapshot_not_found; its not_found receipt stays unchanged. | M9 client error projection; M4 census refusal, no transition change | `cmd/sw-block/chunk_transport.go` `chunkTransportFailure`; `cmd/sw-block/chunk.go` `chunkResult`; `cmd/sw-block/catalog_snapshot_operation.go` `catalogSnapshotDeleteRefusal`; `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `core/frontend/chunkstore/layout/delete.go` `RunMarkDeleting` | `TestOpsChunkTransportFailureMatrix`, `TestOpsChunkVerifyUnreachableCensusPreservesTransport`, `TestCheckSingleFilerKeepsTransportCause`, `TestSingleFilerConfigurationErrorDeadlineBetweenReads`, `TestCheckSingleFilerSlowDialOrdering`, `TestDialBCatalogKeepsCustomCallerDeadline`, `TestMasterCensusKeepsCustomCallerDeadline`, `TestCheckSingleFilerValidatesAllMasterAddressesBeforeCensus`; `TestOpsChunkCatalogUnavailableIsTyped`, `TestCatalogTransportClassificationKeepsDefiniteAnswers`, `TestSnapshotDeleteAbsentCLIUsesContractCodeAndKeepsReceipt` | SnapOps.Poll | STUB |
| `INV-CLI-CATALOG-ERROR-001` | The chunk CLI reports filer/master transport failures as retryable remote_unavailable (exit 75), including census, dial, resolve and read failures; configuration refusals stay distinct. An absent v1.1 delete reports snapshot_not_found; its not_found receipt stays unchanged. | M9 client error projection; M4 census refusal, no transition change | `cmd/sw-block/chunk_transport.go` `chunkTransportFailure`; `cmd/sw-block/chunk.go` `chunkResult`; `cmd/sw-block/catalog_snapshot_operation.go` `catalogSnapshotDeleteRefusal`; `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `core/frontend/chunkstore/layout/delete.go` `RunMarkDeleting` | `TestOpsChunkTransportFailureMatrix`, `TestOpsChunkVerifyUnreachableCensusPreservesTransport`, `TestCheckSingleFilerKeepsTransportCause`, `TestSingleFilerConfigurationErrorDeadlineBetweenReads`, `TestCheckSingleFilerSlowDialOrdering`, `TestDialBCatalogKeepsCustomCallerDeadline`, `TestMasterCensusKeepsCustomCallerDeadline`, `TestCheckSingleFilerValidatesAllMasterAddressesBeforeCensus`; `TestOpsChunkCatalogUnavailableIsTyped`, `TestCatalogTransportClassificationKeepsDefiniteAnswers`, `TestSnapshotDeleteAbsentCLIUsesContractCodeAndKeepsReceipt` | SnapOps.Poll; r2.972 | STUB |
| `INV-CLI-CHUNK-LOOP-001` | Above the per-request bound, sw-block ops chunk snapshot\|detach repeats the SAME request (same name and request id) only after a retryable or outcome_unknown answer. Manual cut and plain detach use the separate one-POST/read-only-poll contract. | client (no state machine): the CLI side of M5 requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkSnapshotRepeatsTimedOutRequestsWithTheSameBody`, `TestChunkSnapshotLoopReusesTheGeneratedRequestID`, `TestChunkLoopRepeatsAnOutcomeUnknownNotMarkedRetryable` (`cmd/sw-block`) | — | ACTIVE |
| `INV-CLI-CHUNK-LOOP-002` | Above the per-request bound, sw-block ops chunk snapshot\|detach stops at the first definite answer (success or non-retryable refusal). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopStopsOnANonRetryableRefusal`, `TestChunkDetachOutcomeUnknownSettles` (`cmd/sw-block`) | — | ACTIVE |
| `INV-CLI-CHUNK-LOOP-003` | Non-plain detach and snapshot admission obey a positive total --timeout. Snapshot observation keeps the same ID with bounded calls and no total deadline. Manual cut and plain detach use the separate inactivity-window contract. | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkLoopEndsAtTheTimeout`, `TestChunkLoopHeldProgressReadSendsNoRequestAfterTheTimeout`, `TestChunkLoopSlowAnswersAreBoundedByTheTimeout`, `TestChunkNonPositiveTimeoutIsRefused` (`cmd/sw-block`) | — | ACTIVE |
@@ -1529,7 +1529,7 @@ One row per wait in the data and control paths. Guest-visible rows on one path m
| Site | Waits for | Bound | Owner that ends it | On expiry | Lock held while waiting | Guest-visible |
|---|---|---|---|---|---|---|
| `cmd/blockvolume/store_admission.go` `readReplicaStore` (from `runVolume`, before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | none while blockmaster gives no reply (`volume.MasterCallClass`); each read `replicaStoreQueryTimeout` (10 s), reads `replicaStoreRetryEvery` (2 s) apart | the master's answer, or a signal (`processExit.parent`) | none: an answer goes to `decideStoreAdmission` (an unreadable record exits 75 `store_record_unreadable`), nothing written while waiting | none | no (no frontend has started) |
| `cmd/blockvolume/main.go` `runVolume`, `Host.ReplicaStoreRecord` (one call before the durable open of a plain walstore holder) | the master's `GetReplicaStore` answer | `replicaStoreQueryTimeout` (10 s) | the call's own context | exit 75 `store_record_unreadable`, nothing written; the supervisor restarts the unit | none | no (no frontend has started) |
| `core/storage/chunk_publish_settled.go` `runPublishSettled` (from `unlockCap`, on the cut or detach caller's goroutine) | the `OnPublishSettled` hook to return | the hook's duration: the hook must return without blocking and without remote calls, enqueueing its work to its own worker | the hook implementer | none: a stalled hook stalls its caller, and later reports queue without a bound (a nil hook queues nothing) | none (`capMu` and `stMu` released) | yes on detach (the detach caller delivers before returning) |
| `cmd/blockvolume/frontend_gate.go` `awaitFrontendStart` (from `runVolume`, before any frontend starts) | the backend's first admitted I/O (`StorageBackend.FirstServing`), or the process's stop waiter returning | none of its own: it ends on the stop waiter, which INV-WS-STARTUP-RETRY-001 bounds (a refused or timed-out claim latches exit 75/78) | `runVolume` (`INV-FE-PRIMARY-READY-OPERATIONAL-001`) | no frontend starts; shutdown as after the frontends | none | no (no target listens yet) |
| `cmd/blockvolume/frontend_gate.go` `firstAdmitted` (one goroutine from `runVolume`, workspace chunk primaries only) | the backend's first admitted I/O (`FirstServing`), then `AdmitsIO` passing, re-checked every 50 ms (the backend has no projection-change signal) | until first served or the process outcome (`e.done`), whichever comes first | the process exit owner (`superviseProcess`) through `e.done` | none: it ends without starting the frontends | none | no (no target listens yet) |
@@ -5,7 +5,7 @@ the common admission callback sampled `s.wal`, the legacy writer. V3 appends go
to `s.v3.w`, so the inactive legacy occupancy stayed zero. A real provider and
NVMe handler writing 128 KiB requests with Flush every 48 MiB hit WRITE
InternalError / WAL region full at 66,977,792 submitted bytes. The same schedule
reproduced on root WSL and as non-root on a Linux lab host. The preceding Flush and a direct Sync
reproduced on root WSL and non-root tp04. The preceding Flush and a direct Sync
after the failed Write succeeded. This does not establish the cause of the
reported guest SyncAll EIO; a host fsync error is not by itself an observed
backend Sync error.
+4 -4
View File
@@ -398,11 +398,11 @@ Example healthy shape:
```text
volume pvc-... status=ok rf=3 ack=sync-quorum
pvc default/mysql-data
primary r1 on node-a frontend=192.168.1.181:3260
primary r1 on m01 frontend=192.168.1.181:3260
replicas desired=3 observed=3
r1 node-a primary ready durable_lsn=44
r2 node-b replica_ready candidate_ready=true durable_lsn=44
r3 node-c replica_ready candidate_ready=true durable_lsn=44
r1 m01 primary ready durable_lsn=44
r2 m02 replica_ready candidate_ready=true durable_lsn=44
r3 tp01 replica_ready candidate_ready=true durable_lsn=44
next action: none
```
+1 -1
View File
@@ -171,7 +171,7 @@ as placeholders:
```bash
NODES=$(awk '/^blockNodes:/{f=1; next} f && /^[^ -]/{f=0} f && /^ *- name:/{print $3}' values.day1.yaml)
echo $NODES # your node names, for example node-a node-b node-c
echo $NODES # your node names, for example az1-c4a az1-c4b az1-c4c
bash scripts/k8s-alpha-certs.sh kube-system ~/.sw-block-alpha-tls $NODES
```
+1 -1
View File
@@ -355,7 +355,7 @@ normalization only. Those are prior author runs, not a claim that this PR reran
TLC. This is an abstraction: physical fsync success, byte layout, crash recovery,
both-slot retirement, timing and multiple writers remain covered by their other
models and actual Go controls. Do not treat finite liveness checking as an
end-to-end wall-clock latency guarantee. Keep long model runs off the shared CI runner.
end-to-end wall-clock latency guarantee. Keep long model runs off tp04.
## HostBudget
@@ -1,4 +1,4 @@
CutTime r8b (a lost publish answer settled by read-back; detach: preempt a scheduled cut, wait behind a manual one; the poll handle): U = 2 per-object steps, W = 3 window steps, P = 2 per-call deadline, MaxAtt = 2; mutants' total bound CapT = 4; total capped at TCap = 4; DL = 0 (none) or 3 (deadline rows); Prompt = TRUE with Wc = 4 unless stated; every row starts with no other cut, a running scheduled cut, or a running manual cut; Kind = cut unless stated; K = 2
CutTime r8b (a lost publish answer settled by read-back; r2.942; detach: preempt a scheduled cut, wait behind a manual one; r2.939, r2.938; the poll handle; r2.931, r2.929): U = 2 per-object steps, W = 3 window steps, P = 2 per-call deadline, MaxAtt = 2; mutants' total bound CapT = 4; total capped at TCap = 4; DL = 0 (none) or 3 (deadline rows); Prompt = TRUE with Wc = 4 unless stated; every row starts with no other cut, a running scheduled cut, or a running manual cut; Kind = cut unless stated; K = 2
safe_cut OK (NoEarlyFail, NoSilentStall, NoLongCall, ProgressKept, CliNoEarlyExit, CliNoSilentWait, CliUnknownOnlySilent, NoQueuedStall, BusyOnlyWhenHeld, CliBusyNotOwn, NoManualPreempt, NoFalseFailure)
safe_cut_deadline OK (the same rules, with the user's absolute deadline DL = 3)
safe_detach OK (the same rules, Kind = detach: preempts a scheduled cut, waits behind a manual one)
+11
View File
@@ -37,6 +37,10 @@ Public-facing docs belong in `docs/`.
| `finished-plans/` | Closed phase/topic plans retained for PM history. |
| `ref/product-spec-gate-template.md` | Cold spec-gate template for product semantics, non-negotiables, allowed simplifications, and drift checks. |
| `ref/stage2-transparent-multipath-host-failover-spec.md` | Stage 2 product spec for iSCSI ALUA/dm-multipath Kubernetes host-path failover without pod recreate. |
| `ref/node-loss-survival-mvp-spec.md` | Node-loss survival product spec: RF3 sync-quorum recovery across distinct Kubernetes nodes with non-loopback frontends. |
| `ref/node-loss-lab-setup.md` | Lab setup note for the Node-Loss D3/D4 gates, including 3 Kubernetes nodes on 2 physical machines and physical-host disclosure. |
| `ref/control-plane-observation-api-mvp.md` | Dashboard-grade read-only observation API spec: cluster status, volume timeline, event stream, and support-bundle UX. |
| `finished-plans/phase1_finishedplan_frontend_protocol_readiness.md` | Historical iSCSI/NVMe protocol-readiness plan closed by the protocol release gate. |
| `finished-plans/phase2_finishedplan_beta_hardening_seed.md` | Historical beta hardening seed plan. |
| `finished-plans/phase3_finishedplan_beta_seed_stabilization.md` | Historical beta seed stabilization plan. |
| `finished-plans/phase4_finishedplan_fast_gates_operations_contract_prep.md` | Historical fast-gates and operations contract prep plan. |
@@ -44,6 +48,8 @@ Public-facing docs belong in `docs/`.
| `finished-plans/phase6_finishedplan_iscsi_os_initiator_compatibility.md` | Historical iSCSI OS initiator compatibility plan closed by Linux and Windows validation. |
| `finished-plans/phase7_finishedplan_iscsi_session_backend_pressure.md` | Historical iSCSI session/backend pressure plan closed by fast protocol, L2 restart, and Linux OS initiator gates. |
| `finished-plans/phase8_finishedplan_main_merge_pr_readiness.md` | Historical main-merge readiness plan closed by PR #46 squash merge. |
| `finished-plans/phase9_finishedplan_light_use_operations_mvp.md` | Historical light-use operations MVP plan closed by local CLI, bundle, and TestOps control-data validation. |
| `finished-plans/phase10_finishedplan_light_use_install_lifecycle_operations_mvp.md` | Historical light-use install/lifecycle operations MVP plan closed by strict first-volume runbook and scenario validation. |
| `finished-plans/phase11_finishedplan_cluster_ops_inventory_lifecycle_visibility_mvp.md` | Historical cluster operations inventory and lifecycle visibility MVP plan closed by strict multi-volume inventory validation. |
| `finished-plans/phase12_finishedplan_product_owned_blockvolume_lifecycle_mvp.md` | Historical product-owned blockvolume lifecycle MVP plan closed by lifecycle ownership and scoped delete validation. |
| `finished-plans/phase13_finishedplan_durable_volume_restart_reattach_mvp.md` | Historical durable volume restart/reattach MVP plan closed by RF=1 durable hostPath restart gates. |
@@ -51,8 +57,13 @@ Public-facing docs belong in `docs/`.
| `finished-plans/phase15_finishedplan_basic_mounted_failover_and_reattach_mvp.md` | Historical RF=2 mounted app baseline plus controlled primary-failure safe-refusal plan. |
| `finished-plans/phase16_finishedplan_stage1_mounted_recovery_ack_profile_mvp.md` | Historical Stage 1 mounted recovery ACK profile plan: RF=2 best-effort demo recovery and RF=3 sync-quorum beta recovery through CSI/pod recreate. |
| `finished-plans/phase17_finishedplan_stage2_transparent_multipath_host_failover_mvp.md` | Historical Stage 2 transparent mounted failover plan: RF=3 sync-quorum iSCSI ALUA/dm-multipath recovery without pod recreate. |
| `finished-plans/phase18_finishedplan_node_loss_survival_mvp.md` | Historical Node-Loss Survival plan: RF=3 sync-quorum Kubernetes-node-loss recovery through CSI/pod recreate on a surviving node. |
| `finished-plans/phase19_finishedplan_control_plane_observation_ai_readable_ops_mvp.md` | Historical Control-Plane Observation plan: read-only master evidence API, AI-readable CLI export, product-owned event stream, and support-bundle evidence. |
| `finished-plans/phase20_finishedplan_activation_day1_ops_mvp.md` | Historical Activation / Day-1 Ops plan: script-based v0.2 alpha install, first PVC, writer/reader checksum, read-only report, release note, and cleanup evidence. |
| `ref/production-readiness-plan.md` | Longer readiness reference and iSCSI P1-P6 detail. |
| `ref/light-use-block-storage-ux-research.md` | Comparison of Longhorn, OpenEBS, Rook/Ceph, Piraeus/LINSTOR, and EBS CSI light-user install/operations UX. |
| `ref/blockvolume-lifecycle-ownership-contract.md` | Product-owned generated blockvolume workload lifecycle ownership contract for the current plan. |
| `ref/iscsi-os-initiator-compat-plan.md` | Detailed iSCSI P1 OS-initiator compatibility plan and evidence. |
| `ref/iscsi-v2-coverage-gap-audit.md` | V2-to-V3 iSCSI coverage gap audit and prioritized test backlog. |
| `ref/v2-frontend-protocol-gap-audit.md` | Broader V2 frontend protocol feature gap audit. |
@@ -0,0 +1,411 @@
# Finished Plan: Light-Use Install And Lifecycle Operations MVP
Status: finished. Strict QA close passed at product commit `fe0de8d`.
Opened after closing
`finished-plans/phase9_finishedplan_light_use_operations_mvp.md`.
## Product Question
Can an early developer use Seaweed Block as a basic Kubernetes block product
without reading internal scripts, and can they diagnose the first failure with
one product-owned status bundle?
The previous plan proved the observe/report/coordinate loop. This plan must
prove the user-facing operational loop:
```text
install/launch -> create PVC -> attach app pod -> write/read -> delete ->
verify cleanup -> collect status bundle on failure
```
If this plan closes, the claim is still narrow:
```text
Single-node Kubernetes light-use path: a user can install/launch the alpha
stack, create one PVC, run app write/read, delete resources, and verify cleanup
with a documented command path and TestOps gate.
```
It is not a production HA, performance, upgrade, multi-node, or operator-grade
claim.
## Current Honest State
What already works in separate gates:
- CSI dynamic PVC create/delete works.
- iSCSI and NVMe protocol paths are release-gated.
- App write/read through PVC exists in the K8s demo path.
- Linux and Windows OS iSCSI initiator compatibility have evidence.
- `sw-block ops status` can produce a self-describing bundle for one volume.
- TestOps can coordinate shared-lab runs with active/history records and locks.
What is still weak for a light-use product:
- The user path is scattered across docs, alpha scripts, TestOps scenarios, and
QA reports.
- Cleanup is partly product behavior and partly harness discipline.
- There is no single user-facing "first volume" claim with one fresh-run gate.
- Failure diagnosis is not yet stitched into the first-volume workflow.
## Research Baseline
See `ref/light-use-block-storage-ux-research.md`.
The useful comparison set is Longhorn, OpenEBS, Rook/Ceph, Piraeus/LINSTOR, and
EKS EBS CSI. The common light-user shape is:
```text
preflight -> install -> wait/verify components -> create StorageClass/PVC ->
create app -> verify bound/running/I/O -> inspect status -> teardown ->
collect support data on failure
```
Design rules for this plan:
- Pick one default path first: iSCSI + `walstore` + single-node k3s.
- Add preflight checks before install instead of discovering missing host
dependencies late.
- Verify every boundary, not just final PASS: pods, StorageClass, PVC,
generated `blockvolume`, app checksum, status bundle, cleanup.
- Treat `sw-block ops status` as the support-bundle step for failures after
volume identity exists.
- Keep cleanup attribution explicit: product/Kubernetes cleanup vs TestOps
guardrail cleanup.
- Do not start a UI/dashboard in this plan; stabilize CLI/runbook/status
contracts first.
## Target User Experience
An early user should be able to:
1. Start from a fresh checkout or released artifact on the supported lab shape.
2. Run one documented launch/install path.
3. Apply or generate a StorageClass/PVC and an app pod.
4. Observe the PVC becoming usable.
5. Write data, replace the app pod, and read the data back.
6. Delete the app/PVC resources.
7. Verify no obvious product or host residue remains.
8. If the flow fails, run or receive a status bundle that explains what was
checked, what was unchecked, and what artifacts to attach.
## Scope
In scope:
- Refresh the first-volume quickstart/runbook around the actual supported path.
- Make the claimed path executable by a TestOps scenario.
- Separate product-owned lifecycle behavior from TestOps-only cleanup.
- Add or tighten fast tests for any new parser, wrapper, or artifact contract.
- Keep the operations status bundle wired into the failure path.
- Add QA assignment for adversarial user-path validation.
Out of scope:
- Full Kubernetes operator/controller.
- Upgrade/uninstall story.
- Multi-node attach.
- HA failover claim for this user path.
- Performance/SLO claim.
- UI/dashboard.
- Mutating repair/admin controls.
## Top Blocking Issues
### P0: First-Volume Path Must Be One Coherent User Story
Today the pieces exist, but the user story is fragmented.
Close requirement: one runbook and one scenario prove the same flow.
### P0: Lifecycle Cleanup Must Be Attributed Correctly
The plan must not hide script-owned cleanup behind a product claim.
Close requirement: the final evidence explicitly marks which cleanup happened
because Kubernetes/product ownership worked and which cleanup was TestOps
guardrail cleanup.
### P0: Failure Bundle Must Be Attached To The User Path
The previous plan built `sw-block ops status`; this plan must show where it fits
when the first-volume path fails.
Close requirement: the TestOps scenario captures the relevant status/support
artifacts on failure or records why they are unavailable.
### P1: Keep Integration Time Under Control
The scenario may use M01/M02 or k3s, but most logic should be component-tested.
Close requirement: new code has fast tests; long integration is reserved for
the end-to-end user claim.
## Deliverables
### D1: First-Volume Runbook
Status: draft attached in `docs/quickstart-kubernetes.md`; dev-run validated
through hardened `light-use-first-volume-chain` at run
`20260511-200544-dca5`. Still needs QA new-user review before final close.
Update or add a concise runbook that answers:
- preflight checks,
- prerequisites,
- exact launch/install command path,
- exact app/PVC path,
- boundary verification commands after install/PVC/app/cleanup,
- expected success line,
- expected cleanup result,
- how to collect `sw-block ops status` artifacts,
- non-claims.
Preferred source to refresh first: `docs/quickstart-kubernetes.md`.
### D2: Runner-Native First-Volume Scenario
Status: initial scenario attached as
`testops/scenarios/light-use-first-volume-chain.yaml`.
Dev validation:
```text
run_id: 20260511-200544-dca5
result: PASS
wall: 3m30s
actions: 35/35 passed
host: m02
```
The scenario proved runnable structured preflight, alpha image build/import,
documented `run-k8s-demo.sh`, writer checksum, reader replacement checksum,
generated iSCSI blockvolume manifest, no active iSCSI session after delete,
line-level cleanup attribution, and final process/session assertions.
Add a TestOps scenario for the same user path.
Expected scenario shape:
```text
pre_clean
pin_or_verify_build
install_or_launch
create_pvc_and_app
verify_write_read
delete_and_verify_cleanup
collect_ops_bundle_on_failure
collect_and_cleanup(always)
```
The scenario should emit normal result/status bundles and participate in the
shared control-data lock model.
### D3: Product-vs-Harness Cleanup Evidence
Status: line-level attribution script attached as
`scripts/summarize-alpha-demo-cleanup.sh`; scenario now uses it. Dev run found
the important boundary: active iSCSI sessions are removed by the demo flow, but
an iSCSI node database entry can remain until TestOps guardrail cleanup deletes
it. That is recorded as guardrail cleanup, not product-owned cleanup.
The artifact bundle should include a short cleanup summary:
- Kubernetes resources deleted by normal owner references,
- iSCSI/NVMe host residue check,
- generated blockvolume deployment/state residue check,
- TestOps cleanup actions, if any,
- non-claims.
### D4: Failure Diagnosis Hook
Status: controlled failure-bundle path attached as
`testops/scenarios/light-use-first-volume-failure-bundle-chain.yaml`.
Dev validation:
```text
run_id: 20260511-202259-86e9
result: PASS
wall: 1m05s
actions: 38/38 passed
host: m02
```
The chain stops the first-volume demo after the generated blockvolume target is
ready, collects `sw-block ops status` while the target is still live, verifies
`ops-status-bundle.json` and `volume-status-summary.txt`, then proves cleanup in
both normal and always-phase assertions. The collected bundle may be
`status=unhealthy` at this stop point because the writer has not completed yet;
that is expected and still useful diagnostic evidence.
When the first-volume flow fails after a volume identity is known, capture the
operations status bundle or a clear explanation:
```text
ops-status-unavailable: no volume id reached
ops-status-collected: <path>
```
### D5: Fast Gates And Review
Use TDD for new parsing/wrapper/status logic:
- component tests for artifact summary parsing,
- component tests for cleanup-attribution summary,
- validate scenario YAML,
- internal review agent before merge if code changes are non-trivial.
### D6: Retry / Idempotency Gate
Status: attached as
`testops/scenarios/light-use-first-volume-retry-chain.yaml`.
Dev validation:
```text
run_id: 20260511-204348-ccc4
result: PASS
wall: 4m10s
actions: 43/43 passed
host: m02
```
The chain starts from a verified clean state, intentionally stops the
first-volume demo after the generated blockvolume is ready, keeps the PVC and
generated blockvolume Deployment in place, runs the documented uninstall path,
proves those stale resources are gone, and then reruns the normal first-volume
demo successfully with writer and reader checksum evidence.
The user-facing uninstall path now deletes the demo PVC-scoped generated
blockvolume by volume label. Broad `app=sw-blockvolume` deletion is only enabled
when TestOps sets `SW_BLOCK_UNINSTALL_DELETE_ALL_BLOCKVOLUMES=1`, so broad lab
guardrails stay separate from user cleanup.
### D7: QA Close Assignment
Ask QA to validate as a new user, not just as an executor:
- run the documented path from a clean state,
- run the runner-native scenario,
- inspect the cleanup attribution,
- intentionally break one prerequisite and confirm the failure bundle is useful,
- report any confusing step or over-claim.
### D8: Adversarial Break-Class Gate
Status: attached as
`testops/scenarios/light-use-first-volume-breaks-chain.yaml`.
Dev validation:
```text
run_id: 20260511-210727-5cb9
result: PASS
wall: 3m57s
actions: 36/36 passed
host: m02
```
This chain covers the three HG-10 fixtures:
- forced missing `iscsiadm` preflight, with remediation text;
- unpullable product image, with `ops-status-unavailable: no volume id reached`
and `no-such-tag` image evidence;
- mid-app attach failure by deleting the generated blockvolume via the
generated volume label, with a collected `sw-block ops status` bundle showing
status endpoint connection refusal and no host residue.
The scenario also validates final cleanup and uses scoped generated-volume
deletion for the attach break instead of broad `app=sw-blockvolume` sweeps.
### D9: Manual Runbook / Scenario Consistency
Status: QA PASS at product commit `ec76385`.
QA ran the documented runbook manually and the runner-native
`light-use-first-volume-chain` back-to-back on m02:
```text
manual run: sw-block-app-demo-20260512T055732Z
scenario run: 20260511-225935-0ff4
result: PASS / PASS
```
The demo artifact file list was identical inside the artifact directory. The
final PASS line was byte-identical, writer and reader checksums matched, and
the only functional differences were run id, timestamp, PVC UUID, and I/O
timing noise. QA found one documented residue boundary: manual uninstall can
leave non-active iSCSI node database entries or `/var/lib/sw-block/` clean-lab
state, while TestOps guardrails attribute and remove that residue.
## Gates To Close
This plan closes only when:
1. The first-volume runbook is accurate from a fresh supported lab state.
2. A runner-native scenario proves the same flow.
3. The app write/read and pod replacement check pass.
4. Delete/cleanup evidence is explicit and attributed.
5. The operations status bundle is captured on failure, or the bundle explains
why no volume identity existed yet.
6. Fast tests cover new logic.
7. QA validates the user experience independently and reports no blocking
usability issue.
## Success Statement
After this plan, Seaweed Block can make a narrow light-use product claim:
```text
On the supported single-node Kubernetes lab shape, an early user can follow one
documented path to launch the alpha stack, create and use one block-backed PVC,
delete it, verify cleanup, and collect a useful support bundle if it fails.
```
That is the bridge from "our tests pass" to "a user can try the product."
## Close Report
Formal QA close report:
`internal/docs/qa-assignments/light-use-mvp-close-report.md`.
QA verdict:
```text
PASS
```
Close evidence:
- Happy path: `20260511-200544-dca5`.
- Failure bundle: `20260511-203619-885f`.
- Retry/idempotency: `20260511-204348-ccc4`.
- Break classes: `20260511-210727-5cb9`.
- Manual runbook: `sw-block-app-demo-20260512T055732Z`.
- Scenario consistency run: `20260511-225935-0ff4`.
Initial QA cleared all HG-0 through HG-12 clauses. A later strict reading found
three gaps; dev addressed them and QA revalidated them as strict PASS:
- HG-2: `docs/quickstart-kubernetes.md` now verifies
`apply-k8s-alpha-blockvolumes.sh` with an explicit generated Deployment
readiness command and expected `1/1` output.
- HG-4: `docs/quickstart-kubernetes.md` now includes per-boundary commands and
expected lines for CSI controller, CSI node, StorageClass, PVC, generated
Deployment, writer, reader, delete, and iSCSI residue.
- HG-9: `testops/scenarios/light-use-first-volume-retry-chain.yaml` now has a
named `rerun_after_success_no_cleanup` phase for "successful run, run again
immediately".
Strict close revalidation:
```text
run_id: 20260512-005836-0998
result: PASS
phases: 9/9
actions: 50/50
```
QA re-issued the close report as `PASS (strict)`.
@@ -0,0 +1,78 @@
# Phase 121 Finished Plan: Data-Plane Address Capability
Status: closed, QA PASS on 2026-07-02.
## Problem
Phase 120 measured NVMe/TCP through the default Kubernetes InternalIP path,
which in the lab resolves to management LAN addresses such as
`192.168.1.181:4420`. That is valid functional evidence, but it is not a
100GbE performance baseline and must not be confused with RoCE/NVMe-RDMA.
## What Changed
- `sw-block ops generate-helm-values` can now accept:
```text
--frontend-ip-map m01=10.0.0.181,m02=10.0.0.184,tp01=10.0.0.188
--frontend-network-class 100gbe_tcp
```
- Helm values now carry optional `managementIP`, `frontendIP`, and
`frontendNetworkClass` per block node.
- The chart renders:
```text
data_addr = frontendIP:dataPort
ctrl_addr = internalIP:controlPort
labels:
sw-block.seaweedfs.com/management-ip
sw-block.seaweedfs.com/frontend-ip
sw-block.seaweedfs.com/frontend-network-class
```
- Master observation, operator-snapshot, and `SwBlockCluster.status.nodes[]`
preserve `internalIP` as management evidence while optionally surfacing
`frontendIP` and `frontendNetworkClass`.
- CRD and values schema were updated so the new status/config fields are not
pruned by Kubernetes schema validation.
## Verification
Source/local checks:
```text
go test ./core/host/master ./core/lifecycle ./core/ops ./cmd/sw-block
helm lint charts/seaweed-block
helm template ... frontendIP=10.0.0.181 ...
```
Phase gate:
```text
phase121_data_plane_address_capability_status=ok
management_ip_m01=192.168.1.181
publish_target_ip_m01=10.0.0.181
publish_target_network_class=100gbe_tcp
publish_target_source=configured_data_plane
frontend_transport=tcp
nvme_rdma_supported=false
roce_claim_allowed=false
internal_ip_not_reused_as_performance_target=true
cleanup_status=ok
```
QA sign-off:
```text
internal/docs/qa-assignments/phase121-data-plane-address-capability-qa-signoff.md
```
## Non-Claims
Phase 121 does not implement NVMe/RDMA, RoCE I/O, GPU Direct, NIXL, cufile,
cuObject, performance SLOs, broad host compatibility, or a live throughput
baseline. It only makes the address/capability model explicit enough for the
next live 100GbE NVMe/TCP baseline.
@@ -0,0 +1,630 @@
# Current Plan: Node-Loss Survival MVP
Status: active, opened after closing
`finished-plans/phase17_finishedplan_stage2_transparent_multipath_host_failover_mvp.md`,
96% complete. D1 cold product spec and D2 strict QA hard gate are drafted. D3
topology eligibility and D4 conservative node-loss recovery scenarios are
authored. The lab has been expanded to three Ready Kubernetes nodes (`m02`
control-plane plus `m01` and `tp01` workers), the node-loss preflight passes,
and QA has now passed the D4 RF3 sync-quorum node-loss recovery gate through
CSI/pod recreate after the inventory attribution and image-import fixes:
- `ref/node-loss-survival-mvp-spec.md`
- `ref/node-loss-lab-setup.md`
- `qa-assignments/node-loss-survival-mvp-close-hard-gate.md`
QA needed now: formal close report against
`qa-assignments/node-loss-survival-mvp-close-hard-gate.md`.
## Product Question
Can a Kubernetes user lose the node that hosts the active Seaweed Block primary
and still recover the same PVC data through a documented path, with evidence
that authority moved safely, stale paths were fenced, and the data check used a
surviving replica on another node?
Stage 2 proved:
```text
same physical node
-> multiple logical replicas
-> iSCSI ALUA + dm-multipath
-> primary blockvolume pod stop
-> same mounted writer pod survives without recreate
```
This plan must move to the user-visible HA question:
```text
primary Kubernetes node becomes unavailable
-> surviving replica on another Kubernetes node is promoted
-> workload recovers through the declared mechanism
-> same PVC data verifies
```
## Product Position
This plan serves `ref/product-positioning-v1.md`: mature block storage cannot
stop at same-node process failover. A credible Kubernetes block product must
name what happens when a node fails.
The value is not "the master selected a different replica." The value is:
```text
an operator can run a documented RF3 sync-quorum Kubernetes path, inject primary
node loss, and see the PVC recover with support-bundle evidence for placement,
authority, CSI target movement, stale-primary fencing, and data integrity.
```
## Scope Decision
First close uses the conservative recovery mechanism:
```text
CSI / pod recreate reattach
```
Reason:
- It isolates the new problem: real multi-node placement and non-loopback
target selection.
- Stage 2 already proved transparent multipath on one physical node; combining
real node loss and transparent multipath immediately would mix too many
failure axes.
- Users still get a valuable claim: PVC data recovers after primary node loss,
with no manual promote/repair.
Transparent multipath node-loss is a later gate or follow-up plan:
```text
same mounted pod -> primary node loss -> host multipath switches to surviving node
```
Lab topology precision:
- The D3/D4 MVP may run on three Kubernetes nodes spread across two physical
machines if the artifacts disclose the physical-host shape.
- That is a Kubernetes-node-loss proof, not a full physical-host-loss proof.
- The stronger physical-host-loss claim requires the failed primary and all
surviving promotion candidates to be on distinct physical fault domains, and
must be gated separately before external positioning uses that wording.
## Target Claim
Narrow beta-facing claim after close:
```text
For the documented RF3 sync-quorum Kubernetes topology with non-loopback
frontends, Seaweed Block can recover a PVC after controlled primary-node loss
through CSI/pod recreate reattach, and the support bundle proves authority
movement, surviving-node target selection, stale-primary fencing, and data
integrity.
```
## Explicit Non-Claims
- No transparent mounted I/O continuation under node loss in the first close.
- No NVMe ANA node-loss claim.
- No Windows MPIO claim.
- No broad multi-distro compatibility claim.
- No RTO/RPO/SLO claim beyond bounded gate timings.
- No automatic rebuild, reintegration, or failback claim.
- No arbitrary multi-failure or network-partition tolerance unless a later gate
explicitly proves it.
- No production HA claim outside the documented lab topology.
- No full physical-host-loss claim when multiple Kubernetes nodes share one
physical machine; that topology is an intermediate Kubernetes-node-loss lab.
## D1: Topology And Placement Audit
Audit before code:
- Does the active TestOps/k3s lab have at least two schedulable Kubernetes
nodes?
- How does `blockmaster` cluster-spec name physical nodes and server IDs?
- Can launcher place RF3 replicas across distinct Kubernetes nodes today?
- Can generated `blockvolume` frontends use non-loopback addresses reachable
from CSI nodes?
- Does CSI publish lookup select a frontend reachable from the consuming node?
- Can inventory prove replica -> server -> Kubernetes node -> frontend mapping?
- What should count as controlled node failure in the lab: cordon/drain,
kubelet stop, node network isolation, or deleting the node's blockvolume pods?
Exit criteria:
- update this plan with the honest current state,
- identify the smallest implementation slice,
- do not write recovery code until the topology gap is clear.
### D1 Audit Result
Current local Kubernetes context is a single Rancher Desktop/k3s node
(`ping-r13`, internal IP `192.168.127.2`). That context cannot run the
node-loss gate. Prior QA runs used the m02 lab, but this branch does not yet
have a runner-native proof that the active QA lab has multiple schedulable
Kubernetes nodes for this plan.
Code audit findings:
- `scripts/install-k8s-alpha.sh` renders every logical server onto one
Kubernetes node (`SW_BLOCK_ALPHA_NODE_NAME`, defaulting to the first node
from `kubectl get nodes`) and emits `127.0.0.1` data/control addresses.
- `core/lifecycle` and `core/host/master` already have a useful base for
distinct physical nodes: `NodeRegistration` carries
`kubernetes.io/hostname`, `DataAddr`, and `CtrlAddr`, and
`TestMountedFailover_WorkloadPlanAllocatesPortsByPhysicalNodeAcrossRF2Volumes`
proves per-node port allocation across `k8s-a`/`k8s-b`.
- `core/launcher/k8s_renderer.go` still renders generated blockvolume
frontends as loopback-only (`--iscsi-listen=127.0.0.1:<port>`,
`--status-addr=127.0.0.1:<port>`, and NVMe similarly). That was correct for
Stage 2 same-node ALUA, but it is invalid for node-loss attach from another
Kubernetes node.
- `cmd/blockvolume` enforces loopback-only frontend binds for iSCSI/NVMe.
The code already has `--iscsi-portal-addr` and CHAP support, but an external
bind is deliberately rejected. Node-loss needs an explicit opt-in external
frontend mode, not an accidental bypass.
- Promotion/status probing is also loopback-shaped today. The generated
`--status-addr=127.0.0.1:<port>` is reachable only through local/pod
context, and master promotion evidence must not depend on a failed node's
loopback. D3 must include a routable status/probe path or an explicitly
documented Kubernetes port-forward/service model.
- Replication data/control addresses must be routable across physical nodes.
If only iSCSI is external but `DataAddr`/`CtrlAddr` remain loopback, RF3
sync-quorum can render three frontends but still fail the actual replication
and promotion-readiness contract.
- CSI already passes `nodeID` into `LookupPublishTarget`, but
`core/csi/master_backend.go` currently ignores it and selects published
frontends without validating reachability from the consuming node.
- Inventory can already print replica `server`, Kubernetes `node`, `frontend`,
`status_addr`, and promotion evidence. The node-loss gate should add stable
derived lines such as `replicas_on_distinct_nodes=true` and
`frontends_non_loopback=true` so QA does not infer eligibility from ad-hoc
greps.
Conclusion: the next slice is not recovery logic. The next slice is a topology
eligibility implementation that makes cross-node targets real and auditable.
Smallest implementation slice:
```text
alpha cluster-spec can describe multiple Kubernetes nodes with routable data/control addrs
-> generated blockvolume Deployments bind/listen through explicit external iSCSI mode
-> status/probe endpoints are routable or explicitly service/port-forwarded
-> iSCSI advertises a routable portal address for each node
-> CSI rejects loopback targets for the node-loss profile and selects the current primary target
-> inventory emits distinct-node and non-loopback eligibility markers
-> runner gate proves RF3 placement and attach eligibility without failure injection
```
Security boundary for the external iSCSI mode:
- external bind must be opt-in and refused by default,
- the first node-loss gate should require CHAP for external iSCSI unless a
later security review approves a narrower lab-only exception,
- CHAP must be plumbed on both sides: generated blockvolume target secret and
CSI `NodeStage` secret delivery,
- NVMe external bind remains non-claimed for this plan.
D3a implementation started:
- `cmd/blockvolume` now has an explicit `--allow-external-iscsi-bind` flag.
External iSCSI remains rejected by default, and opt-in external iSCSI requires
target-side CHAP.
- `core/launcher` can render external iSCSI listens from the placement node
address only when `K8sRenderConfig.ExternalISCSI` is enabled and a CHAP Secret
is configured.
- `cmd/blockmaster` exposes `--launcher-external-iscsi` to pass that renderer
mode.
- `scripts/install-k8s-alpha.sh` and `scripts/run-alpha-app-demo.sh` now accept
explicit multi-node cluster-spec input through `SW_BLOCK_ALPHA_NODE_SPECS`
entries shaped as `server_id|kubernetes_node|host_or_ip|pool_id`. This keeps
the old single-node default intact while giving the node-loss runner a way to
render routable `data_addr` / `ctrl_addr` values.
- The same scripts can inject `--launcher-external-iscsi` and
`--launcher-iscsi-chap-secret-name=<name>` via
`SW_BLOCK_LAUNCHER_EXTERNAL_ISCSI=1`.
- `scripts/run-alpha-app-demo.sh` now wires external iSCSI CHAP end-to-end for
the app path: requires username/secret, creates the Secret in app and
blockvolume namespaces, injects `csi.storage.k8s.io/node-stage-secret-*` into
the rendered StorageClass, and cleans the Secret up.
- `scripts/install-k8s-alpha.sh` now refuses external iSCSI without CHAP
credentials and creates the configured CHAP Secret for standalone install
flows.
- CSI now has an explicit `--reject-loopback-publish-targets` guard. When
enabled, master-backed publish lookup skips loopback or malformed frontend
addresses and fails closed if no routable target remains.
- The alpha install/demo scripts can inject
`--reject-loopback-publish-targets` through
`SW_BLOCK_REJECT_LOOPBACK_PUBLISH_TARGETS=1`.
- `cmd/blockvolume` now has an explicit `--allow-external-status-bind` flag.
The unauthenticated status API remains loopback-only by default; node-loss
gates can opt into a concrete, non-loopback node-address bind so blockmaster
can probe surviving replicas across nodes.
- `core/launcher` can render external status endpoints from the same placement
node address when `ExternalStatus` is enabled alongside external iSCSI. The
generated workload receives both `--status-addr=<node-ip>:<port>` and
`--allow-external-status-bind`.
- `cmd/blockmaster` exposes `--launcher-external-status` and passes that mode
to both the renderer and the workload-plan promotion evidence provider, so
promotion probes use node-address status endpoints instead of
`127.0.0.1:<port>`.
- The alpha install/demo scripts can inject `--launcher-external-status` via
`SW_BLOCK_LAUNCHER_EXTERNAL_STATUS=1`.
- External node-loss mode now rejects loopback/unspecified node-spec hosts at
the script, renderer, blockvolume bind, status bind, and promotion-probe
boundaries. A bad `SW_BLOCK_ALPHA_NODE_SPECS` entry must fail early instead
of producing fake cross-node evidence.
- `scripts/uninstall-k8s-alpha.sh` now deletes the configured iSCSI CHAP Secret
from app and `kube-system` namespaces so standalone external-iSCSI installs
do not leave credentials behind.
- Master status now publishes observed frontends for all assigned replicas, with
the current primary replica first. This keeps multipath consumers able to see
every path while making the conservative CSI/pod-recreate reattach path select
the promoted primary instead of a stale topology-first replica.
- CSI's single-target control-status lookup now has a node-loss guard test that
consumes the first routable frontend as the current-primary target when
loopback rejection is enabled.
- Inventory now emits stable topology eligibility evidence per volume:
`replicas_on_distinct_nodes=<bool>` and `frontends_non_loopback=<bool>` in
both JSON and the summary. These are evidence markers, not health classifiers,
so older single-node/non-node-loss paths are not made unhealthy by the marker.
- `scripts/preflight-node-loss-lab.sh` now provides a reusable lab readiness
check. It emits `NODE_SPECS`, selected writer app node, selected survivor
reader node, Kubernetes-node placement, physical-domain shape, and
`physical_host_loss_claimed=false`. The D3/D4 scenarios call this helper
instead of carrying private discovery logic.
- `scripts/run-alpha-app-demo.sh` now supports
`SW_BLOCK_DEMO_READER_NODE_NAME` so conservative pod-recreate recovery can
schedule the replacement reader onto a surviving node after the primary node
is cordoned.
- `scripts/run-alpha-app-demo.sh` now supports
`SW_BLOCK_DEMO_FAIL_PRIMARY_BEFORE_READER=cordon-node-scale-primary-to-zero`.
The mode derives the primary node from live inventory, cordons that
Kubernetes node, scales the primary blockvolume Deployment to zero, records
`failure_class=primary-kubernetes-node-cordoned-blockvolume-stop`, and
uncordons the node during cleanup.
Still open before QA can produce live validation:
- QA validation of the runner-native multi-node eligibility scenario:
`testops/scenarios/node-loss-topology-eligibility-chain.yaml`. The scenario
supplies real `SW_BLOCK_ALPHA_NODE_SPECS`, enables external iSCSI/status plus
loopback publish-target rejection, and asserts RF3 placement with
`replicas_on_distinct_nodes=true` and `frontends_non_loopback=true`.
- QA validation of the runner-native conservative recovery scenario:
`testops/scenarios/node-loss-survival-rf3-reattach-chain.yaml`. It uses the
same topology, cordons the live primary node, stops the primary blockvolume
workload, recreates the reader on a survivor node, and requires
`data_check_after_node_loss=reader_checksum_passed`.
- optional stronger publish-target identity. Current-primary-first ordering
closes the immediate conservative reattach path, but `FrontendTarget` still
does not encode server/node identity; add that only if D3 evidence needs more
than stable ordering plus inventory markers.
## D2: QA Hard Gate
Hard gate is drafted at
`qa-assignments/node-loss-survival-mvp-close-hard-gate.md`.
It fails if:
- all replicas run on one physical node,
- any cross-node target is loopback,
- the proof uses only a pod stop instead of node failure/isolation,
- reader attaches to the old failed-node frontend,
- authority movement is not visible,
- stale primary is untested,
- cleanup leaves unexplained residue.
## D3: Multi-Node Topology Eligibility Gate
Add the first runner-native gate only after D1 audit:
```text
RF3 PVC
-> replicas placed on distinct Kubernetes nodes
-> non-loopback frontends
-> inventory shows mapping
-> no node failure injection yet
```
This gate proves the topology is eligible for node-loss recovery.
D3 scenario authored:
```text
testops/scenarios/node-loss-topology-eligibility-chain.yaml
```
It fails fast unless the lab has three Ready schedulable Kubernetes nodes with
non-loopback InternalIPs. Those nodes may share two physical machines for this
MVP gate, but the scenario records `physical_domain_count`,
`physical_domain_shape`, and `physical_host_loss_claimed=false` so the evidence
cannot be misread as full physical-host-loss proof. It then runs RF3
sync-quorum with external iSCSI, external status, CHAP, and loopback
publish-target rejection. It stops after writer verification and asserts the
inventory eligibility markers before cleanup.
D3 QA run 20260515-204300-c892:
```text
pre_clean PASS
preflight PASS
discover_multinode_topology FAIL
collect_and_cleanup PASS
```
Reason:
```text
node-loss topology gate requires at least 3 Ready schedulable nodes with
non-loopback InternalIP; found 1
```
This is an intentional fail-closed lab-capacity result. It did not exercise the
RF3 external iSCSI/status, CHAP, loopback-rejection, writer, or inventory
eligibility assertions. It must not be treated as product validation.
Lab update 2026-05-16:
```text
m02 Ready control-plane 192.168.1.184 physical-host=m02
m01 Ready worker 192.168.1.181 physical-host=m01
tp01 Ready worker 192.168.1.188 physical-host=tp01
```
Fabric boundary: this is a LAN TCP/iSCSI topology using `192.168.1.x`.
`tp01` does not have RoCE and must not be used for any `10.0.0.x` RDMA fabric,
NVMe/RDMA, or performance claim in this plan.
`scripts/preflight-node-loss-lab.sh --min-k8s-nodes 3` now passes and emits:
```text
node_loss_topology_eligible=true
selected_node_count=3
physical_domain_count=3
physical_domain_shape=full-physical-host
replica=r1 server=node-loss-r1 node=m01 host=192.168.1.181 physical_host=m01
replica=r2 server=node-loss-r2 node=m02 host=192.168.1.184 physical_host=m02
replica=r3 server=node-loss-r3 node=tp01 host=192.168.1.188 physical_host=tp01
```
Next unblocker:
```text
rerun node-loss-topology-eligibility-chain.yaml
-> only then proceed to D4 node-loss recovery
```
D3 QA run 20260516-134043-becf on the expanded lab advanced past topology
discovery and failed in `rf3_external_topology` because `sw-blockmaster`
scheduled on `m01`, where `sw-block:local` had not been imported. This was a
real multi-node alpha pipeline gap: `scripts/build-alpha-images.sh` imported
local images only into m02's k3s containerd.
Fix implemented and smoke-validated:
```text
preflight emits K3S_IMPORT_NODES=<selected node IPs>
-> D3/D4 pin_build sources node-specs.env
-> build-alpha-images imports sw-block and sw-block-csi into each selected k3s node over SSH
```
This keeps the scheduler free to place blockmaster and blockvolume workloads on
any eligible node while avoiding a registry dependency for the lab.
Focused dev smoke on m02:
```text
K3S_IMPORT_NODES=192.168.1.181,192.168.1.184,192.168.1.188
build-alpha-images exit=0
m01: sw-block:local and sw-block-csi:local present in k3s containerd
m02: sw-block:local and sw-block-csi:local present in k3s containerd
tp01: sw-block:local and sw-block-csi:local present in k3s containerd
```
Dev rerun of D4 also exercises the same image-import path successfully, so D3's
prior image-locality blocker is considered fixed pending QA rerun.
An acceptable intermediate lab can be:
```text
m02 control-plane + m01 worker + one VM/containerized worker
```
as long as `kubectl get nodes` shows three Ready schedulable nodes with
non-loopback InternalIPs. The close report must disclose if two Kubernetes nodes
share one physical host.
Before asking QA for another D3 run, dev can run:
```bash
bash scripts/preflight-node-loss-lab.sh \
--min-k8s-nodes 3 \
--env-out /tmp/node-loss.env \
--placement-out /tmp/node-placement.before.txt
```
If this exits non-zero, the full D3 scenario will fail closed for the same lab
reason.
Preflight contract after QA's m02 check:
- eligible lab: exit `0`, writes `node-loss.env` and
`node-placement.before.txt`;
- ineligible lab: exit `3`, writes a negative placement file with
`node_loss_lab_eligible=false`, removes/skips the env file, and must block
D3/D4 reruns.
## D4: Conservative Node-Loss Recovery Gate
Runner-native recovery gate:
```text
writer writes /data/demo.bin
inventory identifies primary replica and primary node
controlled failure isolates/stops the primary node path
master promotes a surviving replica
replacement pod reattaches through CSI to surviving frontend
reader verifies /data/demo.bin
bundle records node_loss_recovery_claimed=true and transparent_failover_claimed=false
cleanup proves no residue
```
D4 scenario authored:
```text
testops/scenarios/node-loss-survival-rf3-reattach-chain.yaml
```
It is intentionally a Kubernetes-node-loss gate, not a physical-host-loss gate.
It records `physical_host_loss_claimed=false`, `pod_recreate_used=true`, and
`transparent_failover_claimed=false`. The replacement reader uses
`SW_BLOCK_DEMO_READER_NODE_NAME=$SURVIVOR_APP_NODE`, so success requires CSI to
reattach on a survivor node rather than scheduling back onto the cordoned
primary node.
D4 QA run 20260516-152925-42b3 was canceled after the recovery phase appeared
stuck. The important diagnosis from that run: master had already promoted the
volume to r2, but inventory relabeled the failed r1 deployment row as
`replica=r2` because the nested status report reflected the current primary.
The scenario then grepped the first `replica=r2` row, saw
`role=unavailable`, and waited until timeout. This was an inventory row
identity bug, not an authority-promotion failure.
Fix:
```text
core/ops/k8s_inventory.go
-> keep deployment-derived replica identity (`--replica-id`) stable
-> do not overwrite `replica.ReplicaID` from a status report's current-primary field
```
Regression guard:
```text
TestKubernetesInventoryCollector_PreservesDeploymentReplicaIdentityWhenStatusReportsCurrentPrimary
```
Validation:
```text
go test ./core/ops -count=1 PASS
remote m02 targeted regression PASS
D4 dev rerun 20260516-154108-7bb7 PASS
state/phases/actions pass / 8/8 / 74/74
before primary r1@m01
failed node m01
promoted replica r2@m02
post_failure_primary_count 1
before frontend 192.168.1.181:3260
after frontend 192.168.1.184:3260
CSI recovery method pod recreate
reader data check /data/demo.bin: OK
data_check_after_node_loss reader_checksum_passed
transparent_failover_claimed false
physical_host_loss_claimed false
cleanup clean
```
After-failure inventory now preserves all three rows correctly:
```text
r1 node=m01 role=unavailable
r2 node=m02 role=primary
r3 node=tp01 role=unknown replication=replica_ready
```
D4 QA rerun 20260516-154813-109a failed before the recovery path because the
fresh CSI node DaemonSet hit `ImagePullBackOff` on m02:
```text
sw-block-csi-node on m02: ImagePullBackOff for sw-block-csi:local
m01: sw-block:local and sw-block-csi:local present
m02: product images missing from k8s.io containerd namespace
tp01: sw-block:local and sw-block-csi:local present
```
This did not exercise the inventory fix; the writer never attached and the
scenario never reached cordon/scale-down.
Image pipeline hardening:
```text
scripts/build-alpha-images.sh
-> import explicitly into k3s containerd namespace k8s.io
-> verify sw-block:local and sw-block-csi:local after import
-> when SW_BLOCK_IMPORT_K3S_NODES is set, also import/verify the local k3s node if available
```
Dev validation 2026-05-16:
```text
build/import artifact: /mnt/smb/work/share/g15d-k8s/dev-image-import-verify-20260516-160041
m01: docker.io/library/sw-block:local and docker.io/library/sw-block-csi:local present
m02: docker.io/library/sw-block:local and docker.io/library/sw-block-csi:local present
tp01: docker.io/library/sw-block:local and docker.io/library/sw-block-csi:local present
```
The observation API/support-bundle spec now treats this class as first-class
operator evidence: `image_missing_on_node`, `pod_image_pull_failed`, CSI pod
events/logs, and per-node image inventory should be available through
`sw-block ops explain` / bundle rather than requiring manual SSH checks.
D4 QA rerun 20260516-160306-1e54 passed strictly:
```text
state/phases/actions pass / 8/8 / 74/74
lab m01 + m02 + tp01 3-node k3s
transport LAN TCP/iSCSI, CHAP, external iSCSI/status
ack_profile sync-quorum
failure_class primary-kubernetes-node-cordoned-blockvolume-stop
before_primary_replica/node r1@m01
failed_replica/node r1@m01
promoted_replica/node r2@m02
before_publish_target_frontend 192.168.1.181:3260
after_publish_target_frontend 192.168.1.184:3260
post_failure_primary_count 1
old_primary_stale_io_success_count 0
target_ready_replicas 0
pod_recreate_used true
node_loss_recovery_claimed true
data_check_after_node_loss reader_checksum_passed
transparent_failover_claimed false
physical_host_loss_claimed false
cleanup strict clean
```
This run is the first end-to-end Kubernetes-node-loss recovery proof for this
plan: primary node cordoned, primary blockvolume stopped, master promoted a
surviving replica, CSI reattached to the survivor frontend, and the replacement
reader verified the pre-failure data.
## D5: Transparent Multipath Node-Loss Decision
After D4 passes, decide whether to extend this plan or open the next one for:
```text
same mounted pod
primary node loss
host multipath path switch to another node
no pod recreate
post-failure data check
```
Do not merge this into D4 unless the lab/product path is already stable.
## Gates To Close
This plan closes only when:
1. The lab topology has distinct Kubernetes nodes and non-loopback frontends.
2. A strict QA hard gate exists before implementation is treated as complete.
3. Fast tests protect node-aware placement, target selection, and non-loopback
rejection.
4. A runner-native gate proves recovery after controlled primary-node loss.
5. Support bundles explain node placement, authority movement, CSI target
movement, stale-primary fencing, bounded waits, and data verification.
6. User-facing docs distinguish Stage 2 same-node transparent failover from
node-loss recovery.
7. QA validates independently and reports no blocking issue.
@@ -0,0 +1,561 @@
# Current Plan: Control-Plane Observation / AI-Readable Ops MVP
Status: active, opened after closing
`finished-plans/phase18_finishedplan_node_loss_survival_mvp.md`, 95% complete.
Reference spec:
- `ref/control-plane-observation-api-mvp.md`
Close evidence that motivates this plan:
- Node-Loss Survival close report:
`qa-assignments/node-loss-survival-mvp-close-report.md`
- D4 close run: `20260516-160306-1e54`
- Prior QA blockers that should have been self-explaining:
- inventory replica-ID attribution bug,
- missing `sw-block-csi:local` image on m02,
- ImagePullBackOff on CSI node pod,
- reader/reattach waiting on a Kubernetes runtime precondition.
## Product Question
Can a Kubernetes user or support engineer understand Seaweed Block cluster
state from one CLI/API surface, without SSHing into every node, reading raw
Kubernetes events manually, or knowing internal authority implementation
details?
For block storage, a stuck PVC or failover is a serious product moment. The
operator needs a direct answer:
```text
what failed
what the product did
whether data is safe
which target is active
whether recovery is still progressing or blocked
what to collect or do next
```
## Product Position
The last three availability plans moved the data path forward:
```text
Stage 1: RF3 sync-quorum recovery through CSI/pod recreate
Stage 2: RF3 sync-quorum same-node transparent iSCSI ALUA/dm-multipath failover
Stage 3: RF3 sync-quorum Kubernetes-node-loss recovery through CSI/pod recreate
```
The next product gap is operations trust. Mature block products do not require
users to correlate `kubectl describe`, CSI logs, blockmaster logs, support
bundles, and handwritten TestOps timelines. Seaweed Block should expose a
stable observation model that a human, dashboard, CI job, or AI assistant can
read directly.
The product direction should follow the SeaweedFS operations pattern:
```text
shared observation core
-> CLI text for humans, support, QA, and AI
-> JSON/JSONL for automation and bundles
-> master read-only API for dashboard/UI
```
Do not create separate truth sources for CLI, dashboard, TestOps, and AI.
## Target User Experience
Initial CLI:
```bash
sw-block ops cluster
sw-block ops volumes
sw-block ops describe volume <volume-id>
sw-block ops timeline volume <volume-id>
sw-block ops timeline volume <volume-id> -o jsonl
sw-block ops explain volume <volume-id>
sw-block ops inventory --namespace default --master 127.0.0.1:9333 --out /tmp/sw-block-inventory
sw-block ops events --since 1h
```
Default output is human-readable. `-o json` and `-o jsonl` are stable machine
contracts.
Example healthy output:
```text
volume pvc-... status=ok rf=3 ack=sync-quorum
pvc default/mysql-data
primary r1 on m01 frontend=192.168.1.181:3260
replicas desired=3 observed=3
r1 m01 primary ready durable_lsn=44
r2 m02 replica_ready candidate_ready=true durable_lsn=44
r3 tp01 replica_ready candidate_ready=true durable_lsn=44
next action: none
```
Example recovering output:
```text
volume pvc-... status=recovering reason=primary_node_lost
old primary r1 on m01 unavailable
promoted primary r2 on m02 epoch=2 endpoint_version=1
CSI target changed 192.168.1.181:3260 -> 192.168.1.184:3260
reattach method: pod_recreate
next action: wait for app pod readiness, then collect support bundle if stuck
```
Example blocked output:
```text
volume pvc-... status=blocked reason=csi_node_image_pull_failed
node m02 missing image sw-block-csi:local
pod kube-system/sw-block-csi-node-... waiting=ImagePullBackOff
impact: PVC attach cannot proceed on workloads scheduled to m02
next action: import the image to m02 or use a registry reachable by all nodes
```
## Explicit Non-Claims
- No mutating admin controls.
- No promote, repair, rebuild, backup, restore, or cleanup command.
- No hosted dashboard in this MVP.
- No metrics/Prometheus integration in this MVP.
- No alert-manager integration.
- No claim that application-level checksum ran unless TestOps/user actually ran
it.
- No replacement for Kubernetes events; this plan explains Seaweed Block state
and includes relevant Kubernetes runtime evidence.
## D1: Observation Evidence Model
Build the shared data model before adding live APIs.
Status: dev pass, QA not requested yet. Implemented the first stable evidence
model and renderers in `core/ops/observation.go`, with golden tests in
`core/ops/observation_test.go`.
Required structs / schema concepts:
```text
ClusterEvidence
NodeEvidence
VolumeEvidence
ReplicaEvidence
ClusterEvent
VolumeTimeline
VolumeExplanation
SupportBundleManifest
```
Required stable statuses:
```text
ok
degraded
recovering
blocked
invalid
unavailable
```
Required reason codes for first slice:
```text
primary_node_lost
candidate_covers_required_frontier
no_promotion_ready_candidate
durable_frontier_missing
candidate_frontier_behind
status_endpoint_unreachable
csi_node_image_pull_failed
image_missing_on_node
generated_deployment_missing
observed_replicas_below_desired
loopback_frontend_rejected
stale_primary_fenced
```
Pass criteria:
- golden examples for healthy, recovering, and blocked evidence,
- text renderer output is readable without internal context,
- JSON output includes schema version and stable reason codes,
- JSONL timeline emits one event per line with `event_type`, `severity`,
`reason_code`, `volume_id`, `evidence_ref`, and summary text.
Dev evidence:
- `go test ./core/ops -run TestObservation -count=1` PASS.
- `go test ./core/ops -count=1` PASS.
- Healthy text pins `status=ok`, primary frontend, replica durable LSN, and
`next action: none`.
- Recovering text pins `status=recovering reason=primary_node_lost`, stale
primary fencing, and CSI target movement.
- Blocked text pins `status=blocked reason=csi_node_image_pull_failed`, node,
image, and `ImagePullBackOff` pod evidence.
- JSON/JSONL output carries `schema_version=1.0` and stable reason codes.
## D2: CLI From Existing Bundles
Start with existing inventory/support bundles. This avoids waiting for a new
master API and immediately improves support/QA usability.
Status: dev pass, QA not requested yet. Implemented bundle-backed observation
loading in `core/ops/observation_bundle.go` and wired read-only CLI entry points
in `cmd/sw-block/main.go`.
Commands:
```bash
sw-block ops describe volume --from-bundle <dir> <volume-id>
sw-block ops timeline volume --from-bundle <dir> <volume-id>
sw-block ops timeline volume --from-bundle <dir> <volume-id> -o jsonl
sw-block ops explain volume --from-bundle <dir> <volume-id>
```
Inputs:
- `volume-inventory.json`,
- `volume-inventory-summary.txt`,
- `ops-inventory-bundle.json`,
- nested per-replica `ops-status-bundle.json`,
- `primary-failure-recovery.txt`,
- `node-loss-recovery-summary.txt`,
- `control-plane-timeline.txt`,
- Kubernetes runtime evidence when present.
Pass criteria:
- D4 bundle `20260516-160306-1e54` renders the same story as the QA close
report:
`r1@m01 -> r2@m02`, CSI target moved, reader checksum passed, stale primary
fenced, transparent failover not claimed.
- The failed D4 bundle `20260516-154813-109a` renders
`status=blocked reason=csi_node_image_pull_failed` and names m02 plus
`sw-block-csi:local`.
Dev evidence:
- Added:
- `sw-block ops describe volume --from-bundle <dir> <volume-id>`
- `sw-block ops timeline volume --from-bundle <dir> <volume-id> -o jsonl`
- `sw-block ops explain volume --from-bundle <dir> <volume-id>`
- `go test ./core/ops -count=1` PASS.
- `go test ./cmd/sw-block -count=1` PASS.
- Real close bundle smoke:
`go run ./cmd/sw-block ops explain volume --from-bundle V:\share\g15d-k8s\20260516-160306-1e54-node-loss-survival pvc-c606d03a-4136-464d-8716-ef01f92c7b12`
renders `r2@m02`, target movement `192.168.1.181:3260 ->
192.168.1.184:3260`, reader verification, stale-primary fence evidence, and
timeline events.
- Real failed bundle smoke:
`go run ./cmd/sw-block ops explain volume --from-bundle V:\share\g15d-k8s\20260516-154813-109a-node-loss-survival pvc-c606d03a`
renders `status=blocked reason=csi_node_image_pull_failed`, node `m02`, and
image `sw-block-csi:local`.
## D3: Live CLI Over Current Inventory Sources
Use the current live inventory collector and Kubernetes runtime collectors.
Status: dev pass for the first read-only live CLI slice. Implemented live
cluster, volume-list, and per-volume explain/describe/timeline entry points
using the same observation model as D1/D2. This slice reads Kubernetes
inventory and optional per-replica status through the existing collectors; it
does not introduce master write APIs or mutating admin actions.
Commands:
```bash
sw-block ops cluster --namespace default --master 127.0.0.1:9333
sw-block ops volumes --namespace default --master 127.0.0.1:9333
sw-block ops describe volume <volume-id> --namespace default --master 127.0.0.1:9333
sw-block ops explain volume <volume-id> --namespace default --master 127.0.0.1:9333
sw-block ops inventory --namespace default --master 127.0.0.1:9333 --out <dir>
```
Runtime evidence to collect:
- `kubectl get pods -A -o wide`,
- relevant `kubectl describe pod`,
- namespace events,
- blockmaster logs,
- CSI controller logs,
- CSI node logs,
- generated blockvolume pod logs,
- per-node k3s image inventory for selected product images,
- iSCSI sessions and node DB entries when available.
Pass criteria:
- live healthy RF3 node-loss-ready volume explains as `ok`,
- simulated missing image explains as `blocked` with node/image/pod/reason,
- no command mutates Kubernetes, master, iSCSI, or blockvolume state.
Dev evidence:
- Added:
- `sw-block ops cluster --namespace <ns> [--master <addr>] [-o json]`
- `sw-block ops volumes --namespace <ns> [--master <addr>] [-o json]`
- live mode for `sw-block ops describe volume <volume-id> --namespace <ns>
[--master <addr>] [--out <dir>]`
- live mode for `sw-block ops explain volume <volume-id> --namespace <ns>
[--master <addr>] [--out <dir>]`
- `go test ./core/ops -count=1` PASS.
- `go test ./cmd/sw-block -count=1` PASS.
- CLI tests pin live inventory output for:
- cluster summary,
- volume list,
- per-volume describe,
- bundle timeline JSONL,
- ImagePullBackOff explanation from preserved failed bundle.
Remaining D3 gap before QA: run the live commands against the actual 3-node lab
while a healthy RF3 node-loss-ready volume is active, then add the simulated
missing-image live fixture if needed.
## D4: Master Read-Only Snapshot API
Add a master read-only API only after the CLI evidence model is stable.
Status: dev pass. Implemented `Host.ObservationSnapshot()` in
`core/host/master/observation_snapshot.go`, added the read-only
`ClusterEvidenceService` to `core/rpc/proto/control.proto`, regenerated
protobuf bindings, registered the service in blockmaster, and wired server
methods in `core/host/master/observation_service.go`.
Provisional API:
```proto
service ClusterEvidenceService {
rpc GetClusterStatus(GetClusterStatusRequest)
returns (ClusterStatusResponse);
rpc ListVolumes(ListVolumesRequest)
returns (ListVolumesResponse);
rpc GetVolumeStatus(GetVolumeStatusRequest)
returns (VolumeEvidence);
rpc GetVolumeTimeline(GetVolumeTimelineRequest)
returns (VolumeTimelineResponse);
rpc WatchClusterEvents(WatchClusterEventsRequest)
returns (stream ClusterEvent);
}
```
Pass criteria:
- API and CLI share the same evidence model,
- no read API can mutate authority, placement, lifecycle, or replica state,
- one live RF3 volume appears with primary, replicas, frontend, epoch,
endpoint_version, and reason code.
Dev evidence:
- `Host.ObservationSnapshot()` returns `ops.ClusterEvidence` directly, so the
master read surface and CLI/bundle surfaces share one evidence schema.
- Snapshot reads only lifecycle volume/node/placement stores, publisher
authority line, controller evidence, and observation-store heartbeat facts.
- `TestMasterObservationSnapshot_RF3HealthyReadOnly` pins an RF3 volume with
primary, replicas, frontend, epoch, endpoint_version, PVC identity, and node
evidence, then asserts authority state is unchanged after the read.
- `TestMasterObservationSnapshot_MissingReplicaIsDegraded` pins
`observed_replicas_below_desired` and per-replica
`status_endpoint_unreachable` when one placement slot has no fresh
observation.
- `TestMasterObservationSnapshot_NoLifecycleStoreReturnsEmptyOK` pins safe
empty output when lifecycle stores are not configured.
- `go test ./core/host/master -run TestMasterObservationSnapshot -count=1`
PASS.
- `go test ./core/host/master ./core/ops ./cmd/sw-block -count=1` PASS.
- `TestClusterEvidenceService_GRPCRegistered` calls
`ClusterEvidenceService.GetVolumeStatus` through a real gRPC client and pins
that the service is registered on blockmaster.
- `TestClusterEvidenceService_GetClusterStatusSharesObservationSnapshot` pins
schema/status/volume/node evidence and verifies the read does not mutate
publisher authority.
- `TestClusterEvidenceService_ListVolumesAndGetVolumeStatus` pins the degraded
missing-replica wire shape.
- `TestClusterEvidenceService_GetVolumeStatusNotFound` pins `NotFound` for
unknown volumes.
- `TestClusterEvidenceService_GetVolumeTimelineEmptyButVersioned` keeps the D5
timeline gap explicit: the API is versioned, but product-owned event content
lands in the next slice.
- `go test ./core/host/master -run "TestClusterEvidenceService|TestMasterObservationSnapshot" -count=1`
PASS.
- `go test ./core/host/master ./core/ops ./cmd/sw-block -count=1` PASS.
Remaining D4 gap before QA: validate against the live 3-node lab while an RF3
node-loss-ready volume is active, so the API output is checked against real
Kubernetes node/replica placement and published frontend evidence.
## D5: Product Timeline
Move from TestOps-only timelines to product-owned timeline events.
Status: dev pass for the first product-owned timeline slice. Added a bounded
master event ring in `core/host/master/event_ring.go`, included master-owned
events in `Host.ObservationSnapshot()`, and exposed them through
`ClusterEvidenceService.GetVolumeTimeline`.
Required event types:
```text
volume_created
placement_verified
replica_heartbeat_seen
replica_stale
promotion_candidate_evaluated
authority_published
publish_target_changed
stale_primary_fenced
csi_reattach_observed
pod_image_pull_failed
csi_node_unavailable
volume_recovered
volume_blocked
support_bundle_collected
```
Pass criteria:
- node-loss D4 produces the same six-event story from product evidence, not
only from TestOps files,
- `WatchClusterEvents` reconnect with cursor does not miss
`authority_published` or `volume_blocked`.
Dev evidence:
- `RunLifecycleProductTick()` now emits `placement_verified` events when
placement verification succeeds.
- The promotion gate now emits `promotion_candidate_evaluated` events with
stable reason codes:
`candidate_covers_required_frontier`, `candidate_frontier_behind`, or
`no_promotion_ready_candidate`.
- The promotion gate emits `volume_blocked` when no candidate passes the
readiness gate.
- Added a publisher post-mint observer hook:
`authority.WithPublishObserver`.
- `authority_published` is now emitted only after `Publisher.apply()` has
successfully minted, durably committed when a store exists, updated in-memory
state, and delivered the fact. It is not emitted from controller intent
submission.
- CSI/node staging now emits `csi_reattach_observed` through
`ObservationService.ReportClusterEvent` after a successful `NodeStageVolume`.
This is an observation-only append to the master event ring; it does not
mutate lifecycle, authority, placement, Kubernetes, or replica state.
- `cmd/blockcsi` wires a `ControlEventReporter` when `--master` is configured,
so CSI reattach/stage evidence can show up in the master timeline alongside
`placement_verified`, `promotion_candidate_evaluated`, and
`authority_published`.
- `sw-block ops cluster --master-api <addr> -o json` now reads
`ClusterEvidenceService.GetClusterStatus` directly, so TestOps and support
bundles can capture the product-owned event ring without scraping
blockmaster logs or reconstructing the timeline from runner files.
- `node-loss-survival-rf3-reattach-chain.yaml` now captures
`demo/product-observation/cluster-evidence.json` before cleanup and asserts
the product event stream contains `placement_verified`,
`promotion_candidate_evaluated`, `authority_published`, and
`csi_reattach_observed`.
- `TestPublisher_PublishObserverFiresAfterSuccessfulMintOnly` PASS.
- `TestMasterTimeline_RecordsAuthorityPublishedAfterMint` PASS.
- `TestMasterTimeline_RecordsPlacementVerified` PASS.
- `TestMasterTimeline_RecordsPromotionCandidateEvaluation` PASS.
- `WatchClusterEvents` now streams retained product events after
`since_event_id`; unknown cursors conservatively replay retained events so
clients can de-duplicate by event ID instead of silently missing evidence.
- `TestClusterEvidenceService_WatchClusterEventsCursor` PASS and pins that
reconnect after a cursor does not replay the cursor event and still includes
`authority_published`.
- `TestObservationService_ReportClusterEventAppearsInVolumeTimeline` PASS and
pins that a CSI-reported `csi_reattach_observed` event is accepted, assigned
a master event ID, and appears in `GetVolumeTimeline`.
- `TestNodeStage_ReportsCSIReattachObservedAfterSuccessfulStage` PASS and pins
CSI staging emits volume/replica/node/epoch/endpoint_version evidence after
a successful iSCSI stage.
- `TestControlEventReporter_ReportsClusterEvent` PASS and pins the CSI client
conversion into the observation RPC.
- `TestOpsClusterReadsMasterAPIProductEvents` PASS and pins the CLI can export
master-owned product events through `--master-api`.
- `go test ./core/host/master -run "TestMasterTimeline|TestClusterEvidenceService|TestMasterObservationSnapshot" -count=1`
PASS.
- `go test ./core/authority ./core/host/bootstrap ./core/host/master ./cmd/blockmaster ./cmd/blockcsi ./core/csi ./cmd/sw-block ./core/ops -count=1`
PASS.
QA evidence:
- D5 live rerun `20260517-011004-4b79`: PASS, 8/8 phases, 83/83
actions.
- `demo/product-observation/cluster-evidence.json` is present in the bundle
and contains product-owned events exported through
`sw-block ops cluster --master-api`.
- Required event types found in the product event stream:
`placement_verified`, `promotion_candidate_evaluated`,
`authority_published`, and `csi_reattach_observed`.
- `authority_published` has master-minted `event_id` and `event_time` after
authority publication.
- `csi_reattach_observed` is CSI-emitted and master-ingested with a
master-minted `event_id`; it records the promoted r2 frontend
`192.168.1.184:3260`, not the failed r1 frontend.
- The bundle also includes populated node and volume sections: three
schedulable/ready nodes, one RF=3 volume, primary `r2`, published target
`192.168.1.184:3260`, epoch `2`, and all three replica rows.
Remaining D5 gap:
- Kubernetes runtime blocker events such as `ImagePullBackOff` are still
explained by the bundle/inventory path. Promoting them into the master event
stream is useful, but no longer blocks this MVP because D5's product-owned
recovery event ingestion is now proven.
## D6: User Tutorial And Hard Gate
Status: dev pass, QA close pending. User-facing docs now describe the
product-owned control-plane export path, and the formal close hard gate exists
under `qa-assignments/control-plane-observation-ai-readable-ops-mvp-close-hard-gate.md`.
Docs must teach:
- how to inspect cluster health,
- how to inspect one volume,
- how to read a timeline,
- how to collect a support bundle,
- how to interpret healthy/recovering/blocked examples,
- what is not claimed.
QA hard gate should fail if:
- any command mutates state,
- a blocked/recovering state lacks a stable reason code,
- missing image / ImagePullBackOff is not explained,
- node-loss recovery evidence is available only by reading raw TestOps logs,
- stale primary and promoted primary cannot be distinguished,
- JSON/JSONL output is unstable or missing schema version,
- support bundle misses Kubernetes pod events/logs for attach/install failures.
Required close artifacts:
- `docs/operations-v1.md` names the new AI-readable observation path and shows
`sw-block ops cluster --master-api <addr> -o json`.
- `docs/quickstart-kubernetes.md` gives a short "export product evidence"
path using `kubectl port-forward deploy/sw-blockmaster`.
- `qa-assignments/control-plane-observation-ai-readable-ops-mvp-close-hard-gate.md`
exists and makes D5 product event evidence a hard close requirement.
Dev evidence:
- `docs/operations-v1.md` now documents the split between product-owned
`cluster-evidence.json` and inventory/per-replica support bundles.
- `docs/quickstart-kubernetes.md` now shows how to capture
`/tmp/sw-block-cluster-evidence.json` using
`sw-block ops cluster --master-api 127.0.0.1:9333 -o json`.
- The close hard gate has HG-0..HG-12 covering docs, product-owned event
export, required event types, master-minted event identity, CSI reattach
evidence, read-only boundary, stable reason codes, bundle-backed
explanation, support evidence completeness, watch/cursor behavior, explicit
non-claims, and cleanup hygiene.
## Next Step
Ask QA for a formal close review against the observation hard gate. Do not jump
directly to a dashboard. The dashboard should be a consumer of the observation
core, not a new source of truth.
@@ -0,0 +1,869 @@
# Finished Plan: iSCSI/NVMe Frontend Protocol Readiness
Status: historical reference. Closed on 2026-05-09 by the runner-native
protocol release gate.
This phase/topic file preserves the plan that brought iSCSI and NVMe from active
frontend bring-up to release-gated protocol coverage. It is no longer the active
execution plan. Current work is tracked in `../current-plan.md`.
Rule: V2 frontend coverage is the minimum height for V3 unless we explicitly
drop a feature with a product reason. V3 should keep its own architecture, but
the user-visible frontend capability should reach and then exceed V2.
References:
- `ref/iscsi-v2-coverage-gap-audit.md`
- `ref/iscsi-os-initiator-compat-plan.md`
- `ref/v2-frontend-protocol-gap-audit.md`
- `ref/iscsi-csi-alua-review-guide.md`
- `ref/iscsi-p6-alua-mpio-design.md`
- `ref/iscsi-alua-technical-note.md`
- `ref/nvme-ana-parity-plan.md`
- `ref/nvme-v2-coverage-gap-audit.md`
- `ref/nvme-ana-technical-note.md`
- `ref/nvme-p4-multipath-failover-design.md`
## Current Status: Protocol Readiness Closed
As of 2026-05-09, the current iSCSI/NVMe frontend protocol-readiness plan is
closed for this branch.
Close evidence:
- Runner-native protocol release gate PASS on M02:
- product commit: `033028e74c1ac3bc06f19c0563bc2e6a0495af59`,
- runner commit: `3c1b6603aefcf4c1bf0b22f9a9c081a67e786d8d`,
- suite run: `20260509-151531-9c6c`,
- wall clock: 1415.97 seconds,
- children: `iscsi-p6-alua-failover`, `nvme-p4-multipath-failover`,
`nvme-p5-csi-protocol`, and `iscsi-p8-compat-soak`, all PASS.
- `swblock validate-bundle --profile protocol-release-gate` classified the
native suite bundle as VALID.
- Post-run M02 cleanup was clean: no V3 processes and all child
`collect_and_cleanup` phases ran.
Decision:
- iSCSI and NVMe are now release-gated protocol frontends, not active bring-up
work.
- Future iSCSI/NVMe changes should enter through regression tests, V2 parity
backlog items, or broader availability/performance gates.
- Do not treat this as full V2 product parity. Remaining work belongs to
parity/hardening: rebuild/reintegration matrices, operator lifecycle,
multi-node/cloud scale, longer soak/performance, and scenario corpus
migration.
## Product Goal
- Keep iSCSI and NVMe credible Kubernetes block frontends, not only smoke-test
paths.
- Support real OS initiators, filesystem workloads, stress, auth, lifecycle,
multipath, and mounted failover.
- Keep protocol code separate from authority and replica readiness decisions.
- Use V2 tests as the coverage inventory, not as code to blindly copy.
## Completed Baseline
- iSCSI-P1 OS initiator correctness:
- status: done in PR #24.
- includes Data-Out collector, pending command handling during Data-Out,
Data-Out timeout, and Linux OS initiator evidence.
- Large READ Data-In splitting:
- status: done in PR #25.
- includes residual direction handling.
- iSCSI-P2 first stability pack:
- status: done in PR #26.
- includes RX/TX stability tests, large write memory tests, OS smoke script,
loop mode, stress mode, TestOps registry entry, and sustained sync smoke.
- iSCSI-P2 supplemental session guards:
- status: done in PR #41.
- includes rapid login/logout goroutine budget, concurrent target close
idempotency, target same-address restart, and NOP-Out queued during
Data-Out.
- iSCSI-P3 attach/detach loop tooling:
- status: done in PR #41.
- includes `scripts/run-k8s-attach-detach-loop.sh` and TestOps registry
scenario `iscsi-p3-attach-detach-loop`.
- iSCSI-P2/P3 lab validation:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- OS repeat, OS fio, K8s fio, and K8s attach/detach all passed on M02.
- evidence: `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- iSCSI smoke harness cleanup:
- status: done in PR #27.
- Larger alpha PVC smoke:
- status: done in PR #28.
- Operational iSCSI target knobs:
- status: done in PR #36.
- includes portal address / externally advertised target configuration.
- PVC metadata and owner-reference plumbing:
- status: done in PR #39.
- relevant to CSI/K8s cleanup, not core iSCSI protocol.
- Owner-reference alpha default:
- status: done in PR #40.
- relevant to K8s cleanup and alpha install flow.
- iSCSI-P4 CHAP / Access Control:
- status: done in PR #41.
- includes target-side CHAP, CSI node CHAP, Kubernetes Secret wiring, and
QA evidence.
## Recently Closed Milestone: iSCSI-P2 Stability
- Goal:
- prevent session breakage, leaks, and unbounded memory behavior under real
OS-style traffic.
- turn the recent large I/O debugging class into repeatable local and QA
tests.
- Tasks:
- add RX/TX stability test pack:
- status: done in PR #26.
- supplemental guards: done in PR #41.
- rapid login/logout without goroutine leak,
- many concurrent sessions,
- target close while I/O is active,
- double close without panic,
- NOP-Out during Data-Out,
- error response StatSN behavior.
- add large write memory-pressure tests:
- status: done in PR #26.
- repeated 4 MiB writes,
- slow backend,
- heap/goroutine growth guard.
- extend real OS harness:
- status: done in PR #26.
- `SW_BLOCK_ISCSI_ITERATIONS=N`,
- `SW_BLOCK_ISCSI_STRESS=dd|fio`,
- artifact path printed,
- no active sessions after every loop.
- #QA run K8s validation after local tests:
- status: QA green on `iscsi/frontend-completeness@e7c95ee`.
- larger PVC smoke: done in PR #28.
- 60s fio: QA PASS on M02.
- larger PVC,
- 60s fio,
- daemon logs and iSCSI state captured,
- no K8s residue.
- compare against V2 remaining coverage:
- status: active.
- review whether PR #26 fully covers V2 `qa_rxtx_test.go` and
`large_write_mem_test.go` intent.
- add missing tests only if the mapping is incomplete.
- Close bar:
- `go test ./core/frontend/iscsi -count=1` green,
- OS initiator repeat harness green on M02,
- K8s larger PVC or fio smoke green,
- no session leaks,
- no unbounded buffer or memory behavior.
- #QA assignment:
- `internal/docs/qa-assignments/iscsi-p2-p3-lab-validation.md`.
- status: QA green.
## Milestone: iSCSI-P3 Product-Backed Stability
- Goal:
- prove the protocol path works with real `blockvolume`, WAL, CSI, and K8s
behavior, not only protocol fakes.
- Tasks:
- status: done in PR #41.
- sustained write/read through mounted filesystem,
- `SYNCHRONIZE_CACHE` pressure,
- multiple sessions sharing a volume if supported,
- reconnect after logout/login,
- #QA repeated attach/detach loop,
- script prepared: `scripts/run-k8s-attach-detach-loop.sh`,
- TestOps scenario prepared: `iscsi-p3-attach-detach-loop`,
- app writer pod replaced by reader pod on the same PVC,
- blockvolume restart and reattach once durable state is ready.
- Close bar:
- checksum passes through pod path,
- no session errors,
- cleanup leaves no iSCSI or K8s residue,
- product logs are enough to diagnose failures.
- QA/tooling:
- repeated attach/detach script exists:
`scripts/run-k8s-attach-detach-loop.sh`.
- TestOps registry entry exists:
`internal/testops/registry/iscsi-p3-attach-detach-loop.json`.
- default loop count comes from `SW_BLOCK_ATTACH_DETACH_ITERATIONS`.
- #QA status: PASS on M02, 3 iterations.
## Recently Closed Milestone: iSCSI-P4 CHAP / Access Control
- Goal:
- reach V2-level iSCSI auth behavior before any security-facing claim.
- Tasks:
- status: done in PR #41.
- target-side CHAP login negotiation:
- status: done in PR #41.
- direct LoginOp is rejected when CHAP is required,
- `AuthMethod=None` is rejected when CHAP is required,
- target emits CHAP MD5 challenge,
- correct username/response advances to LoginOp,
- wrong response fails closed,
- missing `CHAP_R` fails closed.
- `cmd/blockvolume` opt-in flags:
- status: done in PR #41.
- `--iscsi-chap-username`,
- `--iscsi-chap-secret`,
- flags require `--iscsi-listen`,
- username and secret must be set together.
- OS initiator CHAP smoke script:
- status: QA green.
- configure `iscsiadm` node auth before login,
- prove correct secret succeeds and wrong secret fails without residue.
- Kubernetes / CSI Secret integration:
- status: QA green on M02 at `9a1fe07`.
- CSI node consumes CHAP credentials from `NodeStageVolumeRequest.Secrets`,
- controller publish path must not copy CHAP secrets into `publish_context`,
- node configures `iscsiadm` CHAP settings after discovery and before login.
- launcher can render target-side CHAP env vars from a Kubernetes Secret,
- alpha runner can create the Secret and inject StorageClass
node-stage secret refs.
- replayed challenge rejected if supported by the protocol path,
- Close bar:
- unauthenticated access fails when CHAP is required,
- authenticated access succeeds,
- failed auth leaves no partial session/device state.
- QA/tooling:
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-chap-lab-validation.md`.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p4-k8s-chap-validation.md`.
- #QA status:
- K8s CHAP dynamic PVC PASS on M02.
- default non-CHAP regression PASS on M02.
- V2 CHAP tests are the reference coverage inventory.
## Recently Closed Milestone: iSCSI-P5 CSI Node Lifecycle
- Goal:
- make kubelet retry/restart behavior safe enough for real clusters.
- Tasks:
- status: QA green on `iscsi/csi-node-lifecycle@4ee35c0`.
- local CSI node lifecycle guards:
- status: done in PR #41.
- NodeStage idempotency,
- mounted staging path must belong to the same volume,
- mounted staging path for another volume fails closed.
- NodeUnstage idempotency,
- unmounted staging path still logs out and removes local state.
- login failure cleanup,
- login failure does not record staged state.
- mkfs failure cleanup,
- already covered: successful login is logged out when mount fails.
- stale session detection,
- existing iSCSI login without staged volume identity fails closed,
- plugin restart may reuse an existing login only when `.volume` matches.
- plugin restart fallback,
- existing transport-file fallback covers unstage after restart.
- NodeStage restart identity is covered by `.volume`.
- repeated stage/unstage,
- local 3-cycle stage/unstage test leaves no staged state,
`.volume`, or `.transport`.
- wrong volume at staging path fails closed.
- #QA CSI node restart while PVC remains,
- script prepared: `scripts/run-k8s-csi-node-restart.sh`,
- TestOps scenario prepared: `iscsi-p5-csi-node-restart`,
- assignment: `internal/docs/qa-assignments/iscsi-p5-csi-node-lifecycle-validation.md`,
- status: QA PASS on M02.
- Close bar:
- kubelet retries do not wedge the node plugin,
- failed attach leaves no leaked device or session,
- repeated create/delete works without manual host cleanup.
- QA/tooling:
- #QA status: PASS on M02.
- manual kubelet poking is allowed only for first reproduction.
## Recently Closed Milestone: iSCSI-P6 ALUA / MPIO / Mounted Failover
- Goal:
- make mounted-volume failover a real frontend behavior instead of only a
reconnect story.
- Tasks:
- status: completed in PR #42 scope; QA green on
`iscsi/csi-node-lifecycle@d1025f1`.
- #design(iscsi-p6-alua-mpio-design) ALUA/MPIO policy and protocol shape:
- owner: dev.
- output: `internal/docs/ref/iscsi-p6-alua-mpio-design.md`.
- must be reviewed before changing protocol behavior.
- #design(iscsi-p6-qa-assignment) real initiator validation shape:
- owner: dev.
- output: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- must define the lab command, non-claims, and pass/fail criteria.
- V2 coverage alignment:
- status: design inventory added.
- do not copy V2 role/state ownership,
- do match V2 externally visible ALUA/MPIO protocol coverage unless V3
explicitly rejects a behavior.
- ALUA state model:
- status: local protocol slice done on `iscsi/csi-node-lifecycle`.
- active optimized,
- active non-optimized,
- standby,
- unavailable,
- transitioning.
- standby command policy:
- status: local protocol slice done; tightened by PR #42 review fix.
- metadata/path probing allowed,
- data READ, WRITE, and SYNCHRONIZE_CACHE fail closed on non-active
paths.
- standard INQUIRY TPGS discipline:
- status: local protocol slice done.
- TPGS stays off until REPORT TARGET PORT GROUPS and ALUA VPD identity
are implemented,
- when enabled, advertise implicit ALUA only unless explicit transitions
are implemented.
- REPORT TARGET PORT GROUPS:
- status: local protocol slice done.
- no-provider rejection,
- short allocation truncation,
- five-state reporting.
- VPD 0x83 target-port identity:
- status: local protocol slice done.
- NAA stable per volume,
- target port group and relative target port distinguish paths,
- short allocation length and no-ALUA branches tested.
- VPD 0x00 remains advertised-pages-equal-implemented-pages:
- status: local protocol slice done.
- state change while I/O is in flight:
- status: local protocol state-change test done.
- concurrent REPORT TARGET PORT GROUPS and standby write reject tests:
- status: done in PR #43.
- frontend state provider wiring:
- status: local P6-C slice done on `iscsi/csi-node-lifecycle`.
- connect ALUA provider to current V3 frontend facts without importing
authority or placement.
- mapping:
- frontend Healthy => active optimized,
- locally healthy but superseded/non-writable => standby,
- recovering => transitioning,
- idle supporting path => standby for metadata/path probing,
- degraded/identity mismatch => unavailable.
- path identity:
- NAA is stable per volume,
- target port group and relative target port are stable per
volume/replica path.
- multipath initiator test:
- status: QA green on `iscsi/csi-node-lifecycle@88e9301`.
- script: `scripts/run-iscsi-alua-os-smoke.sh`.
- script: `scripts/run-iscsi-alua-multipath-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- current claim: one active path reports ALUA through real Linux `sg_inq`
and `sg_rtpg`, then completes mkfs/mount/checksum/logout.
- current two-path claim: two iSCSI portals for one volume can be logged
in by Linux, report active/standby ALUA state, reject standby WRITE,
and appear as one logical device in `multipath -ll`.
- standby/probe session prerequisite: local P6-D slice implemented.
Non-active ALUA paths may use a borrowed metadata backend after
`Provider.Open` returns not-ready, so Linux can probe INQUIRY/VPD/RTPG
without allowing data I/O.
- #QA Test 1B PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T093732Z-iscsi-p6-alua-mpath-fix`.
- evidence: two iSCSI paths, common NAA, distinct TPG/RTP, r1
active/optimized, r2 standby, standby WRITE rejected, `multipath -ll`
grouped both paths under `mpatha`.
- non-claim: mounted workload failover still needs P6-E.
- primary failover while mounted:
- status: QA green on `iscsi/csi-node-lifecycle@d1025f1`.
- script: `scripts/run-iscsi-alua-mounted-failover-smoke.sh`.
- assignment: `internal/docs/qa-assignments/iscsi-p6-alua-mpio-lab-validation.md`.
- verified claim: mounted Linux multipath device can read a
pre-failover checksum and write a post-failover checksum after r1 is
killed and r2 reaches `Healthy=true` at a newer epoch.
- #QA Test 2 PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T094503Z-iscsi-p6-mounted-failover`.
- evidence: `/dev/mapper/mpatha` mounted, pre-failover checksum read
after failover, post-failover checksum written and verified, r2
promoted to `Epoch=2`, old r1 gate-rejected stale writes/syncs, no
active sessions or multipath residue after cleanup.
- old primary cannot serve stale successful I/O:
- status: QA green for killed-old-primary path on `d1025f1`.
- old-primary-return proof remains future soak/fault coverage, not required
for P6 alpha close.
- Close bar:
- real initiator sees correct ALUA/MPIO behavior,
- mounted workload survives or fails/reconnects according to documented
policy,
- byte-equal data proof after failover,
- no stale-primary success.
- QA/tooling:
- #QA active-path ALUA OS script is ready.
- #QA two-path multipath script is green on M02.
- #QA mounted multipath failover script is green on M02.
- do not rely on in-process protocol tests only.
## Recently Closed Milestone: iSCSI-P7 Performance And Backend Matrix
- Goal:
- make performance experiments comparable without turning early numbers into
product claims.
- Tasks:
- status: QA green on `iscsi/p7-performance-matrix-clean@6826139`.
- walstore baseline fio,
- smartwal fio behind explicit flag,
- Linux iSCSI loopback matrix,
- record fio summary and cleanup state.
- deferred:
- RoCE / 10.0.0.x lab path if available,
- 1GbE vs 25GbE comparison,
- pgbench scenario,
- CPU, memory, latency, and bandwidth sweep.
- script: `scripts/run-iscsi-backend-fio-matrix.sh`.
- assignment:
`internal/docs/qa-assignments/iscsi-p7-backend-fio-matrix-validation.md`.
- #QA PASS on M02:
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T215457Z-iscsi-p7-backend-fio`.
- fio profile: 4 KiB randrw, psync, iodepth=1, size=128m,
runtime=60s.
- walstore: PASS, about 124 read IOPS / 124 write IOPS.
- smartwal: PASS, about 124 read IOPS / 125 write IOPS.
- cleanup: no active iSCSI sessions and no blockmaster/blockvolume
processes.
- non-claim: single-host loopback only, not a product performance claim.
- Close bar:
- same test runner scenario can compare backends,
- no silent backend switch,
- results are labelled experimental until SLOs exist.
- QA/tooling:
- #QA run the backend matrix on M02 first.
- #QA if RoCE is available, rerun with explicit 10.0.0.x portal path and
record the network path in the report.
- avoid manual benchmark notes without a repeatable scenario.
## Recently Closed Milestone: iSCSI-P8 Compatibility And Soak
- Goal:
- turn the current alpha iSCSI feature set into repeatable compatibility and
soak evidence without making performance claims.
- keep frontend protocol behavior stable while K8s and backend tests get
longer and more varied.
- Tasks:
- local ALUA concurrency guard:
- status: done on `iscsi/frontend-hardening`.
- cover concurrent REPORT TARGET PORT GROUPS while data READ/WRITE on a
standby path is rejected.
- closes the P6 pending item for concurrent RTPG plus standby reject.
- OS initiator soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat `run-iscsi-os-smoke.sh` with fio for a longer runtime.
- record session errors, fio summary, goroutine/process cleanup, and
final `iscsiadm -m session`.
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T223240Z-iscsi-p8-soak-38ff850`.
- evidence:
- 2 iterations,
- 120s fio per iteration,
- `iscsiadm mkfs mount write/read logout` PASS,
- no active sessions after final cleanup.
- K8s CSI soak:
- #QA green on `iscsi/frontend-hardening@38ff850`.
- repeat attach/detach and fio paths with explicit iteration/runtime
values.
- record whether launcher owner-reference cleanup remains clean.
- evidence:
- `[alpha-fio] PASS`,
- `[attach-loop] PASS: 3 attach/detach app PVC cycles completed`,
- no sw-block PVC or deployment residue.
- compatibility matrix:
- #QA green for M02.
- document exact host distro, kernel, open-iscsi version, fio version,
and sg3-utils/multipath versions when used.
- add more hosts only when the first soak is repeatable.
- Close bar:
- local protocol concurrency tests green,
- one OS fio soak green,
- one K8s attach/detach or fio soak green,
- all runs leave no active sessions, mounts, multipath maps, or K8s residue.
- QA/tooling:
- prefer wrappers with env knobs over manual command sequences.
- label all runtime/throughput numbers as soak evidence, not benchmark
claims.
- #QA assignment:
`internal/docs/qa-assignments/iscsi-p8-compat-soak-validation.md`.
- #QA status:
- PASS on M02 at `38ff850`.
- final line:
`[iscsi-soak] PASS: compatibility soak completed`.
- non-claim:
compatibility probe only, not a long-running soak or performance claim.
## Recently Closed Milestone: TestOps For Frontend Lab Gates
- Goal:
- reduce false failures from manual multi-step lab runs by moving P8-style
gates into one TestOps entry point.
- keep existing shell scripts as the execution backend first; do not rewrite
all harness logic before the gate is stable.
- Tasks:
- #QA package P8 compatibility soak as a TestOps scenario:
- status: done; wrapper proven green in standalone runner and carried back
into the product planning flow.
- must record commit SHA, command, artifact root, step result, final line,
and cleanup status in a single result file.
- initial scenario may call `scripts/run-iscsi-compat-soak.sh`.
- pin alpha image build/import before K8s frontend gates:
- status: QA green at `c3a6e28`; workload composition hook active in this
branch.
- script: `scripts/build-alpha-images.sh`.
- TestOps scenario: `alpha-images-pin-build`.
- contract:
- build `sw-block:local` and `sw-block-csi:local`,
- optionally import both images into k3s containerd with
`SW_BLOCK_IMPORT_K3S=1`,
- record Docker image IDs,
- record `blockmaster`, `blockvolume`, and `blockcsi` `--version`
output,
- downstream K8s harnesses may consume the build output with
`SW_BLOCK_ALPHA_IMAGES_ENV=/path/to/pin-build/alpha-images.env`,
- fail before protocol smoke tests if build/import/version capture fails.
- composed TestOps workload scenarios:
- status: QA green at `cf9183a`.
- `nvme-p5-csi-dynamic`,
- `nvme-p5-default-iscsi-regression`.
- developer-owned P5 suite:
- status: QA green at `67592f2`.
- `scripts/testops-run-nvme-p5-suite.sh`,
- runs pin-build, then both P5 workload scenarios,
- passes `alpha-images.env` forward mechanically,
- writes one suite-level `result.json`.
- reason:
- NVMe-P5 showed that stale k3s images can mimic product protocol bugs.
The build/import step must be one reviewed gate, not manual lab memory.
- platform extraction target:
- status: seed shape extracted into standalone runner and native suite
flow; continue hardening in runner repo.
- port this V3 reference implementation into reusable runner primitives:
- `testops_pin_build` for build/import/version/image provenance,
- `consume_pin` for passing pinned outputs between phases,
- `assert_revision_matches` for component/runtime SHA checks,
- suite linkage that passes prior phase outputs without ad-hoc env-file
conventions.
- reference hardware evidence:
- `alpha-images-pin-build` PASS at `cf9183a`,
- `nvme-p5-csi-dynamic` PASS at `cf9183a`,
- `nvme-p5-default-iscsi-regression` PASS at `cf9183a`.
- runner-native protocol release suite:
- status: QA green on M02 at product `033028e` and runner `3c1b660`.
- suite: `testops/suites/protocol-release-gate.yaml`.
- command shape:
`swblock suite --results-dir <root> --env product_root=<remote-root>
--env ssh_key=<key> testops/suites/protocol-release-gate.yaml`.
- children:
- `iscsi-p6-alua-failover-chain`,
- `nvme-p4-multipath-failover-chain`,
- `nvme-p5-csi-protocol-chain`,
- `iscsi-p8-compat-soak-chain`.
- validation:
`swblock validate-bundle --profile protocol-release-gate <suite-run>`.
- define the minimal result contract:
- scenario name,
- repository SHA,
- host,
- step table,
- artifact paths,
- cleanup checks.
- keep product development unblocked:
- TestOps work should not change iSCSI protocol code.
- product branches can continue using scripts until TestOps reaches parity.
- Close bar:
- one command runs the P8 full lab gate,
- old-commit/stale-binary ambiguity is impossible or explicitly reported,
- result file is enough for review without reading raw terminal output.
- one runner-native command runs the full iSCSI/NVMe/CSI/soak release gate,
and `validate-bundle --profile protocol-release-gate` accepts the bundle.
- QA/tooling:
- Dev owns the core test content and uses TestOps as the primary dev loop.
- QA may run the same scenarios, add lab automation, and improve collection,
but should not be the only path that can execute a gate end-to-end.
- prefer small TestOps wrapper over a wholesale scenario DSL rewrite.
## Recently Closed Milestone: NVMe-oF / ANA Parity Planning
- Goal:
- bring NVMe-oF up to the same product discipline as the now-green iSCSI
frontend.
- treat V2 NVMe behavior as the feature floor, not code to copy blindly.
- understand the old high-performance path before touching protocol code.
- Reference:
- `internal/docs/ref/nvme-ana-parity-plan.md`.
- `internal/docs/ref/nvme-v2-coverage-gap-audit.md`.
- Tasks:
- NVMe-P0 audit:
- status: initial audit done; keep updating as code lands.
- compare V2 NVMe implementation and scenarios against current V3.
- classify every visible feature as present, missing, intentionally
deferred, or rejected with product reason.
- specifically answer whether the remembered "control API carries data"
path was standard NVMe/TCP in-capsule data or a custom V2 shortcut.
- initial answer: standard in-capsule data; no custom V2 vendor/admin data
command found in the NVMe package.
- NVMe-P1 OS kernel baseline:
- status: QA green on M02.
- script: `scripts/run-nvme-os-smoke.sh`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p1-os-smoke-validation.md`.
- #QA evidence:
- basic OS path PASS on M02,
- 60s fio PASS on M02,
- loopback 4 KiB fio used inline writes only,
- no test NQN or process residue after cleanup.
- build a repeatable `nvme connect -> mkfs -> mount -> fio/checksum ->
disconnect` script.
- dynamic ports only.
- no stale sessions or target processes.
- NVMe-P2 in-capsule / R2T performance path:
- status: QA green on M02 with host-specific classification.
- target now reports transport counters in `blockvolume.log` on close:
inline writes, R2T writes, H2C/C2H PDU counts, and read/write/flush
command counts.
- P1 observation: Linux `fio --bs=4k` used inline writes exclusively on
M02 (`r2t_writes=0`).
- P2 observation: Linux kernel 6.17.0-19 on M02 did not trigger R2T even
for `fio --bs=128k` or `dd bs=1M`; all writes were fragmented into
inline/in-capsule transfers.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p2-inline-r2t-validation.md`.
- prove whether Linux uses inline data for small writes.
- run 128 KiB+ profiles to force or classify the R2T path.
- add visible counters or artifacts for inline vs R2T writes.
- follow-up:
- R2T requires a different initiator/profile or target-side test knob;
current M02 kernel behavior is not a product failure.
- compare iSCSI and NVMe only under labelled network/backend conditions.
- NVMe-P3 ANA identity and log page:
- status: QA green on M02 at `d330e89`.
- provider: `core/frontend/nvme.ANAProvider`.
- product wiring: `cmd/blockvolume` derives ANA state from the same
frontend projection used by iSCSI ALUA.
- log page: admin Get Log Page `0x0c` returns one ANA group when a
provider is configured.
- mapping:
- frontend Healthy => optimized,
- superseded healthy / idle supporting path => non-optimized,
- recovering => ANA change,
- degraded / identity mismatch => inaccessible.
- guard: Identify Controller / Namespace ANA fields remain zero without a
provider.
- P3-C behavior: with a provider, Identify Controller advertises ANA,
Identify Namespace carries the provider's ANA group, and Get Log Page ANA
reports the same group/state.
- OAES ANA Change Notice remains off; no async event producer exists yet.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p3-ana-log-validation.md`.
- #QA evidence:
- ANA log `group_id=1`, `state=0x01`, `nsid=1`,
- Identify Controller `cmic=0x8`, `anagrpmax=1`, `nanagrpid=1`,
- Identify Namespace `anagrpid=1`,
- no `nvme_parse_ana_log` kernel warning,
- mkfs/mount/checksum PASS after ANA advertisement is enabled.
- NVMe-P4 multipath and mounted failover:
- status: fully QA green on M02 at `e1e0e0c`.
- #design:
`internal/docs/ref/nvme-p4-multipath-failover-design.md`.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p4-multipath-lab-validation.md`.
- reach the iSCSI P6 bar for NVMe multipath.
- Test 1/2 discovery and native grouping:
- status: QA green on M02 at `a5ef1a5`.
- script: `scripts/run-nvme-multipath-smoke.sh`.
- evidence:
- run ID `20260507T161800Z-test`,
- two NVMe/TCP paths registered immediately,
- native Linux multipath exposed one namespace device,
- ANA log `group_id=1`, `state=0x01 optimized`, `nsid=1`,
- identity `nguid=24634c35194743419febbb18e06446be`,
`eui64=24634c3519474341`, `anagrpid=1`,
- final line:
`[nvme-mpath] PASS: two NVMe/TCP paths expose one ANA-aware namespace`.
- decision: single ANA group is sufficient for the current two-path
native multipath identity model.
- mounted failover:
- status: QA green on M02 at `e1e0e0c`.
- script: `scripts/run-nvme-mounted-failover-smoke.sh`.
- local guard:
- metadata-only standby NVMe path continues to reject I/O before
promotion,
- after ANA state becomes optimized, the same session can pass I/O to
the backend.
- #QA evidence:
- run ID `20260507T170000Z-nvme-p4-mounted-failover`,
- two TCP paths registered and Linux native multipath merged them to
`/dev/nvme1n1`,
- mounted ext4 workload survived active r1 kill,
- r2 promoted to `Epoch=2`, `AuthorityRole=primary`,
`FrontendPrimaryReady=true`,
- `pre.bin` checksum remained OK after failover,
- `post.bin` write/read/verify succeeded after failover,
- cleanup left no test NQN and no blockmaster/blockvolume process.
- NVMe-P5 CSI integration:
- status: QA green on `frontend/nvme-ana-parity-plan@8e0a28f`.
- latest QA:
- red at `622fae7`: StorageClass rendered `protocol: nvme`, but
lifecycle intent had no protocol and generated blockvolume still used
iSCSI args.
- red at `a1d5201`: live StorageClass carried both protocol keys, but
persisted lifecycle JSON still had no `protocol`; current source has
protocol on CSI/RPC/lifecycle, so the harness now gates component
`--version` output to catch stale K8s images before protocol checks.
- green at `69a1d20`: Test 1 NVMe dynamic PVC passed after rebuilt and
k3s-imported images; lifecycle persisted `protocol: "nvme"` and
launcher emitted NVMe args only.
- green at `8e0a28f`: Test 2 default iSCSI regression passed; all three
version gates matched HEAD, lifecycle persisted `protocol: "iscsi"`,
generated manifest used iSCSI args only, and cleanup left no iSCSI or
NVMe residue.
- current fix: prefer product-scoped
`sw-block.seaweedfs.com/protocol`, keep `protocol` as compatibility,
delete stale cluster-scoped StorageClass before apply, capture
`storageclass.live.yaml`, and record `--version` for blockmaster,
blockcsi, and generated blockvolume before judging launcher output.
- allow StorageClass protocol selection without changing the app.
- default StorageClass path stays iSCSI.
- `parameters.sw-block.seaweedfs.com/protocol: nvme` selects NVMe target
facts end-to-end:
- CSI CreateVolume records protocol in lifecycle intent,
- master lifecycle RPC carries protocol,
- launcher renders `blockvolume` with `--nvme-listen`,
`--nvme-subsysnqn`, and `--nvme-ns`,
- CSI ControllerPublish returns `protocol=nvme`, `nvmeAddr`, and `nqn`,
- CSI NodeStage uses `nvme connect`, formats/mounts the NVMe namespace,
and disconnects by NQN on NodeUnstage.
- K8s harness:
- script: `scripts/run-k8s-alpha-nvme.sh`,
- underlying env knob: `SW_BLOCK_FRONTEND_PROTOCOL=nvme`,
- dynamic PVC/app manifest remains unchanged except injected
StorageClass parameter.
- #QA assignment:
`internal/docs/qa-assignments/nvme-p5-csi-protocol-selection-validation.md`.
- platform lesson:
- stale k3s images cost multiple lab rounds; TestOps pin-build/import
should make build, k3s image import, digest capture, and component
version verification one required step for future release gates.
- NVMe-P6 RoCE / network performance matrix:
- status: deferred to future network/performance plan.
- correctness gates are green; RoCE is no longer part of protocol
readiness closure.
- Close bar for the planning slice:
- audit table exists,
- next code task has a red test or lab reproduction,
- no ANA or performance claim is enabled before matching host evidence.
- QA/tooling:
- protocol assignments remain as historical evidence under
`internal/docs/qa-assignments/`.
- future protocol changes should update the runner-native release gate rather
than adding manual-only QA instructions.
## Current Active Milestone: V2 Parity And Hardening Backlog
- Goal:
- keep iSCSI/NVMe protocol readiness protected by the release gate while
moving active development to remaining V2 parity, product hardening, and
TestOps platform work.
- Work buckets:
- V2 parity audit:
- compare the old `weed/storage/blockvol` scenario corpus against current
V3 capabilities,
- classify each gap as already covered by the release gate, still missing,
intentionally deferred, or rejected with product reason.
- availability/recovery hardening:
- replica return and reintegration,
- RF2/RF3 rebuild and failover matrices,
- WAL retention and flow-control pressure,
- longer soak and failure-injection runs.
- Kubernetes/operator hardening:
- durable blockvolume state beyond throwaway alpha defaults,
- operator/controller lifecycle,
- multi-node attach and non-loopback frontend addressing.
- TestOps platform:
- keep product-owned scenarios in this repo,
- move repeated primitives into the standalone runner,
- use native suite/run-control/validate-bundle for release evidence,
- explore controller/agent mode separately from the open SSH runner path.
- Close bar for the next planning slice:
- a V2 parity matrix exists with explicit disposition per feature/scenario,
- at least one non-protocol hardening gate is runner-native and repeatable,
- protocol release gate remains green after unrelated hardening changes.
## Cross-Cutting Technical Rules
- Protocol code must not decide authority.
- Protocol code must not decide replica readiness.
- CSI must consume frontend facts, not infer storage truth.
- Placement intent is not authority.
- Authority movement is not data continuity.
- Best-effort ACK is not full durability.
- If V2 behavior is copied, copy the test expectation first and adapt the code
to V3 boundaries.
## QA / TestOps Rules
- Prefer scripts or TestOps scenarios over manual command sequences.
- Manual testing is allowed for first reproduction, but convert the result into
a repeatable script or scenario.
- Keep default `go test` focused on unit/component coverage.
- Local binary wiring tests that build product binaries, spawn
`blockmaster`/`blockvolume`, and use loopback protocol clients must use the
explicit `subprocess` build tag. These are not m01/m02 lab integration tests.
- Linux OS/K8s/lab tests that use `iscsiadm`, `nvme-cli`, kernel initiators,
mounts, `sudo`, or m01/m02 cleanup state belong in runner-native TestOps
scenarios, not default `go test` and not the local `subprocess` tag.
- When a subprocess or runner integration test fails, first ask whether its
assertion can be moved down to a component seam such as authority, engine
projection, frontend protocol adapter, lifecycle rendering, or
ready-assignment handling. Keep only binary wiring, real OS frontend I/O,
process lifecycle, and lab cleanup in the runner layer.
- QA report must include:
- branch and commit,
- command,
- lab host,
- result,
- artifact path,
- cleanup state,
- exact log line for any failure.
## PR Cadence
- Use milestone PRs, not one PR per tiny fix.
- Target one or two PRs per day at most.
- For the current active milestone, keep parity matrix updates, non-protocol
hardening gates, and runner scenario changes grouped by reviewable outcome.
- Split OS/K8s harness work only if it becomes too large to review cleanly.
## Finish Action
- When a milestone closes, move the finished plan and related references into a
dedicated directory, for example `internal/docs/finished/iscsi-p2/`.
- Keep `current-plan.md` focused on the next active milestone.
@@ -0,0 +1,427 @@
# Finished Plan: Phase 20 - Activation / Day-1 Ops MVP
Status: closed after the v0.2 alpha Day-1 activation PR merged to `main`.
The script-based activation path, first-volume loop, read-only report, release
note, PM evaluation guide, and user-facing README/tutorial updates are complete.
Previous closed capability:
- `finished-plans/phase19_finishedplan_control_plane_observation_ai_readable_ops_mvp.md`
- Control-plane observation QA evidence: run `20260517-011004-4b79`.
## Release Ladder From Here
- `v0.2-alpha` (this plan): script-based Day-1 activation and first-volume
loop. Users can activate the stack, create one PVC, verify writer/reader
data, generate a local read-only report, and clean up.
- `v0.3-alpha` (next): Helm activation. Convert the supported install path into
a Kubernetes-native chart while preserving preflight, first-volume smoke,
report generation, and cleanup evidence.
- `v0.4-beta-candidate` (after Helm): Operator lifecycle. Add CRDs,
Conditions, Events, and day-2 reconciliation for install status, node
eligibility, volume lifecycle, recovery observation, and safe cleanup.
Product guidance: do not jump directly from scripts to operator. Helm is the
right next release because it makes installation regular and reviewable without
locking us into a CRD/operator lifecycle contract too early. The operator
release is more meaningful as a product milestone because it can close the
Kubernetes lifecycle loop, but it should build on a charted install contract.
## Product Question
Can a new Kubernetes user complete one understandable block-storage activation
loop without reading internal docs or SSHing into every node?
```text
preflight
-> install
-> node readiness
-> create PVC
-> volume ready
-> write/read app
-> status/timeline/evidence
-> cleanup
```
Expanded product loop:
```text
install Seaweed Block from one documented path
-> verify node readiness and blockers
-> create one PVC-backed volume through Kubernetes
-> run an app write/read check
-> inspect read-only CLI/status evidence
-> collect product evidence, inventory, logs, and support bundle
-> uninstall cleanly
```
This plan is about activation and day-1 operations. It should not add new HA,
backup, restore, repair, or mutating admin claims.
## Core Thesis
The product is now strong enough in recovery and observation that the next
highest-friction gap is the user journey around it. A good block product needs
more than a working CSI path: users need to install it, understand whether each
node is usable, create volumes, see what happened, and capture evidence when it
is not healthy.
The implementation should reuse the Phase 19 observation surface. Dashboard,
CLI, logs, and bundles should all describe the same facts with stable reason
codes.
## Scope
### D1: Install Loop
- Keep `scripts/install-k8s-alpha.sh` as the implementation substrate for this
phase.
- Add a simpler documented wrapper path if needed. This should wrap preflight,
local image build/import, install, rollout wait, and summary. It may be a
script first; a `sw-block install k8s-alpha` CLI is optional and should not
block the first gate.
- Dev slice: `scripts/activate-k8s-alpha.sh` is the first wrapper path. It
calls `preflight-k8s-alpha.sh`, `build-alpha-images.sh`,
`install-k8s-alpha.sh`, applies the alpha StorageClass, captures rollout
readiness, and writes `activation-summary.txt`.
- Image path split:
- `SW_BLOCK_ACTIVATION_IMAGE_MODE=local` (default) builds/imports
`sw-block:local` and `sw-block-csi:local` for dev and QA work-tree
validation.
- `SW_BLOCK_ACTIVATION_IMAGE_MODE=published` skips local build/import,
runs GHCR preflight, and installs `ghcr.io/seaweedfs/seaweed-block:alpha`
plus `ghcr.io/seaweedfs/seaweed-block-csi:alpha` unless overridden.
This is the PM/user-path test surface. Prefer `sha-<commit>` or release
tags over mutable `:alpha` for close validation.
- Add a user-facing install path in README/docs that makes prerequisites,
expected components, and verification commands explicit.
- Emit a concise install summary:
- master ready,
- CSI controller ready,
- CSI node ready count,
- StorageClass present,
- selected protocol,
- selected ACK profile,
- known non-claims.
- Dev slice: summary fields are stable key/value lines:
`activation_status`, `master_ready_replicas`,
`csi_controller_ready_replicas`, `csi_node_ready`,
`storageclass_provider`, `protocol`, `ack_profile`, and next status /
inventory commands.
- Failed install should explain the blocker: missing tool, missing k3s access,
image import failure, pod not ready, or node prerequisite mismatch.
- QA slice: `testops/scenarios/activation-day1-install-chain.yaml` validates
the D1 install-to-ready path.
### D2: Node Readiness
- Provide a read-only node readiness view before claiming add-node automation.
- A node row should make clear:
- Kubernetes node name,
- CSI node pod status,
- iSCSI / multipath prerequisite status where applicable,
- whether the node is eligible for blockvolume placement,
- frontend address mode: loopback or non-loopback,
- blocker reason if not eligible.
- If this phase adds an `add-node` command, it must be conservative: preflight
and explain eligibility first; mutating scheduling or rebalance behavior is
out of scope unless separately gated.
### D3: Add-Volume Loop
- Document the canonical dynamic PVC path as the normal volume creation path.
- Provide a minimal user-facing "add volume" path. This can be a documented
PVC YAML template first. A CLI helper is optional and, if added, must be a
thin generator around Kubernetes PVC creation. It must not bypass PVC/CSI.
```bash
kubectl apply -f examples/kubernetes/basic-app/storageclass-pvc.yaml
```
- The close gate must prove at least two volumes can be created and listed
without attribution or port/status collisions.
- Add or improve a small command/view that maps:
```text
PVC -> PV -> volume_id -> replicas -> primary -> frontend -> events -> bundle
```
- The user should be able to create one PVC, watch it become ready, and see the
same volume appear in CLI/dashboard evidence.
- Dev slice: `scripts/run-basic-app-example.sh` runs the canonical
`examples/kubernetes/basic-app` PVC/writer/reader loop, collects
`sw-block ops cluster` and `sw-block ops inventory` evidence, and writes
`first-volume-summary.txt`.
- QA slice: `testops/scenarios/activation-day1-first-volume-chain.yaml`
validates the published-image Day-1 first-volume path.
### D4: Read-Only Status / Dashboard View
- Dashboard/status view is read-only for this plan.
- It may be a local web view, static report, or CLI-driven status page. Do not
make the close depend on a full hosted UI unless that implementation is
deliberately chosen.
- Product positioning:
```text
V2 UI shape:
cluster / servers / volumes / ops
V3 sw-block data model:
PVC / PV / volume_id / replica / primary / frontend / epoch /
event timeline / bundle / reason codes
```
- Build a read-only block dashboard/status view modeled after the SeaweedFS
`/block/` information architecture, backed by the Phase 19 observation API,
with no mutating admin actions.
- Dev slice: `sw-block ops report` renders a static read-only status page from
either live `--master-api` evidence or a saved support bundle. It writes
`index.html`, `cluster-evidence.json`, `timeline.jsonl`, and `summary.txt`
from the shared observation core.
- Day-1 helper slice: `scripts/run-basic-app-example.sh` now generates
`status/report/index.html` after writer/reader verification, so the first
volume bundle contains a user-readable status page and machine-readable
evidence together.
- Reuse lessons from the V2 SeaweedFS block UI where useful:
- reference files:
`C:\work\seaweedfs\weed\server\master_server_handlers_block_ui.go`,
`C:\work\seaweedfs\weed\server\master_server.go`,
`C:\work\seaweedfs\weed\storage\blockvol\blockapi\types.go`,
- useful read-only shape: cluster cards, server table, volume table,
replica details, health counters, barrier/failover/rebuild counters,
- do not copy mutating V2 operations into this phase: create, delete,
promote, expand, assign, or force actions.
- Minimum pages or panels:
- cluster summary,
- node readiness,
- volumes table,
- volume detail,
- event timeline,
- support bundle / log links.
- The dashboard must consume product-owned observation data, not scrape random
pod logs as its primary source.
- Logs are supporting evidence, not authority.
- Mutating actions such as promote, repair, delete, rebuild, failback, and
cleanup buttons are explicitly out of scope.
- Enterprise UI boundary: first ship observation. Add admin workflows only
after each workflow has a separate product spec, RBAC/audit model, and strict
QA gate.
### D5: Status / Logs / Bundle Loop
- The default CLI path should stay useful without the dashboard:
```text
sw-block ops cluster --master-api <addr>
sw-block ops volumes
sw-block ops describe volume <id>
sw-block ops timeline volume <id>
sw-block ops inventory --namespace <ns> --master <addr> --out <dir>
```
- Text output should be human-readable and AI-readable.
- JSON/JSONL output should remain stable enough for dashboard, CI, and support
assistant use.
- Every unhealthy state should include a reason code and next inspection step.
### D6: README And User Path
- README must present Seaweed Block as an alpha/early-beta product loop, not a
collection of internal gates.
- README must keep claims narrow:
- not production-ready,
- no full HA claim,
- no backup/restore,
- no upgrade safety,
- no mutating admin operations,
- no hosted dashboard unless implemented and gated.
- The documented quick path must match the commands the close gate runs.
- Dev slice: README and `docs/quickstart-kubernetes.md` were rewritten around
the end-user path: activate, first PVC, writer/reader verification, local
read-only report, troubleshooting evidence, and cleanup. Internal gate
details remain in QA docs instead of the user tutorial.
### D7: TestOps Controller / Agent Evidence Loop
- Treat TestOps as product infrastructure for this phase, not as ad-hoc
scripting. The current runner is already the Windows-side controller: it owns
`run_id`, phase/action status, timeouts, cleanup, and the central result
bundle.
- Add a controller/agent track rather than relying only on SSH:
- controller stays on the Windows/dev workstation and runs scenarios,
distributes binaries/scripts, owns cancellation, and writes the final
bundle;
- Linux node agents on m01/m02/tp01 collect local evidence and eventually
execute bounded jobs;
- SSH remains fallback until the agent proves stable.
- First useful agent capability:
- `/healthz` with node name, version, uptime;
- `collect_node_snapshot` for process, iSCSI sessions, multipath, NVMe,
mounts, disk, kernel tail, network, containerd/k3s images, and kubelet
status;
- `collect_path` for local artifact pickup;
- cancellation-aware bounded command execution later, after snapshot is
proven.
- K8s/block failure auto-collect should become a gate rule:
- on phase failure, collect node snapshots from involved nodes,
- collect Kubernetes state (`kubectl get`, `describe`, events, selected logs,
rendered manifests vs live objects),
- collect product state (`sw-block ops cluster`, inventory, timeline/events),
- then run cleanup and collect after-clean state.
- Why this is in the plan: Day-1 first-volume r1/r2 showed that without
automatic evidence, a timeout is ambiguous; with `writer-describe.txt`, the
root cause was immediately visible as loopback publish target vs cross-node
writer placement.
- Open-source analogs to learn from, not copy blindly:
- Sonobuoy: Kubernetes aggregator plus job/daemonset plugins; useful model
for cluster-wide collection and per-node log gatherers.
- Ansible Runner / AWX execution nodes: useful model for transmit -> worker
-> process and central artifact handling.
- Jenkins controller/agent: useful model for scheduling jobs onto prepared
nodes.
- Robot Framework remote libraries: useful model for remote capability
exposure, but too generic for block-specific node snapshots.
- Non-goal for Phase 20: do not rewrite the runner. Add snapshot collection and
failure auto-collect first; move remote exec to agent only after the evidence
loop is stable.
## Non-Claims
This plan does not claim:
- production installer/operator lifecycle,
- full Helm/operator packaging unless explicitly chosen as the implementation,
- online upgrade or rollback safety,
- mutating dashboard actions,
- automatic repair/rebuild/failback,
- backup/snapshot/restore,
- new HA semantics beyond closed RF=3 gates,
- transparent node-loss failover beyond existing closed claims,
- broad distro/kernel compatibility.
## Hard Gate
The close gate should run from a fresh supported Kubernetes lab and prove:
1. One documented command path runs preflight, install, rollout wait, and
install summary.
2. Node readiness view identifies at least one eligible node and explains any
blockers.
3. A PVC is created through the documented Kubernetes path.
4. The generated product-owned volume becomes ready.
5. An app writes and reads data through the mounted PVC.
6. `sw-block` status/evidence explains PVC -> volume -> replica -> primary ->
frontend -> timeline.
7. Product evidence and inventory/support bundle are collected.
8. Cleanup/uninstall leaves no active iSCSI sessions, stale blockvolume
Deployments, stale port-forwards, or unexpected product pods.
9. README quick path matches the commands used by the gate.
10. Failure bundles include automatic K8s/product/node evidence sufficient to
explain at least one failed first-volume run without manual SSH.
## Suggested Close Claim
Seaweed Block provides an alpha install-to-operate loop for Kubernetes users:
from a fresh supported lab, run one documented install path, create a
PVC-backed block volume, verify app write/read, inspect read-only status and
timeline evidence, collect support artifacts, and uninstall cleanly.
## Next Product Choices After This
- Phase 21: Helm Activation MVP.
- Phase 22: Operator Lifecycle MVP.
- Backup / Snapshot / Restore MVP for data protection.
- Rebuild / Reintegration / Failback MVP for returned replicas.
- Mutating admin controls with RBAC/audit hard gates.
## Phase 21 Candidate: Helm Activation MVP
Product question:
```text
Can a Kubernetes user install Seaweed Block as a normal chart, create a first
PVC, inspect status/report evidence, and uninstall without relying on internal
script-only manifest mutation?
```
Scope:
- Add `charts/seaweed-block/` for blockmaster, CSI controller/node, CSI driver,
RBAC, StorageClass, CHAP Secret, and cluster-spec ConfigMap.
- Add `values.yaml` and `values.schema.json` for:
- images and immutable tags/digests,
- namespace and StorageClass name,
- ACK profile,
- frontend protocol,
- external iSCSI/status,
- CHAP configuration,
- cluster/node specs,
- Stage 2 multipath,
- resource requests and tolerations/node selectors where needed.
- Keep `scripts/activate-k8s-alpha.sh` as a wrapper that can generate
`values.day1.yaml`, run preflight, call `helm install`, run the first-volume
smoke, generate `sw-block ops report`, and verify cleanup.
- Do not claim upgrade safety until a separate Helm upgrade/rollback smoke
passes.
Hard gate:
1. Fresh supported cluster passes preflight.
2. `helm install` with generated Day-1 values reaches blockmaster and CSI
readiness.
3. First PVC writer/reader loop passes.
4. `sw-block ops report` is generated from live product evidence.
5. `helm uninstall` plus host cleanup leaves no iSCSI sessions, product pods,
generated blockvolume Deployments, or unexpected StorageClass residue.
6. README/quickstart describe Helm as the preferred user install path and keep
scripts as dev/TestOps helpers.
Non-claims:
- no operator/CRD lifecycle yet,
- no online upgrade/rollback safety until gated,
- no mutating admin actions,
- no backup/restore or rebuild/failback claim.
## Phase 22 Candidate: Operator Lifecycle MVP
Product question:
```text
Can Seaweed Block become a Kubernetes-native product loop where users see
cluster, node, volume, and recovery lifecycle through CRDs, Conditions, Events,
and read-only dashboard/API evidence?
```
Scope:
- Add CRDs such as `SeaweedBlockCluster`, `SeaweedBlockNode`, and/or
`SeaweedBlockVolume` only after the exact lifecycle ownership is specified.
- Operator owns install/upgrade status, node eligibility, desired StorageClass,
CHAP Secret references, blockmaster/CSI rollout state, and cleanup
reconciliation.
- Conditions must be first-class and user-readable:
`Ready`, `Degraded`, `Recovering`, `Blocked`, `CleanupPending`, with stable
reason codes.
- Events must mirror Phase 19 product observation semantics where possible.
- Mutating actions such as repair, rebuild, promote, failback, or delete remain
out of scope unless each has a separate fencing/RBAC/audit gate.
Hard gate:
1. Apply one CR creates the supported stack.
2. Status Conditions show install progress and node eligibility without SSH.
3. First PVC writer/reader loop passes.
4. A controlled failure updates CR status/events and support evidence.
5. Delete CR cleans Kubernetes resources and verifies host/session cleanup via
documented guardrails.
6. Helm-to-operator migration or coexistence boundary is documented.
Why this release matters:
Operator is the first release that can make Seaweed Block feel like a complete
Kubernetes storage product: installation, status, lifecycle ownership, cleanup,
and user-visible diagnosis are managed by a product control plane instead of a
collection of scripts.
@@ -0,0 +1,90 @@
# Phase 38 Finished Plan: Lifecycle Action Model Executable Contract
Status: closed on 2026-06-10.
Branch: `phase33-testops-failure-hardening`.
## Goal
Turn lifecycle/safe-next-step hints into executable, testable action contracts
before adding mutating operator behavior.
The phase deliberately stopped before finalizers, cleanup execution, promotion,
repair, rebuild, failback, backup, restore, or any new mutating RBAC. Its output
is a bounded decision layer: every surfaced action can explain whether it is
`allowed` or `rejected`, why, which facts it requires, which executor owns it,
which invariants/evidence apply, and whether mutation is allowed.
## Delivered
- Action contract inventory for current ManagedVolume actions, including owner
executor, side-effect class, required facts, policy gate, invariant refs, and
evidence requirements.
- Executable evaluator:
`EvaluateManagedVolumeAction(actionType, ManagedVolumeFacts)`.
- Fail-closed rejection reasons:
`unknown_action`, `policy_disabled`, `missing_required_facts`, and
`mutation_not_allowed`.
- Rejected-action evidence renderer for cold review and QA.
- Surface propagation of action decisions through:
- ManagedVolume projection text,
- `summary.txt`,
- `sw-block ops explain`,
- `operator-snapshot.json`,
- dashboard `/operator-snapshot.json`,
- `SwBlockVolume.status.allowedActions[]`.
- CRD-safe camelCase fields for action status:
`decision`, `decisionReason`, `missingFacts`, `mutationAllowed`, and
`evidenceRequired`.
- Dry-run proof for `safe_k8s.reinstall_external_iscsi` on
`publish_target_loopback_cross_node`: decision `allowed`, mode `dry_run`,
evidence `loopback_cross_node_evidence`, and `mutation_allowed=false`.
- Rejected proof for `authority.request_promotion`: decision `rejected`,
reason `policy_disabled`, side effect `authority_mutating`, and
`mutation_allowed=false`.
## QA Evidence
QA verdict: PASS on source commit `ea1618d`.
Gates:
- G1 local contract tests: PASS.
- G2 rejected action evidence: PASS.
- G3 dry-run loopback action: PASS.
- G4 CRD/RBAC boundary: PASS.
- G5 non-mutation and cleanup: PASS.
Validated commands:
```text
go test ./core/ops ./cmd/sw-block ./cmd/blockcsi ./scripts
helm lint charts/seaweed-block
helm template ... --include-crds --set operatorStatus.create=true --set operatorStatus.dryRun=false
git diff --check
```
Sign-off document:
- `internal/docs/qa-assignments/phase38-action-model-executable-contract-qa-signoff.md`
## Non-Claims
- No finalizer/delete safety was added.
- No automatic cleanup was added.
- No image import, Helm release change, host repair, iSCSI/multipath cleanup, or
hostPath mutation was added.
- No promotion, fencing, rebuild, reintegration, failback, repair, backup,
snapshot, or restore execution was added.
- No dashboard mutation buttons or mutating operator executor were added.
- `authority.request_promotion` remains contract-only and policy-disabled; it is
intentionally not surfaced as an executable live action.
## Follow-Ups
- Restore lab node `tp01` before Phase 39 multi-node delete-safety scenarios;
QA observed it as `NotReady`/unreachable during Phase 38 sign-off.
- Add server-side-dry-run/envtest coverage for CRD status payloads so future
schema drift is caught before live QA.
- Begin Phase 39: safe finalizer/delete-safety as the first narrow mutating
operator path, using the Phase 38 action contract as the precondition layer.
@@ -0,0 +1,103 @@
# Phase 39 Finished Plan: Delete-Safety Status Boundary
Status: closed on 2026-06-13.
Branch: `phase33-testops-failure-hardening`
## Outcome
Phase 39 originally targeted finalizer/delete safety as the first mutating
operator path. Live QA proved that CRD finalizer mutation cannot be bounded by
`swblockvolumes/finalizers` RBAC alone: CRDs expose no usable HTTP
`/finalizers` endpoint, and modifying `metadata.finalizers` requires main
`patch swblockvolumes` authorization.
The product decision was to preserve the Phase 35-38 operator-status safety
boundary. Phase 39 therefore closes as a status/events-only delete-safety
boundary:
- operator-status writes `SwBlockCluster/status`, `SwBlockVolume/status`, and
Kubernetes Events only,
- operator-status does not patch `SwBlockVolume.metadata.finalizers`,
`SwBlockVolume.spec`, workloads, storage resources, or host state,
- delete-safety is visible as blocked/releasable status, reason, evidence,
`CleanupRequired`, safe next steps, and `finalizerReleaseAllowed` as a fact,
- actual finalizer add/remove is deferred to a future lifecycle-owner component.
## Delivered
- Delete-safety contract and decision projection:
- states: `not_requested`, `requested`, `blocked`, `releasable`, `released`,
- blocked residue projects `CleanupRequired=True`,
- clean evidence projects `releasable/allowed`,
- missing/residue evidence never claims deletion is safe.
- Status-only operator boundary:
- Helm RBAC grants CRD reads, CRD `/status` writes, Events create, and
Kubernetes read-only evidence access,
- no finalizers, main CRD patch, PVC/PV, workload, storageclass, secret, node,
or host mutation grant.
- CRD schema hardening:
- `SwBlockVolume.status.allowedActions[].mode` accepts `read_only`,
`dry_run`, and `scripted`,
- regression test covers the enum to prevent the live 422 from returning.
- Multi-volume status isolation:
- delete-safety evidence for one volume does not contaminate other volumes,
- unrelated volumes keep their own identity, status, reason, and publish
target,
- clean delete-safety evidence can project independently on another volume.
## QA Evidence
- D4/D5 status-only re-validation:
`internal/docs/qa-assignments/phase39-d4-d5-finalizer-delete-safety-qa-signoff.md`
- RBAC status/events-only: PASS
- D4 blocked delete-safety status: PASS on `f167f9a`
- D5 clean delete-safety status: PASS
- final cleanup verifier: PASS
- D6 multi-volume status isolation:
`internal/docs/qa-assignments/phase39-d6-multi-volume-delete-safety-status-isolation-qa-signoff.md`
- A blocked delete-safety does not contaminate B/C,
- C can independently become releasable,
- `finalizer_patches=0`,
- no finalizer Events,
- CRD/report surfaces agree.
Local verification during close:
```text
go test ./core/ops ./cmd/sw-block
go test ./cmd/blockcsi ./scripts
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
```
## Non-Claims
Phase 39 does not claim:
- automatic deletion protection for `SwBlockVolume`,
- finalizer add/remove by operator-status,
- PVC/PV finalizer ownership,
- automatic cleanup execution,
- iSCSI/multipath/hostPath deletion by the operator,
- promotion, fencing, rebuild, failback, backup, restore, or NVMe ANA parity.
## Follow-Ups
1. **Clear stale deleteSafety when delete evidence disappears.**
QA observed a within-volume stale field: after a delete-summary was removed,
the volume status returned to ready but retained the prior
`deleteSafety=blocked`. This did not contaminate other volumes, but the field
should be cleared or refreshed to avoid confusing consumers.
2. **Add live/envtest coverage for KubernetesStatusClient.**
Multiple defects in Phases 35-39 passed mock unit tests and Helm rendering but
failed against the real Kubernetes API/CRD/RBAC surface. Add an envtest-style
harness using real CRD schemas and the operator ServiceAccount permissions.
3. **Restore `tp01`.**
Lab infra remains `NotReady`/unreachable. Restore before RF=3 live
multi-node work.
4. **Future lifecycle-owner finalizers.**
Implement finalizer add/remove in the component that owns
`SwBlockVolume` object lifecycle, not in operator-status, unless the project
later chooses an admission-bounded main patch model.
@@ -0,0 +1,159 @@
# Phase 40 Finished Plan: Operator Production Hardening
Status: closed on 2026-06-14.
Branch: `phase33-testops-failure-hardening`
## Outcome
Phase 40 closes the status/events-only operator foundation as a release-ready
boundary. The product can now ship a coherent v0.4 beta slice:
```text
Helm + PVC + read-only/status-only operator status + Events + diagnostics +
delete-safety/install-drift visibility. No lifecycle mutation.
```
The main problem addressed by this phase was not a missing user feature; it was
release trust. Phases 35-39 repeatedly found schema/RBAC defects only in live QA.
Phase 40 added release-candidate gates and conformance checks to catch those
classes earlier, then closed the chart/image skew found by QA.
## Delivered
- Status API conformance gate for `SwBlockCluster.status` and
`SwBlockVolume.status` payload shape:
- casing drift,
- enum drift,
- wrong endpoint usage,
- RBAC broadening,
- delete-safety status.
- Status correctness polish:
- stale `deleteSafety` clearing,
- single effective node `Ready` condition,
- bounded/stable Event identity preserved.
- Read-only install drift visibility:
- chart/app/operator image identity,
- current/desired/missing/mismatched status,
- report/dashboard/operator-snapshot/CRD agreement,
- no upgrade execution.
- Release claim alignment:
- README, quickstart, release note, roadmap, and QA assignments describe the
status/events-only operator foundation and explicit non-claims.
- Release candidate gates:
- local release gate script,
- TestOps status API conformance scenario,
- D6 QA assignment and sign-off.
- Chart/image compatibility fix:
- `--launcher-durable-impl` is gated by
`compat.launcherDurableImplFlag=false` by default,
- non-default `blockmaster.durableImpl` fails fast unless the compat flag is
enabled,
- local RC gate asserts the default chart render omits the incompatible flag.
## Release Images
Published by GitHub Actions run `27490827782` from commit
`dc2972d0059beffb2447ab8546ceb65e646a7b66`.
```text
ghcr.io/seaweedfs/seaweed-block:sha-dc2972d0059b
ghcr.io/seaweedfs/seaweed-block-csi:sha-dc2972d0059b
```
Published digests:
```text
seaweed-block
index: sha256:b8da5ca4e2bbe2f0f630fee0468790c444362615d68807a1be31fd237c84928f
linux/amd64: sha256:677f6321ea5199b14792345b8691358860bb9ca7376f4e4a2f3a7c0113d5db9b
seaweed-block-csi
index: sha256:b5942cd68d28aecdfebec1f1e5ec55a9cafe746169fee3b6c35916c93fffcaa6
linux/amd64: sha256:1fc636a4e0e63cc8cbee39e6775053c5d1aba7213ca9182a084e1bb6fe71474c
```
## QA Evidence
Primary D6 close:
- `internal/docs/qa-assignments/phase40-d6-release-candidate-qa-signoff.md`
Result:
- Local release gate: PASS.
- G1 first-volume with published image: PASS.
- G2 operator-status CRD/Event/RBAC with fresh release image: PASS.
- G3 negative status: PASS.
- G4 status API conformance: PASS.
- G5 cleanup residue: PASS.
Important QA sequence:
- Initial D6 held because the chart passed `--launcher-durable-impl` to
published images that did not support that flag.
- The chart compatibility fix resolved the blocker.
- QA reran G1 against the published `sha-6260e46fd3be` image and confirmed
first-volume still works.
- Fresh images were published from `dc2972d0059b`.
- QA ran G2 against `sha-dc2972d0059b` and confirmed live CRD status, Events,
and the status/events-only RBAC boundary on the shipped binary.
Supporting evidence:
- `internal/docs/qa-assignments/phase40-d4-status-api-conformance-qa.md`
- `internal/docs/qa-assignments/phase40-d6-release-candidate-qa.md`
- `docs/releases/v0.4-beta-candidate.md`
## Non-Claims
Phase 40 does not claim:
- production readiness,
- mutating Kubernetes operator lifecycle,
- automatic `SwBlockVolume` object creation or ownership,
- finalizer ownership or finalizer add/remove,
- delete execution,
- automatic cleanup,
- automatic support-bundle collection or upload,
- upgrade or rollback execution,
- promote, repair, rebuild, failback, delete, backup, restore, or cleanup
mutation through UI/API/operator,
- returned-replica rebuild or automated failback,
- NVMe ANA parity expansion,
- production dashboard,
- performance, RTO, RPO, or SLO guarantees.
## Carry-Forwards
1. **Real envtest/live-apiserver status-writer harness.**
The current conformance gate is schema-aware and useful, but still uses a
mock server. A real apiserver + real RBAC harness remains the highest-leverage
way to shift live-only CRD/RBAC defects left.
2. **`swblock -env` flag ordering.**
Runner flags after the scenario path can be silently ignored. Fix the runner
or correct all runbooks to put `-env` before the scenario path.
3. **Parameterized support-bundle import nodes.**
`helm-support-bundle-diagnostics-chain` hardcodes a tp01 import path; make it
env-overridable so one lab node being down does not block unrelated negative
status validation.
4. **Restore `tp01`.**
Lab infra remained `NotReady`/unreachable during the release cycle. Restore
before RF=3 live multi-node work.
5. **Loopback publish-target documentation.**
Document loopback publish targets as single-node/local-consumer only.
## Phase 41 Entry Criteria
Phase 41 should start from the v0.4 beta status/events-only baseline and should
not weaken that boundary.
Recommended next scope:
- lifecycle-owner design,
- CR object ownership and finalizer strategy,
- first bounded mutating path with explicit action/precondition/executor/evidence
contract,
- real envtest/live-apiserver regression before any new mutating RBAC ships.
Do not start with NVMe ANA parity, backup/restore, rebuild/failback, or broad
mutation until the lifecycle-owner boundary is explicit and testable.
@@ -0,0 +1,201 @@
# Finished Plan: Light-Use Operations MVP
Status: finished. Closed after QA validation at product commit
`8beaaa7ca83cc3a9ebbf6873a42eb9b3bd3505be`.
This plan reframed the smaller `Operations Layer Usability Seed` into a
user-visible light-use operations loop. The goal was not to finish the full
enterprise operations story. The goal was to make one useful product workflow
real and gated:
```text
PVC/app problem -> run status command -> read summary -> attach bundle -> dev/QA
can triage without asking for raw logs first
```
## Product Question
Can an early user or developer use Seaweed Block as a functional light block
product without reading internal scripts and logs?
The answer after this plan is narrower but materially better:
- The datapath is close to a functional MVP: CSI dynamic PVC, iSCSI/NVMe
frontend paths, mounted failover, restart, returned-replica evidence, and
beta-hardening gates are real.
- The operations layer now has a first closed read-only loop: a product CLI can
collect status, classify issues, write a support bundle, and TestOps can
prove the command/bundle contract.
- The product is still not a complete light-use product. Install, lifecycle
ownership, cluster-wide observation, and UI/API operations remain future
work.
Close decision: this plan is closed as `Light-Use Operations MVP`, not as
`Light-Use Product MVP`. It proves observe/report/coordinate. It does not prove
that a new user can provision, attach, format, mount, write, delete, and recover
through one documented product workflow.
## Delivered User Experience
As a user or developer, I can now:
1. Run a product-owned status command for one volume.
2. Read a human summary that includes product revision, volume identity,
authority, replication, residue, and issue classification.
3. Attach a self-describing support bundle with machine-readable JSON,
human-readable summary, bundle metadata, artifacts, unchecked classes,
collection errors, and non-claims.
4. Use TestOps control data to see active/history run records, resource locks,
and shared-lab ownership instead of guessing whether a test is running or
stale.
This is the first functional operations loop. It is intentionally read-only.
## Delivered Scope
### Product CLI
`sw-block ops status` was added with the intended shape:
```text
sw-block ops status \
--volume <id> \
--master <host:port> \
--status-addr <host:port|url> \
--out <dir>
```
Exit code contract:
- `0`: report collected, parsed, and classified clean,
- `1`: report collected but unhealthy/incomplete/residue or collection-error
evidence was detected,
- `2`: required input is invalid, artifact writing failed, or the report
identity/schema is invalid.
### Support Bundle
The command writes:
- `volume-status-report.json`,
- `volume-status-summary.txt`,
- `ops-status-bundle.json`.
The bundle records schema version, command, capture time, volume id, product
revision, exit classification, artifacts, unchecked residue classes, collection
errors, and non-claims.
### TestOps Gates
Fast local gates cover the report and CLI boundary:
- `operations-volume-status-report-component-gate`,
- `operations-volume-status-cli-gate`.
These gates validate schema, summary/classifier behavior, artifact writing,
bundle metadata, CLI command boundary, exit code behavior, outlier cases, and
non-claims.
### Shared-Lab Control Data
TestOps gained simple shared-lab control data:
```text
testops-control/
active/<run_id>.json
history/<run_id>.json
locks/<resource>.lock
events.jsonl
```
The first version is not a scheduler. It provides visibility and safety:
- create an active record at run start,
- update state at terminal exit,
- record scenario, artifact dir, commits, and known resource ownership,
- refuse conflicting resource locks,
- move terminal runs into history,
- keep stale active records visible if a runner crashes.
## QA Close Evidence
QA validated the close gate at product commit
`8beaaa7ca83cc3a9ebbf6873a42eb9b3bd3505be`.
Validated parts:
- Part A local tests: PASS for
`go test ./core/ops ./cmd/sw-block ./internal/testops ./cmd/sw-testops -count=1`.
- Part B CLI gate: PASS. `operations-volume-status-cli-gate.yaml` validates
schema, volume id, product revision, status/authority, bundle command,
exit code, artifact list, unchecked classes, collection errors, and
non-claims.
- Part C artifact inspect: PASS. `ops-status-bundle.json`,
`volume-status-summary.txt`, and `volume-status-report.json` all have the
required fields and parse correctly.
- Part D CLI outliers: PASS. Missing `--volume`, bad master/status addresses,
and unwritable `--out` return exit code `2` without false success claims.
- Part E control data: PASS. Terminal run moved from `active/` to `history/`,
locks were released, `events.jsonl` carried start and complete records, and
`--control-list` showed the expected fields.
- Part F lock conflict: PASS. A second run against an exclusive resource exits
`2`, reports the lock owner, creates no active record/artifact dir, and does
not disturb the first run.
- Part G hygiene: N/A. The close gate used local execution only, not M01/M02.
QA verdict:
```text
PASS to close current plan.
The light-use operations loop -- observe one volume -> read a useful summary ->
attach a self-describing bundle -> see TestOps control data for shared lab
ownership -- is exercised end to end with all required guarantees enforced by
code, not by exit-0 alone.
```
## Informational Notes From QA
These are portability notes, not close blockers:
- In custom registries on Windows, Unix-style `/c/work/...` paths are treated
as relative by `filepath.IsAbs`. Use Windows absolute paths such as
`C:/work/...`.
- On Windows, `ShellDriver` invokes the driver path directly with `os/exec`.
`.sh` drivers need a `.bat` shim that calls `bash.exe`, or the driver should
be `.bat`/`.exe`.
## Non-Claims Carried Forward
This plan does not claim:
- productized install/upgrade/uninstall,
- Kubernetes operator/controller ownership,
- mutating admin commands,
- automatic repair,
- cluster-wide UI/dashboard,
- performance monitoring,
- fleet agent,
- full TestOps scheduler.
## Next Roadmap Pull
The next usability work should move from observation to product-owned lifecycle.
The main remaining user-visible gap is:
```text
install/create/delete/retry/cleanup should feel like product behavior, not a
collection of internal scripts plus TestOps cleanup discipline
```
Candidate next plan: `Light-Use Install And Lifecycle MVP`.
The cheapest useful next close loop is a "first volume in 10 minutes" path:
```text
install/launch -> create PVC -> attach app pod -> write/read -> delete ->
verify cleanup -> collect status bundle if anything fails
```
Existing quickstart and K8s demo paths are promising, but the next plan should
make the claim explicit, fresh-run it, and separate product-owned behavior from
TestOps-only cleanup.
@@ -431,7 +431,7 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
ANA change count advances, no-provider OAES remains zero, and the AER
single-slot limit remains enforced.
- Phase 128 is closed for live Linux host validation of ANA Change Notice. The
node-b kernel `nvme:nvme_async_event` tracepoint observed
m02 kernel `nvme:nvme_async_event` tracepoint observed
`NVME_AEN=0x0c0302` during standalone r1->r2 failover, the ANA log change
count advanced, host path state refreshed, mounted I/O remained correct, and
cleanup was clean.
@@ -593,7 +593,7 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
thresholds. The implementation was removed; `walstore` remains the default
and `parallel-walstore` remains opt-in.
- Closed experiment: Phase 169's segmented group-commit candidate passed
format, bounded-owner, durability, failure, and recovery gates. Its node-b
format, bounded-owner, durability, failure, and recovery gates. Its m02
optimistic upper bound grouped `1.348` entries/segment but four writers
reached only `0.772x` one writer and `0.990x` the positioned control. The
implementation was removed before checkpoint/rebuild integration.
@@ -795,7 +795,7 @@ credible light-use product:
### Track G: Test Management Control Plane
- Current: runner scenarios write result/status bundles, but node-a/node-b shared lab
- Current: runner scenarios write result/status bundles, but M01/M02 shared lab
ownership is still mostly implicit.
- Closed: Phase 33 TestOps failure hardening. The runner and helpers now
exercise negative paths, collect useful failure snapshots, assert no false
@@ -1275,7 +1275,7 @@ Approximate engineering effort if scope remains tight:
fixes remained. The finished plan is
`internal/docs/finished-plans/phase172_finishedplan_wal_materialization_pipeline.md`.
- Phase 173 Storage Execution Architecture Decision is closed with no backend
candidate. The exact Linux fixed-work baseline passed on dedicated node-b NVMe;
candidate. The exact Linux fixed-work baseline passed on dedicated m02 NVMe;
shipped logical work reconciled with product counters, `strace`, perf,
profiles, iostat, and checkpoint evidence. D3 then found no stable
owner/queue, writeback-interference, or media-separation signal and closed
@@ -0,0 +1,347 @@
# QA Runbook — Current Block TestOps Flow (v1)
Use this when QA needs to validate **seaweed-block** work on the M02 k3s lab.
This is the block-specific sibling of the RDMA `QA-RUNBOOK-rdma-current-v2.md`.
The *flow* is the same four ideas — standard gate, dirty-adhoc DEBUG-only, deep
runbook for specialty failures, post-run provenance assertion — but the scenario,
project, evidence rows, and failure classes are block's, not RDMA's.
> For the **mechanics** of running a phase gate (env access, syncing
> `product_root`, terminal-evidence discipline, PASS/FAIL/PARTIAL), see
> [`QA-AGENT-RUNBOOK.md`](QA-AGENT-RUNBOOK.md). This runbook is the higher-level
> *which path / accept criteria / provenance* SOP.
> **Unified TestOps parent docs:** the platform-level contract lives in
> `C:\work\seaweedfs\learn\sw-test-runner-standalone\docs\`:
> `unified-testops.md`, `wiki/submitting.md`,
> `control-plane-product-contract.md`, and `qa-bundle-assert.md`. Read those for
> the common 9099 dashboard, bundle envelope, suite/worker model, and shared
> `qa-assert.sh` contract. This file adds the block-specific current-state
> rules.
> **Current block split:** the unified runner repo now has a `block-ci` worker
> script for the canonical published-image first-volume gate. Most active
> seaweed_block phase gates still validate a source branch or local
> `sw-block:local` image and are run by the QA agent with `swblock.exe`
> directly: sync `product_root` → `swblock run` → read/assert the bundle. Do not
> use `POST /api/rdma/submit` for block; use `/api/block/submit` only when the
> assigned gate is registered in the TestOps block worker and the tested ref is
> a published image tag.
## 0. What To Run
Pick exactly one path.
| Path | Use When | Result Can Be Used For |
| --- | --- | --- |
| `block-ci` worker gate | Canonical published-image block gate registered in TestOps | Release/artifact evidence after `qa-assert.sh` |
| Standard phase gate | A reviewable branch / commit (pushed, no dirty source) | QA verdict / phase evidence |
| Adhoc dirty debug | Developer has a local uncommitted `sw-block` build | Debug only, **not** QA ACCEPT |
| Deep runbook | A standard gate fails in/near a specialty area (SmartWAL, iSCSI/NVMe OS, residue) | Specialty QA evidence |
## 0a. Unified `block-ci` Worker Gate
Use this only when the assigned gate is the canonical TestOps block worker path:
a published `seaweed-block` / `seaweed-block-csi` image tag, staged harness, and
`docs/qa-profiles/block.expect`.
Runner repo entry point:
```text
C:\work\seaweedfs\learn\sw-test-runner-standalone\scripts\run-block-ci.sh
```
Contract:
- ref is a published image tag such as `sha-...`, not a dirty source tree;
- worker stages the block harness to m02 `product_root`;
- worker runs `swblock` with `project=block-ci`;
- worker runs:
```bash
scripts/qa-assert.sh <bundle> --ref <tag> --profile docs/qa-profiles/block.expect
```
- success prints `Block CI PASS` and the dashboard path:
```text
http://192.168.1.181:9099/?project=block-ci
```
If the feature under review requires a new source commit, a new scenario, or a
local `sw-block:local` build, do **not** force it through `block-ci`. Use the
standard phase-gate path below and report it as phase evidence, not release
artifact evidence.
## 1. Standard Gate — Reviewable Branch/Commit
This is the normal process.
### Inputs
- A **pushed** seaweed-block branch or commit SHA. No local dirty source, no
hand-copied binary.
- The **scenario** the dev assigned: a phase gate
(`testops/scenarios/<gate>-chain.yaml` driven by
`scripts/run-phaseNN-<slug>-gate.sh`) **or** the v0.5 release smoke.
### Images
Most phase gates run product code, so build from the reviewable commit (published
images often predate a new subcommand):
```bash
# on m02, from the synced product_root at that commit:
bash scripts/build-alpha-images.sh # -> sw-block:local + sw-block-csi:local
ssh testdev@192.168.1.184 'docker images | grep sw-block' # confirm BOTH exist on the node that runs pods
```
Pure RBAC / admission gates need **no image** (they only `kubectl apply` CRDs +
RBAC and run `auth can-i`). The **v0.5 release smoke** uses the **published v0.5
dual images at the same commit** (`ghcr.io/seaweedfs/seaweed-block:<v0.5>` +
`…-csi:<same>`) — **never** `sha-dc2972d0059b` (that is a v0.4 image).
### Sync product_root (the #1 gotcha)
Gate scripts run on m02 from `/tmp/seaweed_block`, which is usually stale. Sync the
phase tree first (details in [`QA-AGENT-RUNBOOK.md` §4](QA-AGENT-RUNBOOK.md)):
```bash
KEY=/c/work/dev_server/testdev_key; M2=testdev@192.168.1.184; R=/c/work/seaweed_block
ssh -i $KEY $M2 'mkdir -p /tmp/seaweed_block/scripts /tmp/seaweed_block/charts/seaweed-block/crds'
scp -i $KEY $R/scripts/run-phaseNN-<slug>-gate.sh $M2:/tmp/seaweed_block/scripts/
scp -i $KEY $R/charts/seaweed-block/crds/*.yaml $M2:/tmp/seaweed_block/charts/seaweed-block/crds/
```
### Run
Run `swblock.exe` from a clean checkout at the reviewable commit and tag the run
so the dashboard ties it to the commit:
```powershell
C:\work\swblock.exe run -results-dir C:\work\seaweed_block\results `
-env product_root=/tmp/seaweed_block `
C:\work\seaweed_block\testops\scenarios\<gate>-chain.yaml
```
For a release-smoke / helm scenario, also pass metadata (mirrors the RDMA
`-meta`):
```text
-meta project=block-qa -meta team=block -meta run_by=<qa-agent>
-meta test_id=<gate> -meta branch=<branch> -meta commit=<sha>
```
> Flags must come **before** the scenario path (Go stdlib flag parser). On Git
> Bash, `MSYS_NO_PATHCONV=1` to keep `/tmp/...` values intact; PowerShell avoids it.
### What It Runs
The assigned gate. Block gates fall into two evidence shapes:
- **Correctness / boundary gates** (most phase gates): the gate script writes a
`…-summary.txt` with `key=value` lines and a final `<gate>_status=ok`; the
scenario `grep_log` + `save_as` + `assert_*` those into `result.json` `vars`.
- **Functional / release gates** (helm first-volume, e2e, HA, v0.5 smoke): PVC
writer/reader PASS, CSI→CR, finalizer add/release, operator-status
`Ready=True/first_volume_verified`, zero-residue uninstall.
### Where To Watch
```text
http://192.168.1.181:9099/?project=block-qa
```
The dashboard re-scans on each load; the bundle appears under
`/mnt/smb/work/share/testops/results/block-qa/<run-id>/`.
### Post-Run Provenance Assertion
Do this before writing ACCEPT. It proves the bundle tested the commit QA ran and
that the gate's own terminal evidence passed.
> **Where the evidence lives (validated):** `result.json` `vars` holds the
> scenario's **`save_as` outputs**, which for `grep_log` gates are **counts** —
> `"1"` means the asserted line was present. So `EXPECT_VARS` uses the **save_as
> names**, e.g. `phase54_rbac_ok=1`, **not** the literal `…_status=ok` line (that
> line lives in the gate's `…-summary.txt` on SMB, not in the bundle). Leave
> `EXPECT_VARS` empty for functional gates that assert entirely in-scenario.
```bash
ssh testdev@192.168.1.184 # or m01; the bundle is on shared SMB
BUNDLE=/mnt/smb/work/share/testops/results/block-qa/<run-id>
COMMIT='<reviewed-branch-or-sha>' # the value passed as -meta commit=<sha>
EXPECT_VARS='phase54_rbac_ok=1,exec_target_status_allowed=1,exec_target_main_denied=1,default_target_status_denied=1'
export BUNDLE COMMIT EXPECT_VARS
python3 - <<'PY'
import json, os, pathlib
b = pathlib.Path(os.environ['BUNDLE']); requested = os.environ['COMMIT']
required = ['result.json','status.json','result.html','scenario.yaml','manifest.json']
missing = [n for n in required if not (b/n).is_file()]
if missing: raise SystemExit('missing bundle files: ' + ', '.join(missing))
result = json.loads((b/'result.json').read_text())
status = json.loads((b/'status.json').read_text())
manifest = json.loads((b/'manifest.json').read_text())
meta = manifest.get('metadata', {}) or {}
vars = result.get('vars', {})
gitsha = manifest.get('git_sha','')
commit_ok = requested in (meta.get('commit',''), meta.get('branch',''), gitsha) \
or (gitsha and gitsha.startswith(requested)) or (requested and requested.startswith(gitsha) if gitsha else False)
checks = {
'result.status': result.get('status') == 'PASS',
'status.state': status.get('state') == 'pass',
'commit_match': bool(commit_ok),
}
for ev in [e for e in os.environ.get('EXPECT_VARS','').split(',') if e]:
k, _, want = ev.partition('=')
checks['evidence:'+ev] = (str(vars.get(k)) == want)
failed = [n for n, ok in checks.items() if not ok]
if failed: raise SystemExit('failed checks: ' + ', '.join(failed))
print('BLOCK_QA_BUNDLE_ASSERT_OK')
print('scenario=' + manifest.get('scenario_name',''))
print('commit=' + (meta.get('commit') or gitsha))
print('git_sha=' + gitsha)
print('run_id=' + manifest.get('run_id',''))
PY
```
> **`-meta commit=<sha>` is REQUIRED (validated).** A block bundle's
> `manifest.git_sha` is the **runner-cwd** repo's HEAD (e.g. it was the
> seaweedfs/learn repo, not seaweed_block, on an ad-hoc run) and `metadata` is
> null unless you pass `-meta`. So `commit_match` is only meaningful if you pass
> `-meta commit=<seaweed_block sha>` (and run `swblock` from a clean seaweed_block
> checkout). For a branch, resolve it first: `git -C C:\work\seaweed_block
> rev-parse <branch>` and pass that SHA.
### ACCEPT Criteria
ACCEPT only if:
1. The dashboard run is `pass` (`status.state == pass`, `result.status == PASS`).
2. The bundle has `result.html` and the assertion prints
`BLOCK_QA_BUNDLE_ASSERT_OK`.
3. The tested commit is the reviewed branch/SHA (`commit_match`).
4. The gate's terminal evidence is present (the `<gate>_status=ok` + boundary
lines, or the functional asserts: PVC RW, CSI→CR, finalizer add/release,
operator-status Ready, zero-residue).
5. Any perf floors in a perf scenario pass.
6. The lab is left clean (no leftover CRDs/release/PVC — see §4 / `QA-AGENT-RUNBOOK §8`).
Report:
```text
Verdict: ACCEPT or REJECT (or PARTIAL — classify artifact/lab/product)
scenario: <gate>-chain.yaml
run: block-qa/<run-id>
commit: <branch-or-sha>
bundle: /mnt/smb/work/share/testops/results/block-qa/<run-id>
dashboard: http://192.168.1.181:9099/?project=block-qa
terminal evidence:
<gate>_status=ok
<key boundary / functional lines>
perf rows (if perf gate):
read_iops / write_iops / p99_ms / MiB/s ...
first failure, if any: ...
residue cleaned: <CRDs/none>
not tested: ...
```
## 2. Adhoc Dirty Debug — Local `sw-block` Build
Allowed for investigation, **not** PR/release evidence.
### Rules
- Must use `project=block-dev`, not `block-qa`.
- Must mark metadata `dirty=true` and name the source/binary/image tested
(e.g. `sw-block:local` built from an uncommitted tree).
- Must **not** produce an ACCEPT verdict.
- If the result matters, ask the dev to commit it and rerun the standard gate.
```powershell
C:\work\swblock.exe run -results-dir C:\work\seaweed_block\results\block-dev `
-env product_root=/tmp/seaweed_block `
-meta project=block-dev -meta team=block -meta run_by=<qa-agent> `
-meta test_id=adhoc-block-debug -meta branch=dirty-local -meta commit=dirty-local -meta dirty=true `
C:\work\seaweed_block\testops\scenarios\<gate>-chain.yaml
```
### Report Format
```text
Verdict: DEBUG ONLY, not QA ACCEPT
reason: dirty local source / uncommitted image
source tested: <path / image tag>
run: block-dev/<run-id>
result: pass/fail
finding: ...
required next step: commit branch/SHA and rerun standard gate
```
## 3. Deep Runbooks — Specialty Paths
Use a deep path only when a standard gate fails in/near it, or the dev asks for a
focused root-cause run. They are expensive and narrow; do not start here for
normal validation.
| Area | Deep path |
| --- | --- |
| SmartWAL corruption / recovery | `testops/scenarios/helm-smartwal-corrupt-restart-chain.yaml` + the phase34-d4 SmartWAL corrupt sign-offs |
| iSCSI OS-initiator / ALUA MPIO | `scripts/run-iscsi-alua-*`, `run-iscsi-os-smoke.sh`; iscsi-p6 ALUA sign-offs |
| NVMe OS / multipath | `scripts/run-nvme-*-smoke.sh`, `run-nvme-multipath-smoke.sh`; nvme-p4 sign-offs |
| Helm support bundle | `testops/scenarios/helm-support-bundle-diagnostics-chain.yaml`, `scripts/collect-helm-support-bundle.sh` |
| Cleanup / residue | `scripts/verify-helm-cleanup.sh` (`cleanup_status=ok`), `testops/scenarios/cleanup-residue-chain.yaml` |
## 4. Failure Handling
When a standard gate fails:
1. Open `result.html`; find the first failed phase/action.
2. Check the action output + `artifacts/` + the gate `…-summary.txt`.
3. Check `kubectl`/pod logs only if the bundle is missing/incomplete.
4. Do **not** delete the failed bundle; do **not** rerun-until-green without
explaining the first failure.
Classify:
| Failure Type | Next Step |
| --- | --- |
| **Image / artifact** (e.g. published image missing a new flag — the Phase 40 D6 class) | Send back to releng; do **not** call it a product bug. Re-run on a fresh build. |
| Build/link | Send back to dev with compiler output |
| Scenario bug | Fix the TestOps scenario, rerun |
| Perf regression | Compare iops/latency/throughput rows against the last accepted run |
| Correctness (PVC RW, CSI→CR, finalizer, operator-status, SHA) | Use a deep runbook or add a focused scenario |
| **Lab / environment** | `product_root` stale, CRD residue, m02 disk > ~85% (k3s GCs `:local`), VAP propagation lag → mark infra-blocked with host/log evidence |
A **PARTIAL** verdict must say which of these it is (artifact / lab / product).
Only **product** blocks the phase; artifact/lab are fixed and re-run.
## 5. Non-Claims
A green standard gate does **not** prove:
- multi-node failover / replica-policy behavior beyond the scenario's scope;
- long soak / restart-persistence stability (use the HA / restart-persistence
chains);
- every iSCSI/NVMe OS-initiator combination (deep runbooks cover those);
- production performance under real workloads (perf gates are fixed shapes);
- backup / NVMe / rebuild surfaces that are still deferred.
If one of those is the claim under review, ask for a focused scenario.
## 6. QA Feedback Requested
When reviewing this v1 runbook, please answer:
1. Is the standard-gate path clear enough to run without asking the dev which
scenario/image to use?
2. Is the `block-qa` vs `block-dev` (accept vs debug) boundary strict enough?
3. Does the provenance assertion's `EXPECT_VARS` mechanism cover both the
correctness/boundary gates and the functional/release gates, or should
functional gates get their own assertion keys?
4. Should the block provenance assertion ship as a committed
`scripts/block-qa-assert.sh <run-id> <commit> [EXPECT_VARS]` (so QA does not
paste python)?
@@ -0,0 +1,145 @@
# QA Assignment: CSI RF=1 Durable Blockvolume Restart Validation
Status: ready for QA repeatability validation after dev run
`20260512-211604-1339` passed at product commit `e90ce49`.
Branch: `docs/post-merge-plan`.
Scope: prove a single-replica dynamic PVC survives a generated `blockvolume`
pod restart when the launcher renders durable host state, and prove the
operator can read the post-restart durable state through `sw-block ops
inventory` and nested `sw-block ops status` bundles.
## Preconditions
- Host: M02 k3s lab or equivalent single-node Kubernetes lab.
- Required host tools:
- `kubectl`,
- Docker image build/load path for `sw-block:local` and
`sw-block-csi:local`,
- iSCSI initiator tools for the default protocol path.
- Build and import fresh alpha images before running, preferably through the
existing pin-build/TestOps path.
- This gate must run with durable generated workload state:
```bash
export SW_BLOCK_LAUNCHER_STATE_HOSTPATH=/var/lib/sw-block/testops-${RUN_ID}
```
Do not mark the gate green if the generated `blockvolume` manifest still uses
`emptyDir` for the state volume. Use a run-scoped hostPath under
`/var/lib/sw-block/testops-*` so repeat runs do not reuse stale durable roots.
## Test 1: RF=1 Dynamic PVC Survives Blockvolume Restart
Script command:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-csi-rf1-blockvolume-restart"
SW_BLOCK_ALPHA_IMAGES_ENV="/path/to/pin-build/alpha-images.env" \
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
SW_BLOCK_LAUNCHER_STATE_HOSTPATH="/var/lib/sw-block/testops-${RUN_ID}" \
bash scripts/run-k8s-blockvolume-restart.sh "$PWD"
```
Expected:
- `run.log` contains:
- `launcher_state_hostpath=/var/lib/sw-block/testops-${RUN_ID}`,
- `restart_blockvolume_before_reader=1`,
- `collect_inventory_after_restart=1`,
- `demo-app-pvc-writer-hold-root.yaml`,
- `delete writer pod but keep PVC`,
- `restart generated blockvolume Deployment before replacing the app pod`,
- `start reader pod on the same PVC`,
- final line:
`[app-demo] PASS: app pod wrote data, replacement app pod read it back through the same PVC, cleanup complete`.
- `block-stack.rendered.yaml` contains:
- `--launcher-state-hostpath=/var/lib/sw-block/testops-${RUN_ID}`.
- `generated-blockvolume.yaml` contains:
- `hostPath:`,
- `path: /var/lib/sw-block/testops-${RUN_ID}`,
- `type: DirectoryOrCreate`,
- no `emptyDir:` under the generated `state` volume,
- `--durable-root=/var/lib/sw-block/<volume>/<replica>`.
- `writer.log` contains:
- `[app-writer] wrote and verified /data/demo.bin`.
- `iscsi-sessions.before-blockvolume-restart.txt` exists and contains no
`iqn.2026-05.io.seaweedfs` session. This proves the writer pod unmounted and
CSI logged out before the `blockvolume` process restart.
- `restart-blockvolume-status.log` shows the generated `blockvolume`
Deployment completed rollout after the writer checksum.
- `blockvolume-pod-ids.before-restart.tsv` and
`blockvolume-pod-ids.after-restart.tsv` are both non-empty and contain
different pod UIDs. This proves the serving `blockvolume` pod was replaced.
- `lifecycle-volumes.after-blockvolume-restart.json` exists and still contains
the PVC volume spec with `protocol: "iscsi"`.
- `reader.log` contains:
- `/data/demo.bin: OK`.
- `reader.describe.before-delete.txt` shows:
- `Status: Succeeded`,
- `SuccessfulAttachVolume`.
- `blockvolume-generated.after-restart.log` contains:
- `phase":"iscsi-listening"`,
- `durable primary lineage ensured`.
Together with the reader checksum, this proves the restarted target recovered
and the replacement reader pod reattached/read after restart. Do not require a
live iSCSI session after the one-shot reader exits; Kubernetes may unstage and
logout immediately after the pod reaches `Succeeded`.
- `ops-inventory-after-restart/volume-inventory-summary.txt` exists and
contains:
- a `volume:` row for `pvc=sw-block-demo-pvc`,
- `protocols=iscsi`,
- a `replica:` row with `lifecycle_owner=pvc-owner-ref
owner_ref=PersistentVolumeClaim/default/sw-block-demo-pvc`,
- `support_bundle=volumes/<volume>/<replica>`.
- `ops-inventory-after-restart/nested-ops-status-bundles.json` contains:
- `"command": "sw-block ops status"`.
- At least one nested
`ops-inventory-after-restart/volumes/<volume>/<replica>/volume-status-summary.txt`
contains:
- `durable_entry:`,
- `latched=true`,
- `operational=true`.
- Cleanup:
- no generated `sw-blockvolume` Deployment remains,
- demo PVC is gone,
- no `iqn.2026-05.io.seaweedfs` iSCSI session remains.
- the run-scoped hostPath `/var/lib/sw-block/testops-${RUN_ID}` is gone.
## What This Proves
- The launcher can render durable generated workload state for a dynamic PVC.
- A generated `blockvolume` pod can restart and recover the same durable root.
- `blockmaster` remains in the loop: the restarted workload must re-observe and
keep enough lifecycle/frontend state for CSI to rediscover and reattach.
- A replacement app pod can read data written before the restart.
- Inventory maps the restarted PVC to its generated workload and support
bundle.
- The nested status bundle shows the durable entry is latched and operational
after restart.
## What This Does Not Prove
- No RF=2/RF=3 promotion or returned-replica catch-up claim.
- No node reboot claim.
- No multi-node scheduling claim.
- No production storage claim for `hostPath`.
- No NVMe multipath claim.
## Report Format
QA should report:
- branch and commit SHA,
- host and kernel,
- exact command,
- result,
- artifact path,
- final PASS line,
- generated manifest state-volume evidence,
- writer and reader checksum lines,
- blockvolume rollout evidence,
- master/lifecycle evidence after restart,
- inventory summary and nested status durable-entry evidence,
- cleanup state,
- any CSI, kubelet, iSCSI, or blockvolume errors.
@@ -0,0 +1,209 @@
# QA Assignment: iSCSI P2/P3 Lab Validation
Status: QA green.
Branch under test: `iscsi/frontend-completeness`.
Verified commit: `e7c95ee44863f34b304995fa977a4ff57ab3e649`.
Host: M02 (lab address redacted).
Purpose: validate the local iSCSI P2/P3 test/tooling work on a real Linux/K8s
lab. This is not a performance claim and not a failover claim.
## Scope
- #QA iSCSI P2 OS initiator repeat loop.
- #QA iSCSI P2 OS initiator fio mode.
- #QA iSCSI P3 Kubernetes fio smoke.
- #QA iSCSI P3 Kubernetes attach/detach loop.
## Preconditions
- Lab host: M02 unless QA states otherwise.
- Linux host has `sudo`, `iscsiadm`, `mkfs.ext4`, `mount`, `sha256sum`.
- K8s tests need working k3s/kubectl and privileged CSI node support.
- Images for K8s tests are either local:
- `sw-block:local`
- `sw-block-csi:local`
- Or QA explicitly records the GHCR image tags/digests used.
## Test 1: OS Initiator Repeat Loop
- Result: PASS.
- Artifact:
`[artifact-root]/20260505T062122Z-iscsi-p2-test1-os-repeat`.
- Final line:
`[iscsi-os] PASS: 5 x iscsiadm mkfs mount write/read logout`.
- Cleanup: `iscsi-sessions.final.txt` reports no active sessions.
- `expected Data-Out` errors in `blockvolume.log`: 0.
- Command:
```bash
SW_BLOCK_ISCSI_ITERATIONS=5 \
SW_BLOCK_ISCSI_STRESS=dd \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
- Pass criteria:
- all 5 iterations pass,
- every iteration logs discovery, login, mkfs, mount, checksum, logout,
- `iscsi-sessions.final.txt` reports no active sessions,
- no `expected Data-Out` session error in `blockvolume.log`.
- Required report:
- branch and commit,
- host,
- command,
- artifact dir,
- final PASS line,
- cleanup state.
## Test 2: OS Initiator fio Mode
- Result: PASS.
- Artifact:
`[artifact-root]/20260505T062159Z-iscsi-p2-test2-os-fio60s`.
- fio summary:
- read IOPS=122, BW=490KiB/s,
- write IOPS=123, BW=494KiB/s,
- runtime=60.004s,
- err=0,
- `fio.iter1.log` present.
- Cleanup: `iscsi-sessions.final.txt` reports no active sessions.
- `expected Data-Out` errors in `blockvolume.log`: 0.
- Command:
```bash
SW_BLOCK_ISCSI_ITERATIONS=1 \
SW_BLOCK_ISCSI_STRESS=fio \
SW_BLOCK_ISCSI_FIO_RUNTIME=60 \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
- Pass criteria:
- fio completes,
- `fio.iter1.log` exists,
- logout succeeds,
- no active iSCSI sessions after cleanup,
- no session errors in `blockvolume.log`.
## Test 3: Kubernetes fio Smoke
- Result: PASS.
- Artifact:
`[artifact-root]/20260505T062334Z-iscsi-p3-test3-k8s-fio`.
- Pod evidence:
- `pod.log` shows Alpine `apk` install of fio,
- 60s randrw run,
- READ BW=13.0MiB/s, 782MiB total,
- WRITE BW=13.1MiB/s, 787MiB total,
- err=0,
- util=96.36%.
- Final line:
`[alpha-fio] PASS: dynamic PVC create/delete completed checksum write/read and cleanup`.
- Cleanup: no PVC, no sw-block deployments, no active iSCSI sessions.
- Command:
```bash
bash scripts/run-k8s-alpha-fio.sh "$PWD"
```
- Pass criteria:
- pod reaches `Succeeded`,
- `pod.log` contains fio output,
- generated blockvolume Deployment is cleaned,
- no active iSCSI sessions after delete,
- no K8s residue for `sw-block`.
- Notes:
- This test uses `alpine:3.20` and installs fio with `apk`.
- If pod egress is blocked, report it as environment failure, not product
failure.
## Test 4: Kubernetes Attach/Detach Loop
- Result: PASS.
- Artifact:
`[artifact-root]/20260505T062606Z-iscsi-p3-test4-attach-detach`.
- Iterations:
- iter-1 PASS: writer wrote and verified `/data/demo.bin`; reader read-back OK; no active iSCSI sessions after delete.
- iter-2 PASS: same.
- iter-3 PASS: same.
- Final line:
`[attach-loop] PASS: 3 attach/detach app PVC cycles completed`.
- Cleanup: no PVC, no sw-block deployments, no active iSCSI sessions.
- Command:
```bash
SW_BLOCK_ATTACH_DETACH_ITERATIONS=3 \
bash scripts/run-k8s-attach-detach-loop.sh "$PWD"
```
- Pass criteria:
- all iterations pass,
- each iteration has writer and reader logs,
- each reader verifies data written by its writer,
- every iteration has no active iSCSI session after delete,
- final summary line reports PASS.
## Failure Handling
- Preserve artifact directories.
- Do not rerun over a failed artifact directory.
- If a script cannot collect required evidence, report the script gap and stop.
- Do not replace the script with manual commands unless needed for first
diagnosis.
## QA Report Template
```text
QA Assignment: iSCSI P2/P3 Lab Validation
Branch:
Commit:
Host:
Test 1 OS repeat:
result:
command:
artifact:
final line:
cleanup:
Test 2 OS fio:
result:
command:
artifact:
fio summary:
cleanup:
Test 3 K8s fio:
result:
command:
artifact:
pod evidence:
cleanup:
Test 4 K8s attach/detach:
result:
command:
artifact:
iterations:
cleanup:
Findings:
- ...
```
## Lab Notes
- M02 initially had no Go installation.
- QA installed Go 1.25.0 to `/usr/local/go` and symlinked
`/usr/local/bin/go`.
- K8s tests used locally rebuilt images:
- `sw-block:local` sha256 `dcb621e4447a`,
- `sw-block-csi:local` sha256 `84fab78dc05a`.
- No GHCR images were used.
- Test 3 requires pod network egress for `apk add fio`; M02 had egress.
@@ -0,0 +1,115 @@
# QA Assignment: iSCSI P4 CHAP Lab Validation
Status: ready for QA.
Branch: `iscsi/frontend-completeness`.
Scope: target-side CHAP login auth through the real Linux `iscsiadm`
initiator. No Kubernetes Secret or CSI CHAP claim in this assignment.
Dev preflight:
- commit: `d0c62e6`
- host: M02 or equivalent Linux lab host
- command: Test 2 below
- artifact:
`[artifact-root]/20260505T072921Z-iscsi-p4-chap`
- result: PASS, including wrong-secret failure, correct-secret login,
`mkfs.ext4`, mount, checksum, 32 MiB dd, logout, and no active sessions.
## Preconditions
- Host: M02 or equivalent Linux host with `sudo`, `iscsiadm`, `mkfs.ext4`,
`mount`, `sha256sum`, and optional `fio`.
- Worktree: local `seaweed-block` checkout on branch `iscsi/frontend-completeness`,
or archived copy of the same commit on the Linux host.
- Lab must start clean:
- `sudo iscsiadm -m session` reports no active sessions, or only unrelated
sessions explicitly noted.
- no stale `blockmaster` / `blockvolume` from prior runs.
## Test 1: Default Non-CHAP Regression
Command:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p4-default" \
SW_BLOCK_ISCSI_ITERATIONS=1 \
SW_BLOCK_ISCSI_STRESS=dd \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
Expected:
- final line contains:
`[iscsi-os] PASS: 1 x iscsiadm mkfs mount write/read logout`
- `iscsi-sessions.final.txt` reports no active sessions.
- no `expected Data-Out` session errors in `blockvolume.log`.
## Test 2: CHAP Positive + Negative Login
Command:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p4-chap" \
SW_BLOCK_ISCSI_ITERATIONS=1 \
SW_BLOCK_ISCSI_STRESS=dd \
SW_BLOCK_ISCSI_CHAP_USERNAME=swchap \
SW_BLOCK_ISCSI_CHAP_SECRET=swchap-secret \
SW_BLOCK_ISCSI_CHAP_BAD_SECRET=wrong-secret \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
Expected:
- run log includes `chap=enabled username=swchap`.
- run log includes `verify wrong CHAP secret fails`.
- `login-bad.iter1.log` exists and shows the wrong-secret login failed.
- `iscsi-sessions.bad-auth.iter1.txt` does not show an established session
for this IQN.
- the following correct-secret login succeeds.
- final line contains:
`[iscsi-os] PASS: 1 x iscsiadm mkfs mount write/read logout`
- `iscsi-sessions.final.txt` reports no active sessions.
- no `expected Data-Out` session errors in `blockvolume.log`.
## Test 3: Optional CHAP fio
Run this only if Test 2 is green and the host has `fio`.
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p4-chap-fio" \
SW_BLOCK_ISCSI_ITERATIONS=1 \
SW_BLOCK_ISCSI_STRESS=fio \
SW_BLOCK_ISCSI_FIO_RUNTIME=60 \
SW_BLOCK_ISCSI_CHAP_USERNAME=swchap \
SW_BLOCK_ISCSI_CHAP_SECRET=swchap-secret \
SW_BLOCK_ISCSI_CHAP_BAD_SECRET=wrong-secret \
bash scripts/run-iscsi-os-smoke.sh "$PWD"
```
Expected:
- fio exits with `err=0`.
- final line contains PASS.
- no active sessions after cleanup.
## Report Format
QA should report:
- branch and commit SHA,
- host and kernel,
- exact commands,
- result for each test,
- artifact path for each run,
- final PASS line,
- `login-bad.iter1.log` result for Test 2,
- `iscsi-sessions.final.txt`,
- count of `expected Data-Out` in `blockvolume.log`,
- any host setup changes, such as installing `open-iscsi` or `fio`.
## Non-Claims
- No Kubernetes Secret integration.
- No CSI publish_context CHAP secret transport.
- No CHAP mutual authentication.
- No ALUA, MPIO, NVMe, or mounted failover claim.
@@ -0,0 +1,100 @@
# QA Assignment: iSCSI P4 K8s CHAP Validation
Status: ready for QA.
Branch: `iscsi/frontend-completeness`.
Scope: Kubernetes dynamic PVC path with target-side CHAP enabled through a
Kubernetes Secret and CSI `NodeStage` secrets.
## What This Verifies
- The alpha runner creates a Kubernetes Secret when CHAP env vars are set.
- The generated `blockvolume` Deployment references that Secret and starts the
iSCSI target with CHAP enabled.
- The StorageClass carries `csi.storage.k8s.io/node-stage-secret-*` refs.
- The CSI node configures `iscsiadm` CHAP before login.
- The pod writes and reads through the mounted PVC.
- Cleanup leaves no iSCSI session, PVC, pod, or generated blockvolume
Deployment.
## Preconditions
- Host: M02 or equivalent Linux Kubernetes node with k3s/kubectl, Docker,
`iscsiadm`, and loadable `iscsi_tcp`.
- Worktree: `iscsi/frontend-completeness` at or after the commit containing
K8s CHAP wiring.
- Build local images from the same worktree before the run:
```bash
bash scripts/build-alpha-images.sh "$PWD"
```
## Test 1: Default Non-CHAP Regression
Run first to prove the default alpha path still works.
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p4-k8s-default"
SW_BLOCK_ARTIFACT_DIR="/tmp/sw-block-artifacts/$RUN_ID" \
bash scripts/run-k8s-alpha.sh "$PWD"
```
Expected:
- final line contains:
`[alpha] PASS: dynamic PVC create/delete completed checksum write/read and cleanup`
- `generated-blockvolume.yaml` does not contain `--iscsi-chap-`.
- `iscsi-sessions.after-delete.txt` reports no active sessions.
- no generated `sw-blockvolume` Deployment remains.
## Test 2: K8s CHAP Dynamic PVC
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p4-k8s-chap"
SW_BLOCK_ARTIFACT_DIR="/tmp/sw-block-artifacts/$RUN_ID" \
SW_BLOCK_ISCSI_CHAP_USERNAME=swchap \
SW_BLOCK_ISCSI_CHAP_SECRET=swchap-secret \
bash scripts/run-k8s-alpha.sh "$PWD"
```
Expected:
- run log includes `chap_enabled=1`.
- `dynamic-pvc-pod.rendered.yaml` contains:
- `csi.storage.k8s.io/node-stage-secret-name`,
- `csi.storage.k8s.io/node-stage-secret-namespace`.
- `generated-blockvolume.yaml` does not contain `--iscsi-chap-`.
- `generated-blockvolume.yaml` contains:
- `secretKeyRef`,
- `SW_BLOCK_ISCSI_CHAP_USERNAME`,
- `SW_BLOCK_ISCSI_CHAP_SECRET`,
- `chapUsername`,
- `chapSecret`.
- pod log contains `/data/payload.bin: OK`.
- final line contains:
`[alpha] PASS: dynamic PVC create/delete completed checksum write/read and cleanup`.
- `iscsi-sessions.after-delete.txt` reports no active sessions.
- no generated `sw-blockvolume` Deployment remains.
## Report Format
QA should report:
- branch and commit SHA,
- host and kernel,
- exact commands,
- result for each test,
- artifact path for each run,
- final PASS line,
- snippets proving StorageClass secret refs and generated Deployment
`secretKeyRef`,
- `blockcsi-controller.log` error count for `chap`,
- `blockvolume-generated.log` auth/session errors if any,
- cleanup state.
## Non-Claims
- No CHAP mutual authentication.
- No Kubernetes Secret rotation.
- No per-volume user management beyond the single Secret used in this alpha
run.
- No ALUA, MPIO, NVMe, or mounted failover claim.
@@ -9,7 +9,7 @@ then replacement app pod reads the same PVC.
## QA Result
- Result: PASS.
- Host: node-b or equivalent Linux Kubernetes lab node.
- Host: M02 or equivalent Linux Kubernetes lab node.
- Artifact:
`[artifact-root]/20260505T231321Z-iscsi-p5-csi-node-restart`.
- Final line:
@@ -0,0 +1,197 @@
# QA Assignment: iSCSI P6 ALUA / MPIO Lab Validation
Status: Test 1B and Test 2 QA green.
Branch: `iscsi/csi-node-lifecycle`.
Scope: real Linux initiator validation for ALUA/MPIO and mounted failover.
## Preconditions
- Linux initiator host with:
- `open-iscsi`,
- `multipath-tools`,
- `sg3_utils` or equivalent tools for `sg_inq` and `sg_rtpg`,
- `mkfs.ext4`,
- `mount`,
- `fio` or `dd`,
- sudo access.
- Target host or Kubernetes lab capable of exposing two iSCSI paths for the
same volume.
- P6-B/P6-C implementation must be present before execution.
## Test 1: ALUA Discovery And Active Path Identity
Status: ready.
Run:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p6-alua-active"
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
bash scripts/run-iscsi-alua-os-smoke.sh "$PWD"
```
Expected:
- initiator discovers and logs into the V3 iSCSI target.
- standard INQUIRY shows TPGS enabled.
- VPD 0x00 still advertises only implemented pages.
- VPD 0x83 identity is stable and path-distinguishing:
- NAA is present,
- target port group and relative target port descriptors are present.
- REPORT TARGET PORT GROUPS returns active/optimized for the current path.
- `mkfs.ext4`, mount, checksum write/read, logout, and cleanup succeed.
- final `iscsiadm -m session` shows no active sw-block session.
Evidence to collect:
- `iscsiadm -m discovery` output.
- `iscsiadm -m session -P 3` output.
- `sg_inq <device>` standard INQUIRY output.
- `sg_inq -p 0x00 <device>` supported VPD pages.
- `sg_inq -p 0x83 <device>` device identification.
- `sg_rtpg <device>` or equivalent REPORT TARGET PORT GROUPS output.
- checksum output.
- final session cleanup.
Non-claim:
- Test 1 does not prove Linux `multipathd` grouping yet.
- Test 1 does not prove standby path login or mounted failover yet.
## Test 1B: Two-Path Multipath Identity
Status: PASS on `iscsi/csi-node-lifecycle@88e9301`.
Run:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p6-alua-mpath" \
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
bash scripts/run-iscsi-alua-multipath-smoke.sh "$PWD"
```
Expected:
- initiator discovers two target paths for one volume.
- `multipath -ll` shows one logical device.
- standard INQUIRY / VPD 0x83 / REPORT TARGET PORT GROUPS can be queried
through both paths.
- one path reports active/optimized.
- one path reports standby.
- VPD 0x83 exposes volume identity plus target-port identity for each path.
- standby path does not accept normal WRITE as GOOD.
- cleanup leaves no sw-block iSCSI sessions.
QA evidence:
- host: M02, Ubuntu 24.04.3 LTS, kernel 6.17.0-22-generic.
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T093732Z-iscsi-p6-alua-mpath-fix`.
- final line:
`[iscsi-mpath] PASS: two iSCSI paths report ALUA and multipath groups one logical device`.
- wire proof:
- common NAA: `36bfc269594ef6492`.
- r1: TPG `0x9866`, RTP `0x6b22`, AAS `0x00`.
- r2: TPG `0xf866`, RTP `0xdff0`, AAS `0x02`.
- `multipath -ll`: `mpatha` contains both `sda` and `sdb` with
`hwhandler='1 alua'`.
- standby path raw WRITE returned I/O error.
- cleanup left no active iSCSI sessions.
Evidence to collect:
- two-path `iscsiadm -m session -P 3`.
- `multipath -ll`.
- `sg_inq -p 0x83` from each path.
- `sg_rtpg` from each path.
- standby write rejection evidence.
- final `iscsiadm -m session`.
Non-claim:
- Test 1B does not prove mounted workload failover.
- Test 1B does not prove Windows MPIO.
- Test 1B does not prove primary movement while the filesystem is mounted.
## Test 2: Mounted Workload Failover
Status: PASS on `iscsi/csi-node-lifecycle@d1025f1`.
Run:
```bash
RUN_ID="$(date -u +%Y%m%dT%H%M%SZ)-iscsi-p6-mounted-failover" \
SW_BLOCK_ARTIFACT_DIR="/mnt/smb/work/share/g15d-k8s/${RUN_ID}" \
bash scripts/run-iscsi-alua-mounted-failover-smoke.sh "$PWD"
```
Expected:
- workload starts on mounted multipath device.
- active path failure triggers authority movement to the replica path.
- authority moves only after data-continuity prerequisites are met.
- final read-back is byte-equal.
- old primary path cannot acknowledge stale successful I/O.
- cleanup leaves no sw-block iSCSI sessions and no multipath residue.
QA evidence:
- host: M02, Ubuntu 24.04.3 LTS, kernel 6.17.0-22-generic.
- artifact:
`/mnt/smb/work/share/g15d-k8s/20260506T094503Z-iscsi-p6-mounted-failover`.
- final line:
`[iscsi-failover] PASS: mounted multipath workload read/wrote through r1->r2 failover`.
- wire proof:
- before failover: r1 AAS `0x00`, r2 AAS `0x02`.
- after killing r1: r2 AAS `0x00`.
- `multipath -ll`: same `mpatha` map served the mounted filesystem.
- r2 status after failover: `Epoch=2`, `AuthorityRole=primary`,
`Healthy=true`, `FrontendPrimaryReady=true`.
- pre-failover `pre.bin` checksum read back after failover.
- post-failover `post.bin` checksum written and verified.
- r1 log showed stale primary lineage rejections for post-promotion
WRITE/SYNCHRONIZE_CACHE attempts.
- cleanup left no active iSCSI sessions, no multipath map, and no stray
blockmaster/blockvolume processes.
Evidence to collect:
- pre-failover and post-failover checksum logs.
- r1/r2 target logs.
- r2 `/status` after failover showing `Healthy=true` and `Epoch>=2`.
- `multipath -ll` before and after failover.
- `sg_rtpg` before failure, during transition, and after recovery.
- `iscsiadm -m session -P 3` before and after failover.
- cleanup commands and final empty session/device state.
Non-claim:
- Test 2 is Linux multipath evidence only.
- Test 2 does not prove Kubernetes-mounted failover.
- Test 2 does not prove Windows MPIO.
- Test 2 does not claim production HA soak.
- Test 2 covers one volume and one RF=2 pair, not multi-volume soak or
repeated fault injection.
## Report Format
QA should report:
- branch and commit SHA,
- host/kernel,
- exact commands,
- `iscsiadm -m session`,
- `multipath -ll`,
- `sg_inq` standard/VPD evidence,
- `sg_rtpg` or equivalent REPORT TARGET PORT GROUPS evidence,
- workload result,
- failover event timing,
- cleanup state,
- any kernel `dmesg` I/O errors.
## Non-Claims
- No Windows MPIO claim.
- No NVMe-oF ANA claim.
- No performance claim.
- No production HA claim until soak/fault testing exists.
@@ -1,6 +1,6 @@
# QA Assignment: iSCSI P7 Backend FIO Matrix
Status: PASS on node-b.
Status: PASS on M02.
Branch: `iscsi/p7-performance-matrix-clean`.
Commit: `6826139ed9551df957a10a1cbc7368f63cccc36c`.
Scope: experimental Linux iSCSI fio comparison between `walstore` and
@@ -71,7 +71,7 @@ SW_BLOCK_BACKEND_BASE_ISCSI_PORT=3290
## QA Result
- Host:
- node-b, `192.168.1.184`,
- M02, `192.168.1.184`,
- Ubuntu 24.04.3 LTS,
- Linux 6.17.0-22-generic.
- Tooling:
@@ -4,7 +4,7 @@ Status: QA green on `iscsi/frontend-hardening@38ff850`.
Branch: `iscsi/frontend-hardening`.
Scope: repeatable soak evidence for the current iSCSI frontend stack.
Verified on node-b:
Verified on M02:
- run ID: `20260506T223240Z-iscsi-p8-soak-38ff850`
- artifact:
@@ -194,12 +194,12 @@ indistinguishable from a clean D2 scenario run.
## QA Process Commitment
- Validation host: node-b (`192.168.1.184`) k3s lab, or a user-provided
- Validation host: m02 (`192.168.1.184`) k3s lab, or a user-provided
equivalent single-node Kubernetes lab that passes
`docs/quickstart-kubernetes.md` preflight.
- QA does not sign off on close based on "all gates green in CI." QA runs
the documented runbook by hand, cold, from a clean state on the supported
lab shape (node-b + k3s, or node-a + k3s), as a user who has not seen the dev
lab shape (m02 + k3s, or M01 + k3s), as a user who has not seen the dev
process. If QA gets confused, close stops until the doc is fixed.
- QA deliberately breaks at least the three break-classes in HG-10 and
rejects the close if any break produces a bundle that does not help.
@@ -0,0 +1,278 @@
# QA Assignment: Light-Use Operations MVP Close Validation
## Goal
Validate the current plan's user-facing operations loop before it moves to
`finished-plans/`.
This is a spec-driven close gate. Do not validate only that commands exit 0.
Validate whether an early user/developer can:
```text
observe one volume -> read a useful summary -> attach a self-describing bundle
-> see TestOps control data for shared lab ownership
```
## Scope
Validate two surfaces:
1. Product CLI support bundle:
- `sw-block ops status`
- `volume-status-report.json`
- `volume-status-summary.txt`
- `ops-status-bundle.json`
2. Product-local TestOps control data:
- `sw-testops --control-dir`
- `active/<run_id>.json`
- `history/<run_id>.json`
- `locks/<resource>.lock`
- `events.jsonl`
- `sw-testops --control-list`
## Build
From the product repo under test:
```text
go build -o sw-block ./cmd/sw-block
go build -o sw-testops ./cmd/sw-testops
```
Record:
- product branch,
- product commit,
- whether worktree is dirty,
- OS/controller host,
- target host if using M01/M02.
## Part A: Fast Local Contract Validation
Run:
```text
go test ./core/ops ./cmd/sw-block ./internal/testops ./cmd/sw-testops -count=1
```
Expected:
- exit 0,
- no skipped failure relevant to ops status or TestOps control data.
## Part B: CLI Bundle Contract
Run the command-boundary gate:
```text
swblock validate testops/scenarios/operations-volume-status-cli-gate.yaml
```
Expected:
- scenario validates,
- the gate asserts:
- report schema,
- volume id,
- product revision,
- summary status/authority identity,
- `ops-status-bundle.json` command,
- exit code,
- status,
- artifact list,
- `unchecked`,
- `collection_errors`,
- `non_claims`.
If the runner binary is unavailable, run the equivalent `go test` path and
manually inspect the output directory from `SW_BLOCK_OPS_STATUS_CLI_ARTIFACT_DIR`.
## Part C: Bundle Artifact Inspection
From an actual generated bundle, verify:
### `ops-status-bundle.json`
Required:
- `schema_version == "1.0"`
- `command == "sw-block ops status"`
- `volume_id` is populated
- `product_revision` is populated
- `exit_code` is present
- `status` is one of:
- `ok`
- `unhealthy`
- `invalid`
- `artifacts` includes:
- `volume-status-report.json`
- `volume-status-summary.txt`
- `ops-status-bundle.json`
- `unchecked` exists, even if empty
- `collection_errors` exists, even if empty
- `non_claims` is non-empty
### `volume-status-summary.txt`
Required:
- starts with `status:`
- includes `product_revision:`
- includes `volume:`
- includes `authority:`
- includes `replication:`
- includes `residue:`
- includes either `issues: none` or explicit issue lines.
### `volume-status-report.json`
Required:
- parses as JSON,
- includes `schema_version`,
- includes `source`,
- includes `volume`,
- includes `authority`,
- includes `replication`,
- includes `durable`,
- includes `residue`.
## Part D: CLI Outlier Checks
Run at least these adversarial cases:
1. Missing required args:
```text
sw-block ops status --volume v1
```
Expected:
- exit 2,
- stderr explains missing `--volume`/`--out` or missing live sources,
- no misleading artifact success line.
2. Bad master/status address against an output dir:
```text
sw-block ops status \
--volume v1 \
--master 127.0.0.1:1 \
--status-addr 127.0.0.1:2 \
--out <tmp-dir>
```
Expected:
- non-zero exit,
- if partial artifacts are written, `ops-status-bundle.json` and
`volume-status-summary.txt` reflect unhealthy/error state,
- collection error is visible in either summary or bundle.
3. Output path invalid or unwritable.
Expected:
- exit 2,
- no false `status: ok` claim.
## Part E: TestOps Control Data
Use a shared/control directory. Prefer a shared-drive path if available.
```text
CONTROL=<shared-or-temp>/testops-control
ART=<shared-or-temp>/artifacts
sw-testops \
--repo-root <seaweed_block_repo> \
--scenario g15b-manifest \
--artifact-dir "$ART/run-1" \
--run-id qa-control-run-1 \
--commit <product_commit> \
--control-dir "$CONTROL"
sw-testops --repo-root <seaweed_block_repo> --control-dir "$CONTROL" --control-list
```
Expected after terminal exit:
- `active/qa-control-run-1.json` absent,
- `history/qa-control-run-1.json` present,
- `locks/` empty,
- `events.jsonl` has start and complete events,
- `--control-list` shows:
- state,
- run id,
- scenario,
- source commit,
- updated timestamp,
- locks column,
- artifact dir.
## Part F: Control Lock Conflict
Validate resource-lock collision behavior. Use either:
- a tiny custom registry with a shell script that sleeps, or
- an existing resource-declaring scenario if it is safe to run.
Expected:
- first run creates active record and lock files,
- second run using the same resource exits before driver execution,
- second run does not create an active record,
- first run's lock is not removed by the conflicting run,
- terminal first run moves to history and releases locks.
## Part G: Shared Lab Hygiene
If running on M01/M02, verify after the test:
- no stale TestOps locks for completed runs,
- no active record for completed runs,
- no unexpected iSCSI session,
- no unexpected NVMe SeaweedFS subsystem,
- no blockmaster/blockvolume process left by this validation.
## Report Template
Return one report with:
```text
QA Report — Light-Use Operations MVP Close Validation
Product commit:
Runner/swblock commit or binary:
Host/controller:
Target node(s):
Artifact/control dirs:
Part A local tests: PASS/FAIL
Part B CLI gate: PASS/FAIL
Part C artifact inspection: PASS/FAIL
Part D CLI outliers: PASS/FAIL
Part E control data: PASS/FAIL
Part F lock conflict: PASS/FAIL
Part G hygiene: PASS/FAIL
Findings:
1. ...
Verdict:
PASS to close current plan / FAIL with blockers
```
## Non-Claims
This validation does not prove:
- production HA,
- performance,
- install/upgrade/uninstall,
- Kubernetes operator ownership,
- UI/dashboard,
- remote TestOps agent,
- queueing or stale-lock stealing.
@@ -10,7 +10,7 @@ gate, not a new NVMe protocol gate.
## Preconditions
- Host: node-b k3s lab or equivalent single-node k3s host.
- Host: M02 k3s lab or equivalent single-node k3s host.
- Required host tools:
- `kubectl`,
- `nvme-cli`,
@@ -0,0 +1,384 @@
# Phase 120 NVMe/TCP Performance Baseline QA Sign-off
Verdict: **FAIL**
Classification: **product** - the live gate failed in the synced current product
tree after successful local image build/import, Helm install, PVC binding, and
perf pod readiness. This was not a lab access, disk, image availability, or
cleanup failure.
## Scope
- Branch tested: `phase120-nvme-tcp-performance-baseline`
- Commit tested: `949a8e9`
- Scenario: `testops/scenarios/nvme-tcp-performance-baseline-chain.yaml`
- Run command: `C:\work\swblock.exe run -env product_root=/tmp/seaweed_block testops/scenarios/nvme-tcp-performance-baseline-chain.yaml`
- Run id: `20260702-163714-0048`
- Bundle path: `C:\work\seaweed_block\results\20260702-163714-0048`
- Remote artifact path: `/mnt/smb/work/share/g15d-k8s/20260702-163714-0048-phase120-nvme-perf`
- Image mode: local images (`sw-block:local`, `sw-block-csi:local`) built and imported by the gate
## Result
The scenario failed in `run_gate` before the `assert_summary` phase ran:
```text
volume status=ok, want ready
```
Runner state:
```text
pre_clean=pass
run_gate=fail
collect=pass
scenario_status=FAIL
```
The gate wrote partial summary rows only; no baseline performance rows were
collected.
## Full Summary Rows
```text
phase120_nvme_tcp_performance_baseline_status=running
protocol=nvme
frontend_transport=tcp
roce_claim_allowed=false
nvme_rdma_claim_allowed=false
performance_claim_allowed=false
performance_slo_claim_allowed=false
perf_gate_type=baseline_no_slo
go_test_blockvolume_sw_block=pass
image_ready=true
generated_external_nvme=true
blockvolume_node=m01
app_node=m02
helm_template_external_nvme=true
helm_install=pass
pvc_bound=true
perf_pod_ready=true
```
Missing required PASS rows include:
```text
phase120_nvme_tcp_performance_baseline_status=ok
managed_volume_status=ready
managed_volume_reason=first_volume_verified
publish_target_loopback=false
marker_verified=true
final_data_verified=true
seq_write_mibps=<number>
seq_read_mibps=<number>
small_write_iops=<number>
cleanup_status=ok
```
## Failure Evidence
`status/cluster-evidence.json` contained a ready managed-volume view but the
gate script checked the older `volumes` status field:
```text
cluster_evidence.status=ok
cluster_evidence.volumes[0].status=ok
cluster_evidence.volumes[0].publish_target=192.168.1.181:4420
cluster_evidence.managed_volumes[0].status=ready
cluster_evidence.managed_volumes[0].reason_code=first_volume_verified
cluster_evidence.managed_volumes[0].publish_target=192.168.1.181:4420
```
The current gate script exits unless `cluster_evidence.volumes[0].status` is
`ready`, so it failed before marker verification and performance measurements.
## Cleanup Status
The gate exited before its in-script `verify-helm-cleanup.sh` step, so QA ran the
cleanup verifier separately after the failure:
```text
cleanup_status=ok
helm_release=sw-block
helm_namespace=kube-system
iqn_substr=io.seaweedfs
k8s_residue_count=0
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=0
cleanup_observed_at=2026-07-02T23:41:10Z
```
Final residue checks found no `swblock*` CRDs, no `sw-block` Helm release, and no
`sw-block` pods/PVCs/PVs/namespaces. Only the physical local NVMe PCI subsystem
remained in `nvme list-subsys`.
## Lab Notes
- Synced the current Windows product tree to `m02:/tmp/seaweed_block` before the run.
- Sync verification hashes matched for the Phase 120 script, scenario, and `go.mod`.
- m01 and m02 were `Ready`; tp01 was `NotReady` but not used by this two-node gate.
- m02 root disk was 61% used.
- Pre-flight empty `swblock*` CRDs were removed before running.
## RE-VALIDATION (b9b3bac) - FAIL
Classification: **lab** - the fixed managed-volume readiness path passed and the
baseline reached marker verification, sequential/small-write measurements, and
final data verification. The scenario still failed because the in-gate cleanup
verifier observed one transient Kubernetes residue pod immediately after Helm
uninstall. A post-exit cleanup verifier run one minute later reported
`cleanup_status=ok` with all residue counts zero.
## Re-validation Scope
- Branch tested: `phase120-nvme-tcp-performance-baseline`
- Commit tested: `b9b3bac`
- Scenario: `testops/scenarios/nvme-tcp-performance-baseline-chain.yaml`
- Run command: `C:\work\swblock.exe run -env product_root=/tmp/seaweed_block testops/scenarios/nvme-tcp-performance-baseline-chain.yaml`
- Run id: `20260702-164616-ea17`
- Bundle path: `C:\work\seaweed_block\results\20260702-164616-ea17`
- Remote artifact path: `/mnt/smb/work/share/g15d-k8s/20260702-164616-ea17-phase120-nvme-perf`
- Image mode: local images (`sw-block:local`, `sw-block-csi:local`) built and imported by the gate
- Synced product root: `m02:/tmp/seaweed_block` from Git archive `b9b3bac`
## Re-validation Result
The scenario failed in `run_gate` before `assert_summary` ran because the gate
did not append `cleanup_status=ok` or the final
`phase120_nvme_tcp_performance_baseline_status=ok` row.
Runner state:
```text
pre_clean=pass
run_gate=fail
collect=pass
scenario_status=FAIL
```
Runner failure excerpt:
```text
ERROR: phase "run_gate" failed: action 0 (exec) failed: exec: code=1
```
The runner stderr only surfaced Docker legacy-builder warnings, but the artifact
summary and cleanup verifier show the actual terminal condition: all baseline
checks completed, then in-gate cleanup verification failed on Kubernetes residue.
## Re-validation Full Summary Rows
```text
phase120_nvme_tcp_performance_baseline_status=running
protocol=nvme
frontend_transport=tcp
roce_claim_allowed=false
nvme_rdma_claim_allowed=false
performance_claim_allowed=false
performance_slo_claim_allowed=false
perf_gate_type=baseline_no_slo
go_test_blockvolume_sw_block=pass
image_ready=true
generated_external_nvme=true
blockvolume_node=m01
app_node=m02
helm_template_external_nvme=true
helm_install=pass
pvc_bound=true
perf_pod_ready=true
managed_volume_status=ready
managed_volume_reason=first_volume_verified
publish_target_loopback=false
publish_target=192.168.1.181:4420
marker_verify_ms=197
marker_verified=true
seq_size_mib=64
seq_write_duration_ms=750
seq_write_mibps=85.33
seq_read_duration_ms=219
seq_read_mibps=292.24
small_write_ops=256
small_write_block_bytes=4096
small_write_duration_ms=302
small_write_iops=847.68
small_write_mibps=3.31
final_data_verified=true
```
Missing required PASS rows:
```text
cleanup_status=ok
phase120_nvme_tcp_performance_baseline_status=ok
```
## Re-validation Cleanup Evidence
In-gate cleanup verifier rows:
```text
cleanup_status=failed
helm_release=sw-block
helm_namespace=kube-system
iqn_substr=io.seaweedfs
k8s_residue_count=1
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=1
cleanup_observed_at=2026-07-02T23:49:28Z
```
In-gate cleanup failure:
```text
kubernetes_sw_block_resources_present
pod/sw-block-csi-node-55jt2
```
Post-exit cleanup verifier rows:
```text
cleanup_status=ok
helm_release=sw-block
helm_namespace=kube-system
iqn_substr=io.seaweedfs
k8s_residue_count=0
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=0
cleanup_observed_at=2026-07-02T23:50:34Z
```
Final residue checks found no `sw-block` Helm release, no `sw-block` pods/PVCs/PVs
or namespaces, no `swblock*` CRDs, and no `sw-block` admission policies.
## Re-validation Lab Notes
- m01 and m02 were `Ready`; tp01 was `NotReady` but not used by this gate.
- m02 root disk was 62% used.
- No pre-existing `sw-block` Helm, pod/PVC/PV/namespace, CRD, or admission-policy residue was present before the run.
- The remote product root was synced from `b9b3bac` before running; the synced gate script contained the fixed `managed_volume_status=ready` check.
## RE-VALIDATION (fb19f58) - PASS
Verdict: **PASS**
## Re-validation Scope
- Branch tested: `phase120-nvme-tcp-performance-baseline`
- Commit tested: `fb19f5894262cb598f0d321538242fac186e4358`
- Scenario: `testops/scenarios/nvme-tcp-performance-baseline-chain.yaml`
- Run command: `C:\work\swblock.exe run testops/scenarios/nvme-tcp-performance-baseline-chain.yaml -env product_root=/tmp/seaweed_block`
- Run id: `20260702-165514-8196`
- Bundle path: `C:\work\seaweed_block\results\20260702-165514-8196`
- Remote artifact path: `/mnt/smb/work/share/g15d-k8s/20260702-165514-8196-phase120-nvme-perf`
- Image mode: local images (`sw-block:local`, `sw-block-csi:local`) built and imported by the gate
- Synced product root: `m02:/tmp/seaweed_block` from Git archive `fb19f58`
## Re-validation Result
The scenario passed all phases and assertions:
```text
=== nvme-tcp-performance-baseline-chain === PASS (3m0.599s)
pre_clean=PASS
run_gate=PASS
assert_summary=PASS
collect=PASS
actions=24 passed, 0 failed
```
Asserted summary keys all matched:
```text
phase120_status_ok=1
protocol_nvme=1
frontend_transport_tcp=1
performance_claim_denied=1
roce_claim_denied=1
seq_write_metric=1
seq_read_metric=1
small_write_metric=1
final_data_verified=1
cleanup_ok=1
```
## Re-validation Full Summary Rows
```text
phase120_nvme_tcp_performance_baseline_status=running
protocol=nvme
frontend_transport=tcp
roce_claim_allowed=false
nvme_rdma_claim_allowed=false
performance_claim_allowed=false
performance_slo_claim_allowed=false
perf_gate_type=baseline_no_slo
go_test_blockvolume_sw_block=pass
image_ready=true
generated_external_nvme=true
blockvolume_node=m01
app_node=m02
helm_template_external_nvme=true
helm_install=pass
pvc_bound=true
perf_pod_ready=true
managed_volume_status=ready
managed_volume_reason=first_volume_verified
publish_target_loopback=false
publish_target=192.168.1.181:4420
marker_verify_ms=163
marker_verified=true
seq_size_mib=64
seq_write_duration_ms=777
seq_write_mibps=82.37
seq_read_duration_ms=277
seq_read_mibps=231.05
small_write_ops=256
small_write_block_bytes=4096
small_write_duration_ms=332
small_write_iops=771.08
small_write_mibps=3.01
final_data_verified=true
cleanup_status=ok
phase120_nvme_tcp_performance_baseline_status=ok
```
## Re-validation Cleanup Evidence
In-gate cleanup verifier rows:
```text
cleanup_status=ok
helm_release=sw-block
helm_namespace=kube-system
iqn_substr=io.seaweedfs
k8s_residue_count=0
iscsi_residue_count=0
process_residue_count=0
multipath_residue_count=0
hostpath_residue_count=0
failure_count=0
cleanup_observed_at=2026-07-02T23:58:11Z
```
Final residue checks found no `sw-block` Helm release, no `sw-block` pods/PVCs/PVs
or namespaces, no `swblock*` CRDs, no `sw-block` admission policies, and no
Seaweed NVMe subsystem entries.
## Re-validation Lab Notes
- m01 and m02 were `Ready`; tp01 was `NotReady` but not used by this gate.
- m02 root disk was 63% used.
- No pre-existing `sw-block` Helm, pod/PVC/PV/namespace, CRD, or admission-policy residue was present before the run.
- The remote product root was synced from Git archive `fb19f58`; the synced gate script contained `SW_BLOCK_CLEANUP_WAIT_SECONDS="${SW_BLOCK_CLEANUP_WAIT_SECONDS:-180}"`.
- `publish_target=192.168.1.181:4420` is the NVMe/TCP LAN target on m01. It is
not a RoCE/RDMA address and does not change the explicit
`roce_claim_allowed=false` / `nvme_rdma_claim_allowed=false` boundary.
@@ -106,7 +106,7 @@ failure_count=0
## Notes
- `node-c` remains NotReady in the lab, but this gate only requires the node-a/node-b
- `tp01` remains NotReady in the lab, but this gate only requires the m01/m02
NVMe/TCP path.
- Throughput was recorded as diagnostic evidence only. It is not a performance
claim.
@@ -0,0 +1,56 @@
# Phase 166 NVMe/RDMA Kubernetes Multipath Status
Status: **HOLD - implementation complete, live close gate infrastructure-blocked**
Phase 166 requires an already-mounted RF2 Kubernetes volume to have two live
RDMA controllers, keep I/O running while one non-primary target is unavailable,
reconnect that exact RDMA path, and replace one desired endpoint without
restaging. No TCP controller may satisfy an RDMA path.
## Implemented Contract
- CSI matches a desired path by exact `(transport, NQN, address)` and accepts
only controllers whose state is `live`.
- Initial stage and mounted reconcile connect missing desired endpoints before
pruning stale controllers.
- Initial-stage rollback is scoped to controllers created by that attempt; it
does not disconnect pre-existing or unrelated controllers.
- A mounted volume rejects a transport change and requires restage instead of
silently mixing TCP and RDMA.
- Publish context carries explicit `rdma` intent while preserving legacy TCP
behavior when the transport field is absent.
- The close gate requires a non-primary outage, surviving-path mounted I/O,
exact path restoration, endpoint replacement, cross-surface agreement, no
TCP fallback, and scoped zero-residue cleanup.
## Evidence
| Check | Result | Evidence |
| --- | --- | --- |
| Source and script contracts | PASS | `go test ./core/csi ./cmd/blockcsi ./core/ops ./core/launcher ./scripts -count=1`; changed shell scripts pass `bash -n`; Phase 133 and 166 scenarios validate. |
| Kubernetes single-path RDMA regression | PASS | Phase 165 run `20260718-054945-77d5`: transport `rdma`, host controller `10.0.0.3`, writer/reader verified, no TCP fallback, clean detach and zero residue. |
| Shared RF2 reconnect logic over NVMe/TCP | PASS | Phase 133 run `20260718-061457-5ed4`, 35/35 actions: two initial paths; non-primary endpoint `192.168.1.184:4420` replaced by `192.168.1.184:4520`; surviving `192.168.1.181:4420` controller preserved; mounted I/O and Pod UID preserved; old path absent; CRD/report/dashboard/explain agree; cleanup clean. |
| RF2 RDMA mounted reconnect close gate | BLOCKED | The current lab has only two RoCE-capable nodes, m01 (`10.0.0.1`) and m02 (`10.0.0.3`), and both must host the RF2 targets. The initiator therefore shares a node with one target; Linux rejects that local RDMA self-connect with `Invalid argument`. tp01 is offline and is not a RoCE-capable replacement. |
The Phase 133 regression asserts stable behavior, not observation of a transient
stale controller. A valid result is that the old path is already absent when
sampled, provided the new desired path is live, the surviving controller is
unchanged, the final exact path set is correct, mounted I/O is continuous, and
`stale_old_path_pruned=true`.
## Unblock Requirement
Provide a third Ready Kubernetes node with working RoCE configuration and
reachability to both m01 and m02 RDMA frontend addresses. Both RF2 targets must
be remote from the initiator. Then run:
```powershell
C:\work\swblock.exe run -results-dir C:\work\seaweed_block\results `
-env app_node=<third-kubernetes-node> `
-env app_ssh_addr=<third-node-management-ip> `
C:\work\seaweed_block\testops\scenarios\nvme-rdma-k8s-multipath-reconnect-chain.yaml
```
Phase 166 closes only after that live gate emits
`phase166_nvme_rdma_k8s_multipath_reconnect_status=ok` and
`cleanup_status=ok`. Component regressions do not substitute for this result.
@@ -0,0 +1,266 @@
# Phase 172 D1 WAL Materialization Baseline QA Sign-off
## Verdict
**PASS**
Exact commit `6dd89e71298b5fa5a46d80c4c27efce7d5bba02f` passed the
unchanged Phase 172 D1 Linux gate, the assigned race test at `-count=20`,
and `go vet ./core/storage`.
The baseline admits D2:
```text
d2_single_read_candidate_admitted=true
next_recommendation=implement_disabled_single_read_materialization
```
## Source And Environment
```text
tested_sha=6dd89e71298b5fa5a46d80c4c27efce7d5bba02f
tested_branch=detached_exact_commit
source_dirty=false
lab_host=M02
go_version=go version go1.25.0 linux/amd64
kernel=Linux 6.17.0-23-generic #23~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 14 16:11:48 UTC 2 x86_64 GNU/Linux
strace_version=strace -- version 6.8
```
The source was transferred as a Git bundle and checked out detached in the
isolated Linux worktree
`/tmp/phase172-d1-qa-6dd89e7-20260730-050249`. The shared development
worktree was not used or modified.
## Commands
```bash
bash scripts/run-phase172-wal-materialization-baseline-gate.sh
go test -race ./core/storage \
-run 'Test(DirtyMapSnapshotCarriesRecordGeometry|WALStoreDirtyRecordGeometryAppendPaths|WALStoreRecoverReconstructsRecordGeometry|WALStoreRecoverReconstructsLegacyTrimRecordGeometry|WALStoreRecordGeometrySurvivesRingWrap|FlusherInstrumentationCountsWALRecordMaterializationShape|FlusherInstrumentationExposesCurrentDuplicateReadsForSharedRecord)$' \
-count=20
go vet ./core/storage
```
The gate ran with its committed defaults: five repetitions, one second per
benchmark, normal checkpoint behavior, final Sync and drain, 20 geometry
repetitions, and 1024 records in the scoped syscall probe.
## Required Gates
| Gate | Evidence | Result |
|---|---|---|
| Storage regression | `storage_regression=pass` | PASS |
| Geometry repeat | `record_geometry_repeat_20=pass` | PASS |
| Legacy range trim | Three blocks recovered, flushed, checkpointed; `legacy_trim_recovery_fixture=pass` | PASS |
| Ring wrap | Wrap, crash, reopen, and recovered identity; `ring_wrap_geometry_fixture=pass` | PASS |
| Checkpoint/failures | 20/20 complete checkpoints; 160/160 failure metrics zero | PASS |
| Duplicate-read baseline | Sequential `5/5`; scattered `5/5` | PASS |
| Current reuse behavior | 20/20 workload samples reported zero actual reuse hits | PASS |
| Exact-path syscall probe | Product `2048`; `strace -P` `2048` | PASS |
| Race | `ok ... core/storage 3.807s`, `-count=20` | PASS |
| Vet | Exit 0, no output | PASS |
| D2 admission | `d2_single_read_candidate_admitted=true` | PASS |
The append/recovery fixtures cover ordinary append, independent explicit
batch records, disabled-by-default multi-block records, replicated
`ApplyEntry`, crash/reopen recovery, a three-block legacy trim, and ring
wrap followed by crash/reopen. The exact `RecordSize` and shared record
identity assertions passed.
The commit changes no WAL/superblock format file and adds no default
materialization selector. The D1 path still performs one header read and one
full-record read per validated record.
## Scoped Strace
The probe used `strace -f -c -e trace=pread64 -P <exact-store-file>` rather
than whole-process syscall counts:
```text
phase172_probe_validated_records=1024
phase172_probe_header_read_ops=1024
phase172_probe_record_read_ops=1024
phase172_probe_materialization_read_ops=2048
% time seconds usecs/call calls errors syscall
100.00 0.004185 2 2048 pread64
```
Therefore:
```text
scoped_product_materialization_reads=2048
scoped_strace_pread64_calls=2048
scoped_strace_matches_product_counter=true
```
## Workload Medians
| Workload | MiB/s | p99 ns | Unique records/snapshot entry | Reuse opportunities/snapshot entry | Header reads/validated | Record reads/validated | Materialization reads/validated | Read bytes/entry | Actual reuse hits/validated | WAL wraps |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| Sequential 4 KiB | 66.11 | 2212380 | 1.000 | 0 | 1.000 | 1.000 | 2.000 | 4172 | 0 | 6.000 |
| Scattered 4 KiB | 63.86 | 2208120 | 1.000 | 0 | 1.000 | 1.000 | 2.000 | 4172 | 0 | 5.000 |
| Explicit 16x4 KiB batch | 77.75 | 5770525 | 1.000 | 0 | 1.000 | 1.000 | 2.000 | 3912 | 0 | 9.000 |
| Multi-block 16x4 KiB opt-in | 53.41 | 5791757 | 0.06250 | 0.9375 | 1.000 | 1.000 | 2.000 | 58565 | 0 | 9.000 |
The explicit batch remained independent. The opt-in multi-block workload had
one unique record per 16 logical entries and nonzero reuse opportunity, while
the unchanged D1 implementation recorded zero actual reuse hits.
## Independent Metric Audit
An independent pass over all raw benchmark rows reported:
```text
benchmark_rows=20
zero_failure_metric_checks=160
checkpoint_checks=20
balanced_cycle_checks=20
zero_actual_reuse_checks=20
duplicate_materialization_checks=20
ordinary_read_shape_checks=10
independent_batch_shape_checks=5
multiblock_reuse_opportunity_checks=5
qa_independent_metric_audit=pass
```
## Full Gate Summary
```text
phase172_wal_materialization_baseline_status=running
git_sha=6dd89e71298b5fa5a46d80c4c27efce7d5bba02f
git_dirty=false
go_version=go_version_go1.25.0_linux/amd64
kernel=Linux_6.17.0-23-generic_#23~24.04.1-Ubuntu_SMP_PREEMPT_DYNAMIC_Tue_Apr_14_16:11:48_UTC_2_x86_64_GNU/Linux
benchmark_time=1s
repetitions=5
writers=4
workloads=sequential_4k,scattered_4k,explicit_16x4k_batch,multiblock_16x4k_opt_in
d2_admission=4_of_5_sequential_and_scattered_samples_each_header_and_record_reads_per_validated_record_in_0.95_to_1.05_and_combined_at_least_1.90
strace_scope=exact_store_file_path
storage_regression=pass
record_geometry_repeat_20=pass
legacy_trim_recovery_fixture=pass
ring_wrap_geometry_fixture=pass
repetition_1_order=sequential scattered batch multiblock
repetition_2_order=multiblock batch scattered sequential
repetition_3_order=scattered sequential multiblock batch
repetition_4_order=batch multiblock sequential scattered
repetition_5_order=sequential batch scattered multiblock
all_samples_checkpoint_coverage_complete=true
all_samples_failed_cycles_zero=true
sequential_mibps_samples=55.66,61.63,67.32,120.64,66.11
sequential_mibps_median=66.11
sequential_p99_ns_samples=2265736,2214159,2212380,1187207,2210448
sequential_p99_ns_median=2212380
sequential_unique_records_per_snapshot_entry_samples=1.000,1.000,1.000,1.000,1.000
sequential_unique_records_per_snapshot_entry_median=1.000
sequential_reuse_opportunities_per_snapshot_entry_samples=0,0,0,0,0
sequential_reuse_opportunities_per_snapshot_entry_median=0
sequential_header_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
sequential_header_reads_per_validated_record_median=1.000
sequential_record_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
sequential_record_reads_per_validated_record_median=1.000
sequential_materialization_reads_per_validated_record_samples=2.000,2.000,2.000,2.000,2.000
sequential_materialization_reads_per_validated_record_median=2.000
sequential_materialization_read_bytes_per_entry_samples=4172,4172,4172,4172,4172
sequential_materialization_read_bytes_per_entry_median=4172
sequential_record_reuse_hits_per_validated_record_samples=0,0,0,0,0
sequential_record_reuse_hits_per_validated_record_median=0
sequential_wal_wraps_samples=7.000,6.000,6.000,6.000,6.000
sequential_wal_wraps_median=6.000
scattered_mibps_samples=63.86,66.13,81.54,56.55,43.65
scattered_mibps_median=63.86
scattered_p99_ns_samples=2220691,2208120,2201888,2207386,2337337
scattered_p99_ns_median=2208120
scattered_unique_records_per_snapshot_entry_samples=1.000,1.000,1.000,1.000,1.000
scattered_unique_records_per_snapshot_entry_median=1.000
scattered_reuse_opportunities_per_snapshot_entry_samples=0,0,0,0,0
scattered_reuse_opportunities_per_snapshot_entry_median=0
scattered_header_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
scattered_header_reads_per_validated_record_median=1.000
scattered_record_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
scattered_record_reads_per_validated_record_median=1.000
scattered_materialization_reads_per_validated_record_samples=2.000,2.000,2.000,2.000,2.000
scattered_materialization_reads_per_validated_record_median=2.000
scattered_materialization_read_bytes_per_entry_samples=4172,4172,4172,4172,4172
scattered_materialization_read_bytes_per_entry_median=4172
scattered_record_reuse_hits_per_validated_record_samples=0,0,0,0,0
scattered_record_reuse_hits_per_validated_record_median=0
scattered_wal_wraps_samples=5.000,6.000,5.000,5.000,6.000
scattered_wal_wraps_median=5.000
batch_mibps_samples=77.75,88.87,116.70,64.87,66.22
batch_mibps_median=77.75
batch_p99_ns_samples=5816134,5741796,5765574,5770525,5782230
batch_p99_ns_median=5770525
batch_unique_records_per_snapshot_entry_samples=1.000,1.000,1.000,1.000,1.000
batch_unique_records_per_snapshot_entry_median=1.000
batch_reuse_opportunities_per_snapshot_entry_samples=0,0,0,0,0
batch_reuse_opportunities_per_snapshot_entry_median=0
batch_header_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
batch_header_reads_per_validated_record_median=1.000
batch_record_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
batch_record_reads_per_validated_record_median=1.000
batch_materialization_reads_per_validated_record_samples=2.000,2.000,2.000,2.000,2.000
batch_materialization_reads_per_validated_record_median=2.000
batch_materialization_read_bytes_per_entry_samples=4122,4112,3658,3730,3912
batch_materialization_read_bytes_per_entry_median=3912
batch_record_reuse_hits_per_validated_record_samples=0,0,0,0,0
batch_record_reuse_hits_per_validated_record_median=0
batch_wal_wraps_samples=9.000,9.000,9.000,9.000,9.000
batch_wal_wraps_median=9.000
multiblock_mibps_samples=54.74,58.98,45.92,49.20,53.41
multiblock_mibps_median=53.41
multiblock_p99_ns_samples=5892553,5731452,5786637,5803821,5791757
multiblock_p99_ns_median=5791757
multiblock_unique_records_per_snapshot_entry_samples=0.06250,0.06250,0.06250,0.06250,0.06250
multiblock_unique_records_per_snapshot_entry_median=0.06250
multiblock_reuse_opportunities_per_snapshot_entry_samples=0.9375,0.9375,0.9375,0.9375,0.9375
multiblock_reuse_opportunities_per_snapshot_entry_median=0.9375
multiblock_header_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
multiblock_header_reads_per_validated_record_median=1.000
multiblock_record_reads_per_validated_record_samples=1.000,1.000,1.000,1.000,1.000
multiblock_record_reads_per_validated_record_median=1.000
multiblock_materialization_reads_per_validated_record_samples=2.000,2.000,2.000,2.000,2.000
multiblock_materialization_reads_per_validated_record_median=2.000
multiblock_materialization_read_bytes_per_entry_samples=58395,58565,56312,64007,65147
multiblock_materialization_read_bytes_per_entry_median=58565
multiblock_record_reuse_hits_per_validated_record_samples=0,0,0,0,0
multiblock_record_reuse_hits_per_validated_record_median=0
multiblock_wal_wraps_samples=9.000,9.000,9.000,8.000,9.000
multiblock_wal_wraps_median=9.000
sequential_duplicate_read_pass_count=5
scattered_duplicate_read_pass_count=5
sequential_wrap_pass_count=5
strace_available=true
scoped_product_materialization_reads=2048
scoped_strace_pread64_calls=2048
scoped_strace_matches_product_counter=true
d2_single_read_candidate_admitted=true
next_recommendation=implement_disabled_single_read_materialization
phase172_wal_materialization_baseline_status=ok
```
## Artifacts And Cleanup
```text
artifact_path=/mnt/smb/work/share/g15d-k8s/phase172-d1-6dd89e7-20260730-050249/phase172-d1-6dd89e7-20260730-050249-artifacts.tar.gz
archive_sha256=c04b2c1d8868d05cb3412b23e4508f63c3c98ba4ecb4c16570a465dc526b9277
archive_file_count=105
durable_archive_integrity=pass
archive_filename_cr=false
lingering_test_process=false
temp_cleanup=pass
lab_resource_cleanup=pass
```
The archive contains the full gate summary, all 20 benchmark logs and metric
value files, storage and geometry logs, race and vet logs, exact-path strace
and probe output, script checksum, source provenance, and per-file checksums.
No product or gate finding was found. One QA-created audit filename initially
contained a carriage return due to a PowerShell here-string; it was renamed
before the final archive, and the discarded archive checksum is not used.
@@ -0,0 +1,198 @@
# Phase 172 D2 Single-Read Materialization QA Sign-off
## Verdict
**PASS**
Exact commit `a46af56f850ab3faa03fcad92243bf1bad484a69` passed the
unchanged Phase 172 D2 correctness gate on Linux m02. The disabled candidate
uses one exact-file WAL read per validated record, while the shipped default
continues to use the existing header-plus-record two-read path.
```text
phase172_single_read_correctness_status=ok
d3_shared_record_reuse_eligible=true
```
No product, gate, artifact, or lab finding was found.
## Source And Environment
```text
tested_sha=a46af56f850ab3faa03fcad92243bf1bad484a69
tested_branch=qa/phase172-d2-a46af56
source_dirty=false
lab_host=m02
go_version=go version go1.25.0 linux/amd64
cgo_enabled=1
kernel=Linux 6.17.0-23-generic #23~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 14 16:11:48 UTC 2 x86_64 GNU/Linux
strace_version=strace -- version 6.8
```
The exact commit was transferred as a verified Git bundle and cloned into an
isolated clean worktree on m02. The shared development worktree and its
unrelated modified files were not used or changed.
## Command
The committed gate script was run without modification:
```bash
SW_BLOCK_ARTIFACT_DIR=/tmp/phase172-d2-a46af56-artifacts \
bash scripts/run-phase172-single-read-correctness-gate.sh
```
The external artifact directory kept the source worktree clean while the gate
checked `git_dirty=false`.
## Exact Test Execution
All eight assigned top-level tests executed 20 times in the focused pass and
20 times under `go test -race`. No test or subtest was skipped or missing:
| Test | Focused | Race |
|---|---:|---:|
| `TestWALStoreSingleReadMaterializationDisabledByDefault` | 20 | 20 |
| `TestWALStoreSingleReadMaterializesOrdinaryAndMultiBlockRecords` | 20 | 20 |
| `TestWALStoreSingleReadMaterializesLegacyRangeTrim` | 20 | 20 |
| `TestWALStoreSingleReadFailsClosedOnInvalidRecord` | 20 | 20 |
| `TestWALStoreSingleReadRejectsInvalidMultiBlockSemantics` | 20 | 20 |
| `TestWALStoreSingleReadRejectsInvalidTrimSemantics` | 20 | 20 |
| `TestWALStoreSingleReadFailureAtEachPhysicalRecordKeepsWholeSnapshot` | 20 | 20 |
| `TestWALStoreSingleReadHandlesReverseGappedAndWrappedRecords` | 20 | 20 |
The focused log contains 36 distinct top-level test/subtest names, each with
20 executions. The audit reported:
```text
focused_skip_or_missing_count=0
race_skip_or_missing_count=0
focused_fail_count=0
race_fail_count=0
```
## Fail-Closed Review
The executed failure table covers:
- zero, short, long, and out-of-bounds record geometry;
- short physical reads, stale LSN, corrupt length or payload, invalid flags,
unsupported type, record LBA mismatch, dirty length mismatch, and dirty data
offset mismatch;
- multi-block reserved-count, base-LBA, data-offset, and dirty-length
mismatches;
- legacy range-trim record-length, unaligned/out-of-range data-offset, and
dirty-length mismatches;
- corruption at each of three physical record positions;
- reverse, gapped, and ring-wrapped record placement.
Every failure case uses the same terminal-state assertion:
```text
checkpoint_lsn=0
logical_wal_tail=1
physical_wal_tail=0
dirty_entries=original_snapshot_size
```
Thus no failed cycle publishes checkpoint progress, advances the WAL tail, or
deletes a dirty entry. Earlier partial extent writes are allowed, but the
checkpoint and dirty-map transition remains all-or-nothing.
The multi-block success test reports three logical materializations, three
physical record reads, and zero actual record-reuse hits. Shared-record reuse
is not claimed in D2.
## Exact-File Probes
The unchanged gate's candidate probe produced:
```text
phase172_probe_single_read=true
phase172_probe_validated_records=1024
phase172_probe_header_read_ops=0
phase172_probe_record_read_ops=1024
phase172_probe_materialization_read_ops=1024
100.00 0.006696 6 1024 pread64
```
An additional exact-file control probe with the candidate disabled confirmed
the shipped default remains the two-read path:
```text
phase172_probe_single_read=false
phase172_probe_validated_records=1024
phase172_probe_header_read_ops=1024
phase172_probe_record_read_ops=1024
phase172_probe_materialization_read_ops=2048
100.00 0.009566 4 2048 pread64
```
The candidate switch is an unexported package test helper. Its environment
variable is consumed only by a `_test.go` scoped probe. The commit changes no
`cmd/` or chart file and adds no CLI, Helm, configuration, or production
environment selector.
## Full Gate Summary
```text
phase172_single_read_correctness_status=running
git_sha=a46af56f850ab3faa03fcad92243bf1bad484a69
git_dirty=false
go_version=go_version_go1.25.0_linux/amd64
kernel=Linux_6.17.0-23-generic_#23~24.04.1-Ubuntu_SMP_PREEMPT_DYNAMIC_Tue_Apr_14_16:11:48_UTC_2_x86_64_GNU/Linux
TestWALStoreSingleReadMaterializationDisabledByDefault=pass
TestWALStoreSingleReadMaterializesOrdinaryAndMultiBlockRecords=pass
TestWALStoreSingleReadMaterializesLegacyRangeTrim=pass
TestWALStoreSingleReadFailsClosedOnInvalidRecord=pass
TestWALStoreSingleReadRejectsInvalidMultiBlockSemantics=pass
TestWALStoreSingleReadRejectsInvalidTrimSemantics=pass
TestWALStoreSingleReadFailureAtEachPhysicalRecordKeepsWholeSnapshot=pass
TestWALStoreSingleReadHandlesReverseGappedAndWrappedRecords=pass
focused_repeat_20=pass
default_two_read_path=pass
ordinary_single_read=pass
legacy_range_trim_single_read=pass
multiblock_single_read_without_reuse=pass
invalid_geometry_fails_closed=pass
short_read_fails_closed=pass
stale_corrupt_flags_unsupported_fail_closed=pass
ordinary_batch_trim_semantic_mismatches_fail_closed=pass
failed_cycle_retains_wal_tail=pass
physical_record_failure_positions=pass
reverse_gapped_wrap=pass
race_repeat_20=pass
storage_regression=pass
storage_vet=pass
scoped_probe_single_read=true
scoped_probe_validated_records=1024
scoped_probe_header_reads=0
scoped_probe_record_reads=1024
scoped_probe_product_materialization_reads=1024
scoped_probe_strace_pread64_calls=1024
scoped_strace_matches_product_counter=true
default_materialization_unchanged=true
external_selector_added=false
d3_shared_record_reuse_eligible=true
phase172_single_read_correctness_status=ok
```
## Artifacts And Cleanup
```text
artifact_path=V:\share\g15d-k8s\phase172-d2-a46af56-20260730-124744\phase172-d2-a46af56-artifacts.tar.gz
archive_sha256=b08c3c547c5df39205ea4067ea8cd85634f5ae93302cac8570f1a1cc56cd9219
durable_archive_integrity=pass
qa_matching_process_count=0
qa_source_git_dirty=false
qa_kubernetes_resources_touched=false
remote_temp_cleanup_status=ok
qa_cleanup_status=ok
```
The archive contains the full gate summary, focused and race logs, storage
regression and vet logs, candidate and default exact-file probe/strace output,
the compiled probe binary and stores, gate stdout/stderr, and the independent
execution audit.
Loaded 100 of 149 files, more files were not shown because too many files have changed in this diff. Show more