test: simplify cancellation_par test infrastructure#13663
Merged
Conversation
This PR replaces the `check_cancel` two-way coordination protocol used by `tests/server_interactive/cancellation_par.lean` with a single tactic `block_until_cancelled "<label>"`. The first invocation for a label registers a promise, prints `<label>: blocked`, and loops on `Core.checkInterrupted` until the cancel token fires (then `finally` resolves the promise). Any later invocation for the same label waits on that promise — so the test only terminates if the first invocation actually exited the loop. If cancellation fails to propagate, the second invocation's `IO.wait` blocks forever and the test hangs (timeout = failure), with no false-success path. The test was disabled in `tests/CMakeLists.txt` due to flakiness in the old two-way protocol; this PR re-enables it. Verified that reverting #13428 makes the test deadlock as expected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…chim/cancellation-test-simplification
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
nomeata
added a commit
that referenced
this pull request
May 13, 2026
This PR replaces the `check_cancel` two-way coordination protocol used by `tests/server_interactive/cancellation_par.lean` with a single tactic `block_until_cancelled "<label>"`. The first invocation for a label registers a promise, prints `<label>: blocked`, and loops on `Core.checkInterrupted` until the cancel token fires (then `finally` resolves the promise). Any later invocation for the same label waits on that promise — so the test only terminates if the first invocation actually exited the loop. If cancellation fails to propagate, the second invocation's `IO.wait` blocks forever and the test hangs (timeout = failure), with no false-success path. The test was disabled in `tests/CMakeLists.txt` due to flakiness in the old two-way protocol; this PR re-enables it. Verified that reverting #13428 makes the test deadlock as expected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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 replaces the
check_canceltwo-way coordination protocol used bytests/server_interactive/cancellation_par.leanwith a single tacticblock_until_cancelled "<label>". The first invocation for a label registersa promise, prints
<label>: blocked, and loops onCore.checkInterrupteduntil the cancel token fires (then
finallyresolves the promise). Any laterinvocation for the same label waits on that promise — so the test only
terminates if the first invocation actually exited the loop. If cancellation
fails to propagate, the second invocation's
IO.waitblocks forever and thetest hangs (timeout = failure), with no false-success path.
The test was disabled in
tests/CMakeLists.txtdue to flakiness in the oldtwo-way protocol; this PR re-enables it. Verified that reverting #13428
makes the test deadlock as expected.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com