Files
prometeu-studio/tools/runtime-catalog/verify.py
bquarkz 603ed01227 feat(compiler): port runtime catalogs and enforce target ABI (AGD77)
Import both runtime catalogs and provenance, port all intrinsic metadata and exact constants, and validate target signatures and carriers through the common pipeline. Package matching compiler/SDK resources and add active parity plus production runtime conformance checks.

Validation: 420 compiler/PBS tests passed, with 12 existing skips; provider export, runtime execution and installed catalog checks passed. The pre-existing Gfx.clear typed-metadata failure remains active and assigned to AGD78 under the explicitly accepted scope revision recorded in LSN-0080.
2026-10-15 13:07:49 +01:00

45 lines
2.4 KiB
Python

"""Explicit provider check; ordinary Studio compilation does not invoke this tool."""
import argparse
import hashlib
import pathlib
import platform
import subprocess
import tempfile
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--runtime", type=pathlib.Path, required=True)
args = parser.parse_args()
studio = pathlib.Path(__file__).resolve().parents[2]
mirror = studio / "docs/vm-arch"
properties = dict(line.split("=", 1) for line in
(mirror / "runtime-catalog.properties").read_text().splitlines() if line)
runtime = args.runtime.resolve(strict=True)
revision = subprocess.check_output(["git", "-C", str(runtime), "rev-parse", "HEAD"], text=True).strip()
if revision != properties["runtime.revision"]:
raise SystemExit(f"Expected selected provider {properties['runtime.revision']}, found {revision}; "
"this is an evidence-target mismatch, not a runtime compatibility verdict")
# Evidence must correspond to committed source, not just two matching local copies.
dirty = subprocess.check_output(["git", "-C", str(runtime), "status", "--porcelain"], text=True)
if dirty:
raise SystemExit("Provider checkout is dirty; verify the selected revision in a clean checkout")
for name in ("INTRINSICS.csv", "BUILTIN_CONSTANTS.csv"):
committed = subprocess.check_output(["git", "-C", str(runtime), "show", f"{revision}:docs/vm-arch/{name}"])
if committed != (runtime / "docs/vm-arch" / name).read_bytes() or committed != (mirror / name).read_bytes():
raise SystemExit(f"Provider/mirror bytes differ: {name}")
digest = hashlib.sha256(committed).hexdigest()
if digest != properties[name + ".sha256"]:
raise SystemExit(f"Provenance hash mismatch: {name}")
print(f"MATCH {name} sha256={digest}", flush=True)
print(f"Provider {revision}; {platform.platform()}; Cargo test profile, default features", flush=True)
with tempfile.TemporaryDirectory(prefix="studio-catalog-provider-") as target:
subprocess.run(["cargo", "test", "--locked", "--offline", "--target-dir", target,
"-p", "prometeu-vm", "--test", "numeric_contract",
"exported_artifacts_match_the_single_runtime_catalog", "--", "--exact"],
cwd=runtime, check=True)
if __name__ == "__main__":
main()