block-ci: test the root wiring the active workflows use

The nested self-tests read the module's inactive test.yml, deploy/
Dockerfiles and chunkstore-scope.sh. Assert the docs-only gates in
block-test.yml, that each root image refuses every binary it builds, and
that the root classifier selects run for chunkstore, storage and durable
edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 04:10:08 -08:00
1 parent b3403d5da6
commit 27f97dd6d1
1 file changed
+14
@@ -3,6 +3,7 @@ from pathlib import Path
import copy
import importlib.util
import os
import re
import subprocess
import tempfile
import unittest
@@ -43,6 +44,10 @@ class PortTests(unittest.TestCase):
self.assertIn("git diff --relative --name-only --no-renames HEAD^1 HEAD -- .", test)
self.assertIn("go test (linux)", test)
self.assertIn("process-level tests (real binaries)", test)
scope = test.split(" - name: Docs-only pull request\n", 1)[1].split("\n", 2)[1]
self.assertEqual(scope.strip(), "if: matrix.suite == 'process' && github.event_name == 'pull_request'")
self.assertEqual(test.count("if: matrix.suite == 'process' && steps.scope.outputs.docs_only != '1'"), 5)
self.assertNotRegex(test, r"if: matrix\.suite == 'process'\s*\n")
post = (ROOT / ".github/workflows/block-post-merge-review.yml").read_text()
self.assertIn("working-directory: ${{ github.workspace }}", post)
self.assertIn("""git -C .. diff -z --name-status --no-renames "$BASE...$HEAD" -- . ':(exclude)seaweed-block/'""", post)
@@ -77,6 +82,10 @@ class PortTests(unittest.TestCase):
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"))
built = re.findall(r"go build -o (\S+)", recipe)
refused = re.search(r"^RUN bash scripts/refuse-lab-binary\.sh (.+)$", recipe, re.M).group(1).split()
self.assertTrue(built)
self.assertEqual(sorted(built), sorted(refused))
def test_nested_git_paths_and_blobs_stay_module_relative(self):
with tempfile.TemporaryDirectory() as tmp:
@@ -103,6 +112,11 @@ class PortTests(unittest.TestCase):
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"))
for durable in ("core/frontend/chunkstore/c.go", "core/storage/s.go", "core/frontend/durable/d.go"):
(module / durable).parent.mkdir(parents=True, exist_ok=True); (module / durable).write_text("package x\n")
git("add", "."); git("commit", "-m", "durable")
self.assertEqual(run("chunkstore-scope.sh", head, "HEAD"), b"run 1 " + durable.encode() + b"\n")
git("reset", "-q", "--hard", head)
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")