Repository navigation
Hold repositories to running the proofs they hold (PT-006) - #378
Conversation
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
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. View limit details
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer's GuideData structuresAdd the typed envelope fields for detected proof code and per-workflow proof runs so the policy and callers share a stable representation.
APIExpose proof-run classification and make recipe expansion as callable interfaces for the envelope and workflow analysis.
Uses of the APIBuild the expanded Make rules, script proof facts, and parsed proof-code facts into the tooling envelope consumed by the policy.
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.
ImplementationDefine how Rust source files are selected and how their nearest Cargo manifest determines proc-macro status.
Resolve Rust use trees into Kani attribute aliases and Verus-related imports for proof-code detection.
Parse Rust syntax to identify Kani harnesses, Verus proof code, generators, and proof sources that cannot safely be judged.
Classify substantive commands and distinguish actual Kani or Verus proof runs from setup, listing, printing, and version checks.
Expand repository-owned Make variables when requested, preserving the existing unexpanded recipe view for other checks.
Extract proof-running commands from shell and Python scripts and propagate them through nested script calls.
Trace workflow commands through scripts and Make targets, account for dry runs, and associate each proof run with the prover it invokes.
ConfigurationPin the tree-sitter parser dependencies and bump the rule package to 0.2.0 with updated PT-006 metadata and manifest checksums.
DocumentationExplain the expanded PT-006 scope, proof-code detection, proof-run paths, exception limits, and uncertainty cases for maintainers and users.
TestsAdd policy fixtures and Rego tests for unrun proof code, matching prover runs, generators, unreadable workflows, and non-waivable PT-006 findings.
Add unit coverage for parser-based proof-code detection and proof-run classification through direct commands, Make targets, scripts, and workflow cases.
Update the CLI-level BDD scenarios and existing audit expectation to account for repositories whose proof code now makes them subject to the rule.
Lock files and vendored codeRefresh the dependency lockfile for the newly pinned tree-sitter parser packages.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@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, |
There was a problem hiding this comment.
💡 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".
| for directory, names, files in os.walk(checkout, onerror=refuse): | ||
| here = checkout.joinpath(directory) |
There was a problem hiding this comment.
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 👍 / 👎.
| 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 |
There was a problem hiding this comment.
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 👍 / 👎.
|
Tip For best results, initiate chat on the files or code changes. Analysis chain
False passes
Parser and false-fail cases
The named-error-span check does report the tested malformed PT-002I found no PT-002 change caused by recipe expansion in the static trace. The envelope builds raw 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.
You are interacting with an AI system. |
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.
24a1ccc to
019591f
Compare
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-toolingand 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_clausesand 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.rsfile outsidetests,test,fixtures,examples,targetand similar trees (the trees PT-004 skips) is parsed, with one entry per file and kind:kani-harness: akani::prooforkani::proof_for_contractattribute, resolved through the file'susedeclarations (use kani::proof as p; #[p],use kani::{any, proof},use kani as k; #[k::proof],cfg_attr).verus-block: averus!orverus_!macro,use vstd::..., or#[verifier::...].proof-generator: aquote!orquote_spanned!in a proc-macro crate ([lib] proc-macro = true, read withtomllib) that emits#[kani::proof]orverus!. theoremc is the one known case; a consumer of someone else's generator is out of scope for now..snapfiles are not proof code; acfg(kani)helper module with no harness is not either. A file whose syntax error spans text naming a prover isunreadable, 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 kaniandcargo-kani/kani-driver(notsetup,list,--version),prover-tools kani execandverus run, Verus on a proof file,cargo verus verify|focus|build. A step runs proofs when it runs one directly, runsmake XwhereXor a prerequisite does (the Makefile's own variables are expanded from themakeutilreport, which closes the$(VERUS_RUN)gap), runs a repository script whose commands do (shell, and Python list literals and command strings read from theast), or sits in a workflow that installs through the shared action and runs a prover-namedmake 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 namescargo 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 runequivalent, from this branch): 87 compliant, 1 indeterminate (gpui-component, an existing EN-001 formakesteps 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:
src/header_util/kani.rs)crates/theoremc-macros/src/render.rs, a generator)verus/admission_spec.rs)tools/calibration/cardinality-probe/src/lib.rs)What changed
New facts module
prover_proof_facts.py;prover_commands.runs_proofsandis_substantive; Makefile variable expansion inprover_make_facts; proof runs in the workflow and script facts;proof_codein the envelope andproof_runsper 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 directcargo kani, unrun harness, generator crate,use kani::proof as palias, 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/makeutilis 0.1.0, so the gate ran with the 0.1.2 build another row cached in concordat's scratch sidecar first onPATH.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:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests:
Chores: