Files
prometeu-studio/tools/pbx-conformance/run.py
T
bquarkz 240216170c feat(pbs): add parametric arrays and concrete generic contracts
Support explicit contract type parameters, canonical nominal applications,
recursive substitution, concrete implementations and instantiated editor views.
Complete parametric Array syntax and contextual construction integration.

Preserve type origins across imports and reexports, fix trait argument stack
order, and relocate global slots before lifecycle assembly. Publish specs,
installed examples and consolidated discussion lessons.

Validate frontend, common pipeline, architecture, LSP and installed knowledge
gates, plus the full production VM conformance corpus with 14 generic fixtures.
2026-10-20 11:30:00 +01:00

47 lines
3.9 KiB
Python

"""Build a production-loader harness without writing into the runtime checkout."""
import argparse
import hashlib
import json
import pathlib
import platform
import subprocess
import tempfile
parser = argparse.ArgumentParser()
parser.add_argument("--runtime", type=pathlib.Path, default=pathlib.Path("../runtime"))
parser.add_argument("--fixtures", type=pathlib.Path, default=pathlib.Path("prometeu-compiler/prometeu-build-pipeline/build/registry-conformance"))
parser.add_argument("--online", action="store_true", help="Allow Cargo to fetch uncached dependencies")
parser.add_argument("--release", action="store_true", help="Execute an optimized runtime harness")
parser.add_argument("--math-only", action="store_true", help="Run the complete PBS math corpus only")
parser.add_argument("--random-only", action="store_true", help="Run the complete PBS Random corpus only")
parser.add_argument("--generic-contracts-only", action="store_true", help="Run the mandatory generic-contract source corpus only")
args = parser.parse_args()
runtime = args.runtime.resolve()
if not args.math_only:
provider_vectors = runtime / "crates/console/prometeu-vm/tests/fixtures/random-conformance.tsv"
consumer_vectors = pathlib.Path("prometeu-architecture-tests/src/test/resources/random/random-conformance.tsv")
if provider_vectors.read_bytes() != consumer_vectors.read_bytes():
raise SystemExit("Random oracle differs from the selected provider; update provenance and requalify")
print(subprocess.check_output(["rustc", "-Vv"], text=True).strip(), flush=True)
for source in [pathlib.Path(__file__), pathlib.Path(__file__).with_name("main.rs"),
pathlib.Path("prometeu-architecture-tests/src/test/java/p/studio/compiler/backend/irvm/PbsRuntimeRandomTest.java"),
pathlib.Path("prometeu-compiler/frontends/prometeu-frontend-pbs/src/main/resources/game/stdlib/1/sdk/random/main.pbs")]:
print("sha256", source, hashlib.sha256(source.read_bytes()).hexdigest(), flush=True)
print("runtime", subprocess.check_output(["git", "-C", str(runtime), "rev-parse", "HEAD"], text=True).strip(), flush=True)
print("platform", platform.platform(), "limits=default capabilities=NONE", flush=True)
print("profile", "release" if args.release else "dev", "features=resource-diagnostics", flush=True)
for relative in ["Cargo.lock", "docs/vm-arch/INTRINSICS.csv", "docs/vm-arch/BUILTIN_CONSTANTS.csv", "crates/console/prometeu-vm/tests/fixtures/numeric-conformance.tsv", "crates/console/prometeu-vm/tests/fixtures/random-conformance.tsv"]:
print("sha256", relative, hashlib.sha256((runtime / relative).read_bytes()).hexdigest(), flush=True)
with tempfile.TemporaryDirectory(prefix="pbx-conformance-") as directory:
root = pathlib.Path(directory)
manifest = '[package]\nname="studio-pbx-conformance"\nversion="0.1.0"\nedition="2024"\n[dependencies]\n'
for crate in ["prometeu-bytecode", "prometeu-hal", "prometeu-vm", "prometeu-system"]:
features = ',features=["resource-diagnostics"]' if crate == "prometeu-vm" else ''
manifest += f'{crate}={{path={json.dumps(str(runtime / "crates/console" / crate))}{features}}}\n'
manifest += 'serde_json="1.0.149"\njsonschema={version="0.33",default-features=false}\n'
(root / "Cargo.toml").write_text(manifest)
(root / "Cargo.lock").write_text((runtime / "Cargo.lock").read_text())
(root / "src").mkdir()
(root / "src/main.rs").write_text(pathlib.Path(__file__).with_name("main.rs").read_text())
subprocess.run(["cargo", "run", *(["--release"] if args.release else []), *([] if args.online else ["--offline"]), "--manifest-path", str(root / "Cargo.toml"), "--", str(args.fixtures.resolve()), str(runtime / "devtools/headless-protocol/response.schema.json"), *(["--math-only"] if args.math_only else []), *(["--random-only"] if args.random_only else []), *(["--generic-contracts-only"] if args.generic_contracts_only else [])], check=True)