diff --git a/.github/workflows/cbz-source-auditor.yml b/.github/workflows/cbz-source-auditor.yml new file mode 100644 index 000000000..7d7190343 --- /dev/null +++ b/.github/workflows/cbz-source-auditor.yml @@ -0,0 +1,69 @@ +name: CBZ source instrument self-tests +'on': + push: + branches: [main] + paths: + - '**/*.lean' + - 'cbz-source-manifest.json' + - 'tools/cbz_source_audit.py' + - 'tests/test_cbz_source_audit.py' + - 'tests/test_cbz_mutation_harness.py' + - 'tests/run_scanner_mutations.py' + - '.github/workflows/cbz-source-auditor.yml' + pull_request: + paths: + - '**/*.lean' + - 'cbz-source-manifest.json' + - 'tools/cbz_source_audit.py' + - 'tests/test_cbz_source_audit.py' + - 'tests/test_cbz_mutation_harness.py' + - 'tests/run_scanner_mutations.py' + - '.github/workflows/cbz-source-auditor.yml' + workflow_dispatch: +permissions: + contents: read +jobs: + source-instrument: + runs-on: ubuntu-24.04 + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 + with: + persist-credentials: false + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 + with: + python-version: '3.11' + - name: Preserve current source identity + run: | + set -euo pipefail + mkdir -p "$RUNNER_TEMP/cbz-evidence" + git rev-parse HEAD > "$RUNNER_TEMP/cbz-evidence/commit.txt" + python --version > "$RUNNER_TEMP/cbz-evidence/python.txt" + - name: Instrument and harness regression controls + run: | + set -euo pipefail + python -B -S -m unittest discover -s tests -p test_cbz_source_audit.py -v 2>&1 | tee "$RUNNER_TEMP/cbz-evidence/tests-normal.log" + python -B -S -m unittest discover -s tests -p test_cbz_mutation_harness.py -v 2>&1 | tee -a "$RUNNER_TEMP/cbz-evidence/tests-normal.log" + python -B -O -S -m unittest discover -s tests -p test_cbz_source_audit.py -v 2>&1 | tee "$RUNNER_TEMP/cbz-evidence/tests-optimized.log" + python -B -O -S -m unittest discover -s tests -p test_cbz_mutation_harness.py -v 2>&1 | tee -a "$RUNNER_TEMP/cbz-evidence/tests-optimized.log" + - name: Actual scanner mutation controls + run: | + set -euo pipefail + python -B -S tests/run_scanner_mutations.py --evidence-dir "$RUNNER_TEMP/cbz-evidence/mutation-cut" + - name: Preserve lexical findings without manufacturing Layer A success + run: | + set -euo pipefail + set +e + python -B -S tools/cbz_source_audit.py --manifest cbz-source-manifest.json > "$RUNNER_TEMP/cbz-evidence/source-review.json" + status=$? + set -e + test "$status" -eq 1 || test "$status" -eq 2 + python -B -S -c 'import json,os; p=os.path.join(os.environ["RUNNER_TEMP"],"cbz-evidence","source-review.json"); r=json.load(open(p)); valid=r["gate_claims"]=={"G1":"NOT_ESTABLISHED","CBZ-0":"NOT_ESTABLISHED"} and r["input_integrity"]["status"]=="CHECKED" and not r["errors"]; print("Instrument output retained; G1 and CBZ-0 remain NOT_ESTABLISHED"); raise SystemExit(0 if valid else 1)' + - name: Preserve actual instrument evidence including failures + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 + with: + name: cbz-source-instrument-${{ github.run_id }}-${{ github.run_attempt }} + path: ${{ runner.temp }}/cbz-evidence/ + if-no-files-found: error + retention-days: 30 diff --git a/DECISIONS.md b/DECISIONS.md index 21c33ea12..0f52d9fd4 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -13,3 +13,108 @@ Append-only. Historical source outcomes remain in their original records. | 2026-10-29 16:56 | 1 | C | Began installing the repository-pinned Lean toolchain for fresh build/kernel execution. Historical hosted CI will remain historical evidence. | Yes | Math `formal/lean-toolchain`, `lake-manifest.json` | | 2026-10-29 16:54 | 1 | C | Timestamp correction: the entries labelled 16:55 and 16:56 above used projected times by mistake; both actions had actually completed by the observed clock reading 16:54:09 UTC. The actions and evidence are unchanged. | Yes | UTC clock observation 2026-10-29 16:54:09; append-only correction | | 2026-10-29 16:54 | 1 | C | Direct fast-forward push to main was rejected by repository rule GH013 (PR required and three current status checks required). Use a PR with actual automated checks and autonomous integration; no owner input is needed. Do not bypass the rejection. | Yes | Git push exit 1, remote rule readback | + + +## Source instrument execution lane + + +- 2026-10-29 · Phase 1 · Layer B · Apply the current owner Crystalline Baseline + Protocol over conflicting legacy approval/freeze/routing requirements. + Preserve mathematical rigor and actual platform enforcement. +- 2026-10-29 · Phase 1 · Layer C · Recover Main 4ef1867175dbe1072a54a02e95f80c4e2c70a4ff + by Git-blob comparison: 2565 reused files and 259 fetched files. Root tree + 005e7fb08659f23485587b7201779e9d30b7ccd1 and signed commit bytes matched. + The local execution view is explicitly shallow, not full-history custody. +- 2026-10-29 · Phase 1 · Layer C · Separate Main, Math and infrastructure + inventories in disjoint workspaces. No authority or kernel success is + inferred from old claim records or green metadata. +- 2026-10-29 · Phase 2 · Layer C · Build a bounded Lean source inventory + instrument rather than mislabel lexical scans as complete Layer A proof. + Full G1/CBZ claims remain blocked in every report. +- 2026-10-29 · Phase 2 · Layer B · Preserve prior mutation cuts. The first + 37/39 cut exposed missing permission/semantic-gap assertions. Add tests, + reject startup/JSON/timeout harness failures as kills, then require 39/39. +- 2026-10-29 · Phase 2 · Layer C · Repair report FIFO/input overwrite and + unbounded directory materialization defects found by fresh review. + Regression failures were observed before the fixes;36 scanner tests pass. +- 2026-10-29 · Phase 2 · Layer B · Optional report files must be new, regular, + outside the source root and reached without symlinked ancestors. + Enumeration consumes at most the declared budget plus one refusal sentinel. +- 2026-10-29 · Phase 2 · Layer B · Add read-only CI instrument self-tests and + retained mutation evidence. Preserve navigation Option A and all existing + required-check contexts, commands and source files. +- 2026-10-29 · Phase 2 · Layer C · The composed full Main run executed 1591 + tests and exposed one routing-document regression, with 36 environment + skips. Restore the canonical board link as a history/source pointer; do not + reinstate the superseded approval ceremony or weaken the routing test. + +- 2026-10-29 · Phase 2 · Layer C · Reconcile against live Main 81acc060341e8a31cc4cd4f9523ef71fb6c06175; preserve its canonical governance and agent entry byte-for-byte, append this instrument registry and retain both decision histories. No source proof, navigation workflow or required-check rule is changed. +- 2026-10-29 · Phase 2 · Layer B · Consolidate lexical tooling around the + bounded source instrument. Add the stronger trust-bypass/native review + triggers from the pinned alternatives, retain their provenance and adverse + observations in cbz/evidence/source-instrument-selection.json, and qualify + the union with 39 scanner plus 14 harness methods and 47/47 killed mutants. + Alternatives are not declared integrated or superseded by this candidate. +- 2026-10-29 · Phase 2 · Layer B · Scope this new, nonrequired mutation + workflow to its Lean inputs, implementation, manifest, controls and own + workflow, retaining manual dispatch. Its first hosted run retained 451456 + artifact bytes. Navigation Option A stays byte-identical and continues full + normal discovery on every eligible event. No required context or protection + setting is changed; no saved-run count or monetary saving is asserted. +- 2026-10-29 · Phase 2 · Layer C · Execute all 46 Node test files with four + exact public-shop inputs and 34 exact museum inputs: 763 pass, zero skips. + Preserve the initial missing-fixture failure and intermediate skip logs. + No Node test, product source, assertion or mathematical bound was changed. +- 2026-10-29 · Phase 2 · Layer C · Preserve concurrent Main 27c89b05bd2503c580b692f57146d608a7f0f668, + its zeta-manifest source repair and all 14 additional tests during composition. + Fresh hosted qualification will bind the resulting revised PR head. +- 2026-10-29 · Phase 2 · Layer B · Repair four bounded source-instrument defects + reproduced by native review: preserve JSON refusal and create no report file + when the audited root is unknown; reject ambiguous POSIX `//` path anchors; + review record-update `with native :=` fields; record execution health for + every CLI invocation during mutation suites. Input-dependent crashes or + invalid JSON cannot become assertion kills after a healthy benign smoke. + Observe 58 methods passing normally and with optimization, and 50/50 genuine + assertion kills with a healthy 42-method baseline, zero harness/test errors + and zero skips. Retain the exploratory 49/50 cut without relabelling its one + missing-artifact test error as a kill; strengthen the artifact assertion and + qualify the final source separately. G1 and CBZ-0 remain NOT_ESTABLISHED. + Exact commands, controls and prior qualification are preserved in + cbz/evidence/source-instrument-selection.json. Frozen SHA-256 bindings: + scanner `c91da1c607a956cb64d39d8342b7d59722070d0aa5f2dfe54a5e049f3ec8fc9a`; + scanner tests `0facbe01b9e2c69928dce1973206bf4fbbd7b962cfbf8a7c2bed38999d1a2250`; + mutation runner `8ac245bec4c5fafe4c54bbeb51e447783d871570153ac7d5b1e70280e7c8eab5`; + harness tests `588190d7ec55d8d6dcd4e7d2bed290bd3d3593f133d1bcecbbc018d89dcfabe4`. +- 2026-10-29 · Phase 2 · Layer B · Repair native review finding + PRRT_kwDOQpeC2s6xuZcD at reviewed head + 67c58ce23b26f54814b1727a848e2ec090219a8f: comma-free newline-separated + record fields could hide `native := true` after `kernel := false` from the + bounded lexical trigger. The pinned fixture + `7559cc5c662a07cba512c688d568330589165d6675b2a7a1be5c57cf8fc0dfe7` + was accepted by actual Lean 4.34.1 and missed by the prior scanner; a separate + axiom probe observed its generated native-decide axiom. Conservatively review + native assignments as first code on a line inside lexical braces, preserving + comment/literal masks. Four CLI regression cases failed before the repair. + Now 59 methods pass normally and with optimization; the unchanged 43-method + baseline and all 51 mutants have healthy CLI execution, zero errors/skips, + and 51/51 genuine assertion kills. Preserve the prior 58-method/50-mutant + qualification and its raw receipt unchanged. This lexical repair supplies no + semantic or full G1 proof; G1 and CBZ-0 remain NOT_ESTABLISHED. Exact fixture, + runtime observations and qualification are in cbz/evidence/source-instrument-selection.json. + Frozen SHA-256 bindings: scanner + `827c5d582d889ec4b8c5d36ceb9d89de7d79cccfe0736d633ab9eb7b40db0e05`; + scanner tests `4f138b59b8d767e4d1e169b7031f1924f7b8e50ebb0353895c205f4aaf46c1c4`; + runner `7c06fd16fd9a34d9e37b6470971cb415d30a0624d69d531f6357507b83397033`. + Harness test bytes remain at + `588190d7ec55d8d6dcd4e7d2bed290bd3d3593f133d1bcecbbc018d89dcfabe4`. + +- 2026-10-29 · Phase 2 · Layer C · Compose the repaired source instrument on + current Main c93cec70223281492709ff74ca84fed5dc6e40e8, preserving the + receipt-attempt hardening, its source-bound evidence and the novelty-memo + clarification. Native tree comparison confirms no Lean source change in + that base advance. Publish only after all twelve instrument blobs and the + complete base-relative changed-path set match; fresh hosted checks bind + the resulting head. Existing nine green checks at f9b800dc are historical + and do not qualify the four subsequent repairs. + +- 2026-10-29 · Phase2 · LayerC · Resolve four original PR694 review threads only after fixes were published at67c58ce23b26f54814b1727a848e2ec090219a8f and58tests/50mutants observed. Missing-root JSON refusal, all-invocation CLI health, record-update native fields and alternate POSIX path anchors are repaired. Fifth comma-free layout finding is independently reproduced with actual Lean and fixed in this successor; previous run evidence stays historical. No review/protection bypass or person-directed comment. diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 6b39918c2..be5f5c8db 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -107,3 +107,67 @@ are being inventoried against their actual tests and execution coverage. Mission tools must be finished, documented with exact usage and verification, and registered here and in `TOOLING.md` before final admission. Tools are a means to closure, never a reason to open a general infrastructure project. + + +## Registered source inventory instrument + + +### cbz_source_audit + +Path: tools/cbz_source_audit.py. Purpose: reconcile a hash-pinned local .lean +inventory and flag bounded lexical hazards without silently dropping sources. +It is an inventory/review tool, not a full Layer A certifier. Every report +leaves G1 and CBZ-0 NOT_ESTABLISHED. + +Run: python -B -S tools/cbz_source_audit.py --manifest cbz-source-manifest.json + +Manifest paths and SHA-256 values pin every Lean source in the selected local +root. Symlinks, unreadable/missing files, malformed UTF-8, unlisted Lean sources, +hash mismatches and resource-limit failures are explicit refusals. Nested Lean +comments and literal strings are masked; unsupported syntax is reviewed. +Optional output creates a new regular file outside the audited root and +refuses overwriting earlier evidence or inputs. An unknown audited root +preserves the JSON refusal and creates no output. Ambiguous POSIX `//` path +anchors are refused before filesystem traversal or containment checks. + +Review triggers include direct `sorryAx`, compiler-trust primitives +`ofReduceBool`, `ofReduceNat`, `trustCompiler`, `skipKernelTC` and +`addDeclWithoutChecking`, plus `+native` and record-field `native :=` forms, +including record updates after `with`, across whitespace and comments. +An assignment to `native` as the first code on a line inside lexical braces +also requests review, covering comma-free record-field layout. This conservative +trigger preserves literal/comment masking and does not claim to parse records. +Compound-form evidence points to the actual +`native` identifier bytes and records the matched `review_form`. Ordinary +identifiers and literal data do not become compiler options by spelling alone. + +Verification: 43 scanner regression tests; tests/test_cbz_mutation_harness.py has 16 +real-process controls. tests/run_scanner_mutations.py applies 51 source mutants +to the scanner. Its declared threshold is 51/51 killed with a passing unchanged +suite, valid CLI smoke, healthy JSON execution throughout the suite, full case +count, assertion failures and no harness/test errors or skips. Input-dependent +crashes, invalid JSON and timeouts are not successful rejection evidence even +after a healthy benign smoke. Earlier 37/39, 39/39, 47/47 and 50/50 cuts remain preserved. +The exploratory 49/50 repair cut is retained as unqualified evidence; its +missing-artifact test error did not count as a kill. The strengthened assertions +and final source seal are registered in cbz/evidence/source-instrument-selection.json. + +Limits: no grammar/elaboration/kernel proof, complete dependency audit, +semantic bound/nonvacuity proof, historical deletion comparison, concurrent +snapshot atomicity or status-truth certification. These require their actual +independent evidence. A clear lexical scan cannot make G1 green. + +### formal_gate_check + +Existing tool: tools/formal_gate_check.py. +Source-only mode checks the SIDE24 arithmetic manifest and exact source bytes. +With --run-lean it requires pinned Lean, fresh build, leanchecker, target axiom +audit and actual negative controls. Its scope is the registered 31 arithmetic +targets, not an analytic coefficient theorem or all federation mathematics. + +## Ownership and maintenance + +Tools are standard-library Python except documented Lean execution. +Maintenance is self-contained; any subsequent edit repeats the relevant +tests and updates this registry. No future reserved reviewer, human approval +queue or background monitor is installed here. diff --git a/INVENTORY.md b/INVENTORY.md new file mode 100644 index 000000000..833cee272 --- /dev/null +++ b/INVENTORY.md @@ -0,0 +1,38 @@ +# CBZ inventory checkpoint — 2026-10-29 + +Phase 1 remains ACTIVE; this is not its completed exit or CBZ-0. + +| Scope | Observed state | +|---|---| +| Main | 4ef1867175dbe1072a54a02e95f80c4e2c70a4ff; 276 branches; 42 open PRs; 2824 file blobs; 4 Lean files; 30 workflows | +| Math | 8151f592918a845bf19eb8eafaf8444540a32734; 149 branches; 25 open PRs; 4019 file blobs; 162 Lean paths | +| Workspace/governance/query/meta | 108 branches; 0 open PRs; public default trees enumerated | +| Archived trial | 1559 branch refs; 19 tag refs; 0 open PRs; preserved archive | +| Archived sandbox/google-drive | 5/8 branches; 0 open PRs; preserved archives | +| Profile repository | 4 branches; 1 open PR; no proof status inferred | +| Private infrastructure | Authenticated repository GETs are available; RHQ 3 branches/0 tags/1 PR/3 runs, OpenClaw 2 branches/0 tags/1 PR/0 runs at the dated discovery cut; source reconciliation active | + +Counts are pinned observations, not a permanent current-claims register. +Historical archive branches are not newly accepted proofs. + +Subsequent source reconciliation: Main advanced to +81acc060341e8a31cc4cd4f9523ef71fb6c06175 (canonical governance adoption), +Math to 74565f013575b7b05ecfc4034cd5d638ee355353 (determinant admission repair +and explicit quarantine), governance to +1b62ca2f64b3012c2fdbbf7f55ced236c3042891 (lease validator repair). +These compatible concurrent changes are preserved. This file is a checkpoint, +not a claim that all references were observed atomically or fully disposed. + +## Tooling gaps and active remedies + +- Full Layer A semantic coverage: lexical tool has explicit limits; combine + actual kernel/axiom/bound/nonvacuity and status evidence, never a regex PASS. +- Math native kernel coverage: a new eight-project current-source gate is + under implementation; no hosted result is claimed for it. +- Binary64 coefficient certification: explicit A3 quarantine work is tracing + numerical consumers and preserving original packet bytes. +- Full regression matrix: Main baseline ran 1541 tests with 36 environment skips; + that is not the requested final100percent executed matrix. +- Cross-repository pin alignment and complete branch/PR disposition remain + work; old green pin checks are not current federation consistency evidence. +- Cold-start G9 and the final same-run G0-G11 matrix have not been observed. diff --git a/STATUS.md b/STATUS.md index 0be46963b..29c6875fb 100644 --- a/STATUS.md +++ b/STATUS.md @@ -1,3 +1,56 @@ +# CBZ execution state — 29 October 2026 + +Universal Law is consolidating its research federation under the owner's +Crystalline Baseline Protocol. CBZ-0 is NOT ESTABLISHED; discovery and closure +are active. No final G0-G11 same-run pass or new theorem closure is claimed. + +Current implementation: [INVENTORY.md](INVENTORY.md). +[Governance](GOVERNANCE.md), [tools](TOOLING.md) and the append-only +[decision ledger](DECISIONS.md) govern consolidation. Conflicting legacy +approval, freeze and review-family routing rules are superseded. + +## What is closed and what is quarantined + +The source-inventory instrument has 59 passing regression methods and a 51/51 +scanner mutation cut; that is G0 instrument evidence only. Its reports always +leave G1 and CBZ-0 NOT_ESTABLISHED. The Main formal inventory has 31 arithmetic +targets; use actual pinned kernel receipts for their execution scope, never +the historical ACCEPT rows below as a CBZ closure certificate. +The federation proof/quarantine index is not yet complete. The Math binary64 +coefficient packet has active A3-quarantine implementation work; no finished +remote quarantine is inferred from this progress note. + +## How to verify + +From the repository root with Python 3.11 or newer: + + python -B -S -m unittest discover -s tests -p 'test_cbz_*.py' -v + python -B -S tests/run_scanner_mutations.py --evidence-dir /tmp/NEW-CBZ-CUT + python -B -S tools/cbz_source_audit.py --manifest cbz-source-manifest.json + python -B -S tools/formal_gate_check.py + python -B -S tools/formal_gate_check.py --run-lean + python -B -S -m unittest discover -s tests -p 'test_*.py' -v + +The scanner returns 1(review) or 2(not established/refused); it never returns a +full Layer A PASS. --run-lean needs exact Lean 4.34.1 and performs real builds, +leanchecker, axioms and controls. The baseline full Python run completed 1541 +methods with 36 environment skips, not a 100 percent executed final matrix. +Cross-repo consistency, complete branch/PR disposition, status reconciliation +and cold-start G9 remain unfinished; these commands do not establish them. + +## Invariants + +No placeholders, unverified axioms, floating-point bound certificates, +weakened bounds/tests, hidden vacuity, false status or unsound auditors. +Preserve exact source, counterexamples and quarantine boundaries. Record only +observed results. Source links, reviews and plots are not kernel closure. + +## Historical status snapshot — not CBZ closure + +The following original snapshot is retained as historical source evidence. +Its ACCEPT/AMEND vocabulary records prior scoped review; it is not a current +CBZ CLOSED/QUARANTINED index and grants no new kernel or baseline status. + # Scientific status snapshot **Snapshot date:** 2026-09-29 diff --git a/TOOLING.md b/TOOLING.md new file mode 100644 index 000000000..0abc5d9b7 --- /dev/null +++ b/TOOLING.md @@ -0,0 +1,26 @@ +# CBZ tooling + +See [GOVERNANCE.md](GOVERNANCE.md) for purposes, verification and limitations. +Use Python 3.11 or newer; the new inventory tools have no third-party packages. + +From the root: + + python -B -S -m unittest discover -s tests -p 'test_cbz_*.py' -v + python -B -O -S -m unittest discover -s tests -p 'test_cbz_*.py' -v + python -B -S tests/run_scanner_mutations.py --evidence-dir /tmp/NEW-CBZ-CUT + python -B -S tools/cbz_source_audit.py --manifest cbz-source-manifest.json + +The evidence directory must be new; prior cuts are never overwritten. +The scanner returns 1 for review findings or 2 for not-established/refusal. +Neither is a G1 or CBZ success. Its manifest covers the four current main-side +Lean files; using it for another tree requires an explicit complete manifest. +Build caches are not source exports; audit an immutable clean source view. + +Existing main formal execution, with exact Lean 4.34.1 available: + + python -B -S tools/formal_gate_check.py + python -B -S tools/formal_gate_check.py --run-lean + +The existing hosted formal-verification lane performs those actual operations. +The new CBZ source-auditor workflow tests the inventory instrument itself; +it deliberately makes no full Layer A certification claim. diff --git a/cbz-source-manifest.json b/cbz-source-manifest.json new file mode 100644 index 000000000..59ac2ac90 --- /dev/null +++ b/cbz-source-manifest.json @@ -0,0 +1,22 @@ +{ + "version": 1, + "root": ".", + "files": [ + { + "path": "formal/UniversalLaw/Side24/ConeMoments.lean", + "sha256": "2bcd4a83683188856bce010c3dcdec6904e45a6d73b50b9f3891e632ff58985c" + }, + { + "path": "formal/UniversalLaw/Side24/Endpoints.lean", + "sha256": "095102245297707316cfd7e244d5509f9b102fe5aa638b7acdbbcf9d3c9d52bd" + }, + { + "path": "formal/UniversalLaw/Side24/Ledger.lean", + "sha256": "ae4a14f3db8cf26668e55e2d2f80e0dcecb0703826b40396d91fb6e0d266d3f7" + }, + { + "path": "formal/UniversalLaw.lean", + "sha256": "cb94ad3490a00bc35b420a53a42ff65b6fc66a46b8a26ef1b87035d7bb15587e" + } + ] +} diff --git a/cbz/evidence/source-instrument-selection.json b/cbz/evidence/source-instrument-selection.json new file mode 100644 index 000000000..f00a16934 --- /dev/null +++ b/cbz/evidence/source-instrument-selection.json @@ -0,0 +1,2596 @@ +{ + "adversarial_execution_controls": { + "raw_receipt_sha256": "4b5adeb42c8c86236f06df7f6d4aef29f57488212712666525b8a07d1b1dc533", + "results": { + "baseline": { + "assertion_failures": 0, + "cli_health": { + "executions": 124, + "failures": 0, + "status": "HEALTHY" + }, + "killed": false, + "result": "NOT_KILLED", + "test_errors": 0, + "tests_run": 43 + }, + "conditional_invalid_json": { + "assertion_failures": 0, + "cli_health": { + "executions": 124, + "failures": 7, + "status": "UNHEALTHY" + }, + "killed": false, + "result": "HARNESS_ERROR", + "test_errors": 7, + "tests_run": 43 + }, + "conditional_runtime_error": { + "assertion_failures": 0, + "cli_health": { + "executions": 124, + "failures": 7, + "status": "UNHEALTHY" + }, + "killed": false, + "result": "HARNESS_ERROR", + "test_errors": 7, + "tests_run": 43 + }, + "semantic_false_clear_audit": { + "assertion_failures": 109, + "cli_health": { + "executions": 119, + "failures": 0, + "status": "HEALTHY" + }, + "killed": true, + "result": "KILLED", + "test_errors": 0, + "tests_run": 43 + } + } + }, + "alternative_probe_observations": { + "axiom_waiver_without_provenance": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 1, + "returncode": 0 + }, + "math527": { + "files": 1, + "findings_count": 1, + "lex_errors_count": 0, + "returncode": 1 + } + }, + "fifo_source": { + "main687": { + "timed_out": true, + "timeout_seconds": 1 + }, + "math527": { + "timed_out": true, + "timeout_seconds": 1 + } + }, + "float_use": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 0, + "returncode": 0 + }, + "math527": { + "files": 1, + "findings_count": 1, + "lex_errors_count": 0, + "returncode": 1 + } + }, + "interpolation_comment_brace": { + "main687": { + "blocking_hits": 1, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 1, + "returncode": 1 + }, + "math527": { + "files": 1, + "findings_count": 0, + "lex_errors_count": 0, + "returncode": 0 + } + }, + "invalid_utf8": { + "main687": { + "blocking_hits": 0, + "errors_count": 1, + "files_scanned": 1, + "hits_count": 0, + "returncode": 1 + }, + "math527": { + "files": 1, + "findings_count": 0, + "lex_errors_count": 1, + "returncode": 2 + } + }, + "kernel_bypass_token": { + "main687": { + "blocking_hits": 1, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 1, + "returncode": 1 + }, + "math527": { + "files": 1, + "findings_count": 0, + "lex_errors_count": 0, + "returncode": 0 + } + }, + "missing_root": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 0, + "hits_count": 0, + "returncode": 0 + }, + "math527": { + "returncode": 1 + } + }, + "plain_macro_comment_brace": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 0, + "returncode": 0 + }, + "math527": { + "files": 1, + "findings_count": 0, + "lex_errors_count": 0, + "returncode": 0 + } + }, + "symlink_source_escape": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 0, + "returncode": 0 + }, + "math527": { + "files": 1, + "findings_count": 0, + "lex_errors_count": 0, + "returncode": 0 + } + }, + "unreadable_subdirectory": { + "main687": { + "blocking_hits": 0, + "errors_count": 0, + "files_scanned": 1, + "hits_count": 0, + "returncode": 0 + }, + "math527": { + "returncode": 1 + } + } + }, + "alternative_probe_receipt_sha256": "1d8ae8bf2fb3ff1d71915bd415ce231abbdb41977c8a34306888082f2fc6fcbb", + "alternative_source_pins": [ + { + "blob_sha": "a710e009c6bee30c624903b3df92e7d97166922a", + "path": "tools/cbz_layer_a_scan.py", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/tools/cbz_layer_a_scan.py" + }, + { + "blob_sha": "c98d3302d57ac701edc1fcc679d201bcea50acbc", + "path": "tools/cbz_scanner_mutation_check.py", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/tools/cbz_scanner_mutation_check.py" + }, + { + "blob_sha": "7b616cb22d5b44fb8a7f317524bc2eb47333771f", + "path": "tests/test_cbz_layer_a_scan.py", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/tests/test_cbz_layer_a_scan.py" + }, + { + "blob_sha": "4113147d1b7b81617addd16a2ae1bce9975755a9", + "path": "tests/test_cbz_scanner_mutation_check.py", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/tests/test_cbz_scanner_mutation_check.py" + }, + { + "blob_sha": "cacecee3988333c3a5a0a5d2fb4963b54888dd16", + "path": "cbz/evidence/layer-a-lexical-01dkke/README.md", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/README.md" + }, + { + "blob_sha": "ab5cddb8c416a9eb5f8ed167d760b4b8512d0a88", + "path": "cbz/evidence/layer-a-lexical-01dkke/MUTATION_G0.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/MUTATION_G0.json" + }, + { + "blob_sha": "f5738c18461566be6a360f63e6fa43ff25dbda83", + "path": "tools/lean_layer_a_scan.py", + "ref": "6d402474a4a9582a151e9f87ab5f69570a2bc58b", + "repository": "d6g8k5htny-coder/Math-", + "url": "https://github.com/d6g8k5htny-coder/Math-/blob/6d402474a4a9582a151e9f87ab5f69570a2bc58b/tools/lean_layer_a_scan.py" + }, + { + "blob_sha": "b51e861c12189cfbbbc8203a06aa4a73668190fe", + "path": "tests/test_lean_layer_a_scan.py", + "ref": "6d402474a4a9582a151e9f87ab5f69570a2bc58b", + "repository": "d6g8k5htny-coder/Math-", + "url": "https://github.com/d6g8k5htny-coder/Math-/blob/6d402474a4a9582a151e9f87ab5f69570a2bc58b/tests/test_lean_layer_a_scan.py" + }, + { + "blob_sha": "9dc2309014c9a54cba76bbfff5fe6b8fc7148b9f", + "path": ".github/workflows/layer-a-lean-scan.yml", + "ref": "6d402474a4a9582a151e9f87ab5f69570a2bc58b", + "repository": "d6g8k5htny-coder/Math-", + "url": "https://github.com/d6g8k5htny-coder/Math-/blob/6d402474a4a9582a151e9f87ab5f69570a2bc58b/.github/workflows/layer-a-lean-scan.yml" + }, + { + "blob_sha": "9cc488fca2987bc2a520351768383c34c61853b1", + "path": "cbz/evidence/layer-a-lexical-01dkke/HEADS.txt", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/HEADS.txt" + }, + { + "blob_sha": "a6424f6069b86e2f07f4a1e3ee3a951b303d61a6", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_governance.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_governance.json" + }, + { + "blob_sha": "5ff155c4707ffcdf3ffcc945c55a67fa1bab8213", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_main.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_main.json" + }, + { + "blob_sha": "2008889e9876baa5245921c8a4098a898caa3601", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_math.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_math.json" + }, + { + "blob_sha": "a6424f6069b86e2f07f4a1e3ee3a951b303d61a6", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_meta-framework.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_meta-framework.json" + }, + { + "blob_sha": "a6424f6069b86e2f07f4a1e3ee3a951b303d61a6", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_query.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_query.json" + }, + { + "blob_sha": "a6424f6069b86e2f07f4a1e3ee3a951b303d61a6", + "path": "cbz/evidence/layer-a-lexical-01dkke/scan_universal-law-workspace.json", + "ref": "95e9dd43d70b8d650c07fdfc458199eec507a919", + "repository": "d6g8k5htny-coder/main", + "url": "https://github.com/d6g8k5htny-coder/main/blob/95e9dd43d70b8d650c07fdfc458199eec507a919/cbz/evidence/layer-a-lexical-01dkke/scan_universal-law-workspace.json" + } + ], + "current_source_binding": { + "harness_tests_sha256": "588190d7ec55d8d6dcd4e7d2bed290bd3d3593f133d1bcecbbc018d89dcfabe4", + "runner_sha256": "7c06fd16fd9a34d9e37b6470971cb415d30a0624d69d531f6357507b83397033", + "source_sha256": "827c5d582d889ec4b8c5d36ceb9d89de7d79cccfe0736d633ab9eb7b40db0e05", + "tests_sha256": "4f138b59b8d767e4d1e169b7031f1924f7b8e50ebb0353895c205f4aaf46c1c4" + }, + "exploratory_review_cut": { + "killed": 49, + "raw_receipt_sha256": "9ffd45ba3a891c2b8dec4586dd157bc7645d5a76235a6126f14e85d26480977c", + "runner_sha256": "8ac245bec4c5fafe4c54bbeb51e447783d871570153ac7d5b1e70280e7c8eab5", + "source_sha256": "c91da1c607a956cb64d39d8342b7d59722070d0aa5f2dfe54a5e049f3ec8fc9a", + "tested": 50, + "tests_sha256": "b5dd1a219582122a954d43e41d69852450d88f7d93287499f8519b38c35cb923", + "unqualified_reason": "Healthy false-clear mutant had one incidental missing-artifact test error; not a kill. Assertion strengthened before the final cut." + }, + "historical_qualifications": [ + { + "current_source_binding": { + "runner_sha256": "2940b27dbf0947005b6525ad7d6a45b50d475cb6d198c58a7dcba371f0b52ed8", + "source_sha256": "48e43864860222aab893f76f60163c52fef634408298ec9c503cbfd8fb9971e1", + "tests_sha256": "473a1cf7212c1cb1e968c372934eb3b3c2d3926380e2227d1880554cd4cee30a" + }, + "mutants": [ + { + "assertion_failures": 3, + "log_sha256": "2e84157ec8ac9968cdd4e06f0989e9f83a841c60481f174e541ed0631df39d86", + "name": "disable_token_sorry", + "result": "KILLED", + "source_sha256": "9cf874534d4491ee695644bc7d60935ec3277aa44e5cb79c6847b594b7213c45", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "log_sha256": "95812e17f43cff7103bdb963275bbbb47c3873774fd34af6a27de9b3622854ab", + "name": "disable_token_admit", + "result": "KILLED", + "source_sha256": "682e06066dac3ee6aa46e76ab679c3e2e9119c6cb778d1beb8b2440d7380d1cb", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "d425f8412c190c0bd492a9cc66d542325d8ef7c755e77141c1bb058c5d462bdb", + "name": "disable_token_axiom", + "result": "KILLED", + "source_sha256": "8dc5df579f2ee1f9eb44c56627f1e8e97d4cedf83aa8a07b83675642c322a57b", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "56c9810362a03c751660d4af3c92965e624e518c01f779336962a3b4ac436ba9", + "name": "disable_token_native_decide", + "result": "KILLED", + "source_sha256": "d58fc3f79f5d04bb0665606d9583ee7d29b42ecf5c1697879d74056f9f646cf7", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "a9da462a195303850c2cfcb188c04e89ed11ffb8b1c1f13c6cbcaad82bc57f26", + "name": "disable_token_unsafe", + "result": "KILLED", + "source_sha256": "60e117c7823f29189957c46851ed8bf58a0ea710def506f77e4cc700c398f634", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "f908efb5ab78b9f94914e15ea3cc7bf87ab5fce203f6f0917481e9954fd21c15", + "name": "disable_token_Float", + "result": "KILLED", + "source_sha256": "ee8c2e84c50fe4c738177c525c1c4357dc9f158b7598295926a215aa2e38d009", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "7b5617356a1384d2831b9f38407f81f6327e2ee5c37d6ba2dc6cbff3003d574c", + "name": "disable_token_Float32", + "result": "KILLED", + "source_sha256": "2991e014312c25ec241613fe665606311496b450be0a96022868c4ef1ded41a0", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "35edcfed4f05c4d9b629d08c1a8e4c9605e09330e814fd943c2ac2b9c0206670", + "name": "disable_token_sorryAx", + "result": "KILLED", + "source_sha256": "df04000a1f205796261c754e7b5154baf043afbb238f98b04a774d3e060943ca", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "18d69d5911bc83d44a8aae246d2fcc5d39243f56790cbed18e554fa589219451", + "name": "disable_token_ofReduceBool", + "result": "KILLED", + "source_sha256": "5483dd32caf34a18a43cc10adfc0c02c86ba9d023c3f6b8808f36aa665ca45ca", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "0e185ed2d64ddf0d14d5ed597d924cb32afc832b6b938a3db4c4b6f0dd38c298", + "name": "disable_token_ofReduceNat", + "result": "KILLED", + "source_sha256": "3a325b0c462f9c940253a6096eed0e37819c502720805aae793b7950d1722355", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "e97e67850808e85384fe7c1b0c16d79abbc0f9cee54a6d1cb29c5c4898fd53d2", + "name": "disable_token_trustCompiler", + "result": "KILLED", + "source_sha256": "cb11329352d96f7affd54a1120025e3f3070434576e7cb113c9a5f27db1583ce", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "55952df009a9a2a6cd61467177aee30d1e4bfe21557e93150ebb97e7212f4411", + "name": "disable_token_skipKernelTC", + "result": "KILLED", + "source_sha256": "e5d5431b4adcd3facb0d039ab5d64c0025bbc6dee75de2b1f9a885b738d790e2", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "e536425639a293736c6afa666bc92fb1a942d804fff3e4d9786214964a35fe5b", + "name": "disable_token_addDeclWithoutChecking", + "result": "KILLED", + "source_sha256": "3425915f1b5a391fd341908128685397174a42dcf249b5bd9567c95aee6245e5", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "5a620a2e83972a8a2ecf8122e621898f1a40f4b33390c0b2f002dc7b370d1433", + "name": "disable_token_run_tac", + "result": "KILLED", + "source_sha256": "1fafe6d04473739f71d1ca6af77cef700d9f1d938c540292b283ded233fe169d", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "e450a2919ef41f64fe544361ab9259ee0a9de4879d5ab3e76cd0abcd05a67550", + "name": "disable_token_run_elab", + "result": "KILLED", + "source_sha256": "519e8622349a0f76eac11d14229557d4d9b114e8566a97ae5c85002f34eb5bfc", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "8d975cc744817af87a73fab2fd09697d145b7984c365d86db96b7083fba79e05", + "name": "disable_token_eval_expr", + "result": "KILLED", + "source_sha256": "bc228c9a74d45d39c76a33f190926d9c91ca26e8507ac5585d80d198d8f35b9b", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "9f170f328aa2904d2c299d411e1836de0a887d4a0965917fcb17924e9f5b00f3", + "name": "disable_token_implemented_by", + "result": "KILLED", + "source_sha256": "2b043c4b737997eab24e5621ad491e87c0dbdae0a451c79796f9ba29724750de", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "6d01c42cf5daf49fcf57616e630b819fd32e14a0ddf6417269c5e542341bfd1a", + "name": "disable_token_extern", + "result": "KILLED", + "source_sha256": "78c38f2ea7600b662ee731975fbf6a3e69eb0da3d168af6596682fc86dbb6bbd", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "9b18f433f7d0e37ebd605373f48f7f529bb06cb55255844b21cd8abf34bd7504", + "name": "disable_token_macro", + "result": "KILLED", + "source_sha256": "cb9971b603dc41be82a5dbf38979fb0a1f6ab60bb192b5d5069358a30df575bc", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "cc2f90e5c5365fc2437654c0dfdb4cc1fdcd438e85ea3551af86d21fd931ca12", + "name": "disable_token_macro_rules", + "result": "KILLED", + "source_sha256": "8d62e602f863af99fc91bfe8901baaa410021100aa34683c8c073273c9550962", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "ebdadd792fd22e3fae49b7ac7508c659a296913b66e2e9f5a2bd718ac2d9ae9c", + "name": "disable_token_syntax", + "result": "KILLED", + "source_sha256": "5da5b8bed5d1ac4a81b78ac72aab079824885447ad8ed25f28a7a171c2e60ffe", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "74a8e33af80d9ce6882a9987979daf877f9da4b96979cb2509a904c2a470e8d0", + "name": "disable_token_elab", + "result": "KILLED", + "source_sha256": "27ca3330d7c2d96d7bda05c3ad7d54a8c10f7ebda8f81721db571412a8da0ac3", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "ce66e09034474be59be0bd8fce594d997be73f00f9bf791dfbc35be6d3ec0817", + "name": "disable_token_elab_rules", + "result": "KILLED", + "source_sha256": "e452cd6f53091b3d2cbc8bf96b1dbc4021c9bc6a0d320812c8f87f1771f7e57a", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "3dfd37bce8d1f2d40cd0e94f2981d337f8ee42d5c1754b64f39079ff0529fb3c", + "name": "disable_token_declare_syntax_cat", + "result": "KILLED", + "source_sha256": "058dcf472d24d9f9fe0feab1a9f1c305d570764e16447653db8d829757adfe9a", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "56191c8a3bdf6829804ba646cd7c8444deb8b890f94d93a3672b725533ac0c58", + "name": "disable_token_initialize", + "result": "KILLED", + "source_sha256": "78b8271778be8748d08b7f356c23a7153a4678e8e208f4f09a5a11b71dd73717", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "6a870e71d44fa90d28187f0787f10ce1741b1364f47a397a2a8d2534df442c79", + "name": "disable_token_builtin_initialize", + "result": "KILLED", + "source_sha256": "facb5011574a4657271c6b1d5daac515fa61daa2e0bf4a87f8a67c3759bd89e3", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "71e5a5e90d89564984970edabbf5493841fc9716a876a25a5b2401975a8cbf40", + "name": "suppress_quoted_identifier", + "result": "KILLED", + "source_sha256": "6d4b875488ed58e5ba470b7c2322d9aa3af31b4c07206aed082c774f9d9a6da8", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "log_sha256": "892d79323b04376292fc88a05f5d74a2e68dea48cb40f1e183bfea8312cde0ad", + "name": "suppress_string_interpolation", + "result": "KILLED", + "source_sha256": "4932acaf2478d28288382c8a1b2975f0cf0dc36f424858546e02a757ddf04c23", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 7, + "log_sha256": "72db70e83ce6b3e332aa89bdc13270eb9f5b37d2cbc0f0d3d0a25218e1d3cebe", + "name": "suppress_unsupported_syntax", + "result": "KILLED", + "source_sha256": "ac810264dae176fa21b9644b713b5e091f7d2f9766cf9d2190fa4cff2989431e", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "9893bd523b2b585fc78a8def59a79b09ecf8dfea7cf973cf4c7d2d87de898154", + "name": "suppress_unsupported_escape", + "result": "KILLED", + "source_sha256": "7659a9889a1e5ca6b6f8cb7c37e401d3031d464859483d73cd285e7ccc6a040f", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "log_sha256": "d55c7b35f9c46a22d2fe9aa3e59854b5bd1c3fc8c623817350e8a15b48e489ab", + "name": "disable_plus_native_form", + "result": "KILLED", + "source_sha256": "6c1fb2628ffabaec872aef6b44e35817811123422f2c683a61097878e06dfca8", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "log_sha256": "d5cd9e2db35649e19367f777aab7258846e0704b3afbc17dfb819b0fda8c8f35", + "name": "disable_native_assignment_form", + "result": "KILLED", + "source_sha256": "9d222638802db0f6d6506a785ce44eaf8e01b80f38af4625f947cabf15e22828", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "481948838ae3565c6b5e7b9d42605619fbe4ea10e0573e63261f7b1efc671892", + "name": "skip_missing_file", + "result": "KILLED", + "source_sha256": "a95c479088f0d903d3448d9cd200424b36e3124f5af95979fdee83bc8506fef8", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "cb235f0e1ec1b6a6e293b03eaf3f65d2f491098138d0b7df1d5a76f94c6c2bd0", + "name": "disable_hash_check", + "result": "KILLED", + "source_sha256": "fa2d26a4639fde754afc3e12b09c8d11658ec2cb3184a94909b9b69302ee80ad", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "e2c8b81790f6ed95332fb83749d073cf536c4f7e22cb19471e9374cd744b5ea9", + "name": "fake_hash_identity_from_manifest", + "result": "KILLED", + "source_sha256": "5515c3eb4dd45bfec31cfa1708169421c7b1a14427d13f3fed03a6dd713a3f68", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "d7d1c80109e8481cdbf5a15a5e0ce36ea4e7a0cb102c75013f7f53e83602c30f", + "name": "skip_unlisted_files", + "result": "KILLED", + "source_sha256": "e4cd0f7c298e39bcd898087e5b9607280133ccfaa0d6c9840576e85a32b59ebd", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "147c4cefcaffa394c0afcc470df174c994b07fa43440ca6de80a4676da6395b4", + "name": "ignore_permission_denial", + "result": "KILLED", + "source_sha256": "a98f5ab017cd151e9208029a3024b044b3da930027aea988e88e74f3527d92cc", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "log_sha256": "5944ee5b869b34ec411792bafdc11820a0d2b9b4b355c856c96dc48a7ff1e3bc", + "name": "disable_symlink_classification", + "result": "KILLED", + "source_sha256": "a2203a5487166eb5f40b6ee58eee3e19e8225ea8ccde02f0bcd003b7531d0e43", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "log_sha256": "33b5d16f05b2b13800b1e8ee5393a86289bd7047167603d28aa29696fc141608", + "name": "ignore_invalid_utf8", + "result": "KILLED", + "source_sha256": "8cea1e10f5837e7c97f8481d3f70bd481d35b934ea8a4deb7bed8b233d13d07d", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "log_sha256": "45126651dcfd4849ee3d40ab430e92cbf077542f64d69a8e45c94c4223d1ecef", + "name": "ignore_nested_comments", + "result": "KILLED", + "source_sha256": "b6f01cd8d20a81113f722f449be50ea18ee5e089523c8bca7b1ca5b18e3d7bb0", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "log_sha256": "a12119ac55fb564800a7149f85c944a67984d8fcf8227bdce7d50da90ff15762", + "name": "disable_string_mask", + "result": "KILLED", + "source_sha256": "b9b1bbc7da7616674db8a7c6f9414547c582ed41e9182471ecd3d2b82c359f01", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "log_sha256": "0421a5b5f461329c202b5fb68d61fd78eb52a25a093f875617fd7af5e8a1b888", + "name": "disable_character_mask", + "result": "KILLED", + "source_sha256": "ceb1aea44dd1ace695734e85325ce79eafddb7920a48c4fd5acd431dacd1e215", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "log_sha256": "6df4edd731f1066f615bb3eb318c064835e99abf69974e348a677df28afd3199", + "name": "disable_raw_string_mask", + "result": "KILLED", + "source_sha256": "1206c73cc28695f5a0d5cbaefe6dff21ded82f8791d0966cf1f48728c0831712", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "8e2ed776eb52ba3cd70660536aa425b61c53a1036a6907b3c410dc372c88c8c3", + "name": "omit_unestablished_semantic_coverage", + "result": "KILLED", + "source_sha256": "94873cbc3b1578d49217e1879d918127884856370dae1ebe1147273e3822741d", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 102, + "log_sha256": "63201f9c5296820e81dab043161e4141ac3a8d5cc5f61626a3d82d6a1264b3b9", + "name": "fake_unconditional_success", + "result": "KILLED", + "source_sha256": "3f6599d7ea36e6aeadaf52099772a9be08b523b413229df5ca054d448a4c2d96", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 102, + "log_sha256": "40c7538026df9554abf87282da67d5eb99191c36089b11ec9fabbfdadce1edae", + "name": "fake_unconditional_clear_audit", + "result": "KILLED", + "source_sha256": "dfc3ec1b92dced86ef6a552d754cf4cd863d30fe4a05e64de442a130b5a84806", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "log_sha256": "411a976759046f6a2e176c0277851a8a7d3dc0e8a8bf595978b5088a07b65659", + "name": "ignore_duplicate_json_keys", + "result": "KILLED", + "source_sha256": "2fcf707da1a70f7c0b52fd71d8704664202a567e80ee08196475e87d16652bf0", + "test_errors": 0, + "tests_run": 39, + "tests_skipped": 0 + } + ], + "mutation_cut": { + "declared_threshold": 47, + "harness_errors": 0, + "healthy_baseline_tests": 39, + "killed": 47, + "raw_receipt_sha256": "91891f0cfb69a15656454210b4277b4b73e24dcee863d8eb65be3654f63a8e91", + "skips": 0, + "test_errors": 0, + "tested": 47 + }, + "name": "trust-bypass-union-47", + "regression_methods": { + "harness": 14, + "normal_total": 53, + "optimized_total": 53, + "scanner": 39 + } + }, + { + "adversarial_execution_controls": { + "raw_receipt_sha256": "f02de3b4512cc27e6102abe7dc8dd19da7b63cbdb5cc62d841cb1f52856d69dd", + "results": { + "baseline": { + "assertion_failures": 0, + "cli_health": { + "executions": 120, + "failures": 0, + "status": "HEALTHY" + }, + "killed": false, + "result": "NOT_KILLED", + "test_errors": 0, + "tests_run": 42 + }, + "conditional_invalid_json": { + "assertion_failures": 0, + "cli_health": { + "executions": 120, + "failures": 7, + "status": "UNHEALTHY" + }, + "killed": false, + "result": "HARNESS_ERROR", + "test_errors": 7, + "tests_run": 42 + }, + "conditional_runtime_error": { + "assertion_failures": 0, + "cli_health": { + "executions": 120, + "failures": 7, + "status": "UNHEALTHY" + }, + "killed": false, + "result": "HARNESS_ERROR", + "test_errors": 7, + "tests_run": 42 + }, + "semantic_false_clear_audit": { + "assertion_failures": 105, + "cli_health": { + "executions": 115, + "failures": 0, + "status": "HEALTHY" + }, + "killed": true, + "result": "KILLED", + "test_errors": 0, + "tests_run": 42 + } + } + }, + "current_source_binding": { + "harness_tests_sha256": "588190d7ec55d8d6dcd4e7d2bed290bd3d3593f133d1bcecbbc018d89dcfabe4", + "runner_sha256": "8ac245bec4c5fafe4c54bbeb51e447783d871570153ac7d5b1e70280e7c8eab5", + "source_sha256": "c91da1c607a956cb64d39d8342b7d59722070d0aa5f2dfe54a5e049f3ec8fc9a", + "tests_sha256": "0facbe01b9e2c69928dce1973206bf4fbbd7b962cfbf8a7c2bed38999d1a2250" + }, + "mutants": [ + { + "assertion_failures": 3, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ade22a0de405180820dcfe8790d1a8ebc2518757c2fb93afa65fcff7c4edf209", + "name": "disable_token_sorry", + "result": "KILLED", + "source_sha256": "8cfbc0c335ab185464181efe3190453ccf7b441b991216873f4b26babefa6503", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "a1aba573a63074354e05b41e75d9303c098195826c0a628ea0feebb661ca7c8f", + "name": "disable_token_admit", + "result": "KILLED", + "source_sha256": "81909b59c096f30b396a2a6722ac1642417b650858c63d1e579e12200146df40", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "004580e5a628d70ebfa394386e24a645b0536f57e65948bd6806688feb07fcac", + "name": "disable_token_axiom", + "result": "KILLED", + "source_sha256": "f6ae906de7d056ee742c415ed994d36e24c213136df409eeb88d100c90a28562", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "d7f511fc8d1e25457770cf20ff2dadc64a1a06c4d674443b8788d002ddf744c2", + "name": "disable_token_native_decide", + "result": "KILLED", + "source_sha256": "36f0e59a28ed3d48f4ebae8fc6d1680615465be85b3352d1cb88018682cf5167", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "923686d8fb9a8176c63d356a5662c74a58d657123f1617084c49cc0f164187ca", + "name": "disable_token_unsafe", + "result": "KILLED", + "source_sha256": "9da954cb3f326d204580d5b7b9f8345605502a51c5f83a4970e3d04805615f83", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "6313715d21fade8a2500b8499746f2977e4da089420ae7479ef68e553f0c2043", + "name": "disable_token_Float", + "result": "KILLED", + "source_sha256": "d487b07a6629313f1780c9f9d445a53d010a856ca720d6fe87429e6a50fed5c9", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "e2f57c74437516605779e4d65bd9140308958a770b518a46f6bc43735fbd77b4", + "name": "disable_token_Float32", + "result": "KILLED", + "source_sha256": "2739b32394286b1120007d9e707eedb161448960aeef656edeff887f40d91ea4", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0c930ae522c8179b65bbfe367e0c88f8b110e4f5b51bf3297f26c4c7cc5170e5", + "name": "disable_token_sorryAx", + "result": "KILLED", + "source_sha256": "a98e367d3830c03f7f988282029e0a2d212b2f6d526131a6c0838a8324053a0c", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "7fac057ff604aba41432b7cd6b615afb4071a55a43049ddf1f0d828dd10e4786", + "name": "disable_token_ofReduceBool", + "result": "KILLED", + "source_sha256": "65261cc50808d31007d5b3cf72aadf76e0d6db8ea7e8f45de227de72cbecc80d", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "f29f35f9f348899f8f531854fa3fbdd369cabfe3f0bfe1fde72f24cc694e585c", + "name": "disable_token_ofReduceNat", + "result": "KILLED", + "source_sha256": "28170eae35bcb5851e3a9e60a6db08a7a0efd2c2fdcb5574a1f46e2a22d07cb7", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "b4e19c723d7318f1f1757f992dcd545d40840dbd32c5c3342808aaf59624d86a", + "name": "disable_token_trustCompiler", + "result": "KILLED", + "source_sha256": "70fc55ccceb99edf76b2e091f4981155d78f8574c753704aca01eb3f89bece38", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "96e973c19d0b4246d6a6a688c447154681e2d3d40eae1fa19fbdd8c6ab7e081f", + "name": "disable_token_skipKernelTC", + "result": "KILLED", + "source_sha256": "698837e6ccb9ec602961147cebe9043c1277626d22d5d1140fb7c5c54625169f", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "322189102182414470c2d40898adea38f0b2813e60a2ae9e872270b74f1aaedd", + "name": "disable_token_addDeclWithoutChecking", + "result": "KILLED", + "source_sha256": "2b2b987d4cbe80e37bd0ccc6a413d26e2139592d66c23b547dda4c09e43c7bf5", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "3364f20bd6cdea9d6c6a7d17f6f5761e859c32e78c1d9149ddc0c88e241e364c", + "name": "disable_token_run_tac", + "result": "KILLED", + "source_sha256": "32e4a89fbadfa07d87eca0ceab443a7f55edc9b1dd7579f3348acb7be84b2a73", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "15b9dc60df144155666eac6eb861b6fae2f5b3b98d20b2fcdc9f1655511bfe93", + "name": "disable_token_run_elab", + "result": "KILLED", + "source_sha256": "c39933284c46426274d6da4ccb4871a8289ebe69150e6b8c337d9e8ce3e1d94f", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c320216b7e890f3fd34042b8558cac7b56e2b66964889bb3953d4dbf78049326", + "name": "disable_token_eval_expr", + "result": "KILLED", + "source_sha256": "6b79c61a18d90f503c90605503edacef763c417d65467358164f610a2572728e", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "3aff70494446352bc8de6b51bca9623c13e68059802913b4f202d346c4f9c9a7", + "name": "disable_token_implemented_by", + "result": "KILLED", + "source_sha256": "1d1b4d8e564d193a4fae7884e6829033ca9d28d7668d71999d01ff61844984a9", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "87855c95a354dbea0ce98c3ce86e3e31ab72f2b0848ec613db98d8ee4c825756", + "name": "disable_token_extern", + "result": "KILLED", + "source_sha256": "89aec961a390cd6ab234359f86ef901dba451f00fd7c2a70dddf16b081a6f0cb", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "045eb429aae435a886acc7010ffed692c7c47a842cfbed603cdb0467a1aa396d", + "name": "disable_token_macro", + "result": "KILLED", + "source_sha256": "c1fe89162385a22e67c6f547902178d83e8a65d942cde787d303e7c61abcdf51", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "afeb62d2d746b5f6497ea7cf5cb3c7f07f55cb79955f3d975580afd5c3f7871e", + "name": "disable_token_macro_rules", + "result": "KILLED", + "source_sha256": "a2234b1ccfbc0d65e946a9149be48f5646f038eab00f99b7bed791e1a76054fb", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "deed1bab91b0ddbef25f79ac7ba510371db29a7ffef7587deecfa725b1594926", + "name": "disable_token_syntax", + "result": "KILLED", + "source_sha256": "f254be05c67d2a094ad32215459a95361f93363100cd08f6918940bcf5ab7385", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "f5cbc1945616dab59596f221099da154602d00c985174ff92f021b0eaf1e3c55", + "name": "disable_token_elab", + "result": "KILLED", + "source_sha256": "bb00763f43fcbecabd36aae55036172c8b631df66e7a07d37ed31d8a2bdde887", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "a668db625490eb9a1f1a2f8e65304929378fd1c39bdc0a4592665f961c8a5d1e", + "name": "disable_token_elab_rules", + "result": "KILLED", + "source_sha256": "07cd07fc6c3e853fcdafacfde5a597eb75c486577965f2ab821d284d3b4af535", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "6bd0d4b86557e507f6a3f987c8a8c13ac7741afa995ea51c8a14c28412cebfaf", + "name": "disable_token_declare_syntax_cat", + "result": "KILLED", + "source_sha256": "2113161a78923c6c2fb8e35e3b61b4dd393eee636badc20f0b015cfbc18b7d92", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "2a13486abc17a946dbc8a3649fde96387c44f19dbe88f9bcd1c57f1eb08bb5e6", + "name": "disable_token_initialize", + "result": "KILLED", + "source_sha256": "e4b93b1defa594479879cea3fc04e140eb7f70775abc6b0153f698d32adff8e0", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c3032917639b06a403de6cf953c1aef96f20589f5afd8ae7b378ca4e47c8d088", + "name": "disable_token_builtin_initialize", + "result": "KILLED", + "source_sha256": "e452b369c19006e2121710850d9c87a9a0a195fe00d61461e504445bb7b057fa", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "cc57acc5af22851ac718866a75c6a6b982b5bc4b8490c47bdabcbd2075d3ca16", + "name": "suppress_quoted_identifier", + "result": "KILLED", + "source_sha256": "77aa5a63420eebe86fda711f853174938f5262b4e0b72e9f119b3259bb8a45a0", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0c4c675ce9f60ee67d9e5d5aa7dbbc0c86bda88eccf6c2dc798680ca7a7d307f", + "name": "suppress_string_interpolation", + "result": "KILLED", + "source_sha256": "59284c72b2a5659ae15f4f6f910701350fc68b664c1df25bca46127110d6492a", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 7, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ee78aa3b991a7e7c3d0e71f7549096ac086553f05d0f3e57728efdc360a55bbc", + "name": "suppress_unsupported_syntax", + "result": "KILLED", + "source_sha256": "4dd89c097d138980b1a1e4a4b323dfe3911826fa40338d0db595aa896cafa5f7", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0a2f7a90cf19238a85e470e70c0c0ef48729917bd6865b56f378541897e90efd", + "name": "suppress_unsupported_escape", + "result": "KILLED", + "source_sha256": "d7b0e9187568f8777b6ab3c6f886b123afbdb91c16b5e9850581f3481feda9ec", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "420a8560000fe97b58033ac3ac3d4172912f00cfbc78e1d5220681054abcb6ee", + "name": "disable_plus_native_form", + "result": "KILLED", + "source_sha256": "4ab38d4161b2625df43edbe0235c8d19bfa03b6a2ada083265e09911fb421a44", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 9, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "48173eda0fbb3905d0f46c24ecbc369e81f5a704aa3528c80728837f83c04a25", + "name": "disable_native_assignment_form", + "result": "KILLED", + "source_sha256": "6eaee2e5ba69c4cc114097a83786f6a4560ec4ae0159c97c9a0051bfe2e5d262", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "d70117d0abe31d4c71887016bc2ff55eee1a0198206fec4c20cfe1f306afc452", + "name": "ignore_native_record_updates", + "result": "KILLED", + "source_sha256": "096c4d4a0556572218fb6ff46a709a372f195dfa852a8ed4f194a64ab8d7dd05", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "24f158a0054f19052669a0121ef0eeec78a15dd71b16b0aa9f7fb4700372af92", + "name": "allow_double_slash_anchor", + "result": "KILLED", + "source_sha256": "2c59f3cf955fe76da25e5b61f9072b4b22bf35773837bd1e70ee5d0201ed7ab9", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c0c26cfad0d1e7abb290f1d17f85bb0c7590c485964b03e9ff681b171fba1e47", + "name": "invent_root_to_allow_output", + "result": "KILLED", + "source_sha256": "464ba83ccd67cd50895d3f34943a9cf77ec1ec676813b67c8e32d09598a9a127", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c9f51ad3535dbd799e5f91f3e567595a5990d9b1780eaa7cf8609f6fed6b93d6", + "name": "skip_missing_file", + "result": "KILLED", + "source_sha256": "88f54e28b4a638d0e44c6d5747f35e213eace6b76b77f7048c8b5b7c972bff97", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "3248781b2d0ba7090e5a25afe737b27d38db0c1098d8a80f77eeefd07ab39eb5", + "name": "disable_hash_check", + "result": "KILLED", + "source_sha256": "83c19283bc0be88de2ccc064f7babacc5ce5c250b9aaa68546eea7a3a9a1b221", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c98af6c51fc6faaae238020f240791abfc526d363116062f7fe5f739be2a256b", + "name": "fake_hash_identity_from_manifest", + "result": "KILLED", + "source_sha256": "798e58e5e9ba89da606e719f122c1e66e193433b70d5f01e414045305094c0e9", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "1fbe5ac93537c492f25a47843532184b7760816df129b0cf0537dba2fdd299a3", + "name": "skip_unlisted_files", + "result": "KILLED", + "source_sha256": "671f2915a7d766bb2747e1ee7e23293acff3c22fe3e0e7e9cf635f3d1b0e6f46", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "95e8cf547a3e94b497f39686e9a3b5ca4ba8776b7aa2dcf50ade9dbd9336c05d", + "name": "ignore_permission_denial", + "result": "KILLED", + "source_sha256": "aada541b095f7520f7e4c5e70699fb5a02319901e1d7032460f9eeec79ff1f79", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "cli_health": { + "executions": 118, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "125c43c13d644c662f5bbe0299374470dcfd84918df01529debed2fd7be05815", + "name": "disable_symlink_classification", + "result": "KILLED", + "source_sha256": "4b27099fb3226ce07aba94672e8352a184bc8186cc9f9ae6adc523e2f217d9bc", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 119, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "bd5da3ec9fbea6313715e49c49fb8002cf4657727abe009f5c98f62f6ddf3f18", + "name": "ignore_invalid_utf8", + "result": "KILLED", + "source_sha256": "f5d9cd9081ebbb4c3e47d5940334e04d6fc38a279fef08aba95ff4d9d45ec81a", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ae59e445b9b0dcf72306df02d9b3c8854c24bd75783de5284c11493fe47f02c5", + "name": "ignore_nested_comments", + "result": "KILLED", + "source_sha256": "35be158b4319af79832ca50ca10ee5ea977c1afb8821a18a9fa13f7fd21370e1", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "5dcbf720a5d6d7bb5077ccd71ff316ad9959f655e2f92ee7c81db94d4da1f3b2", + "name": "disable_string_mask", + "result": "KILLED", + "source_sha256": "08837f13750f8c31715cf37afc993ef44c13d5c1f60f38a90b81fc5c09665fa5", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "f0f5d503f1ca574f815288081b1c99937b1499046dbcc97cd813a7582f9f64c3", + "name": "disable_character_mask", + "result": "KILLED", + "source_sha256": "e399bbc41b1789dd90cc3ac1655c33753ddf003f9c0247cd770637dd672caa81", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "9e06e203e81cbca3023123addb3a7f66977fe0381f55e0cf7135fd38895ec34d", + "name": "disable_raw_string_mask", + "result": "KILLED", + "source_sha256": "87bd2675a9636bcaa00868a9584538f9cc067188f52d1f4f4f1583443a0557bc", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "aa395306b2542a85d6cb1ed89eb188a550a312396d9809b9f1bd68182522470e", + "name": "omit_unestablished_semantic_coverage", + "result": "KILLED", + "source_sha256": "7e661f2abe1807e7333ebf66dd090bbf80a94866808ec338037fa0d656bad788", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 113, + "cli_health": { + "executions": 113, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c1cf5a3fb6a54e341cb4043e23ae9b5889c217a8692a24c92e51c1964a6d1aa8", + "name": "fake_unconditional_success", + "result": "KILLED", + "source_sha256": "5b4784e4ab3eabda0f6be3f72943028ffafd6faa7501351b0a5b55b9b7febbfc", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 105, + "cli_health": { + "executions": 115, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "802f167257ecc8f99e5fac4d2d3f96d55352d64836ed49d44e32069df2776400", + "name": "fake_unconditional_clear_audit", + "result": "KILLED", + "source_sha256": "ac885a0b012c4dbc170b5dafccb62778072b9e544b8d06e089f3bb74b91c229f", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 120, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "04cc2cb88c0aa7ef8656c4ab65a310bb3c99c5719e45ee191f98d679f05e0463", + "name": "ignore_duplicate_json_keys", + "result": "KILLED", + "source_sha256": "37b7316e91ab78e3ece132fa187ee84bf9a892471d22a89b980cbfc9e56d7857", + "test_errors": 0, + "tests_run": 42, + "tests_skipped": 0 + } + ], + "mutation_cut": { + "declared_threshold": 50, + "harness_errors": 0, + "healthy_baseline_cli_executions": 120, + "healthy_baseline_tests": 42, + "killed": 50, + "raw_receipt_sha256": "6a1e960e4e3d92cb259390351f6838f7227a66cea0abf3c86cddb6f384a463cb", + "runner_receipt_schema_version": 3, + "skips": 0, + "test_errors": 0, + "tested": 50 + }, + "name": "native-review-four-repairs-50", + "regression_methods": { + "harness": 16, + "normal_total": 58, + "optimized_total": 58, + "scanner": 42 + } + } + ], + "limitations": [ + "Alternative probe reports are observations at their pinned commits, not claims about later updates.", + "No source instrument establishes imported axioms, compiled source closure, satisfiability, bound semantics or full G1.", + "No alternative PR is declared superseded until the maintained canonical candidate is actually integrated." + ], + "mutants": [ + { + "assertion_failures": 3, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "2d2b9a822441da427f0515acdb29a109fc2ff02bfc23845a627adec06f1c038b", + "name": "disable_token_sorry", + "result": "KILLED", + "source_sha256": "89275317a60f0931114e171ed8f9aae8274cc465b2fb5da1bc36d0cb6de7e938", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "b16057c66c9273c97b40c206c2be994a8b9430bf862b3134ec914248003b158f", + "name": "disable_token_admit", + "result": "KILLED", + "source_sha256": "0370a48812c13d8b08a5b7ec239111d95e32309ffb74db755df4b3ad4b173e56", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "6a70b8f53b6903451a5481cc10d2044ae311764514f585ba1421dee25d078df0", + "name": "disable_token_axiom", + "result": "KILLED", + "source_sha256": "bbb32b7c6e05a3907ac2862c039aeb7a0075f36a4b1021cf0f50b664cf35b228", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "776417b4e11bb2ecb947771f9a50b4fc2372bf8ed27688521e2b90c7f6a15f86", + "name": "disable_token_native_decide", + "result": "KILLED", + "source_sha256": "97420402a77b73cf0af6310152fe51e01db325251512310c900f42f2199cea32", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "2a9935b15661b51673bd0d608b32c97819145656fe3ff262739abc76ff68f7e0", + "name": "disable_token_unsafe", + "result": "KILLED", + "source_sha256": "f36d48a3fd25006b799f58191229852d130196a6f109a6f974fefe1215fb57df", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "15af089334e2fdf9bf8fcecd4c097ec1b23ee8a386efaddc3affee230fc4a2a8", + "name": "disable_token_Float", + "result": "KILLED", + "source_sha256": "80fabb3554cae538a738e58645f9f26585dd21617eb74e59bf78e48be9d06119", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "5261811e73b2ef0cf029f4d1b4b0994fdf427aa2e016aca7ff2ffb07aaa29f9c", + "name": "disable_token_Float32", + "result": "KILLED", + "source_sha256": "1ec6fb40f714719e883df921218d003f12905b2b97f21a3cd1e97cc0af651c9d", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "2ae3c3e0ded0cf45305985e6e77273c29ef122c35b3e622f4c55dc48d36c79a5", + "name": "disable_token_sorryAx", + "result": "KILLED", + "source_sha256": "47d1611b7e5292a91b280ad9f435e77edd81882272449cf700a334aca6b20daf", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "27cf72db72db4de8fd6ebf9dc62bea8f8715afc727fd2a444d50a0823cfde1bb", + "name": "disable_token_ofReduceBool", + "result": "KILLED", + "source_sha256": "5ef9ac42052824cb04bb553e861a31760a038beeaee39a3f478b138ffd90a4b8", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "52f617fefced7c007b6c3ab6d4304b67ee3bb8645c08ed11bb083827b42090cd", + "name": "disable_token_ofReduceNat", + "result": "KILLED", + "source_sha256": "5f194e953a0a46f029f69c694e9f6abb1699bfedb958b0425d0ac16d0732af47", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ccf987150557cbbfcb7e09046351493386c08fdf8185471836f2de80b21d303b", + "name": "disable_token_trustCompiler", + "result": "KILLED", + "source_sha256": "803b226c5bc18e0e549aaeb3af1b0f6e5953fda47238cbcb072ed43f30928c38", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0c9679f15e58e94b8339bfa5848f5db84cabfd6886fd72a25c18914ccf54b72e", + "name": "disable_token_skipKernelTC", + "result": "KILLED", + "source_sha256": "d421a8d9ffa82987d7c875417f7f1092fdfa53c97d35d1f8ccb1432b7c1f460f", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "702c17ecf1bae6c4408d9d72b218940f5267efeb7fac258a3501ca2860859560", + "name": "disable_token_addDeclWithoutChecking", + "result": "KILLED", + "source_sha256": "0bafc755ecfc2804c14197dde04396538b32b5b4ae8e4fe2d97c781ae9646a21", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "6cf347f48ac890daecf551faa2a4395c4e61960652983cd43d760ff5c9989f86", + "name": "disable_token_run_tac", + "result": "KILLED", + "source_sha256": "d271c189d7bc7482b3a0de7e540cc4a65535e431edc584f1dfdddc959814fd30", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "bac6fa83b2f3e0a52262f46ec2b7fb8c6984ddd0f8ca10f77aa3eb3c9a04e7c7", + "name": "disable_token_run_elab", + "result": "KILLED", + "source_sha256": "5b96def8427b2456a6b205fd98b9a19aa5eaab0275abe36c3681dd3a9e265dd9", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0e1466be769c2b129c2b1f902638256c74f594253963dbb0b131f8b67d79ab42", + "name": "disable_token_eval_expr", + "result": "KILLED", + "source_sha256": "8be0083d990c44932449d9055c12ddac0948064edeeb0da38179125a060fd52d", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "9d6de5dd844a732d05615fef04659e7217b2ffd249b956435a72aa7299d6f386", + "name": "disable_token_implemented_by", + "result": "KILLED", + "source_sha256": "7cbf3710f551c21b0374a135b3ccf3b9c2fc1d25643c9bbf414e006b3af8deee", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ddac7b770af0250c879bc5ec097c15716964eba1b94b94fbf77fb8cc26c5afb2", + "name": "disable_token_extern", + "result": "KILLED", + "source_sha256": "91aee950a4e4aa964d19e69ee323e412e430cf92ece9cb3ce2b343dc04f11a70", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "0d12d8aaa6bdcc15698579c33bbb7db0f3306b7c106458f5984063b5e8dfec6c", + "name": "disable_token_macro", + "result": "KILLED", + "source_sha256": "1f80fd6831d0cbc61f498d3b9e80f3de9e347d920b728efb5398b538fd8dedfb", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "d13cf33dded9ce43443f4ad0cfcb915f035e4fc1c7e723a826b6db97d7b89685", + "name": "disable_token_macro_rules", + "result": "KILLED", + "source_sha256": "2d4f5d1fd500153e3aecdc3edb1ccbb68f3e13b612e985711bf1f298bc376480", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "1a76dd9fac74a447109e9375135a1f5da1237c3e526f48f36382b7c4043baaf9", + "name": "disable_token_syntax", + "result": "KILLED", + "source_sha256": "8e17e5a05593d2508e8dcc0e9918e16dd1450d6e36cadcb88d230a15da3265af", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "4b151355c42e0809e476f0af8764927dfda79754296ed7e16938bbc5b5e9dba0", + "name": "disable_token_elab", + "result": "KILLED", + "source_sha256": "7ac6949e7383170cfefac15d5ec9a38c20f49a66d8ff96fca7b074533b3ed1f0", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "5214a92f13ffabb3beed8abce5ddb3c5bfbd3203f207bdada07c2210018beb6a", + "name": "disable_token_elab_rules", + "result": "KILLED", + "source_sha256": "cd6dc2262253ca5cc14d228be7dad3f537156bf6c251110f39d6c85c7fba9965", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "562ef44357d82221c4fb634e283c0ea4171e50f3f016b8738b5b90dec90d5e34", + "name": "disable_token_declare_syntax_cat", + "result": "KILLED", + "source_sha256": "ebfbbda62ce8af3a30020fa080fbf4c363b322ee8e1c2f161f14f7cc08c7bbbd", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "a88f56af987b78f39425b4b304d4c77b81d6c44c15eee577a1f7289be93905bc", + "name": "disable_token_initialize", + "result": "KILLED", + "source_sha256": "319f632e72a955fe48c480388965fe0f94c2f84e884cd5780b6c8cc65671f8ef", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "448cac5b6cfaf6e322950addb88ec9770711c1b7d0f71bf93d83a984720fc89d", + "name": "disable_token_builtin_initialize", + "result": "KILLED", + "source_sha256": "caa8cbd7d7d82172d6b8e52ea2179114f364eb155ab449675f412df60953dbdf", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "8ab182679f2160912403fa91dcc86af407da7f2878522eea4c01db6dd1f1045c", + "name": "suppress_quoted_identifier", + "result": "KILLED", + "source_sha256": "9a2628a4f3289f6fd5245b2d74a55c3acc48a071155beb094db217dfccf89167", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "9257fef39d1bb29347897dbc507c2c9023289ef7a575f59d75ef59d88f69d93b", + "name": "suppress_string_interpolation", + "result": "KILLED", + "source_sha256": "851da5a5095aa6da9e5f73bf327d03644e54f3b5791875f19d172cab88d36700", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 7, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "9fae79bdab9a4a28b41c52e84be641a666c06d760ad88227cf956b3ba4425168", + "name": "suppress_unsupported_syntax", + "result": "KILLED", + "source_sha256": "4b08f752cc959831ce843124814acfd2e660482ca95a7011e97954128cd8b0fa", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "997fcc9bcabddd56683a77b04f1ae2994c4f76649477231f4c4cad7379edb615", + "name": "suppress_unsupported_escape", + "result": "KILLED", + "source_sha256": "432dbed23e632a18cfbf56d781ead40764a5e000baa334db306dee4fa8bd671b", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "36712316e81ad943ccd07110bec30f56242327304762738b97c4f517ce9be351", + "name": "disable_plus_native_form", + "result": "KILLED", + "source_sha256": "f2f482ad8b16b7e0bb8b4cb3ab221e04b73161e965e198221516a4e99b6bc27f", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 13, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "755cd88017b792a0348d3093cb8ca032c898bc96fe34aff5f39dfa6d6eb2ca81", + "name": "disable_native_assignment_form", + "result": "KILLED", + "source_sha256": "c1a3e2474bb694f48055618691dc8e1a850ac85e3628f73e6ae0229db7390cf6", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "4b0ee304810adfd13e87fb20cb4e696938041116598816eb527ffd3bec6a95af", + "name": "ignore_native_record_layout", + "result": "KILLED", + "source_sha256": "070922bd5329575be7687698a7a6c8254a589a9684a69c19255f8cfa7fcabaf3", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "1e841c3a00120a9c5d06bee48c322f6ac4e2071764a6888b7ff43a612d5c5b98", + "name": "ignore_native_record_updates", + "result": "KILLED", + "source_sha256": "5e666671cc2fa69c68a4b79a3919ab57cd7d14f497f3bde35eb06e755f46623a", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 2, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "fc76bbaa87a3baa696cec43426bb816fe8eca6bd64e04dbfe3e2f65bfb41a789", + "name": "allow_double_slash_anchor", + "result": "KILLED", + "source_sha256": "4641d251479554e6b01d31b37ac20565d104850ec57fc95c9919e3dd0c5394b5", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "26898b901c65bee0770f43677bd38e287691ed8bfbb34a607ee162ba9ea6826c", + "name": "invent_root_to_allow_output", + "result": "KILLED", + "source_sha256": "3b26fc4d561ba67d39a8d951b9f1d1d82eaf72d4dddce5d9adc3cdb26eda0c27", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "3334671c53f6127cc5d75ac716d70bfea80f9f17235eff313490671528b6c417", + "name": "skip_missing_file", + "result": "KILLED", + "source_sha256": "04f9df84cfa911de2b515cf948f3c7d8f1aa3eda379e85cdce056522048fdb87", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c02fabfcf15836aac04e72f0d776228c8c378df6760ebf26b3d274125c9aef4b", + "name": "disable_hash_check", + "result": "KILLED", + "source_sha256": "76bde3c1c72aa31b50b7e7e0e2d56d8341f2733af18481404f27f14581406837", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "c894ae0965a0068636ec25c64015ce2cf026b8684d468155d8bcc85068f7467d", + "name": "fake_hash_identity_from_manifest", + "result": "KILLED", + "source_sha256": "7e7f5fe663d789cc3a05d3f217e0100c79910f5d1096f8ff9859c9517bb0f666", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "6ec107c5c46107c047d512e145740bb9aa7f41ed3590fc86389596f1ade98cc4", + "name": "skip_unlisted_files", + "result": "KILLED", + "source_sha256": "edf62d03dd0ca1283aa96342347d3c41640f3b999e91880918e383a0cc142e1c", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "b72b59a44388620d2e1021d644042e351275c06789d853bfb2ce2e1b1a3561db", + "name": "ignore_permission_denial", + "result": "KILLED", + "source_sha256": "53d478ee651a1e6dd1137e7478624e60ef70853f684dbd95118824e4f6451bc7", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "cli_health": { + "executions": 122, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "2d18f22d98ae3ab0bb0a7b1c63ded1b39bb86553312f9bb61b9c36c5402d7024", + "name": "disable_symlink_classification", + "result": "KILLED", + "source_sha256": "bfc428b0393e5301172b2ada4538afefe2dce1abde53e1e54bdc2564d204d03d", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 123, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "087d5074f65c5ba2b6af2f0bff8c927893fd3d9e54a4b9078fb0131c8603f425", + "name": "ignore_invalid_utf8", + "result": "KILLED", + "source_sha256": "b8175dd89f4a5655d8f702e4bbd20d6261fbafe51e6e9a64238416fa0a90f8f3", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "f98297c791691275826a55ca57cbd21da73fb70297fdd87bd2bea432e9143653", + "name": "ignore_nested_comments", + "result": "KILLED", + "source_sha256": "f303c14d7414afb1c3494345030d413c8207f9191f041c6d5d8a46d1e697d515", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 5, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "71d34bac3c4a7535874e93099665c45f5fae67344b0645c1adcf069d560ee355", + "name": "disable_string_mask", + "result": "KILLED", + "source_sha256": "df30e7a82d6cdecda8294e257d4a0b8f51a04ca6c566953867f60ac22b6e3fcf", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 3, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "ecd8142a75e1cb510d1d681c53b3f7f90cd488814546c00d6a16fcc351a0c50e", + "name": "disable_character_mask", + "result": "KILLED", + "source_sha256": "0221e2eca4d16b155ab5dff0ba66027621fa41a88381218e6f35065f25396d50", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 4, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "d9468c3787562c22c082acbdb1c164da0d0e5cc4dd530238814ba57f0475be15", + "name": "disable_raw_string_mask", + "result": "KILLED", + "source_sha256": "8ceaa13f22b5146fa4f67ee8587fcfe07043222783958663abd916f0edb266c6", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "47ac833f49a6f89528f1a9cf994368e62a643c2635f3ea01a866062e510aef5f", + "name": "omit_unestablished_semantic_coverage", + "result": "KILLED", + "source_sha256": "d11f2cbed1aca7c57b38807f5ddfe7a7fc3c5e14294daa76d0b65e41f67f0068", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 117, + "cli_health": { + "executions": 117, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "42ae22530f571857f812278786c042b25c07d2e5a4e0502d9e35b8a4d1407c58", + "name": "fake_unconditional_success", + "result": "KILLED", + "source_sha256": "b7c481ddfb43a8af39f600066fa16b711aad2f88d1a276559225e2139f085405", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 109, + "cli_health": { + "executions": 119, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "bc2ac0a7897131feff4c175e3c52552d2a90ce683ebc6fd730aedc65c984d471", + "name": "fake_unconditional_clear_audit", + "result": "KILLED", + "source_sha256": "f488253e38b946f1f32e78ed03248ff71776ecb70629562b8eb33946ddb7d8b3", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + }, + { + "assertion_failures": 1, + "cli_health": { + "executions": 124, + "failure_events": [], + "failures": 0, + "status": "HEALTHY" + }, + "log_sha256": "357ba17c36b906f33bbab845b7e3676f9d720f90d2221bcf3f9435dc8df47814", + "name": "ignore_duplicate_json_keys", + "result": "KILLED", + "source_sha256": "d15943cffbe15bec56b32a90fa3c0d0dee48eb02e47aeef8fac9ff08e6788c85", + "test_errors": 0, + "tests_run": 43, + "tests_skipped": 0 + } + ], + "mutation_cut": { + "declared_threshold": 51, + "harness_errors": 0, + "healthy_baseline_cli_executions": 124, + "healthy_baseline_tests": 43, + "killed": 51, + "raw_receipt_sha256": "36e068da3d60451d38c425eace79bca4e4062d8cd1f8cc18bd7d00ef377ae599", + "runner_receipt_schema_version": 3, + "skips": 0, + "test_errors": 0, + "tested": 51 + }, + "native_record_layout_repair": { + "axiom_probe_fixture_sha256": "50685626cf01c541baa13c5957be112926e4058ece5e394792b6519509f391dc", + "axiom_probe_result": "'commaFreeNative' depends on axioms: [commaFreeNative._native.decide.ax_1_1]", + "compatibility_scope": "Normalize only this process's numeric /proc/PID/exe path to /proc/self/exe.", + "compatibility_shim_sha256": "200fef1d5ffe4d7fc314f9292d4ea1151b0361555da9223cf75e2b87eb51876a", + "fixture_name": "CommaFreeNative.lean", + "fixture_sha256": "7559cc5c662a07cba512c688d568330589165d6675b2a7a1be5c57cf8fc0dfe7", + "fixture_utf8": "import Lean\n\ntheorem commaFreeNative : True := by\n decide (config := {\n kernel := false\n native := true\n })\n", + "lean_binary_sha256": "e8baaa71855a616dc351028f3ad2200051b0671f423a1696a100e809302d5550", + "lean_compile_returncode": 0, + "lean_version": "Lean (version 4.34.1, x86_64-unknown-linux-gnu, commit 5045d0056413266e57c625dcd7c365b10e377c52, Release)", + "native_review_head": "67c58ce23b26f54814b1727a848e2ec090219a8f", + "new_mutant": "ignore_native_record_layout", + "post_fix_finding": { + "byte_length": 6, + "byte_offset": 96, + "code": "UNCERTIFIED_EXECUTION", + "column": 5, + "detail": "Native compiler option requires separate evidence.", + "line": 6, + "path": "CommaFreeNative.lean", + "review_form": "native:=", + "source_line": " native := true", + "source_line_start_column": 1, + "source_line_truncated": false, + "token": "native" + }, + "pre_fix_findings": 0, + "pre_fix_returncode": 2, + "prior_58_method_50_mutant_receipt_sha256": "6a1e960e4e3d92cb259390351f6838f7227a66cea0abf3c86cddb6f384a463cb", + "review_thread": "PRRT_kwDOQpeC2s6xuZcD", + "scope": "Conservative lexical review for native assignments as first code on a line inside braces; not record parsing or G1 proof.", + "source_before_sha256": "c91da1c607a956cb64d39d8342b7d59722070d0aa5f2dfe54a5e049f3ec8fc9a" + }, + "qualification_commands": [ + "python -B -S -m unittest discover -s tests -p 'test_cbz*.py' -v", + "python -B -S -O -m unittest discover -s tests -p 'test_cbz*.py' -v", + "python -B -S tests/run_scanner_mutations.py --evidence-dir /tmp/NEW-CBZ-CUT", + "python -B -S tools/cbz_source_audit.py --manifest cbz-source-manifest.json" + ], + "regression_methods": { + "harness": 16, + "normal_total": 59, + "optimized_total": 59, + "scanner": 43 + }, + "review_repairs": [ + "Unknown audited root preserves JSON refusal and authorizes no output creation.", + "Every suite CLI invocation records health; any crash, invalid JSON, stderr launch error or timeout excludes a kill after benign smoke.", + "Native record-field assignments after record-update with are reviewed across whitespace/comments.", + "Ambiguous POSIX double-slash anchors are rejected before filesystem traversal and containment decisions." + ], + "schema_version": 1, + "scope": "Finite inventory/refusal and mutation evidence; never full Layer A, kernel, semantic or CBZ-0 certification.", + "selection": "Maintain cbz_source_audit as one canonical bounded source instrument. Preserve pinned alternative sources/evidence, and do not deploy duplicate certifying lexical gates." +} diff --git a/tests/run_scanner_mutations.py b/tests/run_scanner_mutations.py new file mode 100644 index 000000000..19dfc9ee7 --- /dev/null +++ b/tests/run_scanner_mutations.py @@ -0,0 +1,460 @@ +#!/usr/bin/env python3 +"""Run the unmodified black-box suite against isolated source-level mutants. + +This is test tooling. Production code has no test flags or detector toggles. +Compilation failure, launch failure and timeout are harness errors, not kills. +Every CLI invocation in the registered suite records execution health; a later +input-dependent failure invalidates the cut even after a healthy benign smoke. +""" + +import argparse +import ast +import copy +import hashlib +import json +import os +from pathlib import Path +import re +import shlex +import subprocess +import sys +import tempfile + + +ROOT = Path(__file__).resolve().parents[1] +SOURCE = ROOT / "tools/cbz_source_audit.py" +TESTS = ROOT / "tests/test_cbz_source_audit.py" +SUITE_ARGUMENTS = ["-m", "unittest", "discover", "-s", "tests", + "-p", "test_cbz_source_audit.py", "-v"] + + +def function(tree, name): + found = [node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == name] + assert len(found) == 1, (name, len(found)) + return found[0] + + +def exact_statement(tree, fragment, replacement): + matches = 0 + for parent in ast.walk(tree): + for attr, value in ast.iter_fields(parent): + if not isinstance(value, list): + continue + for index, child in enumerate(value): + if isinstance(child, ast.stmt) and ast.unparse(child).startswith(fragment): + value[index:index + 1] = ast.parse(replacement).body + matches += 1 + assert matches == 1, (fragment, matches) + + +def disable_token(tree, token): + for node in ast.walk(tree): + if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == "REVIEW_TOKENS" + for t in node.targets): + pairs = list(zip(node.value.keys, node.value.values)) + matches = [index for index, (key, _) in enumerate(pairs) if key.value == token] + assert len(matches) == 1, (token, matches) + del pairs[matches[0]] + node.value.keys = [key for key, _ in pairs] + node.value.values = [value for _, value in pairs] + return + raise AssertionError("Missing token mapping") + + +def suppress_finding(tree, code): + method = function(tree, "finding") + method.body[:0] = ast.parse(f"if code == {code!r}:\n return").body + + +def disable_native_form(tree, form): + targets = [node for node in ast.walk(function(tree, "native_review_form")) + if isinstance(node, ast.Return) and isinstance(node.value, ast.Constant) + and node.value.value == form] + if len(targets) != 1: + raise RuntimeError("Native review-form mutation anchor is missing or ambiguous: " + form) + targets[0].value = ast.Constant(None) + + +def ignore_native_record_updates(tree): + targets = [node for node in ast.walk(function(tree, "native_review_form")) + if isinstance(node, ast.Tuple) + and any(isinstance(value, ast.Constant) and value.value == "with" for value in node.elts)] + if len(targets) != 1: + raise RuntimeError("Native record-update mutation anchor is missing or ambiguous.") + targets[0].elts = [value for value in targets[0].elts + if not isinstance(value, ast.Constant) or value.value != "with"] + + +def ignore_native_record_layout(tree): + targets = [node for node in ast.walk(function(tree, "native_review_form")) + if isinstance(node, ast.Assign) + and any(isinstance(target, ast.Name) and target.id == "layout_field" for target in node.targets)] + if len(targets) != 1: + raise RuntimeError("Native record-layout mutation anchor is missing or ambiguous.") + targets[0].value = ast.Constant(False) + + +def allow_double_slash_anchor(tree): + targets = [node for node in ast.walk(function(tree, "absolute_input_path")) + if isinstance(node, ast.If) and ast.unparse(node.test) == "path.anchor == '//'"] + if len(targets) != 1: + raise RuntimeError("Double-slash refusal mutation anchor is missing or ambiguous.") + targets[0].test = ast.Constant(False) + + +def invent_root_to_allow_output(tree): + targets = [node for node in ast.walk(function(tree, "write_output")) + if isinstance(node, ast.If) and ast.unparse(node.test) == "'root' not in report"] + if len(targets) != 1: + raise RuntimeError("Unknown-root output mutation anchor is missing or ambiguous.") + targets[0].body = ast.parse("report['root'] = '/__cbz_unverified_source_root__'").body + + +def omit_missing_file(tree): + target = [node for node in ast.walk(tree) if isinstance(node, ast.If) + and ast.unparse(node.test) == "path not in discovered"] + assert len(target) == 1 + target[0].body = [ast.Continue()] + + +def disable_hash_check(tree): + target = [node for node in ast.walk(tree) if isinstance(node, ast.If) + and ast.unparse(node.test) == "record['sha256'] != entry['sha256']"] + assert len(target) == 1 + target[0].test = ast.Constant(False) + + +def fake_hash_identity(tree): + exact_statement(tree, "record['sha256'] = hashlib.sha256(source).hexdigest()", + "record['sha256'] = entry['sha256']") + + +def omit_unlisted_files(tree): + target = [node for node in ast.walk(tree) if isinstance(node, ast.For) + and ast.unparse(node.target) == "path" and ast.unparse(node.iter) == "unlisted"] + assert len(target) == 1 + target[0].body = [ast.Pass()] + + +def ignore_permissions(tree): + target = [node for node in ast.walk(function(tree, "check_entry")) if isinstance(node, ast.If) + and "mode & 292" in ast.unparse(node.test)] + assert len(target) == 1, [ast.unparse(n.test) for n in ast.walk(function(tree, "check_entry")) + if isinstance(n, ast.If)] + target[0].test = ast.Constant(False) + + +def ignore_symlink_classification(tree): + count = 0 + for node in ast.walk(tree): + if isinstance(node, ast.If) and isinstance(node.test, ast.Call): + call = node.test.func + if isinstance(call, ast.Attribute) and call.attr == "S_ISLNK": + node.test = ast.Constant(False) + count += 1 + assert count == 2, count + + +def ignore_utf8_errors(tree): + count = 0 + for node in ast.walk(tree): + if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and node.func.attr == "decode": + for keyword in node.keywords: + if keyword.arg == "errors": + keyword.value = ast.Constant("ignore") + count += 1 + assert count == 2 + + +def ignore_comment_nesting(tree): + target = [node for node in ast.walk(function(tree, "block_comment")) + if isinstance(node, ast.AugAssign) and isinstance(node.op, ast.Add) + and isinstance(node.target, ast.Name) and node.target.id == "depth"] + assert len(target) == 1 + target[0].value = ast.Constant(0) + + +def ignore_literal_mask(tree, name): + function(tree, name).body = ast.parse("self.advance(self.i + 1)\nreturn").body + + +def ignore_raw_strings(tree): + function(tree, "raw_string").body = [ast.Return(value=ast.Constant(False))] + + +def omit_semantic_gaps(tree): + for node in ast.walk(function(tree, "empty_report")): + if isinstance(node, ast.Dict): + for index, key in enumerate(node.keys): + if isinstance(key, ast.Constant) and key.value == "blocking_coverage": + node.values[index] = ast.List(elts=[], ctx=ast.Load()) + return + raise AssertionError("Missing semantic gap report") + + +def fake_unconditional_success(tree): + function(tree, "main").body = ast.parse( + "report = empty_report()\n" + "report['aggregate_status'] = 'ESTABLISHED'\n" + "report['gate_claims']['G1'] = 'ESTABLISHED'\n" + "sys.stdout.write(render_report(report))\nreturn 0" + ).body + + +def fake_unconditional_clear_audit(tree): + function(tree, "audit_manifest").body = ast.parse( + "report = empty_report()\nreport['input_integrity']['status'] = 'CHECKED'\nreturn report" + ).body + + +def ignore_duplicate_json_keys(tree): + target = [node for node in ast.walk(function(tree, "unique_object")) if isinstance(node, ast.If)] + assert len(target) == 1 + target[0].test = ast.Constant(False) + + +def python_command(arguments): + return [sys.executable, "-B", "-S", *(["-O"] * sys.flags.optimize), *arguments] + + +def child_environment(target): + environment = {key: value for key, value in os.environ.items() + if key not in {"PYTHONHOME", "PYTHONPATH", "PYTHONOPTIMIZE", + "PYTHONSTARTUP", "PYTHONINSPECT", "CBZ_AUDITOR_HEALTH_LOG"}} + environment["CBZ_AUDITOR_SCRIPT"] = str(Path(target).resolve()) + environment["PYTHONDONTWRITEBYTECODE"] = "1" + return environment + + +def write_log(evidence_dir, name, output): + path = Path(evidence_dir) / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(output, encoding="utf-8") + return {"log": str(path.resolve()), + "log_sha256": hashlib.sha256(output.encode("utf-8")).hexdigest()} + + +def partial_output(error): + def decoded(value): + return value.decode("utf-8", errors="backslashreplace") if isinstance(value, bytes) else value or "" + return decoded(error.stdout) + decoded(error.stderr) + + +def test_target(target, log_name, evidence_dir, *, suite_root=ROOT, timeout=60): + command = python_command(SUITE_ARGUMENTS) + result = {"returncode": None, "tests_run": 0, "assertion_failures": 0, + "test_errors": 0, "tests_skipped": 0, "failing_tests": [], + "suite_argv": command, "harness_error": None, + "cli_health": {"executions": 0, "failures": 0, "status": "NOT_OBSERVED"}} + Path(evidence_dir).mkdir(parents=True, exist_ok=True) + with tempfile.NamedTemporaryFile(prefix="cli-health-", suffix=".jsonl", dir=evidence_dir, + delete=False) as health_file: + health_path = Path(health_file.name) + environment = child_environment(target) + environment["CBZ_AUDITOR_HEALTH_LOG"] = str(health_path) + try: + completed = subprocess.run(command, cwd=suite_root, env=environment, + text=True, encoding="utf-8", capture_output=True, timeout=timeout) + except subprocess.TimeoutExpired as error: + result["harness_error"] = {"stage": "suite", "kind": "TIMEOUT"} + result.update(write_log(evidence_dir, log_name, partial_output(error))) + return result + except (OSError, UnicodeError) as error: + result["harness_error"] = {"stage": "suite", "kind": type(error).__name__} + result.update(write_log(evidence_dir, log_name, str(error) + "\n")) + return result + output = completed.stdout + completed.stderr + tests = re.search(r"^Ran (\d+) tests? in .*$", output, flags=re.MULTILINE) + summary = re.search(r"^(?:FAILED \([^\n]*\)|OK(?: \([^\n]*\))?)$", output, flags=re.MULTILINE) + counts = dict(re.findall(r"(failures|errors|skipped)=(\d+)", summary.group(0))) if summary else {} + result.update({ + "returncode": completed.returncode, + "tests_run": int(tests.group(1)) if tests else 0, + "assertion_failures": int(counts.get("failures", 0)), + "test_errors": int(counts.get("errors", 0)), + "tests_skipped": int(counts.get("skipped", 0)), + "failing_tests": sorted(set(re.findall(r"^FAIL: (\S+)", output, flags=re.MULTILINE))), + **write_log(evidence_dir, log_name, output), + }) + if tests is None or summary is None: + result["harness_error"] = {"stage": "suite", "kind": "INCOMPLETE_RESULT"} + health_bytes = health_path.read_bytes() + try: + events = [json.loads(line, parse_constant=reject_json_constant) + for line in health_bytes.decode("utf-8").splitlines()] + if any(not isinstance(event, dict) or not isinstance(event.get("status"), str) for event in events): + raise ValueError("Invalid CLI health event.") + failures = [event for event in events if event["status"] != "VALID_JSON_REPORT"] + result["cli_health"] = {"executions": len(events), "failures": len(failures), + "status": "UNHEALTHY" if failures else "HEALTHY" if events else "NOT_OBSERVED", + "failure_events": failures} + if failures: + result["harness_error"] = {"stage": "suite_cli", "kind": "UNHEALTHY_EXECUTION"} + except (ValueError, UnicodeError, RecursionError): + result["harness_error"] = {"stage": "suite_cli", "kind": "INVALID_HEALTH_LOG"} + result["cli_health_log"] = {"log": str(health_path.resolve()), + "log_sha256": hashlib.sha256(health_bytes).hexdigest()} + return result + + +def reject_json_constant(value): + raise ValueError("Nonfinite JSON constant: " + value) + + +def smoke_target(target, evidence_dir, *, timeout=5): + """Check launch health only; semantic wrongness remains the suite's job.""" + Path(evidence_dir).mkdir(parents=True, exist_ok=True) + with tempfile.TemporaryDirectory(prefix="smoke-", dir=evidence_dir) as temporary: + base = Path(temporary) + root = base / "source" + root.mkdir() + source = b"theorem smoke_ok : True := by trivial\n" + (root / "Main.lean").write_bytes(source) + manifest = base / "manifest.json" + manifest.write_text(json.dumps({ + "version": 1, "root": str(root), + "files": [{"path": "Main.lean", "sha256": hashlib.sha256(source).hexdigest()}], + }), encoding="utf-8") + command = python_command([str(Path(target).resolve()), "--manifest", str(manifest)]) + try: + completed = subprocess.run(command, env=child_environment(target), text=True, + encoding="utf-8", capture_output=True, timeout=timeout) + except subprocess.TimeoutExpired as error: + return {"status": "TIMEOUT", "stdout_and_stderr": partial_output(error)} + except (OSError, UnicodeError) as error: + return {"status": "LAUNCH_ERROR", "detail": str(error)} + result = {"returncode": completed.returncode, "stdout": completed.stdout, + "stderr": completed.stderr} + # Zero is allowed here so a functioning false-success mutant is still testable. + if completed.stderr or completed.returncode not in (0, 1, 2): + return {"status": "LAUNCH_ERROR", **result} + try: + report = json.loads(completed.stdout, parse_constant=reject_json_constant) + except (ValueError, RecursionError): + return {"status": "INVALID_JSON", **result} + if not isinstance(report, dict): + return {"status": "INVALID_JSON_OBJECT", **result} + return {"status": "VALID_JSON_REPORT", **result} + + +def evaluate_target(target, baseline_count, log_name, evidence_dir, *, suite_root=ROOT, + smoke_timeout=5, suite_timeout=60): + """Separate invalid programs/executions from complete behavioral assertion kills.""" + result = {"returncode": None, "tests_run": 0, "assertion_failures": 0, + "test_errors": 0, "tests_skipped": 0, "failing_tests": [], + "harness_error": None, "smoke": None, "killed": False} + try: + compile(Path(target).read_bytes(), str(target), "exec") + except (OSError, SyntaxError, ValueError) as error: + result["harness_error"] = {"stage": "compile", "kind": type(error).__name__, "detail": str(error)} + result["result"] = "HARNESS_ERROR" + result.update(write_log(evidence_dir, log_name, str(error) + "\n")) + return result + result["smoke"] = smoke_target(target, evidence_dir, timeout=smoke_timeout) + result["smoke_log"] = write_log(evidence_dir, log_name + ".smoke.json", + json.dumps(result["smoke"], sort_keys=True, indent=2) + "\n") + if result["smoke"]["status"] != "VALID_JSON_REPORT": + result["harness_error"] = {"stage": "smoke", "kind": result["smoke"]["status"]} + result["result"] = "HARNESS_ERROR" + result.update(write_log(evidence_dir, log_name, "Suite not run: invalid smoke execution.\n")) + return result + result.update(test_target(target, log_name, evidence_dir, suite_root=suite_root, timeout=suite_timeout)) + killed = (result["harness_error"] is None and result["returncode"] == 1 + and result["assertion_failures"] > 0 and result["test_errors"] == 0 + and result["tests_skipped"] == 0 and result["tests_run"] > 0 + and result["cli_health"]["status"] == "HEALTHY" + and result["tests_run"] == baseline_count) + result["killed"] = killed + result["result"] = ("HARNESS_ERROR" if result["harness_error"] else + "KILLED" if killed else "NOT_KILLED") + return result + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--evidence-dir", required=True, type=Path, + help="New directory for this cut's receipts, logs and isolated mutants.") + args = parser.parse_args(argv) + evidence_dir = args.evidence_dir.resolve() + evidence_dir.mkdir(parents=True, exist_ok=False) + mutant_dir = evidence_dir / "mutants" + mutant_dir.mkdir() + original = SOURCE.read_bytes() + original_tests = TESTS.read_bytes() + original_runner = Path(__file__).read_bytes() + source_hash = hashlib.sha256(original).hexdigest() + parsed = ast.parse(original.decode("utf-8")) + baseline = evaluate_target(SOURCE, None, "mutation-baseline.log", evidence_dir) + if (baseline["harness_error"] or baseline["returncode"] != 0 or baseline["tests_run"] == 0 + or baseline["assertion_failures"] or baseline["test_errors"] or baseline["tests_skipped"] + or baseline["cli_health"]["status"] != "HEALTHY"): + raise RuntimeError("Unmodified auditor suite/smoke did not pass: " + repr(baseline)) + + mutants = [] + for token in ("sorry", "admit", "axiom", "native_decide", "unsafe", "Float", "Float32", + "sorryAx", "ofReduceBool", "ofReduceNat", "trustCompiler", "skipKernelTC", "addDeclWithoutChecking", + "run_tac", "run_elab", "eval_expr", "implemented_by", "extern", "macro", + "macro_rules", "syntax", "elab", "elab_rules", "declare_syntax_cat", + "initialize", "builtin_initialize"): + mutants.append(("disable_token_" + token, lambda tree, token=token: disable_token(tree, token))) + for code in ("QUOTED_IDENTIFIER", "STRING_INTERPOLATION", "UNSUPPORTED_SYNTAX", "UNSUPPORTED_ESCAPE"): + mutants.append(("suppress_" + code.lower(), lambda tree, code=code: suppress_finding(tree, code))) + for name, form in (("disable_plus_native_form", "+native"), ("disable_native_assignment_form", "native:=")): + mutants.append((name, lambda tree, form=form: disable_native_form(tree, form))) + mutants.extend([ + ("ignore_native_record_layout", ignore_native_record_layout), + ("ignore_native_record_updates", ignore_native_record_updates), + ("allow_double_slash_anchor", allow_double_slash_anchor), + ("invent_root_to_allow_output", invent_root_to_allow_output), + ("skip_missing_file", omit_missing_file), + ("disable_hash_check", disable_hash_check), + ("fake_hash_identity_from_manifest", fake_hash_identity), + ("skip_unlisted_files", omit_unlisted_files), + ("ignore_permission_denial", ignore_permissions), + ("disable_symlink_classification", ignore_symlink_classification), + ("ignore_invalid_utf8", ignore_utf8_errors), + ("ignore_nested_comments", ignore_comment_nesting), + ("disable_string_mask", lambda tree: ignore_literal_mask(tree, "string")), + ("disable_character_mask", lambda tree: ignore_literal_mask(tree, "character")), + ("disable_raw_string_mask", ignore_raw_strings), + ("omit_unestablished_semantic_coverage", omit_semantic_gaps), + ("fake_unconditional_success", fake_unconditional_success), + ("fake_unconditional_clear_audit", fake_unconditional_clear_audit), + ("ignore_duplicate_json_keys", ignore_duplicate_json_keys), + ]) + results = [] + for name, mutate in mutants: + tree = copy.deepcopy(parsed) + mutate(tree) + ast.fix_missing_locations(tree) + changed = (ast.unparse(tree) + "\n").encode("utf-8") + assert changed != original + target = mutant_dir / (name + ".py") + target.write_bytes(changed) + result = evaluate_target(target, baseline["tests_run"], "mutation-" + name + ".log", evidence_dir) + results.append({"name": name, "source_sha256": hashlib.sha256(changed).hexdigest(), **result}) + print(f"{name}: {result['result']}", flush=True) + if (SOURCE.read_bytes() != original or TESTS.read_bytes() != original_tests + or Path(__file__).read_bytes() != original_runner): + raise RuntimeError("Source, tests or runner changed during the mutation cut.") + receipt = { + "schema_version": 3, "source": SOURCE.relative_to(ROOT).as_posix(), + "source_sha256": source_hash, "tests_sha256": hashlib.sha256(original_tests).hexdigest(), + "runner_sha256": hashlib.sha256(original_runner).hexdigest(), + "command": shlex.join(["python", "tests/run_scanner_mutations.py", "--evidence-dir", str(evidence_dir)]), + "suite_command": shlex.join(["python", *python_command(SUITE_ARGUMENTS)[1:]]), + "suite_argv": python_command(SUITE_ARGUMENTS), + "evidence_dir": str(evidence_dir), + "negative_control": {**baseline, "result": "UNMODIFIED_SUITE_PASSES"}, + "mutants_tested": len(results), "mutants_killed": sum(r["result"] == "KILLED" for r in results), + "harness_errors": sum(r["result"] == "HARNESS_ERROR" for r in results), + "mutants": results, + "interpretation": "Finite regression evidence only; no semantic or complete scanner-correctness proof.", + } + (evidence_dir / "mutation-receipt.json").write_text(json.dumps(receipt, sort_keys=True, indent=2) + "\n", + encoding="utf-8") + return 0 if receipt["mutants_killed"] == receipt["mutants_tested"] else 1 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tests/test_cbz_mutation_harness.py b/tests/test_cbz_mutation_harness.py new file mode 100644 index 000000000..596d0ecbd --- /dev/null +++ b/tests/test_cbz_mutation_harness.py @@ -0,0 +1,185 @@ +"""Real-process controls for mutation-runner health and kill accounting.""" + +import ast +import importlib.util +from pathlib import Path +import tempfile +import textwrap +import unittest + + +RUNNER = Path(__file__).with_name("run_scanner_mutations.py") +spec = importlib.util.spec_from_file_location("cbz_mutation_harness", RUNNER) +harness = importlib.util.module_from_spec(spec) +spec.loader.exec_module(harness) + + +class MutationHarnessTests(unittest.TestCase): + def setUp(self): + temporary = tempfile.TemporaryDirectory(prefix="cbz-harness-test-") + self.addCleanup(temporary.cleanup) + self.base = Path(temporary.name) + self.root = self.base / "project" + (self.root / "tests").mkdir(parents=True) + self.evidence = self.base / "evidence" + self.target = self.base / "target.py" + self.write_suite() + + def write_suite(self, body=None): + if body is None: + body = """ + report, run = cli_contract.execute_auditor(['--manifest', 'unused']) + self.assertEqual(report['aggregate_status'], 'NOT_ESTABLISHED') + """ + code = ( + "import importlib.util, json, os, subprocess, sys, time, unittest\n" + "spec = importlib.util.spec_from_file_location('cbz_cli_contract', " + repr(str(harness.TESTS)) + ")\n" + "cli_contract = importlib.util.module_from_spec(spec)\n" + "spec.loader.exec_module(cli_contract)\n" + "class AuditorContract(unittest.TestCase):\n" + " def test_gate_remains_blocked(self):\n" + + textwrap.indent(textwrap.dedent(body).strip() + "\n", " ") + ) + (self.root / "tests/test_cbz_source_audit.py").write_text(code) + + def evaluate(self, code, *, baseline_count=1, **options): + self.target.write_text(textwrap.dedent(code)) + evaluator = getattr(harness, "evaluate_target", None) + self.assertTrue(callable(evaluator), "missing operational mutant evaluation") + return evaluator(self.target, baseline_count, "control.log", self.evidence, + suite_root=self.root, **options) + + def assert_harness_error(self, result, stage): + self.assertEqual(result["result"], "HARNESS_ERROR", result) + self.assertEqual(result["harness_error"]["stage"], stage, result) + self.assertFalse(result["killed"], result) + + def test_startup_exception_cannot_be_an_assertion_kill(self): + # Removing launch validation would let the CLI helper count this traceback. + result = self.evaluate("raise RuntimeError('startup failure')\n") + self.assert_harness_error(result, "smoke") + self.assertEqual(result["tests_run"], 0) + + def test_non_json_output_cannot_be_an_assertion_kill(self): + result = self.evaluate("print('not an audit JSON report')\n") + self.assert_harness_error(result, "smoke") + + def test_nonobject_json_cannot_be_an_assertion_kill(self): + for output in ("[]", "null", "1", '"report"'): + with self.subTest(output=output): + result = self.evaluate("print(" + repr(output) + ")\n") + self.assert_harness_error(result, "smoke") + + def test_nonfinite_json_constants_do_not_pass_launch_health(self): + for constant in ("NaN", "Infinity", "-Infinity"): + with self.subTest(constant=constant): + output = '{"value":' + constant + '}' + result = self.evaluate("print(" + repr(output) + ")\n") + self.assert_harness_error(result, "smoke") + + def test_stderr_failure_cannot_be_hidden_by_json_stdout(self): + result = self.evaluate(""" + import sys + print('{"aggregate_status":"ESTABLISHED"}') + print('Traceback: simulated launch failure', file=sys.stderr) + """) + self.assert_harness_error(result, "smoke") + + def test_smoke_timeout_is_not_a_kill(self): + result = self.evaluate("import time\ntime.sleep(60)\n", smoke_timeout=0.2) + self.assert_harness_error(result, "smoke") + self.assertEqual(result["smoke"]["status"], "TIMEOUT") + + def test_compile_failure_is_recorded_without_running_the_suite(self): + result = self.evaluate("def broken(:\n pass\n") + self.assert_harness_error(result, "compile") + self.assertEqual(result["tests_run"], 0) + + def test_valid_semantic_failure_is_killed_even_with_exit_zero(self): + result = self.evaluate('print(\'{"aggregate_status":"ESTABLISHED"}\')\n') + self.assertEqual(result["result"], "KILLED", result) + self.assertTrue(result["killed"], result) + self.assertEqual(result["assertion_failures"], 1) + self.assertEqual(result["test_errors"], 0) + self.assertEqual(result["tests_run"], 1) + self.assertTrue((self.evidence / "control.log").is_file()) + + def test_unrelated_repository_tests_are_not_discovered(self): + marker = self.base / "unrelated-ran" + decoy = "from pathlib import Path\nPath(" + repr(str(marker)) + ").write_text('ran')\nraise RuntimeError('unrelated suite was discovered')\n" + (self.root / "tests/test_unrelated.py").write_text(decoy) + result = self.evaluate('print(\'{"aggregate_status":"ESTABLISHED"}\')\n') + self.assertEqual(result["result"], "KILLED", result) + self.assertFalse(marker.exists(), "mutation run escaped its registered suite") + self.assertEqual(result["tests_run"], 1) + + def test_incomplete_suite_is_not_a_kill(self): + result = self.evaluate('print(\'{"aggregate_status":"ESTABLISHED"}\')\n', + baseline_count=2) + self.assertEqual(result["result"], "NOT_KILLED", result) + self.assertFalse(result["killed"], result) + + def test_suite_timeout_is_not_a_kill(self): + self.write_suite("time.sleep(60)") + result = self.evaluate('print(\'{"aggregate_status":"NOT_ESTABLISHED"}\')\n', + suite_timeout=0.2) + self.assert_harness_error(result, "suite") + + def test_suite_errors_cannot_substitute_for_complete_assertion_evidence(self): + self.write_suite(""" + with self.subTest(case='assertion'): + self.fail('behavioral assertion') + with self.subTest(case='execution'): + raise RuntimeError('test execution error') + """) + result = self.evaluate('print(\'{"aggregate_status":"ESTABLISHED"}\')\n') + self.assertFalse(result["killed"], result) + self.assertEqual(result["result"], "NOT_KILLED", result) + self.assertEqual(result["assertion_failures"], 1) + self.assertEqual(result["test_errors"], 1) + + def test_skipped_suite_cases_cannot_establish_a_kill(self): + self.write_suite(""" + with self.subTest(case='assertion'): + self.fail('behavioral assertion') + self.skipTest('unfinished evidence') + """) + result = self.evaluate('print(\'{"aggregate_status":"ESTABLISHED"}\')\n') + self.assertFalse(result["killed"], result) + self.assertEqual(result["assertion_failures"], 1) + self.assertEqual(result["tests_skipped"], 1) + + def test_clean_negative_control_is_not_a_kill(self): + result = self.evaluate('print(\'{"aggregate_status":"NOT_ESTABLISHED"}\')\n') + self.assertEqual(result["result"], "NOT_KILLED", result) + self.assertEqual(result["returncode"], 0) + self.assertEqual(result["tests_run"], 1) + + def input_dependent_mutant(self, body): + tree = ast.parse(harness.SOURCE.read_text(encoding="utf-8")) + methods = [node for node in ast.walk(tree) + if isinstance(node, ast.FunctionDef) and node.name == "scan"] + self.assertEqual(len(methods), 1) + methods[0].body[:0] = ast.parse("if ' sorry' in self.text:\n" + textwrap.indent(body, " ")).body + ast.fix_missing_locations(tree) + self.target.write_text(ast.unparse(tree) + "\n", encoding="utf-8") + count = unittest.defaultTestLoader.discover( + str(harness.ROOT / "tests"), pattern="test_cbz_source_audit.py").countTestCases() + return harness.evaluate_target(self.target, count, "control.log", self.evidence, + suite_root=harness.ROOT) + + def test_input_dependent_cli_crash_is_not_an_assertion_kill(self): + result = self.input_dependent_mutant("raise RuntimeError('input-dependent CLI failure')\n") + self.assertEqual(result["smoke"]["status"], "VALID_JSON_REPORT", result) + self.assert_harness_error(result, "suite_cli") + self.assertGreater(result["cli_health"]["failures"], 0, result) + + def test_input_dependent_invalid_json_is_not_an_assertion_kill(self): + result = self.input_dependent_mutant("print('not a JSON report')\nraise SystemExit(0)\n") + self.assertEqual(result["smoke"]["status"], "VALID_JSON_REPORT", result) + self.assert_harness_error(result, "suite_cli") + self.assertGreater(result["cli_health"]["failures"], 0, result) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_cbz_source_audit.py b/tests/test_cbz_source_audit.py new file mode 100644 index 000000000..b4be7a94e --- /dev/null +++ b/tests/test_cbz_source_audit.py @@ -0,0 +1,618 @@ +"""Black-box contract tests; CBZ_AUDITOR_SCRIPT selects an isolated mutant.""" + +import hashlib +import importlib.util +import json +import os +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + + +SCRIPT = Path(os.environ.get( + "CBZ_AUDITOR_SCRIPT", str(Path(__file__).resolve().parents[1] / "tools/cbz_source_audit.py") +)) + + +class AuditorExecutionFailure(RuntimeError): + """An unhealthy CLI execution is not a behavioral assertion failure.""" + + +def execute_auditor(arguments, *, timeout=15): + """Check every CLI invocation and record health separately from its meaning.""" + def record(status, **detail): + event = {"status": status, **detail} + destination = os.environ.get("CBZ_AUDITOR_HEALTH_LOG") + if destination: + with Path(destination).open("a", encoding="utf-8") as log: + log.write(json.dumps(event, sort_keys=True) + "\n") + return event + + def unhealthy(status, detail): + record(status, detail=detail) + raise AuditorExecutionFailure(f"{status}: {detail}") + + try: + run = subprocess.run([sys.executable, "-B", "-S", *(["-O"] * sys.flags.optimize), + str(SCRIPT), *arguments], + text=True, capture_output=True, timeout=timeout) + except (OSError, UnicodeError, subprocess.TimeoutExpired) as error: + unhealthy(type(error).__name__, str(error)) + if run.stderr or run.returncode not in (0, 1, 2): + unhealthy("LAUNCH_ERROR", repr((run.returncode, run.stdout, run.stderr))) + + def reject_constant(value): + raise ValueError("Nonfinite JSON constant: " + value) + + try: + report = json.loads(run.stdout, parse_constant=reject_constant) + except (ValueError, RecursionError) as error: + unhealthy("INVALID_JSON", f"{error}: {run.stdout!r}") + if not isinstance(report, dict): + unhealthy("INVALID_JSON_OBJECT", repr(report)) + record("VALID_JSON_REPORT", returncode=run.returncode) + return report, run + + +class SourceAuditTests(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.base = Path(self.tmp.name) + self.root = self.base / "source" + self.root.mkdir() + self.manifest = self.base / "manifest.json" + + def pin(self, files=None, **extra): + if files is None: + files = sorted(p.relative_to(self.root).as_posix() + for p in self.root.rglob("*.lean") if p.is_file()) + document = { + "version": 1, + "root": str(self.root), + "files": [{"path": p, "sha256": hashlib.sha256((self.root / p).read_bytes()).hexdigest()} + for p in files], + } + document.update(extra) + self.manifest.write_text(json.dumps(document), encoding="utf-8") + return document + + def source(self, content, name="Main.lean"): + path = self.root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_bytes(content.encode("utf-8") if isinstance(content, str) else content) + return path + + def run_audit(self, manifest=None, *arguments): + self.assertTrue(SCRIPT.is_file(), "bounded auditor implementation is missing") + report, run = execute_auditor(["--manifest", str(manifest or self.manifest), *arguments]) + self.assertIn(run.returncode, (1, 2), (run.stdout, run.stderr)) + self.assertEqual(run.stderr, "") + self.assertIn(report["aggregate_status"], ("NOT_ESTABLISHED", "REVIEW_REQUIRED")) + self.assertEqual(report["gate_claims"]["G1"], "NOT_ESTABLISHED") + self.assertEqual(report["gate_claims"]["CBZ-0"], "NOT_ESTABLISHED") + return report, run + + def audit_source(self, source): + self.source(source) + self.pin() + report = self.run_audit()[0] + self.assertEqual(len(report["files"]), 1, "one pinned source must have one accounted record") + return report + + def assert_error(self, code, report): + self.assertEqual(report["aggregate_status"], "NOT_ESTABLISHED") + self.assertEqual(report["input_integrity"]["status"], "NOT_ESTABLISHED") + self.assertIn(code, [e["code"] for e in report["errors"]], report) + + def test_lexically_clear_source_cannot_establish_layer_a(self): + report = self.audit_source("theorem example_ok : True := by\n trivial\n") + self.assertEqual(report["aggregate_status"], "NOT_ESTABLISHED") + self.assertEqual(report["input_integrity"]["status"], "CHECKED") + self.assertEqual(report["findings"], []) + self.assertEqual(report["files"][0]["status"], "SCANNED") + gaps = {entry["invariant"]: entry for entry in report["blocking_coverage"]} + for invariant in ("A3", "A4", "A5", "A6", "A7"): + self.assertIn(invariant, gaps, "semantic blockers must not disappear from a report") + self.assertEqual(gaps[invariant]["status"], "NOT_ESTABLISHED") + self.assertTrue(gaps[invariant]["required_evidence"]) + self.assertEqual(report["coverage"]["lean_grammar_and_elaboration"], "NOT_ESTABLISHED") + + def test_every_prohibited_token_detector_has_independent_evidence(self): + for token in ("sorry", "admit", "axiom", "native_decide", "unsafe", + "Float", "Float32", "run_tac", "run_elab", "eval_expr", + "implemented_by", "extern", "sorryAx", "ofReduceBool", + "ofReduceNat", "trustCompiler", "skipKernelTC", "addDeclWithoutChecking"): + with self.subTest(token=token): + report = self.audit_source("-- preceding line\n" + token + "\n") + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + hit = [f for f in report["findings"] if f["token"] == token] + self.assertEqual(len(hit), 1, report) + self.assertEqual(hit[0]["line"], 2) + self.assertEqual(hit[0]["column"], 1) + self.assertEqual(hit[0]["source_line"], token) + + def test_native_option_forms_are_reviewed_across_whitespace_and_comments(self): + cases = ( + ("+native", "example : True := by decide +native\n"), + ("+native", "example : True := by decide + native\n"), + ("+native", "example : True := by decide +\n native\n"), + ("+native", "example : True := by decide + /- outer /- nested -/ -/ native\n"), + ("native:=", "example : True := by decide (config := {native := true})\n"), + ("native:=", "example : True := by decide (config := {native/- note -/:=true})\n"), + ("native:=", "example : True := by decide (config := {native -- note\n := true})\n"), + ("native:=", "example : True := by decide (config := {other := false, native := true})\n"), + ) + for form, source in cases: + with self.subTest(form=form, source=source): + report = self.audit_source(source) + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + hits = [f for f in report["findings"] if f.get("review_form") == form] + self.assertEqual(len(hits), 1, report) + self.assertEqual(hits[0]["token"], "native") + self.assertEqual(hits[0]["code"], "UNCERTIFIED_EXECUTION") + + def test_native_form_evidence_points_to_the_actual_identifier_bytes(self): + for source, form, position in ( + ("-- α\n+native\n", "+native", (2, 2, 7, 6)), + ("-- α\n{ native /- note -/ := true }\n", "native:=", (2, 3, 8, 6)), + ): + with self.subTest(form=form): + report = self.audit_source(source) + hits = [f for f in report["findings"] if f.get("review_form") == form] + self.assertEqual(len(hits), 1, report) + hit = hits[0] + self.assertEqual((hit["line"], hit["column"], hit["byte_offset"], hit["byte_length"]), position) + self.assertEqual(source.encode("utf-8")[hit["byte_offset"]:hit["byte_offset"] + hit["byte_length"]], b"native") + + def test_native_field_in_record_updates_is_reviewed(self): + for source in ( + "example : True := by decide (config := { {} with native := true })\n", + "example : True := by decide (config := { config with\n native := true })\n", + "example : True := by decide (config := { config with /- note -/ native := true })\n", + "example : True := by decide (config := { config with native -- note\n := true })\n", + ): + with self.subTest(source=source): + report = self.audit_source(source) + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + hits = [f for f in report["findings"] if f.get("review_form") == "native:="] + self.assertEqual(len(hits), 1, report) + self.assertEqual((hits[0]["token"], hits[0]["code"]), + ("native", "UNCERTIFIED_EXECUTION")) + + def test_comma_free_native_record_fields_are_reviewed(self): + for source in ( + "example : True := by\n decide (config := {\n kernel := false\n native := true\n })\n", + "example : True := by\n decide (config := {\n kernel := false -- field\n /- nested /- note -/ -/ native /- value -/ := true\n })\n", + "example : True := by\r\n decide (config := {\r\n kernel := false\r\n native := true\r\n })\r\n", + "example : True := by\n decide (config := { {} with\n kernel := false\n native := true\n })\n", + ): + with self.subTest(source=source): + report = self.audit_source(source) + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + hits = [f for f in report["findings"] if f.get("review_form") == "native:="] + self.assertEqual(len(hits), 1, report) + self.assertEqual((hits[0]["token"], hits[0]["code"]), + ("native", "UNCERTIFIED_EXECUTION")) + offset = hits[0]["byte_offset"] + self.assertEqual(source.encode("utf-8")[offset:offset + hits[0]["byte_length"]], b"native") + + def test_native_identifiers_and_literal_data_are_not_compiler_options(self): + source = ('def native := 1\ndef native_option := 2\ndef native! := 3\n' + 'def value := Foo.native\n' + 'def data := "+native {native := true}"\n' + 'def multiline := r#"{\n native := true\n}"#\n' + 'def\n native := 4\n' + '-- {\n/- { native := true } -/\n' + '-- +native {native := true}\n/- +native {native := true} -/\n') + report = self.audit_source(source) + self.assertEqual(report["errors"], []) + self.assertEqual(report["findings"], []) + + def test_extensible_syntax_is_reviewed_instead_of_silently_skipped(self): + for token in ("macro", "macro_rules", "syntax", "elab", "elab_rules", + "declare_syntax_cat", "initialize", "builtin_initialize"): + with self.subTest(token=token): + report = self.audit_source(token + " anything\n") + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + self.assertTrue(any(f["token"] == token and f["code"] == "EXTENSIBLE_SYNTAX" + for f in report["findings"])) + + def test_nested_comments_and_literal_strings_do_not_create_token_hits(self): + text = ( + '-- sorry " unterminated quote inside a comment\n' + '/- axiom /- admit " -/ unsafe /- Float -/ -/\n' + 'def message := "sorry admit axiom native_decide unsafe Float run_tac"\n' + r'def escaped := "a \" sorry \\ still a string"' + '\n' + 'def raw := r##"sorry " axiom \\ unsafe"##\n' + "def character := '\"'\n" + ) + report = self.audit_source(text) + self.assertEqual(report["errors"], []) + self.assertEqual(report["findings"], []) + + def test_comment_end_inside_string_and_quote_inside_comment_do_not_leak(self): + report = self.audit_source('def s := "/- sorry -/ \\\" axiom"\n/- " -/\nadmit\n') + self.assertEqual([(f["token"], f["line"]) for f in report["findings"]], [("admit", 3)]) + + def test_raw_string_hash_delimiters_and_backslashes_are_not_normal_escapes(self): + report = self.audit_source('def a := r"sorry \\"\ndef b := r#"axiom " unsafe"#\n') + self.assertEqual(report["errors"], []) + self.assertEqual(report["findings"], []) + + def test_identifiers_with_keyword_substrings_and_apostrophes_are_not_keywords(self): + report = self.audit_source("def sorryName := 1\ndef xs' := 2\ndef notFloat := 3\ndef sorry? := 4\ndef sorry! := 5\n") + self.assertEqual(report["findings"], []) + + def test_unicode_identifier_cannot_be_split_into_a_spurious_keyword(self): + report = self.audit_source("def sorryα := 1\n") + self.assertEqual(report["errors"], []) + self.assertEqual([(f["code"], f["token"]) for f in report["findings"]], + [("UNSUPPORTED_SYNTAX", "sorryα")]) + + def test_qualified_tokens_are_detected_and_have_exact_utf8_byte_offsets(self): + text = '-- α\r\n\n Lean.sorry\n' + report = self.audit_source(text) + self.assertEqual(len(report["findings"]), 1) + hit = report["findings"][0] + self.assertEqual(hit["token"], "sorry") + self.assertEqual((hit["line"], hit["column"], hit["byte_offset"], hit["byte_length"]), + (3, 8, 15, 5)) + self.assertEqual(hit["source_line"], " Lean.sorry") + + def test_quoted_identifiers_are_reviewed_even_with_comment_characters(self): + report = self.audit_source("def «/-sorry-/» := 1\n") + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + self.assertEqual([(f["code"], f["token"]) for f in report["findings"]], + [("QUOTED_IDENTIFIER", "«/-sorry-/»")]) + + def test_quotations_antiquotations_and_unknown_characters_are_reviewed(self): + for text, token in (("`(tactic| sorry)", "`"), ("$x", "$"), + ("#eval 1", "#"), ("sorr\u2060y", "\u2060"), + ("def x := λ", "λ"), ("def x := \\x", "\\")): + with self.subTest(text=text): + report = self.audit_source(text) + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + self.assertTrue(any(f["code"] == "UNSUPPORTED_SYNTAX" and f["token"] == token + for f in report["findings"])) + + def test_interpolated_strings_are_reviewed_even_if_the_payload_is_masked(self): + for prefix in ("s!", "m!", "f!"): + with self.subTest(prefix=prefix): + report = self.audit_source('def s := ' + prefix + '"{sorry}"\n') + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + self.assertTrue(any(f["code"] == "STRING_INTERPOLATION" + for f in report["findings"])) + + def test_unknown_string_escape_is_explicit_review(self): + report = self.audit_source('def s := "\\q sorry"\n') + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + self.assertTrue(any(f["code"] == "UNSUPPORTED_ESCAPE" for f in report["findings"])) + self.assertFalse(any(f["token"] == "sorry" for f in report["findings"])) + + def test_unterminated_lexical_constructs_fail_closed(self): + for text in ('/- sorry', '"sorry', 'r##"sorry"#', '«sorry', "'x", "'sorry'"): + with self.subTest(text=text): + self.assert_error("LEXICAL_ERROR", self.audit_source(text)) + + def test_invalid_utf8_is_not_replaced_or_ignored(self): + self.source(b"theorem x := \xffsorry\n") + self.pin() + report, _ = self.run_audit() + self.assert_error("INVALID_UTF8", report) + self.assertEqual(report["files"][0]["status"], "ERROR") + + def test_missing_manifest_file_is_not_skipped(self): + self.source("theorem a : True := by trivial\n") + self.pin() + (self.root / "Main.lean").unlink() + report, run = self.run_audit() + self.assertEqual(run.returncode, 2) + self.assert_error("MISSING_FILE", report) + self.assertEqual(report["input_integrity"]["expected_files"], 1) + self.assertEqual(report["files"][0]["status"], "ERROR") + + def test_unavailable_root_still_accounts_for_every_manifest_entry(self): + self.source("def x := 1\n", "X.lean") + self.source("def y := 2\n", "Y.lean") + self.pin() + for path in self.root.iterdir(): + path.unlink() + self.root.rmdir() + report, _ = self.run_audit() + self.assert_error("MISSING_FILE", report) + self.assertEqual([(f["path"], f["status"]) for f in report["files"]], + [("X.lean", "ERROR"), ("Y.lean", "ERROR")]) + + def test_source_resource_limit_is_blocking_before_unbounded_read(self): + path = self.source(b"") + with path.open("wb") as output: + output.truncate(33554433) + self.pin() + report, _ = self.run_audit() + self.assert_error("RESOURCE_LIMIT", report) + + def test_otherwise_valid_manifest_with_duplicate_keys_is_rejected(self): + self.source("def x := 1\n") + self.pin() + original = self.manifest.read_text(encoding="utf-8") + self.manifest.write_text(original.replace('"version": 1', '"version": 1, "version": 1'), + encoding="utf-8") + self.assert_error("INVALID_MANIFEST", self.run_audit()[0]) + + def test_relative_root_is_anchored_to_manifest_directory(self): + self.source("def x := 1\n") + self.pin(root="source") + report, _ = self.run_audit() + self.assertEqual(report["input_integrity"]["status"], "CHECKED") + self.assertEqual(report["input_integrity"]["scanned_files"], 1) + + def test_exact_manifest_hash_mismatch_is_blocking(self): + self.source("def x := 1\n") + self.pin() + self.source("def x := 2\n") + report, _ = self.run_audit() + self.assert_error("HASH_MISMATCH", report) + + def test_every_lean_descendant_must_be_explicitly_pinned(self): + self.source("def x := 1\n") + self.pin() + self.source("axiom hidden : False\n", "nested/Hidden.lean") + report, _ = self.run_audit() + self.assert_error("UNLISTED_FILE", report) + self.assertIn("nested/Hidden.lean", report["input_integrity"]["unlisted_files"]) + + def test_file_and_directory_symlinks_are_rejected_without_following(self): + self.source("def x := 1\n") + document = self.pin() + outside = self.base / "Outside.lean" + outside.write_text("sorry\n", encoding="utf-8") + for kind in ("file", "directory", "unrelated"): + with self.subTest(kind=kind): + link = self.root / ("Link.lean" if kind == "file" else "link") + link.symlink_to(outside if kind in ("file", "unrelated") else self.base, + target_is_directory=kind == "directory") + try: + report, _ = self.run_audit() + self.assert_error("SYMLINK", report) + finally: + link.unlink() + self.assertEqual(document["files"][0]["path"], "Main.lean") + + def test_symlinked_root_ancestor_and_manifest_are_rejected(self): + self.source("def x := 1\n") + document = self.pin() + link = self.base / "linked" + link.symlink_to(self.root, target_is_directory=True) + document["root"] = str(link) + self.manifest.write_text(json.dumps(document), encoding="utf-8") + self.assert_error("SYMLINK", self.run_audit()[0]) + document["root"] = str(link / "sub") + self.manifest.write_text(json.dumps(document), encoding="utf-8") + self.assert_error("SYMLINK", self.run_audit()[0]) + manifest_link = self.base / "linked-manifest.json" + manifest_link.symlink_to(self.manifest) + self.assert_error("SYMLINK", self.run_audit(manifest_link)[0]) + + def test_unreadable_source_and_directories_are_not_root_bypass_success(self): + path = self.source("def x := 1\n", "nested/Main.lean") + self.pin() + path.chmod(0) + try: + self.assert_error("UNREADABLE", self.run_audit()[0]) + finally: + path.chmod(0o600) + path.parent.chmod(0) + try: + self.assert_error("UNREADABLE", self.run_audit()[0]) + finally: + path.parent.chmod(0o700) + + def test_explicit_permission_guard_does_not_depend_on_os_capabilities(self): + path = self.source("def x := 1\n") + spec = importlib.util.spec_from_file_location("auditor_guard_under_test", SCRIPT) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + path.chmod(0) + try: + with self.assertRaises(module.AuditFailure) as caught: + module.check_entry(path.stat(), path) + self.assertEqual(caught.exception.error["code"], "UNREADABLE") + finally: + path.chmod(0o600) + + def test_output_fifo_refuses_without_waiting_for_a_reader(self): + self.source("def x := 1\n") + self.pin() + output = self.base / "output.fifo" + os.mkfifo(output) + report, run = execute_auditor(["--manifest", str(self.manifest), + "--output", str(output)], timeout=2) + self.assertEqual(run.returncode, 2) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + + def test_output_cannot_overwrite_manifest_source_or_previous_evidence(self): + source = self.source("def x := 1\n") + self.pin() + previous = self.base / "previous.json" + previous.write_bytes(b"immutable earlier evidence\n") + for output in (self.manifest, source, previous): + with self.subTest(output=output.name): + before = output.read_bytes() + report, run = self.run_audit(None, "--output", str(output)) + self.assertEqual(run.returncode, 2) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + self.assertEqual(output.read_bytes(), before) + + def test_output_is_outside_audited_root_and_has_no_symlinked_ancestor(self): + self.source("def x := 1\n") + self.pin() + output = self.root / "new-output.json" + report, run = self.run_audit(None, "--output", str(output)) + self.assertEqual(run.returncode, 2) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + self.assertFalse(output.exists()) + target = self.base / "output-directory" + target.mkdir() + alias = self.base / "output-alias" + alias.symlink_to(target, target_is_directory=True) + report, run = self.run_audit(None, "--output", str(alias / "receipt.json")) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + self.assertFalse((target / "receipt.json").exists()) + + def test_output_with_unknown_root_preserves_json_refusal_and_creates_nothing(self): + cases = (("missing", None, "MISSING_FILE"), + ("unreadable", b"{}", "UNREADABLE"), + ("malformed", b"{", "INVALID_MANIFEST"), + ("invalid-utf8", b"\xff", "INVALID_UTF8")) + for name, data, code in cases: + with self.subTest(case=name): + if self.manifest.exists(): + self.manifest.unlink() + if data is not None: + self.manifest.write_bytes(data) + if name == "unreadable": + self.manifest.chmod(0) + output = self.base / (name + "-report.json") + try: + report, run = self.run_audit(None, "--output", str(output)) + self.assertEqual(run.returncode, 2) + self.assert_error(code, report) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + self.assertFalse(output.exists(), "an unknown source root cannot authorize a report path") + finally: + if self.manifest.exists(): + self.manifest.chmod(0o600) + + def test_double_slash_anchors_cannot_create_output_inside_audited_root(self): + source = self.source("def preserved := 1\n") + original = source.read_bytes() + for root_alias, output_alias in ((False, True), (True, False), (True, True)): + with self.subTest(root_alias=root_alias, output_alias=output_alias): + output = self.root / "Injected.lean" + document = self.pin(["Main.lean"]) + if root_alias: + document["root"] = "/" + str(self.root) + self.manifest.write_text(json.dumps(document), encoding="utf-8") + output_argument = ("/" if output_alias else "") + str(output) + try: + report, run = self.run_audit(None, "--output", output_argument) + self.assertEqual(run.returncode, 2) + self.assertIn("OUTPUT_ERROR", [e["code"] for e in report["errors"]]) + self.assertFalse(output.exists(), "a spelling alias must not mutate the input tree") + self.assertEqual(source.read_bytes(), original) + self.assertEqual(sorted(p.name for p in self.root.iterdir()), ["Main.lean"]) + finally: + if output.exists(): + output.unlink() + + def test_directory_limit_bounds_consumption_before_sorting_names(self): + for index in range(8): + (self.root / f"{index}.txt").write_text("entry\n") + spec = importlib.util.spec_from_file_location("auditor_limit_under_test", SCRIPT) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + module.MAX_TREE_ENTRIES = 3 + real_scandir = os.scandir + consumed = [] + class TrackedDirectory: + def __init__(self, fd): + self.iterator = real_scandir(fd) + def __enter__(self): + return self + def __exit__(self, *args): + self.iterator.close() + def __iter__(self): + return self + def __next__(self): + entry = next(self.iterator) + consumed.append(entry.name) + return entry + fd = module.open_directory(self.root) + try: + module.os.scandir = TrackedDirectory + with self.assertRaises(module.AuditFailure) as caught: + module.discover_sources(fd) + self.assertEqual(caught.exception.error["code"], "RESOURCE_LIMIT") + finally: + module.os.scandir = real_scandir + os.close(fd) + self.assertLessEqual(len(consumed), 4, "enumeration must stop at the first excess entry") + + def test_nonregular_source_is_rejected_without_blocking(self): + self.source("def x := 1\n") + document = self.pin() + (self.root / "Main.lean").unlink() + os.mkfifo(self.root / "Main.lean") + self.assert_error("NONREGULAR_FILE", self.run_audit()[0]) + self.assertEqual(len(document["files"]), 1) + + def test_unsafe_manifest_paths_and_duplicates_fail_closed(self): + self.source("def x := 1\n") + original = self.pin() + for path in ("../Outside.lean", "/Main.lean", "nested/../Main.lean", "./Main.lean", + "nested//Main.lean", "nested\\Main.lean", "Main.txt", ""): + with self.subTest(path=path): + document = json.loads(json.dumps(original)) + document["files"][0]["path"] = path + self.manifest.write_text(json.dumps(document), encoding="utf-8") + self.assert_error("INVALID_MANIFEST", self.run_audit()[0]) + original["files"].append(original["files"][0]) + self.manifest.write_text(json.dumps(original), encoding="utf-8") + self.assert_error("INVALID_MANIFEST", self.run_audit()[0]) + + def test_empty_invalid_or_extended_manifest_is_not_a_vacuous_pass(self): + self.source("def x := 1\n") + original = self.pin() + for update in ({"files": []}, {"version": True}, {"version": 2}, {"skip_errors": True}, + {"files": [{"path": "Main.lean", "sha256": "0" * 63}]}, + {"files": [{"path": "Main.lean", "sha256": "0" * 64, "skip": True}]}): + with self.subTest(update=update): + document = dict(original) + document.update(update) + self.manifest.write_text(json.dumps(document), encoding="utf-8") + self.assert_error("INVALID_MANIFEST", self.run_audit()[0]) + for payload in ('{"version":1,"version":1}', '{"value":NaN}', "[]", "{"): + with self.subTest(payload=payload): + self.manifest.write_text(payload, encoding="utf-8") + self.assert_error("INVALID_MANIFEST", self.run_audit()[0]) + + def test_missing_unreadable_and_malformed_utf8_manifest_fail_closed(self): + self.assert_error("MISSING_FILE", self.run_audit()[0]) + self.manifest.write_bytes(b"\xff") + self.assert_error("INVALID_UTF8", self.run_audit()[0]) + self.manifest.chmod(0) + try: + self.assert_error("UNREADABLE", self.run_audit()[0]) + finally: + self.manifest.chmod(0o600) + + def test_reports_are_deterministic_and_account_for_every_pinned_file(self): + self.source("def z := 2\n", "z/Z.lean") + self.source("def a := 1\n", "A.lean") + document = self.pin(["z/Z.lean", "A.lean"]) + report, first = self.run_audit() + _, second = self.run_audit() + self.assertEqual(first.stdout, second.stdout) + self.assertEqual([f["path"] for f in report["files"]], ["A.lean", "z/Z.lean"]) + self.assertEqual(report["input_integrity"]["expected_files"], 2) + self.assertEqual(report["input_integrity"]["scanned_files"], 2) + self.assertEqual(report["input_integrity"]["discovered_files"], ["A.lean", "z/Z.lean"]) + expected = {f["path"]: f["sha256"] for f in document["files"]} + for entry in report["files"]: + self.assertEqual(entry["sha256"], expected[entry["path"]]) + + def test_output_artifact_matches_stdout_and_does_not_imply_success(self): + self.source("sorry\n") + self.pin() + output = self.base / "report.json" + report, run = self.run_audit(None, "--output", str(output)) + self.assertTrue(output.is_file(), "a successful output request must retain a regular report") + self.assertEqual(output.read_text(encoding="utf-8"), run.stdout) + self.assertEqual(report["aggregate_status"], "REVIEW_REQUIRED") + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/cbz_source_audit.py b/tools/cbz_source_audit.py new file mode 100644 index 000000000..170ed1edd --- /dev/null +++ b/tools/cbz_source_audit.py @@ -0,0 +1,666 @@ +#!/usr/bin/env python3 +"""Bounded source inventory and lexical review, never a Layer A certifier. + +Only a manifest-pinned, local, POSIX byte snapshot is examined. No Lean parser, +elaborator, kernel, tactic evaluator, dependency closure, or semantic checker is +run. Every report leaves G1 and CBZ-0 NOT_ESTABLISHED, including a scan without +lexical findings. Exit 1 means review findings; exit 2 means not established. +""" + +import argparse +import errno +import hashlib +import json +import os +from pathlib import Path +import re +import stat +import sys +import unicodedata + + +MAX_SOURCE_BYTES = 32 * 1024 * 1024 +MAX_MANIFEST_BYTES = 8 * 1024 * 1024 +MAX_TREE_ENTRIES = 200000 +MAX_DIRECTORY_DEPTH = 128 +MAX_FINDINGS = 10000 + +# A missing entry is a loss of advertised detection, covered by scanner mutants. +# These are review triggers, not claims that every occurrence is unsound. +REVIEW_TOKENS = { + "sorry": ("PROHIBITED_TOKEN", "Logical placeholder requires review."), + "admit": ("PROHIBITED_TOKEN", "Logical placeholder requires review."), + "sorryAx": ("PROHIBITED_TOKEN", "Direct placeholder axiom use requires review."), + "axiom": ("PROHIBITED_TOKEN", "Axiom declaration requires provenance and verification."), + "native_decide": ("UNCERTIFIED_EXECUTION", "Native evaluation is not certified by this scanner."), + "ofReduceBool": ("UNCERTIFIED_EXECUTION", "Compiler-trust reduction requires separate evidence."), + "ofReduceNat": ("UNCERTIFIED_EXECUTION", "Compiler-trust reduction requires separate evidence."), + "trustCompiler": ("UNCERTIFIED_EXECUTION", "Compiler trust requires separate evidence."), + "skipKernelTC": ("UNCERTIFIED_EXECUTION", "Kernel-check bypass requires separate evidence."), + "addDeclWithoutChecking": ("UNCERTIFIED_EXECUTION", "Unchecked declaration admission requires separate evidence."), + "unsafe": ("UNSAFE_DECLARATION", "Unsafe declaration or use requires review."), + "Float": ("FLOAT_USE", "Floating point cannot certify a bound in this audit."), + "Float32": ("FLOAT_USE", "Floating point cannot certify a bound in this audit."), + "run_tac": ("UNCERTIFIED_EXECUTION", "Metaprogram execution requires separate evidence."), + "run_elab": ("UNCERTIFIED_EXECUTION", "Elaborator execution requires separate evidence."), + "eval_expr": ("UNCERTIFIED_EXECUTION", "Expression evaluation requires separate evidence."), + "implemented_by": ("UNCERTIFIED_EXECUTION", "Implementation replacement requires separate evidence."), + "extern": ("UNCERTIFIED_EXECUTION", "External execution requires separate evidence."), + "macro": ("EXTENSIBLE_SYNTAX", "Macro expansion is outside the lexical contract."), + "macro_rules": ("EXTENSIBLE_SYNTAX", "Macro expansion is outside the lexical contract."), + "syntax": ("EXTENSIBLE_SYNTAX", "Syntax extension is outside the lexical contract."), + "elab": ("EXTENSIBLE_SYNTAX", "Custom elaboration is outside the lexical contract."), + "elab_rules": ("EXTENSIBLE_SYNTAX", "Custom elaboration is outside the lexical contract."), + "declare_syntax_cat": ("EXTENSIBLE_SYNTAX", "Custom syntax categories require separate analysis."), + "initialize": ("EXTENSIBLE_SYNTAX", "Initialization may change the elaboration environment."), + "builtin_initialize": ("EXTENSIBLE_SYNTAX", "Initialization may change the elaboration environment."), +} + +BLOCKING_COVERAGE = ( + ("A1", "Kernel-checked closure without placeholders or stubbed obligations.", + "Pinned Lean dependency closure, elaboration and kernel evidence, plus obligation review."), + ("A2", "Absence of newly introduced unverified axioms.", + "Pinned declaration/dependency axiom analysis and approved baseline comparison."), + ("A3", "Certified exact bounds and their mathematical semantics.", + "Exact mathematical specifications and kernel-checked bound certificates; no float certification."), + ("A4", "Absence of weakened claims, bounds or tests.", + "Trusted prior baseline, semantic statement/test comparison and independently justified tests."), + ("A5", "Absence of improperly deleted obligations or research.", + "Trusted prior inventory and preserved-history/deletion comparison across the federation."), + ("A6", "Nonvacuity of hypotheses, witnesses and remaining obligations.", + "Independent satisfiability/witness and obligation-completeness evidence."), + ("A7", "Truth of status, gate and completion assertions.", + "Current pinned gate receipts and a status-to-evidence reconciliation."), +) + + +class AuditFailure(Exception): + def __init__(self, code, path, detail, **evidence): + super().__init__(detail) + self.error = {"code": code, "path": str(path), "detail": detail, **evidence} + + +def io_failure(error, path): + if error.errno in (errno.ELOOP,): + return AuditFailure("SYMLINK", path, "Symbolic link traversal is prohibited.") + if error.errno in (errno.ENOENT,): + return AuditFailure("MISSING_FILE", path, "Required filesystem entry is missing.") + if error.errno in (errno.EACCES, errno.EPERM): + return AuditFailure("UNREADABLE", path, "Filesystem access was denied.") + return AuditFailure("IO_ERROR", path, f"Filesystem operation failed (errno {error.errno}).") + + +def check_entry(st, path, directory=False): + if stat.S_ISLNK(st.st_mode): + raise AuditFailure("SYMLINK", path, "Symbolic links are prohibited, including ancestors.") + if directory and not stat.S_ISDIR(st.st_mode): + raise AuditFailure("NOT_DIRECTORY", path, "Expected a real directory.") + if not directory and not stat.S_ISREG(st.st_mode): + raise AuditFailure("NONREGULAR_FILE", path, "Expected a regular source/manifest file.") + mode = stat.S_IMODE(st.st_mode) + if not mode & 0o444 or (directory and not mode & 0o111): + raise AuditFailure("UNREADABLE", path, "Entry has no read permission bits or directory traversal bits.") + + +def absolute_input_path(value): + path = Path(value) + if path.anchor == "//": + raise AuditFailure("INVALID_PATH", value, "Ambiguous double-slash POSIX anchors are prohibited.") + if ".." in path.parts: + raise AuditFailure("INVALID_PATH", value, "Parent traversal in input paths is prohibited.") + return path if path.is_absolute() else Path.cwd() / path + + +def open_directory(path): + """Open each ancestor with no-follow semantics; return an owned descriptor.""" + path = absolute_input_path(path) + if not hasattr(os, "O_NOFOLLOW") or not hasattr(os, "O_DIRECTORY"): + raise AuditFailure("UNSUPPORTED_PLATFORM", path, "POSIX no-follow directory descriptors are required.") + fd = os.open("/", os.O_RDONLY | os.O_DIRECTORY) + try: + check_entry(os.fstat(fd), "/", directory=True) + for index, part in enumerate(path.parts[1:], 1): + display = str(Path(*path.parts[:index + 1])) + st = os.stat(part, dir_fd=fd, follow_symlinks=False) + check_entry(st, display, directory=True) + next_fd = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=fd) + os.close(fd) + fd = next_fd + check_entry(os.fstat(fd), display, directory=True) + return fd + except OSError as error: + os.close(fd) + raise io_failure(error, path) from error + except BaseException: + os.close(fd) + raise + + +def read_child(parent_fd, name, display, maximum): + """Read one regular file once, rejecting links, mode denial and observed races.""" + fd = None + try: + before = os.stat(name, dir_fd=parent_fd, follow_symlinks=False) + check_entry(before, display) + fd = os.open(name, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=parent_fd) + opened = os.fstat(fd) + check_entry(opened, display) + if (before.st_dev, before.st_ino) != (opened.st_dev, opened.st_ino): + raise AuditFailure("UNSTABLE_INPUT", display, "File identity changed while opening.") + if opened.st_size > maximum: + raise AuditFailure("RESOURCE_LIMIT", display, f"File exceeds the {maximum}-byte limit.") + chunks = [] + total = 0 + while True: + chunk = os.read(fd, min(65536, maximum + 1 - total)) + if not chunk: + break + chunks.append(chunk) + total += len(chunk) + if total > maximum: + raise AuditFailure("RESOURCE_LIMIT", display, f"Read exceeds the {maximum}-byte limit.") + after = os.fstat(fd) + keys = ("st_dev", "st_ino", "st_size", "st_mtime_ns", "st_ctime_ns") + if any(getattr(opened, key) != getattr(after, key) for key in keys) or total != after.st_size: + raise AuditFailure("UNSTABLE_INPUT", display, "File changed during the read.") + return b"".join(chunks) + except OSError as error: + raise io_failure(error, display) from error + finally: + if fd is not None: + os.close(fd) + + +def read_absolute(path, maximum): + path = absolute_input_path(path) + fd = open_directory(path.parent) + try: + return read_child(fd, path.name, path, maximum) + finally: + os.close(fd) + + +def unique_object(pairs): + result = {} + for key, value in pairs: + if key in result: + raise ValueError("Duplicate JSON object key.") + result[key] = value + return result + + +def reject_noninteger(value): + raise ValueError("Non-integer JSON numbers/constants are unsupported.") + + +def parse_manifest(data, manifest_path): + try: + text = data.decode("utf-8", errors="strict") + except UnicodeDecodeError as error: + raise AuditFailure("INVALID_UTF8", manifest_path, "Manifest is not strict UTF-8.", + byte_offset=error.start) from error + try: + document = json.loads(text, object_pairs_hook=unique_object, + parse_float=reject_noninteger, parse_constant=reject_noninteger) + if not isinstance(document, dict) or set(document) != {"version", "root", "files"}: + raise ValueError("Expected exactly version, root and files keys.") + if type(document["version"]) is not int or document["version"] != 1: + raise ValueError("Only integer manifest version 1 is supported.") + root = document["root"] + if not isinstance(root, str) or not root or "\x00" in root or ".." in Path(root).parts: + raise ValueError("Root must be a nonempty path without parent traversal.") + root.encode("utf-8", errors="strict") + entries = document["files"] + if not isinstance(entries, list) or not entries: + raise ValueError("An explicit nonempty file list is required.") + paths = set() + for entry in entries: + if not isinstance(entry, dict) or set(entry) != {"path", "sha256"}: + raise ValueError("Each file requires exactly path and sha256 keys.") + name = entry["path"] + if (not isinstance(name, str) or not name or name.startswith("/") or "\\" in name + or "\x00" in name or any(part in ("", ".", "..") for part in name.split("/")) + or not name.endswith(".lean")): + raise ValueError("Every file must be a canonical relative .lean path.") + name.encode("utf-8", errors="strict") + if name in paths: + raise ValueError("Duplicate file path.") + paths.add(name) + digest = entry["sha256"] + if not isinstance(digest, str) or re.fullmatch("[0-9a-f]{64}", digest) is None: + raise ValueError("Each file must pin a lowercase 64-digit SHA-256.") + root_path = Path(root) + if not root_path.is_absolute(): + root_path = manifest_path.parent / root_path + return absolute_input_path(root_path), sorted(entries, key=lambda entry: entry["path"]) + except (ValueError, TypeError, UnicodeError, RecursionError) as error: + raise AuditFailure("INVALID_MANIFEST", manifest_path, str(error)) from error + + +def discover_sources(root_fd): + """Reconcile the full local tree, never following any symbolic link.""" + discovered = set() + errors = [] + count = 0 + + def visit(fd, prefix, depth): + nonlocal count + if depth > MAX_DIRECTORY_DEPTH: + raise AuditFailure("RESOURCE_LIMIT", prefix, "Directory depth limit exceeded.") + try: + with os.scandir(fd) as iterator: + names = [] + for entry in iterator: + count += 1 + if count > MAX_TREE_ENTRIES: + raise AuditFailure("RESOURCE_LIMIT", prefix, + "Directory entry limit exceeded during enumeration.") + names.append(entry.name) + names.sort() + for name in names: + display = prefix + name + try: + name.encode("utf-8", errors="strict") + entry = os.stat(name, dir_fd=fd, follow_symlinks=False) + if stat.S_ISLNK(entry.st_mode): + raise AuditFailure("SYMLINK", display, "Tree contains a symbolic link; coverage is incomplete.") + if stat.S_ISDIR(entry.st_mode): + check_entry(entry, display, directory=True) + child = os.open(name, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=fd) + try: + visit(child, display + "/", depth + 1) + finally: + os.close(child) + elif name.endswith(".lean"): + discovered.add(display) + check_entry(entry, display) + elif not stat.S_ISREG(entry.st_mode): + raise AuditFailure("NONREGULAR_FILE", display, "Tree contains a nonregular entry.") + except AuditFailure as failure: + if failure.error["code"] == "RESOURCE_LIMIT": + raise + errors.append(failure.error) + except UnicodeError: + errors.append(AuditFailure("INVALID_UTF8", repr(display), "Filename is not valid UTF-8.").error) + except OSError as error: + errors.append(io_failure(error, display).error) + except OSError as error: + raise io_failure(error, prefix) from error + + visit(root_fd, "", 0) + return discovered, errors + + +def read_relative(root_fd, name): + parts = name.split("/") + parent_fd = os.dup(root_fd) + try: + for index, part in enumerate(parts[:-1], 1): + display = "/".join(parts[:index]) + entry = os.stat(part, dir_fd=parent_fd, follow_symlinks=False) + check_entry(entry, display, directory=True) + child = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent_fd) + os.close(parent_fd) + parent_fd = child + return read_child(parent_fd, parts[-1], name, MAX_SOURCE_BYTES) + except OSError as error: + raise io_failure(error, name) from error + finally: + os.close(parent_fd) + + +def identifier_start(char): + return char == "_" or unicodedata.category(char).startswith("L") or unicodedata.category(char) == "Nl" + + +def identifier_rest(char): + return identifier_start(char) or char.isdigit() or unicodedata.category(char) in ("Mn", "Mc", "No") or char in "'!?" + + +class Lexer: + """Lexical masks for a bounded subset; unsupported constructs cause review.""" + + def __init__(self, text, path): + self.text, self.path = text, path + self.i, self.line, self.column, self.byte_offset = 0, 1, 1, 0 + self.lines = text.split("\n") + self.findings = [] + self.previous_code = None + self.brace_depth = 0 + self.line_has_code = False + + def advance(self, end): + for char in self.text[self.i:end]: + self.byte_offset += len(char.encode("utf-8")) + if char == "\n": + self.line, self.column = self.line + 1, 1 + self.line_has_code = False + else: + self.column += 1 + self.i = end + + def mark_code(self, token): + self.previous_code = token + self.line_has_code = True + if token == "{": + self.brace_depth += 1 + elif token == "}": + self.brace_depth = max(0, self.brace_depth - 1) + + def evidence(self, token): + line = self.lines[self.line - 1].removesuffix("\r") + start = max(0, self.column - 1 - 256) if len(line) > 1024 else 0 + return { + "path": self.path, "line": self.line, "column": self.column, + "byte_offset": self.byte_offset, "byte_length": len(token.encode("utf-8")), + "token": token, "source_line": line[start:start + 1024], + "source_line_start_column": start + 1, "source_line_truncated": len(line) > 1024, + } + + def finding(self, code, token, detail, **context): + if len(self.findings) >= MAX_FINDINGS: + self.fail("Finding count limit exceeded.", code="RESOURCE_LIMIT") + self.findings.append({"code": code, "detail": detail, **self.evidence(token), **context}) + + def fail(self, detail, code="LEXICAL_ERROR"): + raise AuditFailure(code, self.path, detail, line=self.line, + column=self.column, byte_offset=self.byte_offset) + + def block_comment(self): + depth = 1 + self.advance(self.i + 2) + while self.i < len(self.text): + if self.text.startswith("/-", self.i): + depth += 1 + self.advance(self.i + 2) + elif self.text.startswith("-/", self.i): + depth -= 1 + self.advance(self.i + 2) + if depth == 0: + return + else: + self.advance(self.i + 1) + self.fail("Unterminated nested block comment.") + + def escape(self): + if self.i + 1 >= len(self.text): + self.fail("Unterminated string/character escape.") + char = self.text[self.i + 1] + end = self.i + 2 + recognized = char in "\\\"'nrt0" + if char in "xu": + size = 2 if char == "x" else 4 + digits = self.text[end:end + size] + if len(digits) == size and all(c in "0123456789abcdefABCDEF" for c in digits): + recognized, end = True, end + size + elif char == "u" and self.text.startswith("{", end): + close = self.text.find("}", end + 1, end + 9) + digits = self.text[end + 1:close] if close != -1 else "" + if (1 <= len(digits) <= 6 and all(c in "0123456789abcdefABCDEF" for c in digits) + and int(digits, 16) <= 0x10ffff and not 0xd800 <= int(digits, 16) <= 0xdfff): + recognized, end = True, close + 1 + if not recognized: + self.finding("UNSUPPORTED_ESCAPE", self.text[self.i:end], + "Escape form is outside the bounded literal mask.") + self.advance(end) + + def string(self): + self.advance(self.i + 1) + while self.i < len(self.text): + if self.text[self.i] == '"': + self.advance(self.i + 1) + return + if self.text[self.i] == "\\": + self.escape() + else: + self.advance(self.i + 1) + self.fail("Unterminated string literal.") + + def raw_string(self): + end = self.i + 1 + while end < len(self.text) and self.text[end] == "#": + end += 1 + if end >= len(self.text) or self.text[end] != '"': + return False + delimiter = '"' + "#" * (end - self.i - 1) + close = self.text.find(delimiter, end + 1) + if close == -1: + self.fail("Unterminated raw string literal.") + self.advance(close + len(delimiter)) + return True + + def character(self): + self.advance(self.i + 1) + if self.i >= len(self.text) or self.text[self.i] in "'\r\n": + self.fail("Malformed character literal.") + if self.text[self.i] == "\\": + self.escape() + else: + self.advance(self.i + 1) + if self.i >= len(self.text) or self.text[self.i] != "'": + self.fail("Character literal must contain exactly one character or escape.") + self.advance(self.i + 1) + + def following_code_text(self, start): + """Peek through trivia without moving or changing source evidence positions.""" + text, end = self.text, len(self.text) + while start < end: + if text[start] in " \t\r\n": + start += 1 + elif text.startswith("--", start): + close = text.find("\n", start + 2) + start = end if close == -1 else close + elif text.startswith("/-", start): + depth, start = 1, start + 2 + while start < end and depth: + if text.startswith("/-", start): + depth, start = depth + 1, start + 2 + elif text.startswith("-/", start): + depth, start = depth - 1, start + 2 + else: + start += 1 + if depth: + return "" # The main lexer will refuse this unterminated comment. + else: + return text[start:start + 2] + return "" + + def native_review_form(self, token, end): + if token != "native": + return None + if self.previous_code == "+": + return "+native" + layout_field = self.brace_depth > 0 and not self.line_has_code + if (self.previous_code in ("{", ",", "with") or layout_field) and self.following_code_text(end) == ":=": + return "native:=" + return None + + def scan(self): + while self.i < len(self.text): + char = self.text[self.i] + if char in " \t\r\n": + self.advance(self.i + 1) + elif self.text.startswith("--", self.i): + end = self.text.find("\n", self.i + 2) + self.advance(len(self.text) if end == -1 else end) + elif self.text.startswith("/-", self.i): + self.block_comment() + elif char == '"': + self.string() + self.mark_code("literal") + elif char == "r" and self.raw_string(): + self.mark_code("literal") + continue + elif char == "'": + self.character() + self.mark_code("literal") + elif char == "«": + end = self.text.find("»", self.i + 1) + if end == -1: + self.fail("Unterminated quoted identifier.") + self.finding("QUOTED_IDENTIFIER", self.text[self.i:end + 1], + "Quoted identifier is preserved and requires separate name resolution.") + self.advance(end + 1) + self.mark_code("quoted_identifier") + elif identifier_start(char): + end = self.i + 1 + while end < len(self.text) and identifier_rest(self.text[end]): + end += 1 + token = self.text[self.i:end] + if token.endswith("!") and end < len(self.text) and self.text[end] == '"': + self.finding("STRING_INTERPOLATION", token, + "String macro/interpolation expansion is outside lexical coverage.") + if token in REVIEW_TOKENS: + code, detail = REVIEW_TOKENS[token] + self.finding(code, token, detail) + native_form = self.native_review_form(token, end) + if native_form is not None: + self.finding("UNCERTIFIED_EXECUTION", token, + "Native compiler option requires separate evidence.", review_form=native_form) + if not token.isascii(): + self.finding("UNSUPPORTED_SYNTAX", token, + "Unicode identifier syntax requires Lean parsing; token is preserved.") + self.advance(end) + self.mark_code(token) + elif char.isascii() and (char.isdigit() or char in "()[]{}.,:;=+-*/<>|&!%^~?@"): + self.advance(self.i + 1) + self.mark_code(char) + else: + self.finding("UNSUPPORTED_SYNTAX", char, + "Unknown, quotation, antiquotation or command syntax requires review.") + self.advance(self.i + 1) + self.mark_code(char) + return self.findings + + +def empty_report(): + return { + "tool": "cbz_source_audit", "schema_version": 1, + "scope": "Pinned local source inventory and bounded lexical review only; no Layer A certification.", + "aggregate_status": "NOT_ESTABLISHED", + "gate_claims": {"G1": "NOT_ESTABLISHED", "CBZ-0": "NOT_ESTABLISHED"}, + "input_integrity": {"status": "NOT_ESTABLISHED", "expected_files": 0, + "scanned_files": 0, "discovered_files": [], "unlisted_files": []}, + "coverage": {"lean_grammar_and_elaboration": "NOT_ESTABLISHED", + "kernel_checking": "NOT_ESTABLISHED", "dependency_closure": "NOT_ESTABLISHED", + "trusted_baseline_comparison": "NOT_ESTABLISHED", + "concurrent_tree_snapshot_atomicity": "NOT_ESTABLISHED"}, + "blocking_coverage": [{"invariant": invariant, "status": "NOT_ESTABLISHED", + "claim": claim, "required_evidence": evidence} + for invariant, claim, evidence in BLOCKING_COVERAGE], + "files": [], "findings": [], "errors": [], + } + + +def audit_manifest(manifest): + report = empty_report() + root_fd = None + try: + manifest_path = absolute_input_path(manifest) + data = read_absolute(manifest_path, MAX_MANIFEST_BYTES) + report["manifest_sha256"] = hashlib.sha256(data).hexdigest() + root, entries = parse_manifest(data, manifest_path) + report["root"] = str(root) + report["input_integrity"]["expected_files"] = len(entries) + report["files"] = [{"path": entry["path"], "expected_sha256": entry["sha256"], "status": "ERROR"} + for entry in entries] + root_fd = open_directory(root) + discovered, errors = discover_sources(root_fd) + report["errors"].extend(errors) + report["input_integrity"]["discovered_files"] = sorted(discovered) + expected = {entry["path"] for entry in entries} + unlisted = sorted(discovered - expected) + report["input_integrity"]["unlisted_files"] = unlisted + for path in unlisted: + report["errors"].append(AuditFailure("UNLISTED_FILE", path, + "Discovered .lean source is absent from the pinned manifest.").error) + for entry, record in zip(entries, report["files"]): + path = entry["path"] + if path not in discovered: + report["errors"].append(AuditFailure("MISSING_FILE", path, + "Pinned file was not discovered; it is not skipped.").error) + continue + try: + source = read_relative(root_fd, path) + record["sha256"] = hashlib.sha256(source).hexdigest() + record["bytes"] = len(source) + if record["sha256"] != entry["sha256"]: + raise AuditFailure("HASH_MISMATCH", path, "Source bytes differ from the pinned manifest.") + try: + text = source.decode("utf-8", errors="strict") + except UnicodeDecodeError as error: + raise AuditFailure("INVALID_UTF8", path, "Source is not strict UTF-8.", + byte_offset=error.start) from error + lexer = Lexer(text, path) + try: + lexer.scan() + finally: + report["findings"].extend(lexer.findings) + record["status"] = "SCANNED" + report["input_integrity"]["scanned_files"] += 1 + except AuditFailure as failure: + report["errors"].append(failure.error) + except AuditFailure as failure: + report["errors"].append(failure.error) + except (OSError, ValueError, RecursionError) as error: + report["errors"].append(AuditFailure("AUDIT_ERROR", str(manifest), + f"Audit could not complete ({type(error).__name__}).").error) + finally: + if root_fd is not None: + os.close(root_fd) + report["errors"].sort(key=lambda item: (item["path"], item["code"], item["detail"])) + report["findings"].sort(key=lambda item: (item["path"], item["byte_offset"], item["code"])) + if not report["errors"]: + report["input_integrity"]["status"] = "CHECKED" + if report["findings"]: + report["aggregate_status"] = "REVIEW_REQUIRED" + return report + + +def render_report(report): + return json.dumps(report, sort_keys=True, ensure_ascii=True, indent=2) + "\n" + + +def write_output(path, report): + """Create new evidence outside the source tree; never overwrite an input.""" + if "root" not in report: + raise AuditFailure("OUTPUT_ERROR", path, "Report output requires a known audited source root.") + path = absolute_input_path(path) + if report["root"] is not None and path.is_relative_to(Path(report["root"])): + raise AuditFailure("OUTPUT_ERROR", path, "Report output must be outside the audited source root.") + parent_fd = open_directory(path.parent) + fd = None + try: + fd = os.open(path.name, os.O_WRONLY | os.O_CREAT | os.O_EXCL | + os.O_NOFOLLOW | os.O_NONBLOCK, 0o600, dir_fd=parent_fd) + check_entry(os.fstat(fd), path) + output = render_report(report).encode("utf-8") + with os.fdopen(fd, "wb") as target: + fd = None + target.write(output) + finally: + if fd is not None: + os.close(fd) + os.close(parent_fd) + + +def main(argv=None): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--manifest", required=True, type=Path) + parser.add_argument("--output", type=Path, + help="Create a new report outside the source root; existing paths are never overwritten.") + args = parser.parse_args(argv) + report = audit_manifest(args.manifest) + if args.output is not None: + try: + write_output(args.output, report) + except (OSError, AuditFailure) as error: + report["aggregate_status"] = "NOT_ESTABLISHED" + report["errors"].append(AuditFailure("OUTPUT_ERROR", args.output, + f"Could not retain a new report ({type(error).__name__}).").error) + sys.stdout.write(render_report(report)) + return 1 if report["aggregate_status"] == "REVIEW_REQUIRED" else 2 + + +if __name__ == "__main__": + sys.exit(main())