2 """Validation: density-matrix correctness-evidence package. 4 Builds the shared correctness-evidence package by joining positive supported 5 records and stage-separated unsupported-boundary evidence through one stable 6 machine-reviewable surface. 9 python benchmarks/density_matrix/correctness_evidence/correctness_bundle_validation.py 12 from __future__
import annotations
15 from pathlib
import Path
17 from benchmarks.density_matrix.correctness_evidence.bundle
import (
18 build_correctness_package_payload,
20 from benchmarks.density_matrix.correctness_evidence.common
import (
21 CORRECTNESS_PACKAGE_SCHEMA_VERSION,
22 build_package_software_metadata,
23 correctness_evidence_output_dir,
24 write_artifact_bundle,
26 from benchmarks.density_matrix.correctness_evidence.records
import (
27 counted_supported_case,
29 from benchmarks.density_matrix.validation_scaffold
import require_bundle_fields
31 SUITE_NAME =
"correctness_evidence_correctness_package" 32 ARTIFACT_FILENAME =
"correctness_package_bundle.json" 34 ARTIFACT_CORE_FIELDS = (
52 cases = payload[
"cases"]
53 negative_cases = payload[
"negative_cases"]
56 "suite_name": SUITE_NAME,
58 if counted_supported_cases == len(cases)
59 and len(negative_cases) > 0
60 and all(case[
"status"] ==
"unsupported" for case
in negative_cases)
62 "schema_version": CORRECTNESS_PACKAGE_SCHEMA_VERSION,
64 "selected_candidate": payload[
"selected_candidate"],
65 "summary": payload[
"summary"],
67 "negative_cases": negative_cases,
73 def main(argv: list[str] |
None =
None) -> int:
74 parser = argparse.ArgumentParser(description=__doc__)
78 default=DEFAULT_OUTPUT_DIR,
79 help=
"Directory to write the correctness package bundle into.",
84 help=
"Suppress per-case console output.",
86 args = parser.parse_args(argv)
93 "counted_supported_cases={counted_supported_cases}, unsupported_boundary_cases={unsupported_boundary_cases}".format(
97 print(
"Wrote {}".format(output_path))
99 return 0
if bundle[
"status"] ==
"pass" else 1
102 if __name__ ==
"__main__":
103 raise SystemExit(
main())
def build_package_software_metadata()
def build_correctness_package_payload()
def correctness_evidence_output_dir
def build_artifact_bundle()
def write_artifact_bundle
def counted_supported_case
def require_bundle_fields