open-standards/wai/wai-verify/check_shards.py
Transaction Science 5e6792fd3b
Some checks failed
standards workspaces build + test / jouleclaw-rs (pull_request) Failing after 4m54s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 4s
no-vanity-metrics / WAI public text names no comparison (pull_request) Successful in 4s
no-vanity-metrics / WAI public text names no company or product (pull_request) Successful in 6s
standards workspaces build + test / aac-rs (pull_request) Successful in 3m6s
standards workspaces build + test / arl-rs (pull_request) Successful in 1m22s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m41s
standards workspaces build + test / eoc-rs (pull_request) Successful in 2m7s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 1m3s
standards workspaces build + test / map-rs (pull_request) Successful in 51s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 1m10s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m32s
standards workspaces build + test / mesh-rs (pull_request) Successful in 44s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m18s
standards workspaces build + test / joulehook-rs (pull_request) Successful in 1m20s
standards workspaces build + test / sense-rs (pull_request) Successful in 1m13s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m23s
standards workspaces build + test / openpay (pull_request) Successful in 3m33s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 4m3s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m31s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 14s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 8m24s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 8s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 24s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 49s
wai formal verification (integer core) / every harness in one shard (pull_request) Successful in 13s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 15m31s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 55s
wai-ops integer operators / linux-aarch64 (pull_request) Successful in 1m39s
wai formal verification (integer core) / kani (arith) (pull_request) Successful in 10m16s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 16m4s
wai formal verification (integer core) / kani (plan) (pull_request) Successful in 5m46s
wai formal verification (integer core) / kani (sound) (pull_request) Successful in 11m2s
wai formal verification (integer core) / kani (stage) (pull_request) Successful in 3m25s
wai formal verification (integer core) / kani (stage-long) (pull_request) Successful in 21m33s
wai formal verification (integer core) / kani (isqrt512) (pull_request) Successful in 44m49s
WAI JPEG-AI whole decode (pinned inputs, required) / fetch pinned JPEG-AI inputs → whole decode + pixel hash, required (pull_request) Successful in 1m24s
wai-ops integer operators / linux-x86_64 (pull_request) Successful in 54s
wai formal verification (integer core) / kani (integer-core) (pull_request) Successful in 4m57s
wai-ops integer operators / wasm32 under Node (pull_request) Successful in 23s
wai-ops integer operators / independent checker (Python) (pull_request) Successful in 12s
wai-ops integer operators / wasm32-wasip2 (wasmtime) (pull_request) Successful in 39s
workflow hygiene / every workflow supersedes its own queue (pull_request) Successful in 5s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 4m41s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 2m31s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 5m52s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 22m37s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 51s
wai formal verification (integer core) / kani (rans64-t2) (pull_request) Successful in 1h2m1s
wai-ops integer operators / macos-arm64 (pull_request) Successful in 13m4s
wai-ops proofs: the rans64 totality proof runs where its memory fits
k26 peaks at about 28 GiB of resident memory (688 s, measured); the linux runner has
15 GiB shared by two jobs and CBMC ran out of memory there. It gets a shard of its own
on the macos runner. The Kani install step no longer rewrites a host's live install,
and check_shards reads a matrix line that names its runner and refuses one it cannot
read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 09:50:31 -04:00

85 lines
3.9 KiB
Python

#!/usr/bin/env python3
"""Every model-checker harness this crate hosts runs in exactly one shard.
`.github/workflows/wai-formal-verification.yml` splits the harnesses into shards, each
a list of `--harness` filters (a harness runs when its full name contains a filter).
This finds every `#[kani::proof]` function in the sources `src/lib.rs` includes by
`#[path]` (with the modules those files declare in turn), gives each its full name,
and fails unless each name is matched by the filters of exactly one shard, and each
filter matches at least one harness. A harness no shard runs would be compiled and
never checked; one in two shards would be checked twice. A harness gated by
`cfg(kani_open)` (one whose window the checker did not finish within a shard's
budget) is compiled only on request, so no shard runs it; it is counted apart.
Usage: python3 -I check_shards.py <repository root>
Standard library only.
"""
import os
import re
import sys
PATH_MOD = re.compile(r'#\[path = "([^"]+)"\]\s*(?:pub(?:\(crate\))? )?mod (\w+);')
PLAIN_MOD = re.compile(r'^(?:pub(?:\(crate\))? )?mod (\w+);', re.M)
PROOF = re.compile(r'(#\[cfg\(kani_open\)\]\s*)?#\[kani::proof\]\s*(?:#\[[^\]]*\]\s*)*(?:pub(?:\(crate\))? )?fn (\w+)')
# A matrix line names its shard first and its filters last; between them it may give
# other plain fields, such as the runner (`os: macos`).
SHARD = re.compile(r'^\s*- \{ shard: ([\w-]+),(?: *[\w-]+: [\w-]+,)* *harness: "([^"]*)"', re.M)
MATRIX_LINE = re.compile(r'^\s*- \{ shard: ', re.M)
OPEN = []
def harnesses(path, prefix, out):
"""The harnesses of the module in `path` and of the modules it declares. A harness
gated by `cfg(kani_open)` is compiled only on request and runs in no shard; it is
listed apart."""
src = open(path, encoding="utf-8").read()
for gated, name in PROOF.findall(src):
(OPEN if gated else out).append(prefix + name)
base = os.path.dirname(path)
stem = os.path.splitext(os.path.basename(path))[0]
# A `mod x;` in a.rs is a/x.rs or a/x/mod.rs; in mod.rs or lib.rs, x.rs beside it.
here = base if stem in ("mod", "lib") else os.path.join(base, stem)
for name in PLAIN_MOD.findall(src):
for cand in (os.path.join(here, name + ".rs"), os.path.join(here, name, "mod.rs")):
if os.path.exists(cand):
harnesses(cand, prefix + name + "::", out)
break
def main(root):
lib = os.path.join(root, "wai", "wai-verify", "src", "lib.rs")
src = open(lib, encoding="utf-8").read()
names = []
for rel, name in PATH_MOD.findall(src):
harnesses(os.path.normpath(os.path.join(os.path.dirname(lib), rel)), name + "::", names)
wf = open(os.path.join(root, ".github", "workflows", "wai-formal-verification.yml"), encoding="utf-8").read()
shards = [(s, f.split()) for s, f in SHARD.findall(wf)]
failures = 0
if not names or not shards:
print("FAIL no harnesses or no shards found")
return 1
# A shard line this cannot read would drop its filters unseen.
if len(shards) != len(MATRIX_LINE.findall(wf)):
print("FAIL %d shard lines, %d read" % (len(MATRIX_LINE.findall(wf)), len(shards)))
return 1
for n in names:
hit = [s for s, fs in shards if any(f in n for f in fs)]
if len(hit) != 1:
print("FAIL harness %s is in %d shards: %s" % (n, len(hit), ", ".join(hit) or "none"))
failures += 1
for s, fs in shards:
for f in fs:
if not any(f in n for n in names):
print("FAIL shard %s: the filter %s matches no harness" % (s, f))
failures += 1
print("%d harnesses in %d shards; %d gated by cfg(kani_open), in none" % (len(names), len(shards), len(OPEN)))
for s, fs in shards:
print(" %-14s %d" % (s, sum(1 for n in names if any(f in n for f in fs))))
return 1 if failures else 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1] if len(sys.argv) > 1 else "."))