From fe3b10e2d173ed9c986b68d855b9b160bda74eec Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 17:54:45 -0700 Subject: [PATCH] test(prove): a cut-off Kani run names what failed and what never finished `just prove` ran its 97 fast harnesses under one 30-minute `timeout` and nothing else. On a machine busy with other builds the run was ended with exit 124 and no harness named, so a proof that failed could not be told from a proof that was only slow, and the answer was to run it again and hope. A gate that cannot say which is not a gate. Now each harness has its own cap (Kani's --harness-timeout, KANI_HARNESS_CAP, 900 s: the fast harnesses each take under four minutes on a busy machine, the longer ones are in kani_slow under their own caps), the whole set's cap is KANI_FAST_CAP (1800 s as before), and a run that does not verify every harness lists each one that failed, each that ran past its cap, and each that never finished. No proof changes: the caps bound how long a harness may take, not what it must show, and the count of verified harnesses and the cover check are as they were. Checked: the report read against a real run in which one harness passed and one hit a 15 s cap (the second named as past its cap); and `KANI_FAST_CAP=2 just _kani fast` exits 1 naming all 97 as not finished. A full `just prove` is the batch's gate. Co-Authored-By: Claude --- docs/verification.md | 14 +++++++++++++- justfile | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/docs/verification.md b/docs/verification.md index d93fe254..8d3f629a 100644 --- a/docs/verification.md +++ b/docs/verification.md @@ -1240,7 +1240,9 @@ just prove-all # both ``` `just prove` runs every Kani harness but the justfile's `kani_slow`, in -parallel (`-j $(nproc)`), the whole run under a 30-minute timeout; fetches +parallel (`-j $(nproc)`), each harness under a 15-minute cap +(`KANI_HARNESS_CAP`, seconds) and the whole run under a 30-minute one +(`KANI_FAST_CAP`, seconds); fetches and builds bookspec's Lean proofs (seconds; the git dependency is pinned in `verify/lean/lakefile.toml` and its manifest); and fails if any theorem depends on anything beyond Lean's standard axioms (`propext`, @@ -1257,6 +1259,16 @@ list without spending a verification. CI's weekly run does both, on two runners (`.github/workflows/scheduled.yml`). Kani downloads its pinned nightly and CBMC into `~/.kani` on first use. +**A run that is cut off says what it left (2026-11-09).** Until then the +fast set had the one 30-minute cap and nothing else: on a machine busy +with other builds `timeout` ended it with exit 124, and the output named +neither a failed harness nor an unfinished one, so "red" could not be +told from "slow". Now a run that does not verify every harness lists +each one that failed, each that ran past its own cap, and each that +never finished, and a cut-off run says so and how to give it longer: +`KANI_FAST_CAP=7200 just prove`. The caps are not the proof: raising one +changes how long a harness may take, never what it must show. + **Why the split (2026-10-21, the P3 surface review).** With all of P3 the suite is 55 harnesses. One `just prove` at four jobs (a CI runner's cores), on the development laptop under heavy load from other work (a diff --git a/justfile b/justfile index 89898966..e74bbca7 100644 --- a/justfile +++ b/justfile @@ -213,8 +213,38 @@ _kani set: if [ "{{set}}" = fast ]; then args=() for h in $names; do args+=(--harness "$h"); done - timeout 1800 cargo kani -j "$(nproc)" --output-format terse --exact "${args[@]}" | tee "$logs/fast.log" - checked "$logs/fast.log" "$(wc -l <<<"$names")" + # Two caps, both in seconds. KANI_HARNESS_CAP is one harness's: + # Kani stops that harness and carries on with the rest. + # KANI_FAST_CAP is the whole set's: on a machine busy with other + # builds the set needs more than its 30 minutes, and until + # 2026-11-09 it was cut off there with exit 124 and nothing named. + # Either way the harnesses that failed and the ones that never + # finished are listed below. + status=0 + timeout "${KANI_FAST_CAP:-1800}" cargo kani -j "$(nproc)" --output-format terse --exact \ + -Z unstable-options --harness-timeout "${KANI_HARNESS_CAP:-900}s" "${args[@]}" | + tee "$logs/fast.log" || status=$? + if [ "$status" != 0 ] || ! checked "$logs/fast.log" "$(wc -l <<<"$names")"; then + # With -j Kani prints a harness's whole block when it ends: + # "Checking harness ..." down to its "VERIFICATION:-" line. + awk -v cap="${KANI_HARNESS_CAP:-900}" ' + NR == FNR { asked[$1] = 1; next } + match($0, /Checking harness [^ ]+\.\.\./) { h = substr($0, RSTART + 17, RLENGTH - 20); next } + /VERIFICATION:- / && h != "" { ended[h] = 1; if ($0 !~ /VERIFICATION:- SUCCESSFUL/) failed[h] = 1; last = h; h = ""; next } + /CBMC timed out/ && last != "" { timed[last] = 1 } + END { + for (n in asked) { + if (n in timed) print "Kani: ran past its " cap " s (KANI_HARNESS_CAP): " n + else if (n in failed) print "Kani: FAILED: " n + else if (!(n in ended)) print "Kani: not finished: " n + } + }' <(printf '%s\n' $names) "$logs/fast.log" | sort >&2 + if [ "$status" = 124 ]; then + echo "Kani: the fast set was cut off at ${KANI_FAST_CAP:-1800} s; on a busy machine give it longer (KANI_FAST_CAP=7200 just prove)" >&2 + fi + echo "Kani (fast): not verified (exit $status), see $logs/fast.log" >&2 + exit 1 + fi else cargo kani --only-codegen --output-format terse failed=0