Skip to content

ci: lint API maps#1436

Merged
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
Robby955:api-map-lint
Jul 18, 2026
Merged

ci: lint API maps#1436
jstoobysmith merged 2 commits into
leanprover-community:masterfrom
Robby955:api-map-lint

Conversation

@Robby955

Copy link
Copy Markdown
Contributor

Motivation

Related to #1414. API maps record the implemented status and source locations of requirements for an API. A malformed map or a stale source reference is otherwise found only during manual review.

Changes

Adds scripts/api_map_linter.py and runs it in the existing Python lint job. For every API-map.yaml it checks that the file parses as YAML, that the top-level and per-requirement keys match the schema, and that each requirement marked done points at a Lean file that exists and contains every declared name or notation token it claims.

The map format in #1414 is YAML, so the check lives in the existing Python lint job; the Lean toolchain has no YAML parser. Anonymous instance claims cannot be checked by text search, so the linter counts and reports them instead of treating them as verified. A Lean-side pass that resolves names and synthesizes instance claims in the compiled environment is a natural follow-up; this check is the cheap tier that runs on every push.

Also quotes the colon in the LorentzGroup map description so the existing file parses as YAML. That is the one error the check finds on current master.

Testing

python3 scripts/api_map_linter.py --repo .

exits 0 on this branch with

files=8 requirements=109 checked=86 names_ok=177 MISSING_FILE=0 MISSING_NAME=0 need_Lean_env=26 skipped(N/A|undone)=23

Reverting the LorentzGroup quote reproduces the YAML parse failure (exit 1), and misspelling a declared name in a map fails with MISSING NAME (exit 1). Both were checked locally.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this PR, which will now be reviewed. If submitting to ./Physlib or ./QuantumInfo, please see our review guidelines if you are not familiar with the process. You should expect a back and forth with a reviewer before your PR is merged. See also that link for how to add appropriate labels to your PR. The PR will also go through a number of automated checks. You can learn more about these here, including how to run them locally.

If you are submitting to ./PhyslibAlpha there will be a lighter review process, though your PR must still pass the automated checks.

If you want to bring attention to this PR, please write a message on this thread of the Lean Zulip.

Important: If a reviewer adds an awaiting-author label to your PR, once you have addressed the review comments, please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

@Robby955
Robby955 marked this pull request as ready for review July 18, 2026 03:07
@jstoobysmith jstoobysmith self-assigned this Jul 18, 2026

@jstoobysmith jstoobysmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great! I've done some checks and this seems to work nicely, so have approved. Will merge shortly

@jstoobysmith jstoobysmith added the ready-to-merge This PR is approved and will be merged shortly label Jul 18, 2026
@jstoobysmith
jstoobysmith merged commit 02ac9f1 into leanprover-community:master Jul 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is approved and will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants