Skip to content

[Merged by Bors] - ci: basic check on fields in 100.yaml and 1000.yaml#20078

Closed
bryangingechen wants to merge 13 commits intomasterfrom
bgc-yaml-check
Closed

[Merged by Bors] - ci: basic check on fields in 100.yaml and 1000.yaml#20078
bryangingechen wants to merge 13 commits intomasterfrom
bgc-yaml-check

Conversation

@bryangingechen
Copy link
Copy Markdown
Contributor

@bryangingechen bryangingechen commented Dec 19, 2024

This PR makes scripts/yaml_check.py verify that 100.yaml and 1000.yaml only contain fields the webpage expects them to. Otherwise, changes in mathlib breaking the website won't be noticed until they are merged; this has happened several times in the last days. In particular, replace two occurrences of note in 1000.yaml by comment.
To this end, this PR copies the dataclass constructors which are used in the website script to scripts/yaml_check.py (along with a comment asking to keep them in sync).

While at it, this PR documents the fields in 100.yaml as well, and moves the documentation for 1000.yaml to the copied dataclasses in yaml_check.py.

In addition, validate that at most one of the fields decl and decls are passed: the webpage also does this; this avoids late surprises.

Co-authored-by: grunweg rothgang@math.uni-bonn.de


After merging this, the website will be broken until leanprover-community/leanprover-community.github.io#563 is merged.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 19, 2024

PR summary 3c3fb6a999

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ HundredTheorem:
+ ThousandPlusTheorem:

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Looks good so far. I need to run now, perhaps I can provide a doc-string for doc_decls later.

@bryangingechen bryangingechen added the awaiting-author A reviewer has asked the author a question or requested changes. label Dec 19, 2024
@bryangingechen
Copy link
Copy Markdown
Contributor Author

Thanks for the quick review! I've marked this as awaiting-author until @grunweg has had a chance to add info about doc_decls (and perhaps any other changes to the docstrings). In the meantime I'll consider adding the decl vs decls check as well.

Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Actually, one more thought: there are now two locations for these doc comments on the respective fields: once in {100,1000}.yaml, and once in the HundredTheorems class.

At the minimum, can we make sure to copy all the doc comments everywhere, and add comments to keep these in sync? In fact, I wonder if it's better to shorten the comment in the yaml file, referring to yaml_check.py for a documentation of the respective fields.

(I seemingly cannot edit your PR, so haven't pushed any of these changes directly.)

@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Jan 7, 2025

I just went ahead and updated this PR for the proposed webpage PR (and also added validation for decl vs decls).

The last commit (a more flexible date format) is in anticipation of 1000-plus/1000-plus.github.io#10.

@grunweg grunweg removed the awaiting-author A reviewer has asked the author a question or requested changes. label Jan 7, 2025
@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Jan 7, 2025

Merged master, fixed another violation of the file format and improved the error message. I would maintainer merge this now - but as I wrote the second half of the code, I'd prefer not to.

@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Jan 7, 2025

I'm not sure about the last commit: I consciously deleted those doc-comments, as they make no sense in the context of mathlib. What do you think?

@bryangingechen
Copy link
Copy Markdown
Contributor Author

Ah, I just thought it'd be easier to keep them in sync if they were exactly the same text so I copied and pasted them without thinking. I guess it's not much more work to just copy and paste the fields though. Let me revert.

@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Jan 7, 2025

I hope the allowed fields will change very rarely, if at all. (The current changes are bug fixes, in my opinion.)

@bryangingechen
Copy link
Copy Markdown
Contributor Author

@fpvandoorn This PR has gone through major revision by @grunweg and should now be in sync with leanprover-community/leanprover-community.github.io#563. Do you mind re-reviewing / merging this if it looks good? After this is merged the website will be temporarily broken, but I plan on merging the PR over there in short order so there won't be any actual broken builds, hopefully.

@fpvandoorn
Copy link
Copy Markdown
Member

Thanks!

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Jan 9, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jan 9, 2025
This PR makes `scripts/yaml_check.py` verify that `100.yaml` and `1000.yaml` only contain fields the webpage expects them to. Otherwise, changes in mathlib breaking the website won't be noticed until they are merged; this has happened several times in the last days. In particular, replace two occurrences of `note` in `1000.yaml` by `comment`.
To this end, this PR copies the dataclass constructors which are used in the website script to `scripts/yaml_check.py` (along with a comment asking to keep them in sync).

While at it, this PR documents the fields in `100.yaml` as well, and moves the documentation for `1000.yaml` to the copied dataclasses in `yaml_check.py`.

In addition, validate that at most one of the fields `decl` and `decls` are passed: the webpage also does this; this avoids late surprises.

Co-authored-by: grunweg <rothgang@math.uni-bonn.de>



Co-authored-by: Michael Rothgang <rothgang@math.uni-bonn.de>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jan 9, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title ci: basic check on fields in 100.yaml and 1000.yaml [Merged by Bors] - ci: basic check on fields in 100.yaml and 1000.yaml Jan 9, 2025
@mathlib-bors mathlib-bors bot closed this Jan 9, 2025
@mathlib-bors mathlib-bors bot deleted the bgc-yaml-check branch January 9, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Modifies the continuous integration setup or other automation ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants