Skip to content

Commit fbcee14

Browse files
Replace policy-violating CI helpers with tested native Rust contracts
1 parent acc7a95 commit fbcee14

20 files changed

Lines changed: 1061 additions & 449 deletions

‎.github/workflows/ci-integrity.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ jobs:
117117
done
118118
exit "$fail"
119119
120+
- name: Native CI helper contracts
121+
run: |
122+
set -euo pipefail
123+
cargo test --locked --manifest-path tools/ci/Cargo.toml
124+
cargo clippy --locked --manifest-path tools/ci/Cargo.toml --all-targets -- -D warnings
125+
bash scripts/ci/test-inventory-failure.sh
126+
120127
- name: Repository path portability
121128
run: |
122129
set -euo pipefail

‎.github/workflows/proven-tests.yml‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
- name: Derive the run report (cells must select real tests)
8282
run: |
8383
bash scripts/ci/annotate.sh "proven:ledger" -- \
84-
python3 scripts/proven/verify-ledger.py \
84+
bash scripts/proven/verify-ledger.sh \
8585
--inventory /tmp/inventory.json \
8686
--ledger proven/ledger.json \
8787
--root . \
@@ -101,19 +101,8 @@ jobs:
101101
--proven-tests-root . \
102102
--fail-on-defect \
103103
--output /tmp/proven-aggregate.json
104-
python3 - <<'PY'
105-
import json
106-
agg = json.load(open('/tmp/proven-aggregate.json'))
107-
records = agg['proven_tests']
108-
assert len(records) == 1, records
109-
record = records[0]
110-
assert record['defects'] == [], record['defects']
111-
summary = record['summary']
112-
assert summary['total'] > 0, summary
113-
print(f"proven-tests: {summary['passed']}/{summary['total']} passed, "
114-
f"{summary['covered_cells']}/{summary['cat_aspect_cells']} cells, "
115-
f"{summary['actually_proven']} actually-proven")
116-
PY
104+
jq -e '.proven_tests | type == "array" and length == 1 and (.[0].defects == []) and (.[0].summary.total | type == "number" and . > 0)' /tmp/proven-aggregate.json > /dev/null
105+
jq -r '.proven_tests[0].summary | "proven-tests: \(.passed)/\(.total) passed, \(.covered_cells)/\(.cat_aspect_cells) cells, \(.actually_proven) actually-proven"' /tmp/proven-aggregate.json
117106
118107
- name: Publish to the job summary
119108
if: always()

‎.github/workflows/recon.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.fail_on_new }}" = "false" ]; then
143143
args="--no-fail"
144144
fi
145-
python3 scripts/recon/compare.py \
145+
bash scripts/recon/compare.sh \
146146
--baseline recon/baseline.json \
147147
--assail "$SARIF_DIR/assail.json" \
148148
--pons "$SARIF_DIR/pons.json" \

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# RSR-compliant .gitignore
22
/target
3+
/tools/ci/target/
34
/reports/
45
/verisimdb-data/
56
/runtime/

‎Justfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ proven:
305305
set -euo pipefail
306306
cargo build --locked --release
307307
bash scripts/proven/inventory.sh /tmp/panic-attack-tests.json
308-
python3 scripts/proven/verify-ledger.py \
308+
bash scripts/proven/verify-ledger.sh \
309309
--inventory /tmp/panic-attack-tests.json \
310310
--ledger proven/ledger.json \
311311
--root . \
@@ -324,7 +324,7 @@ recon:
324324
set -euo pipefail
325325
mkdir -p recon-out
326326
cargo run --release --quiet -- assail . --output recon-out/assail.json --quiet
327-
python3 scripts/recon/compare.py \
327+
bash scripts/recon/compare.sh \
328328
--baseline recon/baseline.json \
329329
--assail recon-out/assail.json \
330330
--pons /dev/null \

‎docs/CI-CD.adoc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ never declared**, so:
201201

