From 9dfbe0d5a6a8b54ec4e4cbbde89f3ea14fc6c6f4 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Sat, 24 Oct 2026 14:10:48 -0500 Subject: [PATCH] fix(c296): enforce complete axiom audit and bind consumed inputs Add the exact Lifetime trigger, fail-closed module/target axiom audit, real-Lean policy controls, and refreshed packet hashes. AI-authored by OpenAI Codex root chat01a0bbb5 for Dylan Roy; harness coauthor /root/c299_timeout_scope_audit. Separate source-exposed nonauthor review /root/c299_timeout_adoption_review: PASS_SOURCE_PREFLIGHT_ONLY. No local Lean execution, scientific promotion, or integration claimed. --- .../workflows/c296-regular-point-chart.yml | 7 + .../REPAIR_20261024.md | 50 +++ .../RegularPointChartAxiomAudit.lean | 45 ++- .../SOURCE_SHA256SUMS | 8 +- .../scripts/test_axiom_audit.py | 322 ++++++++++++++++++ 5 files changed, 423 insertions(+), 9 deletions(-) create mode 100644 frontiers/regular_point_chart_20261020/REPAIR_20261024.md create mode 100644 frontiers/regular_point_chart_20261020/scripts/test_axiom_audit.py diff --git a/.github/workflows/c296-regular-point-chart.yml b/.github/workflows/c296-regular-point-chart.yml index 72f647d0e..1e325db30 100644 --- a/.github/workflows/c296-regular-point-chart.yml +++ b/.github/workflows/c296-regular-point-chart.yml @@ -3,6 +3,7 @@ name: C296 regular-point chart on: pull_request: paths: + - "frontiers/critical_level_attainment_20261020/final-project/Lifetime.lean" - "frontiers/regular_point_chart_20261020/**" - ".github/workflows/c296-regular-point-chart.yml" workflow_dispatch: @@ -32,6 +33,7 @@ jobs: working-directory: frontiers/regular_point_chart_20261020 run: | set -euo pipefail + sha256sum --check SOURCE_SHA256SUMS lean --version lake build RegularPointChart RegularPointChartInterface lake env lean -E warning RegularPointChart.lean @@ -39,6 +41,11 @@ jobs: lake env leanchecker RegularPointChart lake env leanchecker RegularPointChartInterface lake env lean RegularPointChartAxiomAudit.lean + - name: Exercise axiom policy and inventory controls with Lean + working-directory: frontiers/regular_point_chart_20261020 + run: | + set -euo pipefail + python3 -B -S scripts/test_axiom_audit.py - name: Mutation-test the negative diagnostic classifier working-directory: frontiers/regular_point_chart_20261020 run: | diff --git a/frontiers/regular_point_chart_20261020/REPAIR_20261024.md b/frontiers/regular_point_chart_20261020/REPAIR_20261024.md new file mode 100644 index 000000000..894b0f61c --- /dev/null +++ b/frontiers/regular_point_chart_20261020/REPAIR_20261024.md @@ -0,0 +1,50 @@ +# C296 audit and dependency-trigger repair + +Engineering successor to Math- PR488 head +`762a6f30e7131b7b2cc02ad2d80113de9263bd4c`, addressing review +`5635610588` and threads `4365149299`, `4365149322`, `4365149354`. +The dated README/RESULTS remain historical evidence, not receipts for this repair. + +The workflow now names the exact consumed C294 `Lifetime.lean` path. The +manifest binds the updated workflow and audit, test harness, unchanged +classifier and its tests, and this scope note. The workflow checks those +digests before building. Regenerate digests whenever an included input changes. + +The audit discovers declarations originating in `RegularPointChart` and checks +that all seven original required names are present. For every discovered name, +it requires a kernel declaration and rejects transitive axioms outside +`propext`, `Classical.choice`, and `Quot.sound`. Its inventory includes generated +declarations belonging to that module; it does not claim to enumerate every +declaration in imported Mathlib. It does inspect the transitive axiom closure +of each audited declaration, including axioms reached through imports. + +The hosted test harness runs actual Lean on disposable audit copies, retaining +stdout, stderr and return codes under `.lake/c296-audit-evidence` and printing +reviewable output into the job log. It tests the production positive case, +forbidden transitive axioms, missing required target, empty inventory, weakened +allowlist, and setup/syntax errors. A printing-only control preserves the old +audit behavior and demonstrates why printed reports are not enforcement. +An unknown declaration already makes Lean fail; completeness is instead tested +by omitting an existing required declaration from the audited inventory. + +The original chart/interface proofs, consumed Lifetime, compiler/mathlib pins, +noncriticality control, classifier and classifier tests are unchanged. +The separately reviewed classifier-composition proposal is not adopted here. + +Execution and attribution: OpenAI Codex root chat +`01a0bbb5-2fcb-77f0-b78b-4d220ddd7ab2` authored the repair; delegated +OpenAI Codex `/root/c299_timeout_scope_audit` authored the test harness. +Separate nonauthor review and current-candidate hosted receipts belong in the +PR discussion. This source note itself asserts neither review nor execution. +Dylan Roy did not personally perform a human review. No organizational or +blind independence is claimed for same-provider delegated review. + +Local Lean execution remains unavailable after the retained `/proc` denial; +no local retry or bypass is part of this repair. The isolated source stage and +native Git publication are not a working local repository checkout. Hosted +results must identify the actual run, attempt, head and tested merge commit. + +This is a draft engineering repair, not default-main integration, theorem +completion, alignment approval, or scientific promotion. All hypotheses, +ordinary-persistence bridges and regional collision obligations remain open. +No merge, Ready transition or deployment is part of this delivery. diff --git a/frontiers/regular_point_chart_20261020/RegularPointChartAxiomAudit.lean b/frontiers/regular_point_chart_20261020/RegularPointChartAxiomAudit.lean index 2d77d7678..8fcd26db2 100644 --- a/frontiers/regular_point_chart_20261020/RegularPointChartAxiomAudit.lean +++ b/frontiers/regular_point_chart_20261020/RegularPointChartAxiomAudit.lean @@ -1,9 +1,40 @@ import RegularPointChart +import Lean.Elab.Command +import Lean.Util.CollectAxioms -#print axioms UniversalLaw.Spec.Lifetime.regularPointDerivative_range_eq_top -#print axioms UniversalLaw.Spec.Lifetime.regularPointHasStrictFDerivAt -#print axioms UniversalLaw.Spec.Lifetime.regularPointChart -#print axioms UniversalLaw.Spec.Lifetime.regularPointChart_fst -#print axioms UniversalLaw.Spec.Lifetime.regularPointChart_self -#print axioms UniversalLaw.Spec.Lifetime.mem_regularPointChart_source -#print axioms UniversalLaw.Spec.Lifetime.mem_regularPointChart_target +/-! Enforce the standard-axiom policy over the complete module-origin census. +The required inventory prevents omission of any of the seven original targets. +This is an engineering audit, not independent alignment or scientific acceptance. -/ + +open Lean Elab Command in +run_cmd do + let env := (← getEnv).setExporting false + let allowed : List Name := [`propext, `Classical.choice, `Quot.sound] + let some idx := env.getModuleIdx? `RegularPointChart + | throwError "C296_AXIOM_MISSING_MODULE RegularPointChart" + let constants := env.constants.toList + let names := (constants.filterMap fun (name, _) => + if env.getModuleIdxFor? name == some idx then some name else none).toArray.qsort Name.lt + let audited := names + if audited.isEmpty then throwError "C296_AXIOM_EMPTY RegularPointChart" + let required : Array Name := #[ + `UniversalLaw.Spec.Lifetime.regularPointDerivative_range_eq_top, + `UniversalLaw.Spec.Lifetime.regularPointHasStrictFDerivAt, + `UniversalLaw.Spec.Lifetime.regularPointChart, + `UniversalLaw.Spec.Lifetime.regularPointChart_fst, + `UniversalLaw.Spec.Lifetime.regularPointChart_self, + `UniversalLaw.Spec.Lifetime.mem_regularPointChart_source, + `UniversalLaw.Spec.Lifetime.mem_regularPointChart_target] + for name in required do + unless audited.contains name do + throwError "C296_AXIOM_MISSING_TARGET {name}" + for name in audited do + if (env.checked.get.find? name).isNone then + throwError "C296_AXIOM_MISSING_KERNEL_DECL {name}" + let axs ← Lean.collectAxioms name + let axiomText := String.intercalate ", " (axs.toList.map fun ax => ax.toString) + logInfo m!"C296_AXIOM_DECL {name.toString} AXIOMS [{axiomText}]" + for ax in axs do + unless allowed.contains ax do + throwError "C296_AXIOM_FORBIDDEN {ax} in {name}" + logInfo m!"C296_AXIOM_POLICY_PASS COUNT {audited.size}" diff --git a/frontiers/regular_point_chart_20261020/SOURCE_SHA256SUMS b/frontiers/regular_point_chart_20261020/SOURCE_SHA256SUMS index 54c1c894d..5ef615162 100644 --- a/frontiers/regular_point_chart_20261020/SOURCE_SHA256SUMS +++ b/frontiers/regular_point_chart_20261020/SOURCE_SHA256SUMS @@ -1,9 +1,13 @@ -1ff2d19ee045175a510d994ad539476e1d5df98247ec4b4d6267fedc7909f996 ../../.github/workflows/c296-regular-point-chart.yml +b9b8bdb81de2b3e16c036bc672e1cb78e3d400c02af68b89e827e3e59d8a870f ../../.github/workflows/c296-regular-point-chart.yml 90f4892608e953ecc696bb32ea159d1c178ceb8a1c6edfd11acfceb14af462c6 ../critical_level_attainment_20261020/final-project/Lifetime.lean 5568c8d6e03f7064cd5924ebe2814ae746100505ae31789d5c975902528f9fa2 RegularPointChart.lean d87cc945b859472417ce9ef1c197a34f5ea4b63e65a857ce24316f435288e051 RegularPointChartInterface.lean da7256bbe6baa41e2fda6888d80b72dce73c27eac5ad641ad9b875243370acf7 WithoutNoncriticality.lean -b1cfc6126c9885e30a4b3d8eac3e96b57e92f88930faa5e6eacbf06fb3ed78b8 RegularPointChartAxiomAudit.lean +1d5ea6e816a580dde7298640eeb27664adb247cbaa347ff0184edf7f6d514a43 RegularPointChartAxiomAudit.lean 3c154a9b908e97ae98c8f2ac0062be391bde49c13f8d436fedbbc8b1b9d88213 lakefile.toml a5f438c3066ea36abd201994397d4b75234b7fff52d2ef8de9dea64f874baf6b lake-manifest.json d5edba4e4b8faad9c1baeadb265716d20d03be4d1a2647dc5e35b0c0325bea7b lean-toolchain +7f27ef40f7c7d76138df0fd8ca376a8a8ea09f5b44a174882ffad0de912e6576 scripts/classify_negative.sh +54f06670e9f5bb3bc7fe20d3cc3e2bf118633bf797011d3f7251bc6da16742ae scripts/test_negative_classifier.sh +aa269dec1f012a059bc7192dcadc5a1ab14f16ad9415fdbcd87faa225ee31920 scripts/test_axiom_audit.py +db85b47b9841e50749b50190cff57ddaadf28c4baaad34f9d05533cff8b6629c REPAIR_20261024.md diff --git a/frontiers/regular_point_chart_20261020/scripts/test_axiom_audit.py b/frontiers/regular_point_chart_20261020/scripts/test_axiom_audit.py new file mode 100644 index 000000000..f6aaf7694 --- /dev/null +++ b/frontiers/regular_point_chart_20261020/scripts/test_axiom_audit.py @@ -0,0 +1,322 @@ +"""Hosted real-Lean controls for the C296 axiom policy; no scientific acceptance. + +Run from the package after its pinned dependencies and RegularPointChart build +exist. Every fixture is a separate source copy under .lake/c296-audit-evidence; +production Lean sources are never changed. This script does not install tools. +""" + +import hashlib +import json +import os +from pathlib import Path +import re +import signal +import subprocess +import sys +import tempfile +import time + + +ROOT = Path(__file__).resolve().parents[1] +AUDIT = ROOT / "RegularPointChartAxiomAudit.lean" +PREFIX = "UniversalLaw.Spec.Lifetime." +REQUIRED = ( + PREFIX + "regularPointDerivative_range_eq_top", + PREFIX + "regularPointHasStrictFDerivAt", + PREFIX + "regularPointChart", + PREFIX + "regularPointChart_fst", + PREFIX + "regularPointChart_self", + PREFIX + "mem_regularPointChart_source", + PREFIX + "mem_regularPointChart_target", +) +ALLOWED = {"propext", "Classical.choice", "Quot.sound"} +AUDITED_ANCHOR = " let audited := names\n" +ALLOWLIST_ANCHOR = ( + " let allowed : List Name := [`propext, `Classical.choice, `Quot.sound]\n" +) +BLOCK_ANCHOR = "open Lean Elab Command in\nrun_cmd do\n" +CONTAMINATION = ( + "axiom C296Forbidden : False\n" + "theorem C296Contaminated : False := C296Forbidden\n\n" +) +TIMEOUT_SECONDS = 90 +MAX_READ_BYTES = 4 * 1024 * 1024 + + +class ControlFailure(RuntimeError): + """An expected semantic behavior was absent, distinct from process setup.""" + + +def require(condition, message): + if not condition: + raise ControlFailure(message) + + +def replace_once(source, old, new): + require(source.count(old) == 1, "fixture anchor missing or nonunique: " + repr(old)) + return source.replace(old, new, 1) + + +def sha(path): + digest = hashlib.sha256() + with path.open("rb") as stream: + for block in iter(lambda: stream.read(65536), b""): + digest.update(block) + return digest.hexdigest() + + +def source_snapshot(): + paths = [p for p in ROOT.iterdir() if p.is_file()] + paths += [p for p in (ROOT / "scripts").iterdir() if p.is_file()] + paths += [ROOT.parent / "critical_level_attainment_20261020/final-project/Lifetime.lean", + ROOT.parents[1] / ".github/workflows/c296-regular-point-chart.yml"] + return {str(p.relative_to(ROOT.parents[1])): sha(p) for p in sorted(paths)} + + +def save_json(path, value): + path.write_text(json.dumps(value, indent=2, sort_keys=True) + "\n", encoding="utf-8") + + +def emit_evidence(directory, report): + # The hosted job has no artifact upload: retain readable evidence in its log + # even when a semantic validator fails. Raw files remain unchanged on disk. + for record in report["processes"]: + for stream in ("stdout", "stderr"): + path = directory / (record["case"] + "." + stream) + with path.open("rb") as handle: + raw = handle.read(MAX_READ_BYTES) + metadata = {"case": record["case"], "stream": stream, + "sha256": record[stream + "_sha256"], + "total_bytes": record[stream + "_bytes"], + "emitted_bytes": len(raw), + "truncated": record[stream + "_bytes"] > len(raw), + "decoding": "utf-8 with replacement for invalid bytes"} + print("=== C296_AUDIT_STREAM_BEGIN " + json.dumps(metadata, sort_keys=True) + " ===") + decoded = raw.decode("utf-8", "replace") + print(decoded, end="" if decoded.endswith("\n") else "\n") + print("=== C296_AUDIT_STREAM_END " + record["case"] + " " + stream + " ===") + print("=== C296_AUDIT_RESULT_BEGIN ===") + print(json.dumps(report, indent=2, sort_keys=True)) + print("=== C296_AUDIT_RESULT_END ===") + + +def stop_child(process): + if process.poll() is not None: + return + try: + os.killpg(process.pid, signal.SIGTERM) + except ProcessLookupError: + pass + try: + process.wait(timeout=5) + except subprocess.TimeoutExpired: + try: + os.killpg(process.pid, signal.SIGKILL) + except ProcessLookupError: + pass + process.wait(timeout=5) + + +def run_lean(directory, label, source, report): + source_path = directory / (label + ".lean") + source_path.write_text(source, encoding="utf-8") + stdout_path = directory / (label + ".stdout") + stderr_path = directory / (label + ".stderr") + command = ["lake", "env", "lean", str(source_path)] + record = {"case": label, "command": command, "cwd": str(ROOT), + "source_sha256": sha(source_path), "timeout_seconds": TIMEOUT_SECONDS, + "timed_out": False, "spawn_error": None, "cleanup_error": None, + "exit_code": None, "classification": "NOT_CLASSIFIED"} + process = None + started = time.monotonic() + with stdout_path.open("xb") as stdout, stderr_path.open("xb") as stderr: + try: + process = subprocess.Popen(command, cwd=ROOT, stdout=stdout, stderr=stderr, + start_new_session=True) + try: + record["exit_code"] = process.wait(timeout=TIMEOUT_SECONDS) + except subprocess.TimeoutExpired: + record["timed_out"] = True + except OSError as error: + record["spawn_error"] = repr(error) + finally: + if process is not None: + try: + stop_child(process) + except (OSError, subprocess.TimeoutExpired) as error: + record["cleanup_error"] = repr(error) + record["exit_code"] = process.poll() + record["duration_seconds"] = time.monotonic() - started + for name, path in (("stdout", stdout_path), ("stderr", stderr_path)): + record[name + "_bytes"] = path.stat().st_size + record[name + "_sha256"] = sha(path) + report["processes"].append(record) + save_json(directory / (label + ".receipt.json"), record) + save_json(directory / "RESULT.json", report) + require(not record["timed_out"], label + ": PROCESS_TIMEOUT, not a policy rejection") + require(record["spawn_error"] is None, label + ": PROCESS_SETUP_FAILURE") + require(record["cleanup_error"] is None, label + ": PROCESS_CLEANUP_FAILURE") + require(max(record["stdout_bytes"], record["stderr_bytes"]) <= MAX_READ_BYTES, + label + ": OUTPUT_LIMIT, not a policy rejection") + stdout = stdout_path.read_bytes().decode("utf-8", "strict") + stderr = stderr_path.read_bytes().decode("utf-8", "strict") + return record, stdout, stderr, source_path + + +def policy_records(stdout): + declarations = {} + for line in stdout.splitlines(): + match = re.search(r"(?:^|: info: )C296_AXIOM_DECL (\S+) AXIOMS \[([^\]]*)\]$", line) + if match: + name, axioms = match.groups() + require(name not in declarations, "duplicate audit declaration: " + name) + declarations[name] = {a.strip() for a in axioms.split(",") if a.strip()} + return declarations + + +def successful_audit(result, allowed=ALLOWED): + record, stdout, stderr, _ = result + require(record["exit_code"] == 0, record["case"] + ": audit did not succeed") + require(stderr == "" and "error:" not in stdout, + record["case"] + ": successful audit has error output") + declarations = policy_records(stdout) + require(set(REQUIRED) <= set(declarations), "successful audit omitted a required target") + counts = re.findall(r"(?:^|: info: )C296_AXIOM_POLICY_PASS COUNT ([0-9]+)$", stdout, re.M) + require(len(counts) == 1 and int(counts[0]) == len(declarations), + "missing or inconsistent audit completion inventory") + for name, axioms in declarations.items(): + require(axioms <= allowed, "successful audit admitted forbidden axioms at " + name) + return declarations + + +def policy_rejection(result, marker, detail=None): + record, stdout, stderr, source_path = result + require(record["exit_code"] == 1, record["case"] + ": expected policy exit 1") + require(stderr == "", record["case"] + ": policy diagnostic unexpectedly on stderr") + # An intended exception must be the sole error at this exact fixture source. + errors = [line for line in stdout.splitlines() if "error:" in line] + pattern = re.escape(str(source_path)) + r":\d+:\d+: error: " + re.escape(marker) + r"(?:\s.*)?$" + require(len(errors) == 1 and re.fullmatch(pattern, errors[0]) is not None, + record["case"] + ": unrelated/setup/syntax error is not the policy rejection") + require("C296_AXIOM_POLICY_PASS" not in stdout, "rejected audit printed a success marker") + if detail is not None: + require(detail in errors[0], record["case"] + ": wrong policy witness") + + +def classified_failure(result, diagnostic_pattern, classification): + record, stdout, stderr, source_path = result + require(record["exit_code"] == 1, classification + ": wrong exit status") + require(stderr == "", classification + ": unexpected stderr") + errors = [line for line in stdout.splitlines() if "error:" in line] + prefix = re.escape(str(source_path)) + r":\d+:\d+: error: " + require(len(errors) == 1 and re.match(prefix, errors[0]) is not None, + classification + ": missing source-bound error") + require(re.search(diagnostic_pattern, errors[0]) is not None, + classification + ": unexpected diagnostic") + require("C296_AXIOM_" not in stdout, classification + ": masquerading as policy output") + try: + policy_rejection(result, "C296_AXIOM_FORBIDDEN", "C296Forbidden") + except ControlFailure: + return + raise ControlFailure(classification + ": incorrectly accepted as a policy rejection") + + +def main(): + evidence = ROOT / ".lake/c296-audit-evidence" + evidence.mkdir(parents=True, exist_ok=True) + directory = Path(tempfile.mkdtemp(prefix="run-", dir=evidence)) + report = {"schema_version": 1, "status": "FAIL", "scientific_effect": "NONE", + "python_optimized": bool(sys.flags.optimize), "processes": [], + "controls": [], "evidence_directory": str(directory)} + before = source_snapshot() + report["source_before"] = before + save_json(directory / "RESULT.json", report) + + def check(label, source, validator, classification): + result = run_lean(directory, label, source, report) + validator(result) + result[0]["classification"] = classification + save_json(directory / (label + ".receipt.json"), result[0]) + report["controls"].append({"case": label, "classification": classification}) + save_json(directory / "RESULT.json", report) + return result + + try: + candidate = AUDIT.read_text(encoding="utf-8") + print_only = "import RegularPointChart\n\n" + "\n".join( + "#print axioms " + name for name in REQUIRED) + "\n" + # This is the original seven-print audit plus one explicit contamination + # witness. Its rc0 must demonstrate the old policy defect, not setup RED. + old_contaminated = print_only + "\n" + CONTAMINATION + "#print axioms C296Contaminated\n" + + def old_printing_only(result): + record, stdout, stderr, _ = result + require(record["exit_code"] == 0 and stderr == "" and "error:" not in stdout, + "printing-only baseline must elaborate successfully") + require(all(name in stdout for name in REQUIRED), "baseline target output missing") + require(re.search(r"C296Contaminated[^\n]*depends on axioms[^\n]*C296Forbidden", stdout) + is not None, "baseline did not expose the transitive forbidden axiom") + require("C296_AXIOM_POLICY_PASS" not in stdout, "baseline was not printing-only") + + check("printing-only-forbidden", old_contaminated, old_printing_only, + "BASELINE_POLICY_DEFECT_OBSERVED_EXIT_ZERO") + check("positive", candidate, successful_audit, "COMPLETE_ALLOWED_INVENTORY") + contaminated = replace_once(candidate, BLOCK_ANCHOR, CONTAMINATION + BLOCK_ANCHOR) + contaminated = replace_once(contaminated, AUDITED_ANCHOR, + " let audited := names.push `C296Contaminated\n") + check("forbidden", contaminated, + lambda r: policy_rejection(r, "C296_AXIOM_FORBIDDEN", "C296Forbidden"), + "TRANSITIVE_FORBIDDEN_AXIOM_REJECTED") + missing = replace_once(candidate, AUDITED_ANCHOR, + " let audited := names.filter (· != `" + REQUIRED[-1] + ")\n") + check("missing-target", missing, + lambda r: policy_rejection(r, "C296_AXIOM_MISSING_TARGET", REQUIRED[-1]), + "MISSING_REQUIRED_TARGET_REJECTED") + empty = replace_once(candidate, AUDITED_ANCHOR, " let audited := (#[] : Array Name)\n") + check("empty-inventory", empty, lambda r: policy_rejection(r, "C296_AXIOM_EMPTY"), + "EMPTY_AUDITED_INVENTORY_REJECTED") + weakened = replace_once(contaminated, ALLOWLIST_ANCHOR, + ALLOWLIST_ANCHOR.rstrip("\n")[:-1] + ", `C296Forbidden]\n") + + def kill_allowlist_mutant(result): + declarations = successful_audit(result, ALLOWED | {"C296Forbidden"}) + require("C296Forbidden" in declarations.get("C296Contaminated", set()), + "allowlist mutant did not exercise transitive contamination") + try: + policy_rejection(result, "C296_AXIOM_FORBIDDEN", "C296Forbidden") + except ControlFailure as error: + report["allowlist_mutant_rejection_failure"] = str(error) + return + raise ControlFailure("forbidden-axiom control failed to kill weakened allowlist") + + check("allowlist-weakened", weakened, kill_allowlist_mutant, + "WEAKENED_ALLOWLIST_KILLED_BY_FORBIDDEN_CONTROL") + check("setup-failure", "import C296FixtureMissingModuleNeverPublished\n", + lambda r: classified_failure(r, + r"unknown module prefix 'C296FixtureMissingModuleNeverPublished'|" + r"object file .*C296FixtureMissingModuleNeverPublished.*does not exist", + "SETUP_FAILURE"), "SETUP_FAILURE_NOT_POLICY_REJECTION") + check("syntax-failure", "import RegularPointChart\ndef C296Broken : Nat := )\n", + lambda r: classified_failure(r, r"unexpected token '\)'", "SYNTAX_FAILURE"), + "SYNTAX_FAILURE_NOT_POLICY_REJECTION") + require(len(report["controls"]) == 8, "incomplete audit-control campaign") + report["status"] = "PASS_ENGINEERING_CONTROLS_ONLY" + except Exception as error: + report["failure"] = type(error).__name__ + ": " + str(error) + finally: + after = source_snapshot() + report["source_after"] = after + report["production_sources_unchanged"] = before == after + if before != after: + report["status"] = "FAIL" + report["source_failure"] = "production source bytes changed" + save_json(directory / "RESULT.json", report) + emit_evidence(directory, report) + print(json.dumps({"status": report["status"], "evidence_directory": str(directory), + "controls_completed": len(report["controls"]), + "scientific_effect": "NONE"}, sort_keys=True)) + return 0 if report["status"] == "PASS_ENGINEERING_CONTROLS_ONLY" else 1 + + +if __name__ == "__main__": + sys.exit(main())