mcp-sandbox-authority-boundary-profile / scripts /build_distribution_artifacts.py
Michael Saleme
fix: reconcile v0.2.0 evidence release controls
347662e unverified
Raw
History Blame
4.21 kB
#!/usr/bin/env python3
"""Build reproducible, synthetic-only distribution artifacts for v0.2.0."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / "artifacts"
RELEASE = "v0.2.0"
FILES = (
"profile/sandbox-boundary-profile-v0.1.json",
"schemas/observation.schema.json",
"examples/synthetic-characterization.json",
"examples/coverage-matrix.md",
"data/authority_boundary_cases.jsonl",
"evidence/evidence-index-v0.2.0.json",
"evidence/target-configuration.synthetic.json",
"evidence/payloads/RS-01.json",
"evidence/payloads/RS-02.json",
"evidence/payloads/CS-01.json",
"evidence/payloads/LC-01.json",
"evidence/payloads/ES-01.json",
"evidence/payloads/SI-01.json",
"evidence/payloads/CS-02.json",
"evidence/payloads/EV-01.json",
"evidence/payloads/CM-01.json",
"scripts/validate_profile.py",
"scripts/validate_viewer_split.py",
"scripts/verify_bundle_manifest.py",
"scripts/verify_replay_record.py",
"scripts/verify_evidence_bindings.py",
"scripts/test_evidence_bindings.py",
"scripts/build_distribution_artifacts.py",
"CITATION.cff",
"REVIEW.md",
"REPRODUCE.md",
"review/replay-record.template.json",
"README.md",
"LICENSE",
)
def digest(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def entry(relative_path: str) -> dict[str, object]:
path = ROOT / relative_path
return {
"path": relative_path,
"sha256": digest(path),
"bytes": path.stat().st_size,
}
def main() -> None:
OUT.mkdir(exist_ok=True)
entries = [entry(relative_path) for relative_path in FILES]
passport = {
"artifact": "MCP Sandbox Authority Boundary Profile Evidence Passport",
"release": RELEASE,
"profile_schema_version": "0.1.0",
"output_type": "characterization",
"classification": "synthetic-only distribution artifact",
"claim_ceiling": (
"This release documents a synthetic characterization profile only. "
"It is not a certification, conformance determination, provider "
"finding, or statement about an untested environment."
),
"canonical_artifacts": entries,
"validators": [
"python3 scripts/verify_bundle_manifest.py",
"python3 scripts/validate_profile.py",
"python3 scripts/validate_viewer_split.py",
"python3 scripts/verify_evidence_bindings.py",
"python3 scripts/test_evidence_bindings.py",
],
"reproduction": "python3 scripts/build_distribution_artifacts.py",
"limitations": [
"The passport verifies published artifact bytes, not an external target.",
"All v0.2.0 evidence payloads and configuration manifests are synthetic fixtures only.",
"Independent review and target authorization remain separate requirements.",
],
}
passport_path = OUT / "evidence-passport-v0.2.0.json"
passport_path.write_text(json.dumps(passport, indent=2) + "\n")
bundle_manifest = {
"bundle": "authority-boundary-synthetic-fixture-bundle",
"release": RELEASE,
"classification": "synthetic-only",
"files": entries,
"verify": [
"python3 scripts/verify_bundle_manifest.py",
"python3 scripts/validate_profile.py",
"python3 scripts/validate_viewer_split.py",
"python3 scripts/verify_evidence_bindings.py",
"python3 scripts/test_evidence_bindings.py",
],
}
bundle_path = OUT / "authority-boundary-synthetic-fixture-bundle-v0.2.0.zip"
with ZipFile(bundle_path, "w", compression=ZIP_DEFLATED) as bundle:
for relative_path in FILES:
bundle.write(ROOT / relative_path, relative_path)
bundle.writestr("bundle-manifest.json", json.dumps(bundle_manifest, indent=2) + "\n")
print(f"built: {passport_path.relative_to(ROOT)}")
print(f"built: {bundle_path.relative_to(ROOT)}")
if __name__ == "__main__":
main()