2 """Run Stage-A Phase 3.1 correctness-evidence validation bundles in one process. 5 python benchmarks/density_matrix/correctness_evidence/phase31_validation_pipeline.py 8 from __future__
import annotations
12 from pathlib
import Path
13 from typing
import Any
15 REPO_ROOT = Path(__file__).resolve().parents[3]
16 if str(REPO_ROOT)
not in sys.path:
17 sys.path.insert(0, str(REPO_ROOT))
19 from benchmarks.density_matrix.correctness_evidence
import (
20 phase31_correctness_bundle_validation
as phase31_correctness_package,
22 from benchmarks.density_matrix.correctness_evidence
import (
23 phase31_correctness_matrix_validation
as phase31_correctness_matrix,
25 from benchmarks.density_matrix.correctness_evidence
import (
26 phase31_external_correctness_validation
as phase31_external_correctness,
28 from benchmarks.density_matrix.correctness_evidence
import (
29 phase31_output_integrity_validation
as phase31_output_integrity,
31 from benchmarks.density_matrix.correctness_evidence
import (
32 phase31_runtime_classification_validation
as phase31_runtime_classification,
34 from benchmarks.density_matrix.correctness_evidence
import (
35 phase31_sequential_correctness_validation
as phase31_sequential_correctness,
37 from benchmarks.density_matrix.correctness_evidence
import (
38 phase31_summary_consistency_validation
as phase31_summary_consistency,
40 from benchmarks.density_matrix.correctness_evidence.common
import DEFAULT_OUTPUT_ROOT
41 from benchmarks.density_matrix.correctness_evidence.common
import (
42 PHASE31_CORRECTNESS_EVIDENCE_STAGE_A_ROOT,
43 write_artifact_bundle,
51 _CASE_SLICE_REGISTRY: tuple[tuple[Any, str, str], ...] = (
52 (phase31_correctness_matrix,
"build_cases",
"build_artifact_bundle"),
53 (phase31_sequential_correctness,
"build_cases",
"build_artifact_bundle"),
54 (phase31_external_correctness,
"build_cases",
"build_artifact_bundle"),
55 (phase31_output_integrity,
"build_cases",
"build_artifact_bundle"),
56 (phase31_runtime_classification,
"build_cases",
"build_artifact_bundle"),
59 _NULLARY_BUNDLE_REGISTRY: tuple[tuple[Any, str], ...] = (
60 (phase31_correctness_package,
"build_artifact_bundle"),
61 (phase31_summary_consistency,
"build_artifact_bundle"),
66 results: list[tuple[str, str, Path]] = []
68 for mod, cases_attr, bundle_attr
in _CASE_SLICE_REGISTRY:
69 cases = getattr(mod, cases_attr)()
70 bundle = getattr(mod, bundle_attr)(cases)
75 for mod, bundle_attr
in _NULLARY_BUNDLE_REGISTRY:
76 bundle = getattr(mod, bundle_attr)()
84 def main(argv: list[str] |
None =
None) -> int:
85 parser = argparse.ArgumentParser(description=__doc__)
89 help=
"Suppress per-bundle console output.",
91 args = parser.parse_args(argv)
93 stage_root = DEFAULT_OUTPUT_ROOT / PHASE31_CORRECTNESS_EVIDENCE_STAGE_A_ROOT
94 stage_root.mkdir(parents=
True, exist_ok=
True)
96 for suite_name, status, output_path
in results:
98 print(f
"{suite_name}: status={status} path={output_path}")
99 return 0
if all(status ==
"pass" for _, status, _
in results)
else 1
102 if __name__ ==
"__main__":
103 raise SystemExit(
main())
def write_artifact_bundle
def run_phase31_pipeline()