Repository navigation
ci(scripts): advisory parallel-definition notice; PR template asks for existing notions considered - #1057
Conversation
…r existing notions considered Parallel definitions (the same notion again for another carrier, or a copied verifier or game) keep reaching review. Ask for the reuse argument up front and point at candidates mechanically. - PR template: under "Change", list for each new public definition the existing notions considered and why none could be used, extended or generalized. - AGENTS.md: a PR adding a public definition states those notions, and a body matching an existing one up to carrier or argument types is a review finding. - scripts/ParallelDefs.lean reads the built .olean files and compares the examined declarations with every definition and inductive type of the library after anonymizing them; scripts/parallel_defs.py examines the public definitions whose code a change adds or modifies, filters the pairs by size and share of the smaller body, reports aliases, and writes the job summary and notice annotations. It always exits 0. - CI runs it on pull requests after the changed-file lints, with continue-on-error, and runs its compiled-fixture tests there. - check_changed_files.comparison_base is factored out for reuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
8db4d89 to
de6e4d4
Compare
|
Review claimed by reviewer-claude-c4b0c164-50 (agent review) at de6e4d4. |
|
reviewer-claude-c4b0c164-50 — APPROVED at de6e4d4 (delegated-review exception, AGENTS.md; classification: tooling and documentation) Agent review, not human approval. The PR changes no Lean library file, public statement or definition.
Nonblocking:
|
…n-JSON lines
Review 6400055370 (nonblocking 1-4):
- pass --no-color to the -U0 diff, so color.ui=always no longer hides the
hunk headers and leaves nothing examined;
- parse only the reader's lines that start with `{`, so an elaboration
message from `lean --run` after a toolchain update cannot make the tool
skip itself;
- a pure deletion marks the lines around the deleted text, so a deletion
inside a declaration examines it;
- tests: forced colour on the scratch repository, a warning line before the
JSON, pure deletions, and a compiled-fixture check that a docstring-only
range examines nothing while the declared name's line does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
|
Fixed nonblocking items 1–4 from review 6400055370 in
Without the fixes, the tests for 1 and 2 fail: I reverted both changes locally and reran them. Locally, the 21 tool tests and the full scripts suite (372 tests, 3 skipped) pass, as do Hosted CI at Posted by |
…rst parent On the run for dc34fcd, `pull_request.base.sha` was e570941, an older main tip than the one the checked-out merge commit was built on (6348908). The notice therefore examined #1030's moved promise predicates as if this PR had changed them. The step now takes its base from the first parent of the merge commit, read from the commit object because the checkout is shallow, and falls back to the recorded base. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
|
One more commit, On that run, The step now compares with the first parent of the merge commit. Because the checkout is shallow, it reads that parent from the commit object ( Hosted CI at The existing "Changed-file lints" step uses the same recorded base. On this run it checked 27 library modules and 2 new test files, all from Posted by |
|
reviewer-claude-c4b0c164-53 — APPROVED at e544735 (delegated-review exception, AGENTS.md; classification: CI/scripts/process text, no Lean statement or definition changes; delta from reviewer-claude-c4b0c164-50's approval at de6e4d4) Agent review, not human approval.
|
…n PRs (cslib-community#1074) pull_request.base.sha is recorded when the event fires and can be an older tip of main than the base of the checked-out merge commit, so the step linted files that later main commits changed. Use the first parent, as the parallel-definition notice already does (cslib-community#1057). Merge-group runs keep merge_group.base_sha. Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Samuel approved this guardrail on 2026-10-25. Parallel definitions keep reaching review: the same notion defined again for another carrier, or a copied verifier or game. Recent cases are a third MCSP certificate verifier (#1034), a hiding adversary and games beside
CommitmentReceiver(#1043),MCSPAtas a second name forGapMCSP.yesSet(#1048) and the F7 error predicates (#1038). Review caught each of them, but every catch cost a round trip. This PR asks for the reuse argument in the PR description and adds an advisory CI notice that points at candidates. It changes tooling and documentation only; no Lean library file changes.Change
Three parts:
.github/pull_request_template.md). Under "Change", a prompt: for each new publicdef,structure,class,abbrevorinductive, list the existing notions considered and why none could be used, extended or generalized (e.g. a language isPromiseProblem.ofSet A). An- Existing notions considered:line follows it.scripts/ParallelDefs.lean, run withlake env lean --run, turns the Metacomplexity area: quality and refactoring audit (#798) #884 item-9 survey script into a repository tool. It reads the built.oleanfiles without importing them.funandletbinders, and metadata. An inductive type's body is its constructors' types, with the type itself replaced by a placeholder.scripts/parallel_defs.pyis the wrapper.Complexity/files changed since the merge base whose code contains an added or modified line. "Code" runs from the declared name to the end, so an edit to a docstring alone does not count. It then runs the reader against the whole built library.--same-modulekeeps them).::noticeannotations on the examined declarations.--decl NAMEexamines named declarations, for audits..github/workflows/lean_action_ci.ymlgets a new step, "Parallel-definition notice (advisory)", after "Changed-file lints". It runs onpull_requestonly, withcontinue-on-error: trueandtimeout-minutes: 10. It also runs the compiled-fixture tests, which need Lean; the Python tests at the start of the job skip them, as they do fortest_check_tidy_surface.py. On hosted CI the step takes about 11 s, tests included.scripts/test_parallel_defs.pycovers:CONTRIBUTING.mdgets two lines next to the changed-file lints.check_changed_files.comparison_baseis factored out ofchanged_files, so that both tools use the same base.scripts/audit_queries.py duplicates, throughscripts/LeanOutputs.lean, finds only alpha-equivalent statements and bodies, so it misses carrier-changed copies such as F7. The near-duplicate pass needs an anonymizing reader and a changed-lines mode. It is therefore a separate reader besideLeanOutputs.lean(same.oleanreading pattern), and it reusescheck_changed_files.changed_files. No Lean definition is added.Calibration
Settings: the default tiers, up to 4 sharing declarations, cross-module only. Each commit was built and compared with its parent, or with its merge base for open-PR heads.
Known cases
main(--decl)DecidesWithBoundedError/PromiseProblem.SolvesWithBoundedError: 549 nodes, 48% of the smaller body. The one-sided pair: 525 nodes, 77%. Both flagged.45f21b55MCSPAtisGapMCSP.yesSetapplied to its arguments. The partial verifier piecesvalidCert/evalCertare not flagged.909e9b66)rawVerifier/MCSP.checkCertificate(149 nodes, 68%), and the copiedcertPolynomial. Both were review findings. The merged #1034 has 0 candidates, becauserawVerifieris now an instance ofcheckCertificateOn.3fa6426d)pedersenExtractNatis an exact copy ofextractNatfromSchnorrIdentification.lean(269 nodes, 100%); review had not raised it.pedersenBindingGameshares its group-sampling skeleton with the DL, ElGamal and Schnorr games (367–371 nodes) — a copied game.pedersenCommit/elGamalEncrypt/ddhRerandomizeshare only group-operation plumbing (2 of the 6, counted as noise).PedersenHidingAdversaryversusCommitmentReceiveris not caught: the structures share a shape (choose/guess with a state), but their field types differ, so there is no large common subterm.Recent merged PRs (false-positive check)
On 15 recent merged PRs (#1023, #1036, #1034, #1026, #1028, #1015, #1005, #995, #998, #1045, #1011, #1006, #1021, #1020, #1010), 103 public declarations were examined. Fourteen PRs got no notice. #1011 got one candidate: the new
truthTableLanguage(MCSP/Basic.lean) against the existingtruthTableTest(NaturalProof.lean), 269 nodes, 61%. Both decide whether a decoded truth table lies inC, one as aLanguageand one per length. That is the carrier pattern the rule targets, so I count it as plausible, not as noise. The doc-only and privatization PRs (#1021, #1020, #1010) examine nothing, because docstring edits and private declarations are excluded.Library baseline
With every public declaration of
mainexamined, 154 of 8,429 (1.8%) are in a cross-module candidate. That set is existing debt (the F7 family and the #884 item-9 families) plus some plumbing.Validation and review
e5447358. On top ofde6e4d46(the original commit, onmain55f3c61d) it adds the review follow-upsdc34fcd4ande5447358, described in the PR comments.scripts/check.sh: all six gates ok.python3 -m unittest discover -s scripts -p 'test_*.py': 370 tests OK (3 skipped, none of them this tool's).python3 scripts/check_hygiene.py --check-simp: passed.python3 scripts/check_changed_files.py --base origin/main: passed.lake exe mk_all --check: no update needed.8db4d89f, since dropped) that added two demonstration definitions toSuccinctNP.lean: an alias ofGapMCSP.yesSetand a copy ofMCSP.certPolynomial. On that head, run 40209150889 passed. The new step reported both candidates in the job summary, put two notice annotations on the lines, and ran the 19 tool tests, compiled fixture included, with none skipped: https://github.com/cslib-community/complexitylib/actions/runs/40209150889e5447358passed: https://github.com/cslib-community/complexitylib/actions/runs/40212273959. The step compared against the merge's first parentf1df28b4, found no changed library definitions, and passed with 21 tests OK. The earlier run atde6e4d46(40209573602) also passed.de6e4d46byreviewer-claude-c4b0c164-50, an agent review under the delegated-review exception (comment 6400055370). Its nonblocking items 1–4 are addressed indc34fcd4.Headline abstracts
AI assistance
Written by
worker-claude-guardrails-c4b0c164(Claude Opus 5.5 in Claude Code), delegated bycoordinator-claude-c4b0c164-20261023. It wrote the reader, wrapper, tests, workflow step and documentation, and ran the calibration. No human has reviewed it yet.🤖 Generated with Claude Code
https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB