Skip to content

test: simplify cancellation_par test infrastructure#13663

Merged
nomeata merged 3 commits into
masterfrom
joachim/cancellation-test-simplification
May 6, 2026
Merged

test: simplify cancellation_par test infrastructure#13663
nomeata merged 3 commits into
masterfrom
joachim/cancellation-test-simplification

Conversation

@nomeata
Copy link
Copy Markdown
Collaborator

@nomeata nomeata commented May 6, 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

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>
@nomeata nomeata requested a review from mhuisi as a code owner May 6, 2026 13:36
@nomeata nomeata added changelog-language Language features and metaprograms release-ci Enable all CI checks for a PR, like is done for releases labels May 6, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 6, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 22abf93a5999e55b3158ec74381bdb39cf943c86 --onto ea6e76707835317858b7dd36c95322679c50aaac. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-06 17:37:18)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 22abf93a5999e55b3158ec74381bdb39cf943c86 --onto 3fc99eef102549c743c6c63547983319bfae6f01. You can force reference manual CI using the force-manual-ci label. (2026-05-06 17:37:20)

@nomeata nomeata added this pull request to the merge queue May 6, 2026
Merged via the queue into master with commit 0c6785c May 6, 2026
24 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-language Language features and metaprograms release-ci Enable all CI checks for a PR, like is done for releases toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants