Skip to content

Hold repositories to running the proofs they hold (PT-006) - #378

Merged
leynos merged 5 commits into
mainfrom
pt-006-unrun-proof-code
Nov 15, 2026
Merged

leynos merged 5 commits into
mainfrom
pt-006-unrun-proof-code

Conversation

@leynos

@leynos leynos commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Part of DF12-102. The user's ruling (14 November 2026): proof code that nothing runs "should be checked". mxd, theoremc, polean and combobulate all held Kani or Verus proofs that no CI job ran, and the rule read them as "no prover in use", so they passed. This adds PT-006 to rust-prover-tooling and bumps it to 0.2.0.

PT-006 (error, not waivable)

A repository that holds proof code has at least one workflow step that runs the proofs. The only remedies are to run them or remove the code, so it stays out of waivable_clauses and an exception that names it is reported as EX-001.

Proof code is read with a parser, not a text search. tree-sitter-rust is a new pinned dependency (tree-sitter==0.25.2, tree-sitter-rust==0.24.2, the versions combobulate already pins), approved for this rule. Each .rs file outside tests, test, fixtures, examples, target and similar trees (the trees PT-004 skips) is parsed, with one entry per file and kind:

  • kani-harness: a kani::proof or kani::proof_for_contract attribute, resolved through the file's use declarations (use kani::proof as p; #[p], use kani::{any, proof}, use kani as k; #[k::proof], cfg_attr).
  • verus-block: a verus! or verus_! macro, use vstd::..., or #[verifier::...].
  • proof-generator: a quote! or quote_spanned! in a proc-macro crate ([lib] proc-macro = true, read with tomllib) that emits #[kani::proof] or verus!. theoremc is the one known case; a consumer of someone else's generator is out of scope for now.
  • Comments, strings, doc examples and .snap files are not proof code; a cfg(kani) helper module with no harness is not either. A file whose syntax error spans text naming a prover is unreadable, which raises EN-001: an unread file is not evidence of absence. A syntax error elsewhere is ignored, because syntax the parser predates cannot hide a proof.

