Skip to content

Validate project files, add order, insert version#116

Open
robsimmons wants to merge 3 commits into
leanprover-community:mainfrom
robsimmons:config-validate
Open

Validate project files, add order, insert version#116
robsimmons wants to merge 3 commits into
leanprover-community:mainfrom
robsimmons:config-validate

Conversation

@robsimmons
Copy link
Copy Markdown

Makes a few changes to the project validation structure.

  • uses Zod parsing to take care of remaining to-dos around validating project configurations
  • adds a sort order field that allows the frontend to order projects by a custom sort
  • Allows project names to use templating:
    • _Vers_ will get replaced by the toolchain (e.g. v4.30.0) or by Lean if the toolchain format isn't recognized and
    • _LeanVers_ will get replaced by the toolchain plus "Lean" (e.g. Lean v4.30.0) or by Lean if the toolchain format isn't recognized

Copy link
Copy Markdown
Collaborator

@joneugster joneugster left a comment

Choose a reason for hiding this comment

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

Thank you for the PR, Rob :D I think these are all great ideas!

  • The failing CI is just a test checking for leanprover/lean4:stable. That can be fixed easily.
  • The docs need to be completed with these two new features.

Copy link
Copy Markdown
Collaborator

@joneugster joneugster May 28, 2026

Choose a reason for hiding this comment

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

what's these day the recommended way of automatically follow stable releases? the file leanweb-build.sh contains lake update -R this will not be good enough to automatically update to v4.30.0, v4.31.0, ... when they are released, will it?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

revert? This seems accidental. But I think changing the name of the stable project to Lean _Vers_, as you had in an intermediate commit, is a good idea!

Comment thread server/index.mjs
function toolchainToName(toolchain, prefixLean) {
console.log(toolchain);
const nightly = toolchain.match(/^leanprover\/lean4\:nightly-(.*)$/);
if (nightly) return prefixLean ? `Lean ${nightly[1]}` : nightly[1];
Copy link
Copy Markdown
Collaborator

@joneugster joneugster May 28, 2026

Choose a reason for hiding this comment

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

What it the point of having _Vers_ and _LeanVers_ when you could also name your project "Lean _Vers_"? Is there any use case for _LeanVers_ I missed?

// Secondary sort: sortOrder field
const ps = p.config.sortOrder
const qs = q.config.sortOrder
if (ps !== null && qs !== null && ps !== qs) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (ps !== null && qs !== null && ps !== qs) {
if (ps != null && qs != null && ps !== qs) {

the potential future struggle with null !== undefined is not worth using !== imo

return ps - qs
}
if (ps !== null && qs === null) return -1
if (ps === null && qs !== null) return 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I've been thinking, if project with the highest number came first, this entire logic would be

if (ps != null || qs != null) return (qs ?? 0) - (ps ?? 0)

wouldn't it? Would that justify sorting this way instead?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Moreover, then one could simply say sortOrder: config.sortOrder ?? 0 as a number, couldn't we?

@joneugster
Copy link
Copy Markdown
Collaborator

joneugster commented May 28, 2026

I've put all these suggestions into a commit (including fixing the tests and adding doc). It seems you've disabled pushing to the PR branch for reviewers, so it is here:

robsimmons#4

I've also added a second commit reverting the toolchain to stable and fixing the build script to update the stable toolchain. Less sure about this. I would like a way so that running the .sh script automatically updates the project to the latest stable Lean release. If you have insider knowledge how to do this correctly, please feel free to update the bash script

Feel free to take these commits as you agree and leave out parts where you don't think that's on the line of your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants