diff --git a/.github/workflows/atoma.yml b/.github/workflows/atoma.yml index eab722f..76c7d6f 100644 --- a/.github/workflows/atoma.yml +++ b/.github/workflows/atoma.yml @@ -16,6 +16,18 @@ concurrency: cancel-in-progress: true jobs: + report_contract: + name: Proven executed-report contract + runs-on: ubuntu-24.04 + timeout-minutes: 5 + steps: + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - run: bash scripts/setup-atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests" + - run: bash tests/atoma-proven-tests-contract.sh "$RUNNER_TEMP/proven-tests" + + word_source: name: Universal source interpretation runs-on: ubuntu-24.04 @@ -130,10 +142,14 @@ jobs: if-no-files-found: error heap_consumers: - name: Heap lifetime consumer replay - needs: [scalar, heap_source] + name: Heap lifetime consumer replay (${{ matrix.profile }}) + needs: [scalar, heap_source, report_contract] runs-on: ubuntu-24.04 timeout-minutes: 45 + strategy: + fail-fast: false + matrix: + profile: [public-header, registry-lifetime] steps: - uses: actions/checkout@v7.0.1 with: @@ -142,19 +158,25 @@ jobs: run: bash scripts/atoma-ci-toolchain.sh - name: Provision independent replay tools run: bash scripts/atoma-ci-replay-toolchain.sh + - name: Provision pinned Proven Tests and Benches contract + run: bash scripts/setup-atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests" - name: Fresh native consumers and source-bound lifetime replay - run: bash scripts/atoma-consumer-heap-gate.sh + env: + PILOT_PROFILE: ${{ matrix.profile }} + run: bash scripts/atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests" build/proven-reports/consumers "atoma-$PILOT_PROFILE" -- bash scripts/atoma-consumer-heap-gate.sh "$PILOT_PROFILE" - uses: actions/upload-artifact@v7.0.2 if: always() with: - name: heap-consumer-evidence-${{ github.sha }} - path: build/atoma-evidence/heap-consumers/ + name: heap-consumer-evidence-${{ matrix.profile }}-${{ github.sha }} + path: | + build/atoma-evidence/heap-consumers/ + build/proven-reports/consumers/ if-no-files-found: error retention-days: 30 core_soundness: name: Existing source and replay gates - needs: [scalar, word_source, wrapper_source] + needs: [scalar, word_source, wrapper_source, report_contract] runs-on: ubuntu-24.04 timeout-minutes: 45 steps: @@ -165,8 +187,10 @@ jobs: run: bash scripts/atoma-ci-toolchain.sh - name: Provision source-model replay tools run: bash scripts/atoma-ci-replay-toolchain.sh + - name: Provision pinned Proven Tests and Benches contract + run: bash scripts/setup-atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests" - name: Run required source, contract and proof checks - run: bash scripts/atoma-gate.sh + run: bash scripts/atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests" build/proven-reports/core atoma-core -- bash scripts/atoma-gate.sh - name: Preserve evidence even on failure if: always() uses: actions/upload-artifact@v7.0.2 @@ -175,6 +199,7 @@ jobs: path: | build/atoma-evidence/ examples/atoma/frame-v1/witness/ + build/proven-reports/core/ if-no-files-found: error retention-days: 30 diff --git a/.github/workflows/proven-tests.yml b/.github/workflows/proven-tests.yml index a314311..8d36f7a 100644 --- a/.github/workflows/proven-tests.yml +++ b/.github/workflows/proven-tests.yml @@ -4,7 +4,7 @@ # proven-tests.yml — Full 3-outcome testing, proof honesty, data-format, and # Six-Sigma leave-one-out benchmark regression suite grounded in # hyperpolymath/proven-tests-and-benches and hyperpolymath/ijson-jcs. -name: Proven Tests and Benches +name: Estate hygiene and template benchmarks on: pull_request: @@ -21,7 +21,7 @@ concurrency: jobs: proven-suite: - name: Proven 3-outcome test & bench suite + name: Estate hygiene and template benchmark suite runs-on: ubuntu-24.04 timeout-minutes: 20 env: diff --git a/docs/status/ATOMA-PILOT-ALPHA.adoc b/docs/status/ATOMA-PILOT-ALPHA.adoc new file mode 100644 index 0000000..f952bce --- /dev/null +++ b/docs/status/ATOMA-PILOT-ALPHA.adoc @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MPL-2.0 += Atoma pilot alpha qualification + +Run the Atoma soundness workflow from a clean checkout of the candidate commit. +On GitHub, the workflow provisions pinned tools, fetches the consumer commits +and publishes the proof, native test and benchmark artifacts. To dispatch it +for a candidate branch with the GitHub CLI: + +[source,bash] +---- +gh workflow run atoma.yml --ref YOUR_CANDIDATE_BRANCH +---- + +The required soundness and CI gates cover the scalar, universal word, wrapper +and heap lifetime campaigns. Each pilot has a separate heap consumer replay +job and artifact: + +* Proven's public header directory contains the Idris-backed exported Zig ABI + tests, forwarder mutation refusals and correctness-checked benchmark samples. +* UAA's registry lifetime directory contains the retained-context tests and + negative controls. Its benchmark measures register, callback, unregister and + detached-call refusal through the pinned Zig registry, in four build modes. + Each mode warms up for 32 cycles and reports three samples of 20,000 cycles. +* The report framework records executed gate outcomes. The separate proof + artifacts carry the scoped formal evidence and the refusal controls. + +The samples characterize these workloads under the recorded runner and compiler. +Regression thresholds require a baseline measured on comparable runners. +See link:../decisions/ATOMA-HEAP-BOUNDARY.adoc[the heap boundary decision] for +the supported source profiles and caller obligations. Native allocation +authority, pointer validity and continuous lifetime remain caller premises. +General Zig compiler refinement remains open. diff --git a/docs/status/ATOMA-PROVEN-TESTS.adoc b/docs/status/ATOMA-PROVEN-TESTS.adoc new file mode 100644 index 0000000..51b5e73 --- /dev/null +++ b/docs/status/ATOMA-PROVEN-TESTS.adoc @@ -0,0 +1,71 @@ +// SPDX-License-Identifier: MPL-2.0 += Atoma: Proven Tests and Benches integration + +The canonical framework is `hyperpolymath/proven-tests-and-benches` at +`f90bacbe3a5fa1869239fcb9175757509464aa13`. Atoma uses its downstream +schema-version-2 emitter and conformance validator, directly from an exact, +clean checkout. This portable reporting interface requires Python 3, not the +framework's Idris2 0.7.0 library toolchain. Atoma's existing pinned proof and Zig +toolchains remain authoritative for their respective gates. + +The checkout helper and report wrapper read the same +`verification/atoma/proven-tests-framework.rev`. Python bytecode writes are +disabled so importing upstream modules cannot dirty this read-only dependency. + +CI wraps an actual command, for example: + +[source,bash] +---- +bash scripts/setup-atoma-proven-tests.sh "$RUNNER_TEMP/proven-tests-framework" +export PROVEN_TESTS_DIR="$RUNNER_TEMP/proven-tests-framework" +bash tests/atoma-proven-tests-contract.sh "$PROVEN_TESTS_DIR" +bash scripts/atoma-proven-tests.sh "$PROVEN_TESTS_DIR" \ + build/proven-reports/core atoma-core -- bash scripts/atoma-gate.sh +bash scripts/atoma-proven-tests.sh "$PROVEN_TESTS_DIR" \ + build/proven-reports/consumers atoma-consumers -- bash scripts/atoma-consumer-heap-gate.sh +---- + +Each output directory must be new. It retains the actual command, log, exit +status, elapsed milliseconds, source/framework revisions, framework script +digests, emitted facts, validated report, and evidence checksums. CI must +upload these alongside native/prover artifacts even on failure. A nonzero +command remains nonzero after report validation. Setup/dependency failures +never become successful checks. Cancellation can leave an incomplete directory; +missing reports and interrupted jobs are missing evidence, not passed tests. +The wrapper does not import arbitrary report files or report skipped/pending +commands as executed. Exit 2 and shell execution/signal errors are `error`; +other nonzero command exits are `failed`. + +Report artifacts live under `build/proven-reports/`, separately from existing +`build/atoma-evidence/` proof artifacts. The fixed report filenames are +`command.json`, `environment.txt`, `execution.log`, `exit-status.txt`, +`executed-facts.json`, `proven-run-report.json`, `conformance.log`, and +`SHA256SUMS`. Native benchmark measurements remain in the consumer gate's own +evidence directory. No benchmark or formal-proof receipt is inferred from the +report wrapper's elapsed time. + +The reporting boundary has executable controls for observed success, ordinary +failure, setup failure, missing-command status, stale success artifacts, and +forged coverage. Commands are trusted CI inputs. The local controls exercise +the reporting boundary; native and proof negative controls remain in their +own gates. One entry represents one executed gate group, not its internal +test count. Coverage is one distinct Contract/Safety cell, and never summed +across reports as if each group established a new cell. + +All downstream execution entries deliberately remain `Unproven` in this +framework's taxonomy. This does not erase the separately replayed Agda, Lean, +Rocq or Idris2 evidence. A conformant JSON report authenticates neither execution +nor mathematical claims: the pinned validator checks supplied structure and +counts, not proof terms or source correspondence. The workflow execution and +retained logs provide operational evidence; the independent existing proof +gates provide their stated formal evidence. No theorem citation or successful +native test is promoted to `ActuallyProven` by this adapter. + +This pin's schema uses 238 category/aspect cells. It is not the estate's newer +252-cell taxonomy and does not establish full test coverage. The inherited +`run-proven-suite.sh` and `template_bench.sh` exercise estate hygiene and report +tooling. Their template baseline does not measure Atoma or Proven library +performance. Actual Proven library workloads retain their own benchmark +artifacts and correctness controls; this adapter records the enclosing gate's +outcome and wall-clock duration, not a native performance baseline. Establish +fresh remote measurements before imposing a performance regression threshold. diff --git a/scripts/atoma-consumer-heap-gate.sh b/scripts/atoma-consumer-heap-gate.sh index 701836c..d694350 100644 --- a/scripts/atoma-consumer-heap-gate.sh +++ b/scripts/atoma-consumer-heap-gate.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash # SPDX-License-Identifier: MPL-2.0 set -euo pipefail +case "${1:-both}" in + both) profiles=(public-header registry-lifetime) ;; + public-header|registry-lifetime) profiles=("$1") ;; + *) echo 'Expected public-header, registry-lifetime or both' >&2; exit 2 ;; +esac +[[ $# -le 1 ]] root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) parent="$root/build/atoma-evidence/heap-consumers" mkdir -p "$parent" @@ -8,7 +14,7 @@ out=$(mktemp -d "$parent/run.XXXXXXXX") work=$(mktemp -d) echo INCOMPLETE > "$out/result.txt" trap 'status=$?; if ((status)); then echo FAIL > "$out/result.txt"; fi; rm -rf "$work"' EXIT -for profile in public-header registry-lifetime; do +for profile in "${profiles[@]}"; do if [[ $profile == public-header ]]; then repo=proven; pin=proven.pin source=ffi/zig/src/core.zig; dependency=ffi/zig/src/main_refc.zig @@ -29,7 +35,7 @@ for profile in public-header registry-lifetime; do echo "$revision" > "$out/$profile/revision.txt" if [[ $profile == public-header ]]; then EVIDENCE_DIR="$out/$profile/native" bash "$checkout/scripts/test-header-bridge.sh" - for marker in result.txt ownership/result.txt ownership-controls/result.txt boundary/result.txt boundary-controls/result.txt; do + for marker in result.txt ownership/result.txt ownership-controls/result.txt boundary/result.txt boundary-controls/result.txt export-controls/result.txt benchmark/result.txt; do [[ $(cat "$out/$profile/native/$marker") == PASS ]] done else @@ -37,6 +43,7 @@ for profile in public-header registry-lifetime; do EVIDENCE_DIR="$out/$profile/$slice" bash "$checkout/scripts/check-registry-$slice.sh" [[ $(cat "$out/$profile/$slice/result.txt") == PASS ]] done + bash "$root/scripts/atoma-registry-benchmark.sh" "$checkout" "$out/$profile/benchmark" fi git -C "$checkout" diff --exit-code "$revision" -- > "$out/$profile/native-recheck.txt" bash "$root/scripts/atoma-source-profile-replay.sh" "$profile" "$checkout/$source" "$checkout/$dependency" "$out/$profile/replay" diff --git a/scripts/atoma-proven-tests.sh b/scripts/atoma-proven-tests.sh new file mode 100644 index 0000000..95ff88b --- /dev/null +++ b/scripts/atoma-proven-tests.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# Execute a real gate, then submit its observed outcome to the pinned framework. +# A conformant report may describe a FAILED run: preserve the command's status. +set -euo pipefail +root=$(cd "$(dirname "$0")/.." && pwd) +pin=$(cat "$root/verification/atoma/proven-tests-framework.rev") +[[ $pin =~ ^[0-9a-f]{40}$ ]] || { echo 'invalid framework pin' >&2; exit 2; } +export PYTHONDONTWRITEBYTECODE=1 +if [[ $# -lt 5 || $4 != -- ]]; then + echo 'usage: atoma-proven-tests.sh FRAMEWORK_DIR NEW_OUTPUT_DIR GROUP -- COMMAND [ARG...]' >&2 + exit 2 +fi +framework=$1 +out=$2 +group=$3 +shift 4 +[[ $group =~ ^[a-z][a-z0-9-]*$ ]] || { echo 'invalid group name' >&2; exit 2; } +for tool in git jq python3 date sha256sum tee; do + command -v "$tool" >/dev/null || { echo "missing report dependency: $tool" >&2; exit 2; } +done +framework=$(cd "$framework" && pwd) || { echo 'framework directory is missing' >&2; exit 2; } +emitter=integrations/contract/proven-tests/downstream/emit_report.py +validator=integrations/contract/check_contract.py +check_framework() { + [[ $(git -C "$framework" rev-parse HEAD) == "$pin" ]] && + [[ -z $(git -C "$framework" status --porcelain --untracked-files=all) ]] && + [[ -f $framework/$emitter && -f $framework/$validator ]] +} +check_framework || { echo 'framework checkout is missing, dirty or not the exact pinned revision' >&2; exit 2; } +# Refuse stale reports, including a previous success left by an interrupted run. +[[ ! -e $out ]] || { echo "output already exists: $out" >&2; exit 2; } +mkdir -p "$out" +out=$(cd "$out" && pwd) +jq -n --args '$ARGS.positional' -- "$@" > "$out/command.json" +{ + printf 'framework_commit=%s\n' "$pin" + printf 'subject_commit=%s\n' "$(git rev-parse HEAD)" + printf 'group=%s\n' "$group" + git status --porcelain + sha256sum "$framework/$emitter" "$framework/$validator" +} > "$out/environment.txt" +start=$(date +%s%N) +set +e +"$@" 2>&1 | tee "$out/execution.log" +pipeline=("${PIPESTATUS[@]}") +set -e +stop=$(date +%s%N) +rc=${pipeline[0]} +[[ ${pipeline[1]} == 0 ]] || { echo 'could not capture execution evidence' >&2; exit 2; } +[[ $start =~ ^[0-9]+$ && $stop =~ ^[0-9]+$ && $stop -ge $start ]] || { + echo 'invalid execution clock' >&2; exit 2; +} +duration_ms=$(((stop - start) / 1000000)) +printf '%s\n' "$rc" > "$out/exit-status.txt" +check_framework || { echo 'framework changed during execution' >&2; exit 2; } +outcome=failed +[[ $rc != 0 ]] || outcome=passed +if [[ $rc == 2 || $rc -ge 126 ]]; then outcome=error; fi +jq -n --arg group "$group" --arg outcome "$outcome" --argjson rc "$rc" \ + --argjson duration "$duration_ms" --arg now "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ + --arg pin "$pin" '{ + suite: "atoma-executed-gates", generated_at: $now, + toolchain: {report_framework_commit: $pin}, cat_aspect_cells: 238, + tests: [{module: "Atoma.executed-gates", name: $group, line: 0, + category: "Contract", aspect: "Safety", tier: "Unproven", + outcome: $outcome, duration_ms: $duration, + message: ("Executed command exit " + ($rc|tostring) + "; see execution.log and command.json"), + fixture_obligation: "Fixtures", + silence: {source: "RuntimeConstructed", description: (if $rc == 0 then "Observed gate completed with exit zero; raw command and output are retained." else "Gate did not complete successfully: this run supplies no passing silence observation; see retained command and output." end)}, + firing: {source: "RuntimeConstructed", defect_class: "A nonzero gate status must remain failed/error even if its report is conformant; exercised by tests/atoma-proven-tests-contract.sh."} + }] + }' > "$out/executed-facts.json" +python3 "$framework/$emitter" "$out/executed-facts.json" "$out/proven-run-report.json" +python3 "$framework/$validator" validate-file "$out/proven-run-report.json" proven-tests \ + | tee "$out/conformance.log" +sha256sum "$out/command.json" "$out/execution.log" "$out/exit-status.txt" \ + "$out/environment.txt" "$out/executed-facts.json" "$out/proven-run-report.json" \ + "$out/conformance.log" > "$out/SHA256SUMS" +exit "$rc" diff --git a/scripts/atoma-registry-benchmark.sh b/scripts/atoma-registry-benchmark.sh new file mode 100644 index 0000000..53380a7 --- /dev/null +++ b/scripts/atoma-registry-benchmark.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +set -euo pipefail +[[ $# == 2 ]] +checkout=$(cd "$1" && pwd) +out=$2 +root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +registry="$checkout/src/interface/ffi/src" +fixture="$root/tests/consumer-heap/registry-benchmark.zig" +mkdir "$out" +out=$(cd "$out" && pwd) +echo INCOMPLETE > "$out/result.txt" +work=$(mktemp -d) +trap 'status=$?; if ((status)); then echo FAIL > "$out/result.txt"; fi; rm -rf "$work"' EXIT +zig=${ZIG:-zig} +[[ $("$zig" version) == 0.15.2 ]] +git -C "$checkout" rev-parse HEAD > "$out/revision.txt" +sha256sum "$fixture" "$registry"/{registry,registry_state,protocol_tag}.zig > "$out/inputs.sha256" +{ "$zig" version; uname -a; } > "$out/environment.txt" +printf 'caller_mode\tsample\titerations\tcallbacks\telapsed_ns\n' > "$out/samples.tsv" +for mode in Debug ReleaseSafe ReleaseFast ReleaseSmall; do + "$zig" build-exe -lc -O "$mode" --dep registry -Mroot="$fixture" \ + -Mregistry="$registry/registry.zig" -femit-bin="$work/bench" > "$out/build-$mode.log" 2>&1 \ + || { cat "$out/build-$mode.log" >&2; exit 1; } + timeout -k 5 60 "$work/bench" >> "$out/samples.tsv" +done +[[ $(wc -l < "$out/samples.tsv") == 13 ]] +sha256sum -c "$out/inputs.sha256" > "$out/input-recheck.txt" +echo PASS > "$out/result.txt" diff --git a/scripts/atoma-source-profile-replay.sh b/scripts/atoma-source-profile-replay.sh index e2a5381..f53c325 100644 --- a/scripts/atoma-source-profile-replay.sh +++ b/scripts/atoma-source-profile-replay.sh @@ -63,7 +63,8 @@ capsule() { capsule > "$out/AtomaProof.v" cd "$out" for library in "${libraries[@]}"; do - timeout -k 5 180 coqc -q "$library.v" > "$library-assumptions.txt" 2>&1 + printf 'Replay %s: compile %s (360s limit)\n' "$profile" "$library" + timeout -k 5 360 coqc -q "$library.v" > "$library-assumptions.txt" 2>&1 done sha256sum ./*.v ./*.vo ./*.zig > before.sha256 timeout -k 5 180 echidna prove "$out/AtomaProof.v" --prover coq --timeout 150 --output json > echidna.json 2> echidna.stderr \ diff --git a/scripts/setup-atoma-proven-tests.sh b/scripts/setup-atoma-proven-tests.sh new file mode 100644 index 0000000..5443b4f --- /dev/null +++ b/scripts/setup-atoma-proven-tests.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# Remote CI preparation only; never removes or repairs an existing checkout. +set -euo pipefail +[[ $# == 1 ]] || { echo 'usage: setup-atoma-proven-tests.sh RUNNER_TEMP_CHECKOUT_DIR' >&2; exit 2; } +root=$(cd "$(dirname "$0")/.." && pwd) +pin=$(cat "$root/verification/atoma/proven-tests-framework.rev") +[[ $pin =~ ^[0-9a-f]{40}$ ]] || { echo 'invalid framework pin' >&2; exit 2; } +command -v git >/dev/null || { echo 'git is required' >&2; exit 2; } +destination=$1 +[[ ! -e $destination ]] || { echo 'framework destination already exists' >&2; exit 2; } +git init --quiet "$destination" +git -C "$destination" config core.autocrlf false +git -C "$destination" remote add origin https://github.com/hyperpolymath/proven-tests-and-benches.git +git -C "$destination" fetch --quiet --depth=1 origin "$pin" +git -C "$destination" -c advice.detachedHead=false checkout --quiet --detach FETCH_HEAD +[[ $(git -C "$destination" rev-parse HEAD) == "$pin" ]] || { echo 'framework revision mismatch' >&2; exit 2; } +[[ -z $(git -C "$destination" status --porcelain --untracked-files=all) ]] || { echo 'framework checkout is dirty' >&2; exit 2; } +printf 'Prepared Proven Tests framework %s at %s\n' "$pin" "$destination" diff --git a/tests/atoma-proven-tests-contract.sh b/tests/atoma-proven-tests-contract.sh new file mode 100644 index 0000000..84b96b6 --- /dev/null +++ b/tests/atoma-proven-tests-contract.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: MPL-2.0 +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell +# Exercise the evidence boundary remotely; no prover or native build is needed. +set -euo pipefail +export PYTHONDONTWRITEBYTECODE=1 +[[ $# == 1 ]] || { echo 'usage: atoma-proven-tests-contract.sh FRAMEWORK_DIR' >&2; exit 2; } +framework=$(cd "$1" && pwd) +root=$(cd "$(dirname "$0")/.." && pwd) +scratch=$(mktemp -d) +trap 'rm -rf "$scratch"' EXIT +wrapper="$root/scripts/atoma-proven-tests.sh" +run_case() { + local code=$1 outcome=$2 observed=0 + bash "$wrapper" "$framework" "$scratch/run-$code" "fixture-$code" -- \ + bash -c 'printf "executed fixture %s\n" "$1"; exit "$1"' fixture "$code" || observed=$? + [[ $observed == "$code" ]] + jq -e '.entries | length == 1' "$scratch/run-$code/proven-run-report.json" >/dev/null + jq -e --arg outcome "$outcome" '.entries[0].result.outcome == $outcome and .entries[0].provenance == "Unproven" and .summary.actually_proven == 0' \ + "$scratch/run-$code/proven-run-report.json" >/dev/null + grep -Fx "executed fixture $code" "$scratch/run-$code/execution.log" +} +run_case 0 passed +run_case 1 failed +run_case 2 error +run_case 127 error +rc=0 +bash "$wrapper" "$framework" "$scratch/missing-command" missing-command -- \ + "$scratch/no-such-command" || rc=$? +[[ $rc == 127 ]] +jq -e '.entries[0].result.outcome == "error" and .summary.covered_cells == 0' \ + "$scratch/missing-command/proven-run-report.json" >/dev/null +# A well-formed failed report MUST NOT turn its executed gate green. +jq -e '.summary.failed == 1 and .summary.covered_cells == 0' "$scratch/run-1/proven-run-report.json" >/dev/null +jq -e '.entries[0].fixtures.silence.description | contains("no passing silence observation")' \ + "$scratch/run-1/proven-run-report.json" >/dev/null +# No reuse of old success artifacts, no unexecuted synthetic inputs. +rc=0 +bash "$wrapper" "$framework" "$scratch/run-0" stale -- true || rc=$? +[[ $rc == 2 ]] +# The canonical checker must reject invented coverage on an observed failure. +jq '.summary.covered_cells=1 | .summary.lattice_covered=1' "$scratch/run-1/proven-run-report.json" > "$scratch/forged.json" +rc=0 +python3 "$framework/integrations/contract/check_contract.py" validate-file "$scratch/forged.json" proven-tests || rc=$? +[[ $rc == 1 ]] +echo 'PASS executed-result reporting: success, failure, setup error, missing command, stale output and forged coverage' diff --git a/tests/consumer-heap/proven.pin b/tests/consumer-heap/proven.pin index 0aa76d0..72cfc60 100644 --- a/tests/consumer-heap/proven.pin +++ b/tests/consumer-heap/proven.pin @@ -1 +1 @@ -24bc1fbed4f250be32b9aa3cb27d130fe75cfcd3 +7c726bf43ffc455c394b6dafa3a04b3608b9654d diff --git a/tests/consumer-heap/registry-benchmark.zig b/tests/consumer-heap/registry-benchmark.zig new file mode 100644 index 0000000..7c8f5ef --- /dev/null +++ b/tests/consumer-heap/registry-benchmark.zig @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MPL-2.0 +const std = @import("std"); +const api = @import("registry"); +const builtin = @import("builtin"); + +fn callback(raw: ?*anyopaque, bytes: ?[*]const u8, len: usize) callconv(.c) c_int { + const count: *usize = @ptrCast(@alignCast(raw orelse return 4)); + const input = bytes orelse return 4; + if (len != 2 or input[0] != 11 or input[1] != 22) return 4; + count.* += 1; + return 0; +} + +fn exercise(registry: *api.Registry, iterations: usize) !usize { + var calls: usize = 0; + const input = [_]u8{ 11, 22 }; + for (0..iterations) |_| { + if (api.uaa_registry_register(registry, 1, callback, &calls) != 0) return error.RegisterFailed; + const status = api.uaa_registry_call(registry, 1, &input, input.len); + if (api.uaa_registry_unregister(registry, 1) != 0) return error.UnregisterFailed; + if (status != 0) return error.CallFailed; + if (api.uaa_registry_call(registry, 1, &input, input.len) != 11) return error.DetachFailed; + } + if (calls != iterations) return error.WrongCallbackCount; + return calls; +} + +pub fn main() !void { + const registry = api.uaa_registry_create() orelse return error.OutOfMemory; + errdefer _ = api.uaa_registry_destroy(registry); + _ = try exercise(registry, 32); + const iterations = 20_000; + for (0..3) |sample| { + var timer = try std.time.Timer.start(); + const calls = try exercise(registry, iterations); + const elapsed = timer.read(); + if (elapsed == 0) return error.NoTimerResolution; + var buffer: [256]u8 = undefined; + const row = try std.fmt.bufPrint(&buffer, "{s}\t{d}\t{d}\t{d}\t{d}\n", + .{ @tagName(builtin.mode), sample, iterations, calls, elapsed }); + try std.fs.File.stdout().writeAll(row); + } + if (api.uaa_registry_destroy(registry) != 0) return error.DestroyFailed; +} diff --git a/verification/atoma/proven-tests-framework.rev b/verification/atoma/proven-tests-framework.rev new file mode 100644 index 0000000..c7348cc --- /dev/null +++ b/verification/atoma/proven-tests-framework.rev @@ -0,0 +1 @@ +f90bacbe3a5fa1869239fcb9175757509464aa13