Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/atoma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/proven-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
32 changes: 32 additions & 0 deletions docs/status/ATOMA-PILOT-ALPHA.adoc
Original file line number Diff line number Diff line change
@@ -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.
71 changes: 71 additions & 0 deletions docs/status/ATOMA-PROVEN-TESTS.adoc
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 9 additions & 2 deletions scripts/atoma-consumer-heap-gate.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
#!/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"
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
Expand All @@ -29,14 +35,15 @@ 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
for slice in ownership ownership-controls lifetime lifetime-controls; 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"
Expand Down
81 changes: 81 additions & 0 deletions scripts/atoma-proven-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
# 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"
29 changes: 29 additions & 0 deletions scripts/atoma-registry-benchmark.sh
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 2 additions & 1 deletion scripts/atoma-source-profile-replay.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
20 changes: 20 additions & 0 deletions scripts/setup-atoma-proven-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0
# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
# 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"
Loading
Loading