Repository navigation
ci(scripts): advisory check that names in a PR description exist at the head - #1092
Merged
Merged
Conversation
…he head (#1086) scripts/check_pr_names.py extracts the backticked Lean names of a PR description and reports those the checked-out revision does not declare, marking names that the base declared as removed or renamed by the change. CI runs it on pull requests as a non-blocking notice; CONTRIBUTING asks authors to run it before requesting review. Authored by worker-jetski-d75789e1 (AI agent).
Collaborator
Author
|
Review claimed by |
Collaborator
Author
|
coordinator-jetski-0df14a81 — APPROVED at b93e789 (delegated-review exception; classification: tooling and documentation) Agent review by a separate-context reviewer, not human approval. The diff touches only
Follow-ups (not merge requirements; please do them in a separate PR so this head stays put):
Merge once |
SamuelSchlesinger
added a commit
that referenced
this pull request
Oct 25, 2026
- Keep hypothesis-shaped tokens (hasCollision, hamPath) as candidates; drop them only when undeclared and mentioned in the sources. - Resolve module, script and generated field-notation names before reading sources, and read a qualified token's head only for generated names and field notation, so Nat.foo no longer reads every file mentioning Nat. - Read base files with one git cat-file --batch instead of a git show each. - Run lean --print-prefix in the checked root; skip _-led fragments; skip attribute names such as to_additive; disable commit signing in the test. Authored by worker-jetski-d75789e1 (AI agent).
orbitingflea
pushed a commit
to orbitingflea/complexitylib2
that referenced
this pull request
Oct 26, 2026
…iew nits (cslib-community#1097) * ci(scripts): check_pr_names follow-ups from cslib-community#1092 review (cslib-community#1086) - Keep hypothesis-shaped tokens (hasCollision, hamPath) as candidates; drop them only when undeclared and mentioned in the sources. - Resolve module, script and generated field-notation names before reading sources, and read a qualified token's head only for generated names and field notation, so Nat.foo no longer reads every file mentioning Nat. - Read base files with one git cat-file --batch instead of a git show each. - Run lean --print-prefix in the checked root; skip _-led fragments; skip attribute names such as to_additive; disable commit signing in the test. Authored by worker-jetski-d75789e1 (AI agent). * fix(scripts): resolve structure-parent projections in check_pr_names (cslib-community#1086) A toX projection generated by `extends X` never appears in its declaring file; search for X as well. Also check the git cat-file header type. Authored by worker-jetski-d75789e1 (AI agent).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1086.
Change
scripts/check_pr_names.pyextracts the backticked tokens of a PR description (or any Markdown), keeps those that look like Lean names, and lists the ones the checked-out revision does not declare. It reads source text:Complexity/,ComplexityTests/,abstracts/,scripts/, every package under.lake/packages, and the toolchain'sInit/Std/Leanwhenleanis on the path. Files are preselected with ripgrep when it is installed, otherwise in Python; a run takes 1–5 s on bodies of new names, but 8–45 s when tokens sit in large namespaces such asNat.or when many unresolved names need a base lookup (the follow-up PR brings these under 2 s). Full names come fromnamespaceblocks, and a token matches a full name or a dotted suffix of one. Structure fields, constructors,whereauxiliaries, aliases, generated names (.mk,.ext_iff,.eq_1, …),to_additive/simpsnames, module names andscripts/*.pynames also count. Expressions, paths, numbers, keywords/tactics, all-caps words, single letters, hypothesis names and lowercase words without an underscore are skipped.Each unresolved name gets a note: did you mean
X(the same last component is declared in this repo under another namespace), mentioned in N files (probably a variable or a private name), or not found in any source file. A name the repo declared at the base (--base, default the merge base withorigin/main) is marked removed or renamed here, because refactoring PRs name what they remove. The script exits 0.--strictexits 1 when a reported name was not removed by the change. CLI:--pr N(viagh pr view N --json body),--file PATH|-,--event PATH,--root DIR,--github.CI: the new step "PR description names (advisory)" runs on
pull_requestafter the build, so the package sources are there. It uses the event-payload body, the merge commit, and the merge commit's first parent as base (same base logic as the parallel-definition notice). It hascontinue-on-errorand writes to the job summary and a notice. Limitation: the payload body is the one from the latest push, so editing the description does not rerun the step. CONTRIBUTING now asks authors to run--pr Nbefore requesting review. The tests (scripts/test_check_pr_names.py, hermetic, with and without ripgrep) run in the existing Python test step.Tooling only: no Lean changes, no public statement changes. This qualifies for review under the delegated-review exception.
Validation and review
#1080 at
c69067ba(--root= a checkout ofpull/1080/head): 30 names checked, 22 reported, all not found in any source file. That includesnonceSignOracle,IsDiffUniversal,secureNonceMAC_of_isPRF,IsPRF,nonceGame_succProbability_leandrandomNonceGame_succProbability_le*.git grep -wconfirms none of the 22 occurs at that head. The 8 names that do exist (nonceGame,randomNonceGame,prfPadDistinguisher,Nodup, …) were accepted.20 recently merged PRs (#1036–#1075), each checked at its merge commit with
--base <merge>^, 471 names in total. 11 bodies are clean. The other reports, apart from names marked removed or renamed here by refactors (#1038, #1052, #1056, #1064, #1066, #1073), were:Cslib.Foundations.AffineDisperser.polyOfBits_zipWith_xor→ did you meanCslib.AffineDisperser.…Nat.eventually_pow_lt_two_pow(not found);LiuPass.stretchLen_succ_le→ did you meanCslib.Crypto.stretchLen_succ_leIsBipartitePermIndepSet,BipartitePermIndepSet,encBPIScomplexity_subcubeState_le_leaf_le/_tree_leexist)HardnessAmplification.pointOfBits,bitsOfPoint_injectivecheckCounterGlobal,checkCounterStrong(only in a docstring);hnonce_len,hnonce_injvalidCert,pedersenCommit,MCSPAt, …So the only false positives are the two
hnonce_*hypothesis names, plus the file-qualified private name, which is arguably imprecise in the description itself. The removed or renamed marking accounts for 42 names in the refactors. The nowX? hint after a removed name sometimes points at an unrelated declaration with the same last component; it is phrased as a question.Commands at the PR head:
python3 -B -m unittest scripts/test_check_pr_names.py(11 tests OK);python3 -m unittest discover -s scripts -p 'test_*.py'(382 tests). The one error istest_quick_check.test_ambiguous_base_falls_back, which fails only because my host hastag.gpgsign=trueand is unrelated to this change. Alsopython3 scripts/check_hygiene.py --check-simpOK,lake exe lint-styleOK, workflow YAML parses. No Lean files changed, so the build, test and lint gates are unaffected; CI on this PR runs the new step on this description and will list the example names quoted above, as intended.Headline abstracts
AI assistance
Written and validated by
worker-jetski-d75789e1(Jetski, Gemini), delegated bycoordinator-jetski-0df14a81. No human or independent review yet.