release(3.0.0-beta.1): product version migration, beta gates, archive tooling and developer docs
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/manual/performance Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s
ci/woodpecker/push/main Pipeline was successful
ci/woodpecker/manual/performance Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s
REL-01: workspace/CLI/Analysis product version 3.0.0-beta.1 with updated Cargo.lock; project.marqdo is enforced against the running core with package.marqdo_range_invalid/package.marqdo_incompatible fail-closed diagnostics; Tool SemVer prerelease negotiation tests; init template and examples use the beta range. Verify init derives the project name from the target directory instead of falling back to 'example'. REL-02: beta support matrix is Linux x86_64 only; macOS/Windows are explicitly experimental/unclaimed; strict policy and G4 Beta-only WARN are documented for the release evidence. REL-03: deterministic release packaging (tools/release/package.py) ships the CLI and provider worker together with SOURCE_SHA, RELEASE_INFO.json, known-limitations, specs, developer docs, examples incl. built plugin/provider artifacts and consumers; tools/release/smoke.py cold-install tests the archive. REL-04: docs/developers entry pages; corrected and self-contained third-party integration handbook; stale Proposed/native-only/informational spec claims fixed; release/status/compatibility/changelog/releasing docs updated. REL-05: release_evidence.py gains an explicit beta profile (BETA_RELEASE_CANDIDATE) distinct from the stable profile; Woodpecker build step now packages and smoke-tests the archive on every pipeline. Adds a runnable Resource Provider v2 example and corrects check --emit to Analysis v2.
This commit is contained in:
1 parent
56189b176c
commit
2c7c4f31e7
55 files changed
+3136
-453
No files matched your search
@@ -0,0 +1,339 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Cold-install smoke test for a built Marqdo release archive.
|
||||
|
||||
Extracts the archive into a fresh temporary directory and exercises the shipped
|
||||
binaries only (never the development source tree): version/help, check/run/call,
|
||||
lock/sync for a path dependency, Analysis v2 + Trace v2 consumers, Tool
|
||||
install/dispatch, native and worker plugin transports, foreign kernel, the
|
||||
Provider v2 worker (positive, unauthorized and missing-helper fail-closed), and
|
||||
strict mode when the host genuinely supports it.
|
||||
|
||||
Usage:
|
||||
python3 tools/release/smoke.py --archive dist/marqdo-3.0.0-beta.1-x86_64-unknown-linux-gnu.tar.gz
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def fail(message: str) -> "NoReturn":
|
||||
print(f"smoke: FAIL: {message}", file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
def sha256_file(path: Path) -> str:
|
||||
digest = hashlib.sha256()
|
||||
with path.open("rb") as handle:
|
||||
for chunk in iter(lambda: handle.read(1024 * 1024), b""):
|
||||
digest.update(chunk)
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
class Runner:
|
||||
def __init__(self, root: Path):
|
||||
self.root = root
|
||||
self.marqdo = root / "marqdo"
|
||||
self.env = dict(os.environ)
|
||||
self.env.pop("MARQDO_MODE", None)
|
||||
self.env["MARQDO_TOOL_HOME"] = str(root / "tool-home")
|
||||
|
||||
def run(
|
||||
self,
|
||||
args: list[str],
|
||||
*,
|
||||
expect: int = 0,
|
||||
contains: str | None = None,
|
||||
cwd: Path | None = None,
|
||||
env: dict | None = None,
|
||||
) -> subprocess.CompletedProcess:
|
||||
command = [str(self.marqdo), *args]
|
||||
merged = dict(self.env)
|
||||
if env:
|
||||
merged.update(env)
|
||||
result = subprocess.run(
|
||||
command,
|
||||
cwd=cwd or self.root,
|
||||
env=merged,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
shown = " ".join(command[1:])
|
||||
if result.returncode != expect:
|
||||
fail(
|
||||
f"`marqdo {shown}` exited {result.returncode}, expected {expect}\n"
|
||||
f"stdout:\n{result.stdout}\nstderr:\n{result.stderr}"
|
||||
)
|
||||
if contains is not None:
|
||||
haystack = result.stdout + result.stderr
|
||||
if contains not in haystack:
|
||||
fail(f"`marqdo {shown}` output does not contain {contains!r}:\n{haystack}")
|
||||
return result
|
||||
|
||||
def json(self, args: list[str]) -> dict:
|
||||
result = self.run([*args, "--json"])
|
||||
try:
|
||||
return json.loads(result.stdout)
|
||||
except json.JSONDecodeError as error:
|
||||
fail(f"`marqdo {' '.join(args)} --json` is not JSON: {error}\n{result.stdout}")
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--archive", required=True)
|
||||
parser.add_argument("--workdir", default=None, help="keep the extracted tree here")
|
||||
parser.add_argument("--skip-strict", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
archive = Path(args.archive).resolve()
|
||||
if not archive.is_file():
|
||||
fail(f"archive not found: {archive}")
|
||||
checksum_file = archive.with_name(archive.name + ".sha256")
|
||||
if checksum_file.is_file():
|
||||
expected = checksum_file.read_text(encoding="utf-8").split()[0]
|
||||
actual = sha256_file(archive)
|
||||
if expected != actual:
|
||||
fail(f"archive sha256 {actual} does not match {checksum_file}: {expected}")
|
||||
|
||||
if args.workdir:
|
||||
root = Path(args.workdir).resolve()
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
root.mkdir(parents=True)
|
||||
else:
|
||||
root = Path(tempfile.mkdtemp(prefix="marqdo-smoke-"))
|
||||
try:
|
||||
shutil.unpack_archive(str(archive), str(root))
|
||||
entries = [path for path in root.iterdir() if path.is_dir()]
|
||||
if len(entries) != 1:
|
||||
fail(f"archive must contain exactly one top-level directory, found {entries}")
|
||||
install = entries[0]
|
||||
info = json.loads((install / "RELEASE_INFO.json").read_text(encoding="utf-8"))
|
||||
version = info["product_version"]
|
||||
source_sha = info["source_sha"]
|
||||
if (install / "SOURCE_SHA").read_text(encoding="utf-8").strip() != source_sha:
|
||||
fail("SOURCE_SHA does not match RELEASE_INFO.json")
|
||||
for name in ("marqdo", "marqdo-provider-worker"):
|
||||
binary = install / name
|
||||
if not binary.is_file() or not os.access(binary, os.X_OK):
|
||||
fail(f"{name} is missing or not executable in the archive")
|
||||
recorded = info["binaries"][name]["sha256"]
|
||||
if sha256_file(binary) != recorded:
|
||||
fail(f"{name} sha256 does not match RELEASE_INFO.json")
|
||||
|
||||
runner = Runner(install)
|
||||
print(f"smoke: archive version {version}, source {source_sha}")
|
||||
|
||||
version_out = runner.run(["--version"]).stdout.strip()
|
||||
if version_out != f"marqdo {version}":
|
||||
fail(f"--version printed {version_out!r}, expected 'marqdo {version}'")
|
||||
runner.run(["--help"])
|
||||
runner.run(["check", "examples/multi-module/index.mq.md"])
|
||||
hello = runner.run(["run", "examples/hello.mq.md"]).stdout
|
||||
if "你好" not in hello:
|
||||
fail(f"hello example printed {hello!r}")
|
||||
factor = runner.run(
|
||||
["call", "examples/factorial.mq.md", "阶乘", "--arg", "n=5"]
|
||||
).stdout.strip()
|
||||
if factor != "120":
|
||||
fail(f"factorial call printed {factor!r}, expected 120")
|
||||
|
||||
# Static Analysis v2 + Trace v2 through the public consumers.
|
||||
analysis = install / "analysis.json"
|
||||
trace = install / "trace.json"
|
||||
runner.run(
|
||||
[
|
||||
"check",
|
||||
"examples/multi-module/index.mq.md",
|
||||
"--emit",
|
||||
str(analysis),
|
||||
]
|
||||
)
|
||||
runner.run(["check", "examples/multi-module/index.mq.md", "--refs"])
|
||||
document = json.loads(analysis.read_text(encoding="utf-8"))
|
||||
if document.get("schema") != "marqdo.analysis" or document.get("schema_version") != 2:
|
||||
fail("--emit did not write Analysis v2")
|
||||
if document.get("producer", {}).get("version") != version:
|
||||
fail("Analysis producer.version does not match the released product version")
|
||||
runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/multi-module/index.mq.md",
|
||||
"--trace-file",
|
||||
str(trace),
|
||||
]
|
||||
)
|
||||
run_trace = json.loads(trace.read_text(encoding="utf-8"))
|
||||
if run_trace.get("schema") != "marqdo.trace" or run_trace.get("schema_version") != 2:
|
||||
fail("--trace-file did not write Trace v2")
|
||||
for consumer in ("analysis_consumer.py", "trace_consumer.py"):
|
||||
command = [
|
||||
sys.executable,
|
||||
str(install / "tests" / "consumers" / consumer),
|
||||
str(analysis),
|
||||
]
|
||||
if consumer == "trace_consumer.py":
|
||||
command.append(str(trace))
|
||||
result = subprocess.run(command, capture_output=True, text=True)
|
||||
if result.returncode != 0:
|
||||
fail(f"{consumer} failed:\n{result.stdout}\n{result.stderr}")
|
||||
validate = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
str(install / "tests" / "consumers" / "validate_protocols.py"),
|
||||
str(analysis),
|
||||
str(trace),
|
||||
str(install / "examples" / "tool-unknown-name" / "tool.json"),
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
if validate.returncode != 0:
|
||||
if "jsonschema" in validate.stderr and "ModuleNotFoundError" in validate.stderr:
|
||||
print("smoke: note: jsonschema is not installed; schema validation skipped")
|
||||
else:
|
||||
fail(f"validate_protocols.py failed:\n{validate.stdout}\n{validate.stderr}")
|
||||
|
||||
# Tool Protocol v1: install and dispatch an independent process.
|
||||
runner.run(["tool", "install", "examples/tool-unknown-name/tool.json"])
|
||||
listed = runner.run(["tool", "list"]).stdout
|
||||
if "benchmark" not in listed:
|
||||
fail(f"tool list does not contain benchmark:\n{listed}")
|
||||
benchmark = runner.run(["benchmark", "run", "."]).stdout
|
||||
if "benchmark tool:" not in benchmark:
|
||||
fail(f"tool dispatch output unexpected:\n{benchmark}")
|
||||
|
||||
# Callable plugin ABI v1: native (explicit trust) and worker transports.
|
||||
native = runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/plugin-demo/plugin-call.mq.md",
|
||||
"--plugin",
|
||||
"examples/plugin-demo/build",
|
||||
"--trust-native-plugin",
|
||||
"--allow-plugin",
|
||||
"demo.solver",
|
||||
]
|
||||
).stdout.strip()
|
||||
if native != "42":
|
||||
fail(f"native plugin example printed {native!r}, expected 42")
|
||||
runner.run(
|
||||
["plugin", "inspect", "examples/plugin-demo/build", "--json"]
|
||||
)
|
||||
worker_dir = install / "worker-plugin"
|
||||
worker_dir.mkdir()
|
||||
shutil.copy2(install / "examples/plugin-demo/build/solver.so", worker_dir / "solver.so")
|
||||
worker_manifest = (
|
||||
install / "examples/plugin-demo/build/plugin.yaml"
|
||||
).read_text(encoding="utf-8").replace("kind: native", "kind: worker")
|
||||
(worker_dir / "plugin.yaml").write_text(worker_manifest, encoding="utf-8")
|
||||
worker = runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/plugin-demo/plugin-call.mq.md",
|
||||
"--plugin",
|
||||
str(worker_dir),
|
||||
"--allow-plugin",
|
||||
"demo.solver",
|
||||
]
|
||||
).stdout.strip()
|
||||
if worker != "42":
|
||||
fail(f"worker plugin example printed {worker!r}, expected 42")
|
||||
|
||||
# Foreign kernel: no core change for a new language tag.
|
||||
kernel = runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/kernel-mock/demo.mq.md",
|
||||
"--kernel",
|
||||
"examples/kernel-mock/kernel.json",
|
||||
"--allow-foreign",
|
||||
]
|
||||
).stdout.strip()
|
||||
if kernel != "42":
|
||||
fail(f"foreign kernel example printed {kernel!r}, expected 42")
|
||||
|
||||
# Resource Provider v2 through the shipped worker helper.
|
||||
provider = "examples/provider-demo/build/provider.json"
|
||||
provider_run = runner.json(
|
||||
[
|
||||
"run",
|
||||
"examples/provider-demo/demo.mq.md",
|
||||
"--provider",
|
||||
provider,
|
||||
"--allow-provider",
|
||||
"demo.sensor",
|
||||
]
|
||||
)
|
||||
if not provider_run.get("success"):
|
||||
fail(f"provider run was not successful: {provider_run}")
|
||||
reads = [
|
||||
event
|
||||
for event in provider_run.get("trace", [])
|
||||
if event.get("op") == "resource.read"
|
||||
]
|
||||
if not reads or "count=5" not in str(reads[-1].get("result")):
|
||||
fail(f"provider read did not report five bytes: {reads}")
|
||||
runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/provider-demo/unauthorized.mq.md",
|
||||
"--provider",
|
||||
provider,
|
||||
],
|
||||
expect=1,
|
||||
contains="permission.denied",
|
||||
)
|
||||
worker_binary = install / "marqdo-provider-worker"
|
||||
shutil.move(str(worker_binary), str(worker_binary.with_suffix(".hidden")))
|
||||
try:
|
||||
runner.run(
|
||||
[
|
||||
"run",
|
||||
"examples/provider-demo/demo.mq.md",
|
||||
"--provider",
|
||||
provider,
|
||||
"--allow-provider",
|
||||
"demo.sensor",
|
||||
],
|
||||
expect=1,
|
||||
contains="ext.worker_unavailable",
|
||||
)
|
||||
finally:
|
||||
shutil.move(str(worker_binary.with_suffix(".hidden")), str(worker_binary))
|
||||
|
||||
# pure mode: language execution without project grants.
|
||||
runner.run(["run", "examples/hello.mq.md", "--mode", "pure"])
|
||||
|
||||
if not args.skip_strict:
|
||||
platform = runner.json(["inspect", "examples/hello.mq.md", "--platform"])
|
||||
strict = platform.get("platform", {}).get("strict", {})
|
||||
if strict.get("state") == "available":
|
||||
runner.run(["run", "examples/hello.mq.md", "--mode", "strict"])
|
||||
print(f"smoke: strict available ({strict.get('mechanism')}) and exercised")
|
||||
else:
|
||||
refused = runner.run(
|
||||
["run", "examples/hello.mq.md", "--mode", "strict"],
|
||||
expect=1,
|
||||
)
|
||||
if "strict" not in (refused.stdout + refused.stderr):
|
||||
fail("unsupported strict mode did not fail closed with a strict diagnostic")
|
||||
print(f"smoke: strict unsupported on this host; fail-closed refused: {strict}")
|
||||
|
||||
print("smoke: PASS")
|
||||
return 0
|
||||
finally:
|
||||
if not args.workdir:
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
Reference in new issue
Block a user