202202
* `scripts/proven/inventory.sh` asks the test runner what tests exist, per
203203
binary;
204-
* `scripts/proven/verify-ledger.py` fails when a cell selects no executed test,
204+
* `scripts/proven/verify-ledger.sh` fails when a cell selects no executed test,
205205
when an executed test is claimed by nothing, or when a stronger tier is
206206
claimed than the evidence supports;
207207
* the resulting report is fed to `panic-attack aggregate --proven-tests
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: CC-BY-SA-4.0
2+
= Native CI helper migration — 7 November 2026
3+
4+
Fresh governance execution exposed two production Python helpers that violate
5+
the estate language policy. They are replaced by the Rust programs in
6+
`tools/ci`, called through the existing-purpose shell entrypoints. Workflow,
7+
Justfile and ledger pointers are updated together; no language-policy waiver
8+
or scanner exclusion is added. The workflow's inline aggregate check uses
9+
its already required jq, with the original nonempty/defect-free assertions.
10+
11+
The standalone dev-tool workspace has its own generated lockfile and is not
12+
an application binary or a new root test binary. It retains the ledger's
13+
coordinate selectors, first matching buckets, remainder ratchet, declared
14+
absence conflict check and proof-file requirements. Test identities now name
15+
both the test binary and test name so equal names cannot collapse across
16+
binaries. Empty inventories, missing coordinates and invalid proof tiers
17+
remain failures; a failed claim does not overwrite an existing report.
18+
19+
Recon preserves category-debt comparison, bootstrap baselines and explicit
20+
`--no-fail` advisory mode. Missing, invalid or unrecognised scanner reports
21+
are unavailable, never clean: strict mode fails and no replacement baseline
22+
is proposed. SARIF rule identifiers are recognised alongside JSON categories.
23+
24+
The inventory producer now preserves a failed Cargo enumeration instead of
25+
turning it into an empty successful list. It does not write an empty/partial
26+
inventory. A dedicated CI fault test injects a failing test binary and an
27+
empty suite; this Bash control is a hosted Linux check, not a claimed Windows
28+
execution.
29+
30+
Local Windows evidence: six library controls and three CLI integration tests
31+
pass. They cover stale/empty claims, binary-name collisions, absent/covered
32+
conflicts, missing proof warrants, remainder bounds, malformed scanner data,
33+
debt regressions and unavailable/advisory behaviour. The actual repository
34+
ledger's taxonomy and selectors are checked. CI runs these controls and
35+
all-targets Clippy with warnings denied before testing the real inventory.
36+
37+
Creusot with Pearlite contracts: `OPEN`, not run for these CI utilities.
38+
Verus: `OPEN`, not run. Executable contract tests are not formal proofs;
39+
framework provenance tiers are retained and no independent witness is claimed.

‎proven/ledger.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
},
4343
"doctrine": [
4444
"A cell is covered only when a test that actually ran selected it. Nothing",
45-
"here declares coverage; scripts/proven/verify-ledger.py derives it from a",
45+
"here declares coverage; scripts/proven/verify-ledger.sh derives it from a",
4646
"test inventory produced by `cargo test -- --list` in the same commit.",
4747
"Tiers are the framework's three: Actually-Proven (a machine-checked proof",
4848
"ladder exists), Provisionally-Proven (typed assertions, example/property",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: MPL-2.0
3+
set -euo pipefail
4+
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5+
work="$(mktemp -d)"
6+
trap 'rm -rf "$work"' EXIT
7+
mkdir -p "$work/bin" "$work/repo/tests"
8+
printf '' > "$work/repo/tests/broken.rs"
9+
cat > "$work/bin/cargo" <<'MOCK'
10+
#!/usr/bin/env bash
11+
case " $* " in
12+
*' --lib '*) printf 'library_control: test\n' ;;
13+
*) exit 42 ;;
14+
esac
15+
MOCK
16+
chmod +x "$work/bin/cargo"
17+
cd "$work/repo"
18+
set +e
19+
PATH="$work/bin:$PATH" bash "$root/scripts/proven/inventory.sh" "$work/inventory.json"
20+
status=$?
21+
set -e
22+
[ "$status" -eq 42 ] || { echo 'failed enumeration was not preserved' >&2; exit 1; }
23+
[ ! -e "$work/inventory.json" ] || { echo 'partial inventory was emitted' >&2; exit 1; }
24+
cat > "$work/bin/cargo" <<'MOCK'
25+
#!/usr/bin/env bash
26+
exit 0
27+
MOCK
28+
set +e
29+
PATH="$work/bin:$PATH" bash "$root/scripts/proven/inventory.sh" "$work/empty.json"
30+
status=$?
31+
set -e
32+
[ "$status" -eq 1 ] && [ ! -e "$work/empty.json" ] || { echo 'empty inventory was certified' >&2; exit 1; }
33+
echo 'Inventory failure and empty-suite controls passed.'

‎scripts/proven/inventory.sh‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ add() {
3030
}
3131

3232
# Library unit tests (module::path::name).
33-
add "panic_attack" "$(cargo test --locked --lib -- --list 2>/dev/null || true)"
33+
names="$(cargo test --locked --lib -- --list)" || {
34+
code=$?; echo 'inventory: library test enumeration failed' >&2; exit "$code";
35+
}
36+
add "panic_attack" "$names"
3437

3538
# Integration test binaries, one per tests/*.rs file.
3639
for f in tests/*.rs; do
@@ -40,11 +43,14 @@ for f in tests/*.rs; do
4043
# shell-driven fixtures, not Rust test binaries
4144
verisimdb_e2e) continue ;;
4245
esac
43-
add "$bin" "$(cargo test --locked --test "$bin" -- --list 2>/dev/null || true)"
46+
names="$(cargo test --locked --test "$bin" -- --list)" || {
47+
code=$?; echo "inventory: test enumeration failed for $bin" >&2; exit "$code";
48+
}
49+
add "$bin" "$names"
4450
done
4551

52+
total="$(jq '[.[] | length] | add // 0' "$tmp")"
53+
bins="$(jq 'length' "$tmp")"
54+
[ "$total" -gt 0 ] || { echo "inventory: no tests found — refusing to certify an empty suite" >&2; exit 1; }
4655
jq -S . "$tmp" > "$OUT"
47-
total="$(jq '[.[] | length] | add // 0' "$OUT")"
48-
bins="$(jq 'length' "$OUT")"
4956
echo "inventory: $total test(s) in $bins binar(ies) -> $OUT"
50-
[ "$total" -gt 0 ] || { echo "inventory: no tests found — refusing to certify an empty suite" >&2; exit 1; }

0 commit comments

Comments
 (0)