A proof run is not an install or a version check. cargo kani and cargo-kani/kani-driver (not setup, list, --version), prover-tools kani exec and verus run, Verus on a proof file, cargo verus verify|focus|build. A step runs proofs when it runs one directly, runs make X where X or a prerequisite does (the Makefile's own variables are expanded from the makeutil report, which closes the $(VERUS_RUN) gap), runs a repository script whose commands do (shell, and Python list literals and command strings read from the ast), or sits in a workflow that installs through the shared action and runs a prover-named make kani*/make verus* target whose recipe does real work. The last shape is theoremc's: its harnesses are verified inside a test suite, so no recipe names cargo kani. When a workflow or the Makefile could not be read, whether CI runs the proofs is unknown and the finding is EN-001 (indeterminate), not PT-006.

A repository with proof code is now audited even if it names no prover, so PT-001 applies to it, which is the intent.

Evidence

Estate run over each repository's default branch (concordat artefact rule run equivalent, from this branch): 87 compliant, 1 indeterminate (gpui-component, an existing EN-001 for make steps in another directory, unrelated) and 1 noncompliant: netsuke. Netsuke holds Verus proofs (verus/canonical_value/main.rs) and runs only Kani in CI; its Makefile says it "deliberately has no Verus CI job". A first draft of this rule accepted any prover run for any proof code and read netsuke as compliant; matching a run to the proof code's own prover (a Kani harness needs a Kani run, a Verus block a Verus run) is what exposed it. That is a real finding, not a rule defect: netsuke needs a Verus job (polean's, leynos/polean#55, is the template) or the proof removed. The other repositories with proof code run it: axinite, chutoro, combobulate, mapsplice, mdtablefix, mxd, polean, theoremc, whitaker. The estate run from main follows the merge.

The rule does catch the real cases. Run over the revisions from before the proofs were wired into CI:

Repository Revision Result
mxd before leynos/mxd#724 PT-001, PT-006 (src/header_util/kani.rs)
theoremc before leynos/theoremc#250 PT-001, PT-006 (crates/theoremc-macros/src/render.rs, a generator)
polean before leynos/polean#55 PT-006 (verus/admission_spec.rs)
combobulate before leynos/combobulate#85 PT-006 (tools/calibration/cardinality-probe/src/lib.rs)

What changed

New facts module prover_proof_facts.py; prover_commands.runs_proofs and is_substantive; Makefile variable expansion in prover_make_facts; proof runs in the workflow and script facts; proof_code in the envelope and proof_runs per workflow (the policy tolerates their absence, so existing envelopes stay valid); the Rego rule and tests; new fixtures (run via make prerequisite, via script, via direct cargo kani, unrun harness, generator crate, use kani::proof as p alias, proof text only in a string, comment or snapshot, unparseable file, unreadable workflow, an attempted exception); README (the "What counts" paragraph rewritten, PT-006 added), rule.yaml (description, version: 0.2.0), manifest checksums, the users' guide, the design document and the roadmap. Unit tests cover the parser facts (31) and the run decision (40), and the BDD feature gains two scenarios through the real CLI.

The step-3 instruction to remove combobulate's exception from concordat's rust-prover-tooling data: there is none in this repository. The exception lived in combobulate's own .concordat, which leynos/combobulate#85 deleted with ADR 0011, so there is nothing to remove here.

Gate

make check-fmt, make lint (Ruff, pylint, df12 lints, interrogate 100%, spelling, Skylos), make typecheck, make markdownlint, make nixie, make test (3526 passed, 1 skipped), opa test (37 passed). The fixture-generator tests need the pinned makeutil 0.1.2; this host's ~/.cargo/bin/makeutil is 0.1.0, so the gate ran with the 0.1.2 build another row cached in concordat's scratch sidecar first on PATH.

Summary by Sourcery

Require repositories that hold Kani or Verus proof code to run the matching proofs in CI and audit the requirement with parser-based evidence.

New Features:

  • Add PT-006 to require repositories containing Kani or Verus proof code to run the corresponding proofs in CI.
  • Detect Kani harnesses, Verus code, and proc-macro proof generators from parsed Rust sources.
  • Track proof execution through workflows, Make targets, shell scripts, and Python process commands.

Bug Fixes:

  • Prevent repositories with unexecuted proof code from being treated as if they do not use a prover.
  • Distinguish proof execution from prover installation, listing, help, and version-check commands.
  • Match proof runs to the prover used by the held proof code and report unreadable inputs as indeterminate findings.

Enhancements:

  • Expand repository-defined Make variables when determining proof execution while preserving existing installer analysis behavior.
  • Make proof-code compliance non-waivable and include proof-code and proof-run evidence in the tooling envelope.

Build:

  • Add pinned tree-sitter and tree-sitter-rust dependencies and bump the rust-prover-tooling rule to version 0.2.0.

Documentation:

  • Document PT-006, supported proof-code forms, proof-run detection, indeterminate cases, and non-waivable exceptions.

Tests:

  • Add parser, command-analysis, policy, fixture, and end-to-end CLI coverage for proof detection and execution paths.

Chores:

  • Update rule manifests and artifact checksums for the expanded rust-prover-tooling policy.

@sourcery-ai

sourcery-ai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Sorry @leynos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 97 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 13745b9 and 019591f.

Files ignored due to path filters: 1

  • uv.lock is excluded by !**/*.lock
Files selected for processing: 24

  • concordat/rules/prover_commands.py
  • concordat/rules/prover_make_facts.py
  • concordat/rules/prover_proof_facts.py
  • concordat/rules/prover_rust_files.py
  • concordat/rules/prover_rust_use.py
  • concordat/rules/prover_script_facts.py
  • concordat/rules/prover_tooling_envelope.py
  • concordat/rules/prover_tooling_types.py
  • concordat/rules/prover_workflow_facts.py
  • docs/concordat-design.md
  • docs/roadmap.md
  • docs/users-guide.md
  • platform-standards/canon/lint-rules/rust-prover-tooling/README.md
  • platform-standards/canon/lint-rules/rust-prover-tooling/fixtures/data.json
  • platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling.rego
  • platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling_test.rego
  • platform-standards/canon/lint-rules/rust-prover-tooling/rule.yaml
  • platform-standards/canon/manifest.yaml
  • pyproject.toml
  • tests/bdd/features/rust_prover_tooling_rule_run.feature
  • tests/bdd/test_rust_prover_tooling_rule_run_steps.py
  • tests/unit/test_prover_proof_facts.py
  • tests/unit/test_prover_proof_runs.py
  • tests/unit/test_prover_tooling.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T23:39:48.014252Z 53f7588 PR opened
🔒 Security Review ✅ Completed 2026-11-14T23:45:33.586890Z 53f7588 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add the typed envelope fields for detected proof code and per-workflow proof runs so the policy and callers share a stable representation.

  • concordat/rules/prover_tooling_types.py L63-100, L119-123 (+3 small edits)

API

Expose proof-run classification and make recipe expansion as callable interfaces for the envelope and workflow analysis.

  • concordat/rules/prover_commands.py L36-38, L346-379
  • concordat/rules/prover_make_facts.py L188-200, L206

Uses of the API

Build the expanded Make rules, script proof facts, and parsed proof-code facts into the tooling envelope consumed by the policy.

  • concordat/rules/prover_tooling_envelope.py L20-23, L109-117, L131-135 (+2 small edits)

Use proof-code and workflow proof-run facts to audit repositories and enforce PT-006, including matching each proof kind to its prover and returning indeterminate findings when CI evidence is unavailable.

  • platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling.rego L1-10, L60-68, L288-368

Implementation

Define how Rust source files are selected and how their nearest Cargo manifest determines proc-macro status.

  • concordat/rules/prover_rust_files.py L1-115

Resolve Rust use trees into Kani attribute aliases and Verus-related imports for proof-code detection.

  • concordat/rules/prover_rust_use.py L1-194

Parse Rust syntax to identify Kani harnesses, Verus proof code, generators, and proof sources that cannot safely be judged.

  • concordat/rules/prover_proof_facts.py L1-250

Classify substantive commands and distinguish actual Kani or Verus proof runs from setup, listing, printing, and version checks.

  • concordat/rules/prover_commands.py L82-89, L270-345, L380-412

Expand repository-owned Make variables when requested, preserving the existing unexpanded recipe view for other checks.

  • concordat/rules/prover_make_facts.py L13, L154-187, L211-213

Extract proof-running commands from shell and Python scripts and propagate them through nested script calls.

  • concordat/rules/prover_script_facts.py L39-47, L61-65, L183-300 (+3 small edits)

Trace workflow commands through scripts and Make targets, account for dry runs, and associate each proof run with the prover it invokes.

  • concordat/rules/prover_workflow_facts.py L165-212, L388-429, L447-479 (+9 small edits)

Configuration

Pin the tree-sitter parser dependencies and bump the rule package to 0.2.0 with updated PT-006 metadata and manifest checksums.

  • platform-standards/canon/lint-rules/rust-prover-tooling/rule.yaml L14-20 (+3 small edits)
  • platform-standards/canon/manifest.yaml L266-271, L277
  • pyproject.toml L20-21

Documentation

Explain the expanded PT-006 scope, proof-code detection, proof-run paths, exception limits, and uncertainty cases for maintainers and users.

  • docs/concordat-design.md L3090-3111
  • docs/roadmap.md L720-723
  • docs/users-guide.md L907-913
  • platform-standards/canon/lint-rules/rust-prover-tooling/README.md L19-51, L78-115, L200-208 (+3 small edits)

Tests

Add policy fixtures and Rego tests for unrun proof code, matching prover runs, generators, unreadable workflows, and non-waivable PT-006 findings.

  • platform-standards/canon/lint-rules/rust-prover-tooling/fixtures/data.json L1291-1563
  • platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling_test.rego L154-191

Add unit coverage for parser-based proof-code detection and proof-run classification through direct commands, Make targets, scripts, and workflow cases.

  • tests/unit/test_prover_proof_facts.py L1-152
  • tests/unit/test_prover_proof_runs.py L1-370

Update the CLI-level BDD scenarios and existing audit expectation to account for repositories whose proof code now makes them subject to the rule.

  • tests/bdd/features/rust_prover_tooling_rule_run.feature L17-18
  • tests/bdd/test_rust_prover_tooling_rule_run_steps.py L31, L54-63
  • tests/unit/test_prover_tooling.py L189-194

Lock files and vendored code

Refresh the dependency lockfile for the newly pinned tree-sitter parser packages.

  • uv.lock L1034-1071 (+3 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@wafflecat-df12

Copy link
Copy Markdown
Collaborator

@coderabbitai At head 53f7588, can a repository that holds proof code pass PT-006 without any workflow step actually verifying it, or fail it although a step does? In particular: does the tree-sitter reading of Kani and Verus proof code (attribute alias resolution, verus! and use vstd, quote! generators in proc-macro crates, the has-error rule that makes a syntax error naming a prover unreadable) miss a real harness or flag a non-harness, and does expanding the Makefile's own variables in recipes change any existing PT-002 verdict (the installer checks should still read recipes as written)?

codescene-access[bot]

This comment was marked as outdated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53f7588122

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread concordat/rules/prover_proof_facts.py Outdated
Comment on lines +319 to +320
for directory, names, files in os.walk(checkout, onerror=refuse):
here = checkout.joinpath(directory)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid prefixing os.walk paths with the checkout again

When the checkout is a relative path such as Path("repo"), os.walk(checkout) already yields paths such as repo/src, so joining them to checkout produces repo/repo/src. The scanner consequently tries to read nonexistent files, records EN-001 errors and fails to detect the actual proof code. This affects relative checkout paths passed through run_rule and the CLI because the envelope passes the original checkout to scan_proof_code, not its resolved root. Use the directory yielded by os.walk directly, or normalize the checkout before walking it.

Useful? React with 👍 / 👎.

Comment thread concordat/rules/prover_script_facts.py Outdated
Comment on lines +209 to +215
case ast.Constant(value=str() as text):
words = text.split()
runs = len(words) > 1 and runs_proofs(words)
case _:
runs = False
if runs:
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish Python command data from command execution

When a workflow invokes a Python script containing print("cargo kani") or even just a """cargo kani""" docstring, this scan returns true despite the script never executing a prover. The same problem affects list literals such as print(["cargo", "kani"]). scan_scripts then records the script as a proof runner, and the workflow's resulting proof_runs suppresses PT-006 even though no proofs run. Inspect the execution context of these literals rather than accepting every matching string or list anywhere in the AST.

Useful? React with 👍 / 👎.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
printf '%s\n' '--- revision ---'
git rev-parse HEAD
git status --short
printf '%s\n' '--- relevant files ---'
fd -i 'prover.*(proof|command|make|workflow|script)|rust-prover-tooling' .
printf '%s\n' '--- change summary ---'
git diff --stat "$(git merge-base HEAD origin/main)" HEAD 2>/dev/null || true
printf '%s\n' '--- relevant symbols and policies ---'
rg -n -C 2 'PT-006|PT-002|runs_proofs|is_substantive|proof_code|proof_runs|makeutil' -g '*.py' -g '*.rego' -g '*.yaml' -g '*.feature' | head -n 350

Length of output: 26219


Script executed:

#!/bin/bash
for f in concordat/rules/prover_proof_facts.py concordat/rules/prover_commands.py concordat/rules/prover_make_facts.py concordat/rules/prover_script_facts.py concordat/rules/prover_workflow_facts.py concordat/rules/prover_tooling_envelope.py tests/unit/test_prover_proof_facts.py tests/unit/test_prover_proof_runs.py; do
  printf '\n--- outline %s ---\n' "$f"
  ast-grep outline "$f" --items all
done
printf '\n--- proof source ---\n'
cat -n concordat/rules/prover_proof_facts.py
printf '\n--- policy ---\n'
cat -n platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling.rego
printf '\n--- envelope ---\n'
cat -n concordat/rules/prover_tooling_envelope.py

Length of output: 52666


Script executed:

#!/bin/bash
for f in concordat/rules/prover_workflow_facts.py concordat/rules/prover_commands.py concordat/rules/prover_make_facts.py concordat/rules/prover_script_facts.py tests/unit/test_prover_proof_facts.py tests/unit/test_prover_proof_runs.py; do
  printf '\n--- %s ---\n' "$f"
  cat -n "$f"
done
printf '\n--- changes affecting previous behavior ---\n'
git diff "$(git merge-base HEAD origin/main)" HEAD -- concordat/rules/prover_make_facts.py concordat/rules/prover_workflow_facts.py concordat/rules/prover_tooling_envelope.py

Length of output: 88530


Script executed:

#!/bin/bash
printf '%s\n' '--- shell parser outline and implementation ---'
ast-grep outline concordat/rules/shell_commands.py --items all
cat -n concordat/rules/shell_commands.py
printf '%s\n' '--- documented PT-006 and make limits ---'
rg -n -C 4 'PT-006|substantive|variable|cfg_attr|proof_for_contract|unreadable|proof run|proof code' platform-standards/canon/lint-rules/rust-prover-tooling/README.md docs/users-guide.md docs/concordat-design.md | head -n 300
printf '%s\n' '--- make variable report schema and tests ---'
rg -n -C 3 '"raw_value"|raw_value|make_rules\(' concordat/rules/makefile_facts.py tests/unit/test_prover_tooling.py tests/unit/test_prover_proof_runs.py | head -n 180
printf '%s\n' '--- independent Rust syntax tree inspection ---'
python - <<'PY'
try:
    import tree_sitter as ts
    import tree_sitter_rust
except ImportError as e:
    print("Parser unavailable:", e)
    raise SystemExit(0)
print("Parser available; inspecting static Rust examples, not repository code.")
parser = ts.Parser(ts.Language(tree_sitter_rust.language()))
examples = {
  "cfg_attr alias": "use kani::proof as p;\n#[cfg_attr(kani, p)]\nfn harness() {}\n",
  "cfg_attr contract": "#[cfg_attr(kani, kani::proof_for_contract(f))]\nfn harness() {}\n",
  "different scopes": "mod a { use kani::proof as test; }\nmod b { #[test] fn ordinary_test() {} }\n",
  "malformed proof": "fn broken( { #[kani::proof] ]]]\n",
  "quoted string": 'fn emit() { quote::quote! { const S: &str = "#[kani::proof]"; } }\n',
  "verus code": "use vstd::prelude::*;\nverus! { proof fn f() {} }\n",
}
for label, source in examples.items():
    root = parser.parse(source.encode()).root_node
    print(f"\n{label}: has_error={root.has_error}")
    print(root)
    stack=[root]
    while stack:
        node=stack.pop()
        if node.type=="ERROR" or node.is_missing:
            print("error span:", node.type, node.is_missing, repr(node.text))
        stack.extend(reversed(node.children))
PY

Length of output: 40901


Script executed:

#!/bin/bash
printf '%s\n' '--- PT-002 policy diff ---'
git diff "$(git merge-base HEAD origin/main)" HEAD -- platform-standards/canon/lint-rules/rust-prover-tooling/policy/rust_prover_tooling.rego
printf '%s\n' '--- related existing installer tests ---'
cat -n tests/unit/test_prover_tooling.py | sed -n '85,125p;260,290p'
printf '%s\n' '--- parser inspection ---'
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
if python -m pip install --quiet --disable-pip-version-check --timeout 5 --retries 0 --target "$tmp" 'tree-sitter==0.25.2' 'tree-sitter-rust==0.24.2' 2>&1; then
  PYTHONPATH="$tmp" python - <<'PY'
import tree_sitter as ts, tree_sitter_rust
parser = ts.Parser(ts.Language(tree_sitter_rust.language()))
examples = {
    "cfg_attr alias": "use kani::proof as p;\n#[cfg_attr(kani, p)]\nfn harness() {}\n",
    "cfg_attr module alias": "use kani as k;\n#[cfg_attr(kani, k::proof)]\nfn harness() {}\n",
    "cfg_attr contract": "#[cfg_attr(kani, kani::proof_for_contract(f))]\nfn harness() {}\n",
    "different scopes": "mod a { use kani::proof as test; }\nmod b { #[test] fn ordinary_test() {} }\n",
    "malformed proof": "fn broken( { #[kani::proof] ]]]\n",
    "malformed alias attribute": "use kani::proof as p;\n#[p\nfn harness() {}\n",
    "quote with string": 'fn emit() { quote::quote! { const S: &str = "#[kani::proof]"; } }\n',
    "verus code": "use vstd::prelude::*;\nverus! { proof fn f() {} }\n",
}
for label, source in examples.items():
    root = parser.parse(source.encode()).root_node
    print(f"\n{label}: has_error={root.has_error}\n{root}")
    stack = [root]
    while stack:
        node = stack.pop()
        if node.type == "ERROR" or node.is_missing:
            print("error:", node.type, "missing:", node.is_missing, "span:", repr(node.text))
        stack.extend(reversed(node.children))
PY
else
  printf '%s\n' 'Pinned parser could not be installed; Rust examples remain statically reasoned.'
fi

Length of output: 12891


@wafflecat-df12 Yes. At 53f7588, the static review found cases that can both miss unrun proofs and report PT-006 when proofs run.

False passes

  • A list operation can count as a proof run. If a workflow uses the shared action and runs make kani, a kani recipe containing only cargo kani list counts as substantive work. PT-006 passes although the command verifies nothing. See concordat/rules/prover_workflow_facts.py Line 350 and concordat/rules/prover_commands.py Line 338.
  • A Python string can count as execution. A script containing only print("cargo kani --workspace") is classified as a proof script. A workflow that invokes it can pass PT-006. See concordat/rules/prover_script_facts.py Line 184.
  • Proof runs are not matched to proof code. A repository with a Kani harness can pass when its only recognized run is verus empty.rs. The policy accepts any nonempty proof_runs list. See rust_prover_tooling.rego Line 294 and concordat/rules/prover_commands.py Line 297.
  • Make execution is assumed. make -n verify counts a cargo kani recipe even though Make only prints it. Make variable expansion also ignores command-line overrides. For example, RUN ?= cargo kani with make verify RUN='echo skipped' is read as a proof run if the recipe is $(RUN). See concordat/rules/prover_make_facts.py Line 106 and Line 158.

Parser and false-fail cases

  • cfg_attr misses valid Kani harnesses. use kani::proof as p; #[cfg_attr(kani, p)] is not detected. Neither is #[cfg_attr(kani, kani::proof_for_contract(f))]. The branch checks only for the literal kani::proof tokens. The pinned parser accepts both forms without syntax errors. See concordat/rules/prover_proof_facts.py Line 194.
  • Bindings are not scoped. An alias imported in one module can make an unrelated attribute in another module look like a harness. That can produce PT-006 for a repository with no harness. Similarly, any qualified macro whose final name is verus is classified as a Verus block. See concordat/rules/prover_proof_facts.py Line 162 and Line 222.
  • A real script chain can be missed. If a workflow runs scripts/outer.sh, and that script invokes scripts/inner.sh which runs cargo kani, the scanner does not follow the inner script. It can report PT-006 despite the proof run. See concordat/rules/prover_script_facts.py Line 219.
  • An unreadable proc-macro manifest is treated as negative evidence. If Cargo.toml cannot be read or parsed, _manifest_is_proc_macro returns False. A quote! generator can therefore be missed without an EN-001 finding. See concordat/rules/prover_proof_facts.py Line 245.

The named-error-span check does report the tested malformed kani::proof example as unreadable. Missing tree-sitter nodes have empty spans, however, so they cannot themselves name a prover. Normal verus!, use vstd::..., and literal quote! generator forms are recognized by the implementation.

PT-002

I found no PT-002 change caused by recipe expansion in the static trace. The envelope builds raw rules separately from expanded proof_rules, and _make_installs uses the raw rules. The PT-002 policy itself is unchanged. See concordat/rules/prover_tooling_envelope.py Line 108 and concordat/rules/prover_workflow_facts.py Line 144.

I recommend fixing the false-pass and false-fail cases and adding regression tests before merging. I inspected the pinned parser on small examples, but I did not run the repository tests or execute repository code.


I couldn't check this conversation for new learnings, so no new learning was saved.

You are interacting with an AI system.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

A repository whose proof code nothing runs read as "no prover in use",
so it passed the rust-prover-tooling rule: mxd, theoremc and polean all
held Kani or Verus proofs that no CI job ran. Add PT-006 (error, not
waivable): a repository that holds proof code has at least one workflow
step that runs the proofs. The only remedies are to run them or remove
the code.

Proof code is read from Rust sources with tree-sitter-rust (a new pinned
dependency, approved for this rule): `kani::proof` and
`kani::proof_for_contract` attributes resolved through the file's use
declarations, `verus!` blocks, `use vstd::` and `#[verifier::...]`, and
`quote!` generators that emit harnesses in a proc-macro crate. Comments,
strings, doc examples and snapshots are not proof code. A file whose
syntax error names a prover is unreadable, which raises EN-001.

A proof run is a command that verifies (`cargo kani`, `kani exec`,
`verus run`, Verus on a proof file), not an install or a version check.
A step runs proofs directly, through a make target or prerequisite (with
the Makefile's own variables expanded), through a shell or Python
script, or, after the shared install, through a prover-named make
target with a substantive recipe (the shape of a generator whose
harnesses a test suite verifies). Where a workflow or Makefile could not
be read the answer is EN-001, not PT-006.

Bump the rule to 0.2.0 and refresh its manifest checksums. Over the
estate's default branches every repository that holds proof code reads
as running it.
CodeScene flagged complex conditionals in runs_proofs and is_substantive,
a cyclomatic complexity of 12 in the use-tree reader and a module mean
above the threshold. Move the use-tree reading into prover_rust_use with
one small function per use form behind a dispatch table, split Bindings.add
into the three things it records, and name the two conditions in
runs_proofs and is_substantive. Behaviour is unchanged: the 71 parser and
run tests and the full suite pass as before.
The proof-facts module still sat above CodeScene's mean complexity
threshold. Move the file walk and proc-macro manifest lookup into
prover_rust_files, give the use-tree module a non-recursive descendants
iterator, and turn the tree scans in prover_proof_facts and bindings_of
into comprehensions over it. Behaviour is unchanged.
CodeRabbit's reading of PT-006 found cases that passed without a run
verifying the proofs, or failed although one did:

- A run now carries its prover, and a Kani harness needs a Kani run and
  a Verus block a Verus run (a generator takes either), so a repository
  whose only run is Verus no longer passes for its Kani harnesses.
- `cargo kani list` and `setup` are not substantive, so a kani target that
  only lists harnesses does not count.
- A Python string counts only when handed to a process call
  (`subprocess.run`, `os.system`), not when printed.
- `make -n`, `-q` and `-t` print, test or touch; they do not run.
- A script that runs another script runs what it runs.
- `cfg_attr(kani, kani::proof_for_contract(f))` and `cfg_attr(kani, p)`
  after `use kani::proof as p` are harnesses.
- A proc-macro manifest that cannot be read is reported, so EN-001 says
  a generator may be hidden instead of PT-006 passing it as library text.

Variables given on a make command line, per-file (not per-module) import
resolution and a qualified `verus!` macro of any path are stated as limits
in the rule's README.
CodeScene still flagged one advisory Complex Method in prover_workflow_facts.
Split the dry-run test into an option predicate and its caller, and lift the
prover-named-target step out of workflow_facts. Behaviour is unchanged.
@leynos
leynos force-pushed the pt-006-unrun-proof-code branch from 24a1ccc to 019591f Compare November 15, 2026 00:30
@leynos
leynos merged commit ffc0dd2 into main Nov 15, 2026
6 checks passed
@leynos
leynos deleted the pt-006-unrun-proof-code branch November 15, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants