fix: deflake the leanExit exit-code-0 test - #14671
Open
sankalpsthakur wants to merge 1 commit into
Open
Conversation
The ErrorExit0 fixture was racy: the type-error diagnostic is emitted by the driver's asynchronous reporting loop (SnapshotTree.runAndReport), while `#eval (IO.Process.exit 0 : IO Unit)` terminates the compiler from inside the next command's elaboration task. When the exit won the race, the `Type mismatch` diagnostic never reached Lake's captured output and the build instead failed on the missing .olean, coin-flipping CI on unrelated PRs (e.g. job 91870184702 on leanprover#14649, job 91869672660 on leanprover#14640). Give the reporting loop a short, bounded head start before exiting. IO.sleep already has precedent for sequencing against concurrent work in tests/lake/tests/lock.
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
sankalpsthakur
marked this pull request as ready for review
August 4, 2026 04:58
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.
This PR makes the
ErrorExit0case of thetests/lake/tests/leanExitfixture deterministic.Since #14629 landed, this test has been coin-flipping in CI on unrelated PRs: the type-error diagnostic is emitted by the CLI driver's asynchronous reporting loop (
SnapshotTree.runAndReport), while#eval (IO.Process.exit 0 : IO Unit)terminates the compiler from inside the next command's elaboration task. When the exit wins the race, theType mismatchdiagnostic never reaches Lake's captured output, the firstmatch_textassertion fails, and the build instead reports only the missing.olean. Observed in CI job 91870184702 (on #14649) and job 91869672660 (on #14640) within the last day.Give the reporting loop a short, bounded head start before exiting.
IO.sleepalready has precedent for sequencing against concurrent work intests/lake/tests/lock.Test plan
tests/lake/tests/leanExit/test.shexercises the same four exit/diagnostic combinations as before; theErrorExit0case no longer depends on thread scheduling.Follow-up to #14629.
AI assistance
AI tools assisted with root-cause analysis and patch preparation. I reviewed the driver reporting flow in
src/Lean/Elab/Frontend.leanandsrc/Lean/Language/Basic.lean, thelean_io_exitruntime semantics insrc/runtime/io.cpp, and the final diff.