Zulip Chat Archive
Stream: mathlib4
Topic: CI errors that are not local errors
Matthew Ballard (Feb 02 2024 at 18:32):
Do we want this? I would like to be fairly confident that if it builds and lints on my machine then CI will happy.
The example I got bit by was says
Kevin Buzzard (Feb 02 2024 at 19:05):
By "lints on my machine" you presumably don't mean "I added some stuff to one file and #lint
was happy"?
Matthew Ballard (Feb 02 2024 at 19:07):
if lake build
and lake exe runLinter mathlib
are happy on my machine I would very much hope they are on other machines
Kevin Buzzard (Feb 02 2024 at 19:10):
I was just observing that mathlib linting is much more then "put #lint at the bottom of the file" but it looks like you're running more than that (presumably you're running what CI runs)
Mario Carneiro (Feb 02 2024 at 23:36):
says
is about whether the says.verify
option is enabled, which is currently true for CI and false for local use, hence the issue
Mario Carneiro (Feb 02 2024 at 23:36):
this is mostly orthogonal to linting
Mario Carneiro (Feb 02 2024 at 23:37):
This was one of the reasons I was against using says
in the library BTW
Mario Carneiro (Feb 02 2024 at 23:39):
it's all well and good to have the mechanism, but actually using it in mathlib means more text on screen and more runtime, both in CI and locally, unless you disable says.verify
locally and then you miss errors that appear in CI as mentioned here. I see only downsides
Matthew Ballard (Feb 02 2024 at 23:42):
Hard error or not. I can be swayed. I think inconsistent behavior between CI and local has no benefits.
Mario Carneiro (Feb 02 2024 at 23:45):
I think to some extent we should expect differences; most people are not going to be running shake
, runLinter
and lean4checker
locally
Mario Carneiro (Feb 02 2024 at 23:46):
of course it's possible for you to mimic a CI run locally, but I think it's okay if we optimize the in-editor experience for fast iteration over full checking
Mario Carneiro (Feb 02 2024 at 23:47):
in fact I'd love it if we got that quick-and-dirty option so that we can just skip proofs in the file we don't care about
Matthew Ballard (Feb 02 2024 at 23:55):
Sure. (I only care about lake build
and lake exe runLinter Mathlib
locally.) _If_ you choose to run something locally, you should expect non-divergent behavior in CI.
Mario Carneiro (Feb 03 2024 at 00:01):
are you willing to take lake build -KCI
as an option?
Matthew Ballard (Feb 03 2024 at 00:09):
I did not know about that. What does it do beside turn this on?
Eric Rodriguez (Feb 03 2024 at 00:10):
I think says.verify
is a bad option that shoudp almost never be on
Mario Carneiro (Feb 03 2024 at 00:16):
I agree, it kind of defeats the purpose
Mario Carneiro (Feb 03 2024 at 00:17):
but people were concerned about the hints going out of date
Mario Carneiro (Feb 03 2024 at 00:17):
or if it suggests more or less than it used to
Mario Carneiro (Feb 03 2024 at 00:17):
but in those cases I think it's fine to just let it go out of date
Matthew Ballard (Feb 03 2024 at 00:55):
Is says.verify
the only difference with the -KCI
flag?
Mario Carneiro (Feb 03 2024 at 10:40):
actually it appears says.verify
does not use the -KCI flag; if you use the default settings then it checks the CI
environment variable during elaboration. So you have to do CI=true lake build
instead
Yaël Dillies (Feb 12 2024 at 09:38):
Here's one CI error which I'm not managing to reproduce locally: https://github.com/leanprover-community/mathlib4/actions/runs/7869281349/job/21468075433
Yaël Dillies (Feb 12 2024 at 09:38):
I would be interested to even know where it is coming from.
Ruben Van de Velde (Feb 12 2024 at 09:52):
PANIC at Lean.MapDeclarationExtension.insert Lean.Environment:607:2: assertion violation: env.getModuleIdxFor? declName |>.isNone -- See comment at `MapDeclarationExtension`
Mario Carneiro (Feb 12 2024 at 10:02):
that means you are adding an attribute/extension entry for a declaration not in the current module
Mario Carneiro (Feb 12 2024 at 10:02):
most attributes catch this in order to present a better error message (that also makes people sad), this is what happens if you don't
Mario Carneiro (Feb 12 2024 at 10:06):
I am reproducing it locally
Mario Carneiro (Feb 12 2024 at 10:07):
remember that panics show a popup and appear in the Output > "Lean: Editor" panel, not as red squiggles
Mario Carneiro (Feb 12 2024 at 10:07):
the culprit is
add_decl_doc AddMonoidHom.map_zero
Mario Carneiro (Feb 12 2024 at 10:08):
which should be relocated to the same file as the declaration
Mario Carneiro (Feb 12 2024 at 10:09):
(you can also use the @[to_additive "declaration doc here"]
form to add a doc on the additive version of a declaration)
Yaël Dillies (Feb 12 2024 at 11:11):
Yeah I know about this, but it was very very hard to edit this file because the LSP server becomes unusably slow when there's >= 30 errors in the file (is this a known issue? I've been encountering it a lot).
Mario Carneiro (Feb 12 2024 at 11:39):
Last updated: May 02 2025 at 03:31 UTC