From 4cf2f939d20b89eaeeae7a27965201976abce9d1 Mon Sep 17 00:00:00 2001 From: t Date: Mon, 16 Nov 2026 23:08:26 +0000 Subject: [PATCH 1/3] fix(census): do not count identifiers such as partial' as the Idris2 partial annotation The proof-holes rules end in a bare \b. A prime is not a word character, so `partial'`, `believe_me'`, `sorry'`, `axiom'` matched as the keyword. The hypatia receipt fixture ReceiptP5MissingExact.idr defines a total function `partial'` and was counted as unsafe = 4 (true count 0). Idris2, Agda, Lean, Rocq, Isabelle and Dedukti rules now use (? Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo --- scripts/census/proof-holes.sh | 42 ++++++++++++------------ tests/census/proof_holes_control_test.sh | 28 ++++++++++++++++ 2 files changed, 49 insertions(+), 21 deletions(-) diff --git a/scripts/census/proof-holes.sh b/scripts/census/proof-holes.sh index 08d2fda..e7f82ce 100644 --- a/scripts/census/proof-holes.sh +++ b/scripts/census/proof-holes.sh @@ -56,37 +56,37 @@ for d in "${EXTRA_EX[@]}"; do EXCLUDE+=(--exclude-dir="$d"); done # (comment-regex is kept for the rule format; comments are now blanked by # strip_comments before matching, so it is no longer consulted.) RULES=$(cat <<'EOF' -agda~*.agda,*.lagda,*.lagda.md~^\s*--~axiom~postulate~^\s*postulate\b +agda~*.agda,*.lagda,*.lagda.md~^\s*--~axiom~postulate~^\s*postulate(?![\w']) agda~*.agda,*.lagda,*.lagda.md~^\s*--~hole~{! !}~\{! agda~*.agda,*.lagda,*.lagda.md~^\s*--~unsafe~TERMINATING~\{-#\s*(NON_)?TERMINATING\s*#-\} agda~*.agda,*.lagda,*.lagda.md~^\s*--~unsafe~NO_POSITIVITY_CHECK~\{-#\s*NO_POSITIVITY_CHECK agda~*.agda,*.lagda,*.lagda.md~^\s*--~unsafe~NO_UNIVERSE_CHECK~\{-#\s*NO_UNIVERSE_CHECK agda~*.agda,*.lagda,*.lagda.md~^\s*--~unsafe~--type-in-type~--type-in-type -agda~*.agda,*.lagda,*.lagda.md~^\s*--~axiom~primTrustMe~\bprimTrustMe\b -idris2~*.idr,*.lidr~^\s*(--|\|\|\|)~hole~believe_me~\bbelieve_me\b -idris2~*.idr,*.lidr~^\s*(--|\|\|\|)~hole~assert_total~\bassert_total\b -idris2~*.idr,*.lidr~^\s*(--|\|\|\|)~hole~assert_smaller~\bassert_smaller\b -idris2~*.idr,*.lidr~^\s*(--|\|\|\|)~hole~idris_crash~\bidris_crash\b +agda~*.agda,*.lagda,*.lagda.md~^\s*--~axiom~primTrustMe~(?\s*)?\(?\s*Off spark~*.adb,*.ads~^\s*--~unsafe~Skip_Proof~Skip_(Flow_And_)?Proof spark~*.adb,*.ads~^\s*--~axiom~Annotate False_Positive~Annotate\s*\(\s*GNATprove\s*,\s*(False_Positive|Intentional) -dedukti~*.dk,*.lp~^\s*(//|\(;)~hole~admit~\badmit(ted)?\b +dedukti~*.dk,*.lp~^\s*(//|\(;)~hole~admit~(?/dev/null || { echo "FAIL: a control alone must not fail --fail-on any"; exit 1; } echo "PASS: negative-control findings classed control, real and prose-only files still axioms" + +# Identifier controls: a keyword followed by a prime is an identifier, not the +# keyword (`'` is not a word character, so a bare \b matched `partial'`). Found +# in hyperpolymath/hypatia tests/accept/ReceiptP5MissingExact.idr, which defines +# a total function `partial'` and was counted as 4 `unsafe` lines. +P=$(mktemp -d); trap 'rm -rf "$F" "$P"' EXIT +printf '%s\n' 'module Ids' "partial' : Body -> Nat" "partial' x = 0" "partial'' : Nat" 'partial_sum : Nat' 'partialApply : Nat' \ + "y = believe_me' 1" "z = assert_total' 2" > "$P/Ids.idr" +printf '%s\n' "theorem t' : True := sorry'" "axiom' x : Nat" > "$P/Ids.lean" +printf '%s\n' "Axiom' f : nat." > "$P/Ids.v" +got=$(bash "$SCAN" --fail-on none "$P" | jq -r 'select(.class=="hole" or .class=="unsafe" or (.class=="axiom" and .marker!="undefined declaration")) | "\(.file):\(.line) \(.class) \(.marker)"') +[[ -z "$got" ]] || { echo "FAIL: identifiers with a trailing prime were counted:"; echo "$got"; exit 1; } +# Positive controls: the real keywords still count. +rm "$P"/* +printf '%s\n' 'module Real' 'partial' 'f : Nat -> Nat' ' partial' 'g : Nat -> Nat' 'partial h : Nat' 'y = believe_me 1' > "$P/Real.idr" +printf '%s\n' 'theorem t : True := sorry' 'axiom a : Nat' > "$P/Real.lean" +got=$(bash "$SCAN" --fail-on none "$P" | jq -r 'select(.marker!="undefined declaration") | "\(.file):\(.line) \(.class) \(.marker)"' | sort) +want=$(sort <<'WANT' +Real.idr:2 unsafe partial +Real.idr:4 unsafe partial +Real.idr:6 unsafe partial +Real.idr:7 hole believe_me +Real.lean:1 hole sorry +Real.lean:2 axiom axiom +WANT +) +[[ "$got" == "$want" ]] || { echo "FAIL: real keywords no longer counted"; diff <(printf '%s\n' "$want") <(printf '%s\n' "$got") || true; exit 1; } +echo "PASS: trailing-prime identifiers not counted, real partial/believe_me/sorry/axiom still counted" From 8e5af280335eed7d76588b1222b1858e72fdba08 Mon Sep 17 00:00:00 2001 From: t Date: Mon, 16 Nov 2026 23:20:18 +0000 Subject: [PATCH 2/3] ci: emit the required CI/gate check from proven-tests.yml The Branch-Floor ruleset requires a status check named exactly `CI/gate`. This repo never emitted it. Add job `ci-gate` (name: CI/gate) to proven-tests.yml, which triggers on every pull_request with no path filter and starts and runs today. It needs every other job in the workflow (proven-suite), runs with if: always(), uses no third-party action, and exits 0 only when every required job succeeded (a skip passes only for a job configured as skipped-by-design behind a detector that itself succeeded). Failure, cancelled, missing or empty results all fail the gate. Map the context in required-contexts-allow.txt so check-required-contexts.sh keeps verifying it. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo --- .github/workflows/proven-tests.yml | 79 +++++++++++++++++++ .machine_readable/required-contexts-allow.txt | 1 + 2 files changed, 80 insertions(+) diff --git a/.github/workflows/proven-tests.yml b/.github/workflows/proven-tests.yml index 241c96c..9c482e3 100644 --- a/.github/workflows/proven-tests.yml +++ b/.github/workflows/proven-tests.yml @@ -147,3 +147,82 @@ jobs: set -euo pipefail export PATH="$HOME/.cargo/bin:$PATH" STANDARDS_DIR="$RUNNER_TEMP/standards" bash scripts/run-proven-suite.sh --require-zig --bench + + # ========================================================================== + # Required status check "CI/gate" (Branch-Floor ruleset). + # The check context is this job's name. It waits for every other job in this + # workflow and runs even when one fails, is cancelled or is skipped; it exits + # 0 only when every required job succeeded (or was skipped by design behind a + # detector job that itself succeeded). Pattern: hyperpolymath/hypatia ci.yml. + # ========================================================================== + ci-gate: + name: CI/gate + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: {} + needs: [proven-suite] + if: always() + steps: + - name: Require every needed job to have succeeded + env: + NEEDS_JSON: ${{ toJSON(needs) }} + REQUIRED_JOBS: "proven-suite" + ADVISORY_JOBS: "" + DESIGNED_SKIPS: "" + run: | + set -euo pipefail + summary="${GITHUB_STEP_SUMMARY:-/dev/null}" + result_of() { jq -r --arg j "$1" '.[$j].result // "missing"' <<< "$NEEDS_JSON"; } + in_list() { case " $2 " in *" $1 "*) return 0 ;; esac; return 1; } + detector_of() { + local pair + for pair in $DESIGNED_SKIPS; do + if [ "${pair%%:*}" = "$1" ]; then echo "${pair#*:}"; return 0; fi + done + return 1 + } + row() { printf '| %s | %s | %s | %s |\n' "$@" | tee -a "$summary"; } + { + echo "### CI/gate" + echo + echo "| job | result | role | verdict |" + echo "|---|---|---|---|" + } | tee -a "$summary" + fail=0 + total=0 + passed=0 + for j in $REQUIRED_JOBS; do + total=$((total + 1)) + r=$(result_of "$j") + case "$r" in + success) v="ok"; passed=$((passed + 1)) ;; + skipped) + if d=$(detector_of "$j") && [ "$(result_of "$d")" = "success" ]; then + v="ok (designed skip; detector $d succeeded)"; passed=$((passed + 1)) + else + v="FAIL (skipped without a successful detector)"; fail=1 + fi ;; + *) v="FAIL (result must be success)"; fail=1 ;; + esac + row "$j" "$r" required "$v" + done + for j in $ADVISORY_JOBS; do + row "$j" "$(result_of "$j")" advisory "not gating" + done + for j in $(jq -r 'keys[]' <<< "$NEEDS_JSON"); do + if ! in_list "$j" "$REQUIRED_JOBS $ADVISORY_JOBS"; then + row "$j" "$(result_of "$j")" unclassified "FAIL (job is in needs but neither required nor advisory)" + fail=1 + fi + done + if [ "$total" -eq 0 ]; then + echo "::error::no required jobs configured" + fail=1 + fi + msg="required jobs: $total; satisfied: $passed; advisory: $(wc -w <<< "$ADVISORY_JOBS")" + echo "$msg" | tee -a "$summary" + if [ "$fail" -ne 0 ]; then + echo "::error::CI/gate failed ($msg)" + exit 1 + fi + echo "CI/gate passed ($msg)" diff --git a/.machine_readable/required-contexts-allow.txt b/.machine_readable/required-contexts-allow.txt index 1f429f7..a87b767 100644 --- a/.machine_readable/required-contexts-allow.txt +++ b/.machine_readable/required-contexts-allow.txt @@ -9,3 +9,4 @@ # renamed or path-filtered workflow can never silently strand pull requests # behind an unsatisfiable ruleset check (issue #219 class). scan / gitleaks => .github/workflows/secret-scanner.yml +CI/gate => .github/workflows/proven-tests.yml From 24800e60bdf10c8faee7a97c743f880ab805e311 Mon Sep 17 00:00:00 2001 From: t Date: Mon, 16 Nov 2026 23:29:20 +0000 Subject: [PATCH 3/3] ci: name the positional parameters in the CI/gate helper functions SonarCloud rule githubactions:S7679 flags $1 and $2 used directly in result_of, in_list and detector_of. Each is now assigned to a named local. No change in behaviour: the gate's decision logic was re-run locally with success, failure, cancelled, skipped, empty, designed-skip and unclassified-job inputs and gives the same exit codes as before. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01J4QvDiW8qD4f2JDQJ4buGo --- .github/workflows/proven-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/proven-tests.yml b/.github/workflows/proven-tests.yml index 9c482e3..08031c5 100644 --- a/.github/workflows/proven-tests.yml +++ b/.github/workflows/proven-tests.yml @@ -172,12 +172,12 @@ jobs: run: | set -euo pipefail summary="${GITHUB_STEP_SUMMARY:-/dev/null}" - result_of() { jq -r --arg j "$1" '.[$j].result // "missing"' <<< "$NEEDS_JSON"; } - in_list() { case " $2 " in *" $1 "*) return 0 ;; esac; return 1; } + result_of() { local job="$1"; jq -r --arg j "$job" '.[$j].result // "missing"' <<< "$NEEDS_JSON"; } + in_list() { local needle="$1" haystack="$2"; case " $haystack " in *" $needle "*) return 0 ;; esac; return 1; } detector_of() { - local pair + local job="$1" pair for pair in $DESIGNED_SKIPS; do - if [ "${pair%%:*}" = "$1" ]; then echo "${pair#*:}"; return 0; fi + if [ "${pair%%:*}" = "$job" ]; then echo "${pair#*:}"; return 0; fi done return 1 }