Add generic checked starter workflows and isolated lifecycle coverage

This commit is contained in:
2026-10-20 21:31:05 +01:00
parent ae6ba6ae10
commit d58b3f49fc
15 changed files with 475 additions and 109 deletions
+35 -12
View File
@@ -19,7 +19,11 @@ def main():
root = Path(temporary)
env = {k: v for k, v in os.environ.items() if not k.startswith("PIPELINES_")}
env.update(GOBIN=str(root / "bin"), XDG_CONFIG_HOME=str(root / "config"),
XDG_DATA_HOME=str(root / "data"), PIPELINES_DRAFT_DIR=str(root / "drafts"))
XDG_DATA_HOME=str(root / "data"), PIPELINES_DRAFT_DIR=str(root / "drafts"),
# Syntactically valid fixture IDs bind template defaults. No
# provider is contacted and no workflow is executed.
PIPELINES_DEFAULT_MODEL="smoke-provider/smoke-model",
PIPELINES_DEFAULT_HARNESS="opencode")
subprocess.run(["go", "install", "-trimpath", "./cmd/..."], cwd=repo, env=env, check=True, timeout=180)
subprocess.run([str(root / "bin/pipelines"), "skill", "install"], cwd=repo, env=env, check=True, timeout=30)
cli = root / "bin/pipelines"
@@ -29,8 +33,14 @@ def main():
workspace.mkdir()
def local(*command):
return subprocess.run([str(cli), *command], cwd=workspace, env=env,
capture_output=True, text=True, check=True, timeout=30).stdout
result = subprocess.run([str(cli), *command], cwd=workspace, env=env,
capture_output=True, text=True, timeout=30)
if result.returncode:
raise RuntimeError(
f"CLI command {command!r} exited {result.returncode}\n"
f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
)
return result.stdout
version = json.loads(local("version", "--json"))
assert version == json.loads(local("--version", "--json"))
@@ -46,7 +56,8 @@ def main():
def start(log):
process = subprocess.Popen([str(root / "bin/pipelines-server"), "-addr", f"127.0.0.1:{port}",
"-db", str(database)], cwd=workspace, env=env, stdout=log, stderr=log)
"-db", str(database), "-allow-authoring"],
cwd=workspace, env=env, stdout=log, stderr=log)
try:
deadline = time.monotonic() + 15
while time.monotonic() < deadline:
@@ -78,29 +89,41 @@ def main():
assert pong["build"] == version, "Client/server build mismatch"
assert not rpc("list").get("pipelines"), "Fresh database must be empty"
assert not rpc("runs").get("runs"), "Fresh database must have no runs"
assert len(rpc("templates")["templates"]) == 5
draft = rpc("new", "First test", "Review the repository", "--template", "review", "--no-open", "--yes")
templates = rpc("templates")["templates"]
keys = {template["key"] for template in templates}
assert keys == {"task", "research", "summarize", "compare", "plan", "review", "three-stage", "debug"}, keys
# Exercise the five primary starters using only draft and
# validation commands: never run a model or launch an editor.
drafts = {}
for key in ("task", "research", "summarize", "compare", "plan"):
drafts[key] = rpc("new", f"Starter {key}", "Use only supplied test context",
"--template", key, "--no-open", "--yes")
rpc("validate", drafts[key]["path"])
source = Path(drafts[key]["path"]).read_text()
assert "provider=smoke-provider" in source, key
assert "model=smoke-model" in source, key
assert "harness=opencode" in source, key
draft = drafts["plan"]
assert not rpc("list").get("pipelines"), "Draft creation must not publish"
rpc("validate", draft["path"])
rpc("submit", draft["path"], "--yes")
published = rpc("show", "First test")
published = rpc("show", "Starter plan")
assert published["version"] == 1
archive = root / "definitions.zip"
rpc("export", "First test", "--output", str(archive))
rpc("export", "Starter plan", "--output", str(archive))
result = rpc("import", str(archive), "--all", "--yes")
assert not result["imported"], "Identical import must not republish"
assert rpc("show", "First test")["version"] == 1
assert rpc("show", "Starter plan")["version"] == 1
assert Path(draft["path"]).is_file(), "Published draft must remain"
finally:
stop(process)
process = start(log)
try:
assert rpc("show", "First test")["source"] == published["source"], "Definition lost on restart"
assert rpc("show", "Starter plan")["source"] == published["source"], "Definition lost on restart"
assert rpc("ping")["build"] == version
assert not rpc("runs").get("runs"), "Smoke check must not execute a workflow"
finally:
stop(process)
print("PASS developer lifecycle fixture: isolated source binaries/skill, offline version, empty DB, five templates, draft/validate/publish, ZIP identical import, restart persistence. Not an installation option; no inference or notifications.")
print("PASS developer lifecycle fixture: isolated source binaries/skill, offline version, empty DB, eight catalog templates, five generic drafts validated with configured defaults, explicit scratch publication, ZIP identical import, restart persistence. Not an installation option; no inference or notifications.")
if __name__ == "__main__":