Skip to content

test: stabilize flaky restart test by waiting for fresh client#766

Merged
mhuisi merged 1 commit intoleanprover:masterfrom
mhuisi:push-mprmlqltnrvx
Apr 14, 2026
Merged

test: stabilize flaky restart test by waiting for fresh client#766
mhuisi merged 1 commit intoleanprover:masterfrom
mhuisi:push-mprmlqltnrvx

Conversation

@mhuisi
Copy link
Copy Markdown
Collaborator

@mhuisi mhuisi commented Apr 14, 2026

Summary

The Worker crashed and client running - Restarting File (Refreshing dependencies) test in restarts.test.ts has been flaking on Windows (and occasionally Linux) with:

Missing "The Lean Server has stopped processing this file" in infoview after 60 seconds

Root cause: the test reuses the untitled:Untitled-1 URI from the preceding sibling test. initLean4Untitled returned as soon as the InfoView was open, before a fresh LeanClient for the new document had been wired up to the InfoProvider. When the server then crashed, infoview RPCs hung against the stale client instead of failing with WorkerCrashed, so the "stopped processing" message — which is only emitted as a side effect of that RPC failure (src/infoview.ts:215-223) — never appeared and the 60s assertion timed out.

  • initLean4Untitled now waits for the active client to reach the running state before returning.

While investigating Claude also fixed two latent bugs in the test helpers:

  • clickInfoViewButton had no return on success, re-clicking the target up to 5 times and toggling UI state.
  • findWord never decremented retries, so a missing word hung until the mocha suite timeout instead of failing with a clear assertion.

Test plan

  • Windows CI job passes (previously failing on this test for 5+ recent runs)
  • Linux CI job still passes
  • Other restart/info suites unaffected

🤖 Generated with Claude Code

The "Worker crashed and client running - Restarting File (Refreshing
dependencies)" test reused the `untitled:Untitled-1` URI from the
preceding test. `initLean4Untitled` returned as soon as the InfoView
was open, before a fresh `LeanClient` for the new document was wired
up to the InfoProvider. When the server crashed, infoview RPCs hung
against the stale client instead of failing with `WorkerCrashed`, so
the "stopped processing" message never appeared and the assertion
timed out after 60s. Observed on both Windows and Linux.

`initLean4Untitled` now waits for the active client to reach the
running state before returning.

Also fixes two latent bugs in the test helpers:
- `clickInfoViewButton` missed a `return` on success, re-clicking the
  target up to 5 times and toggling UI state.
- `findWord` never decremented `retries`, so a missing word hung until
  the mocha suite timeout rather than failing with a clear assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mhuisi mhuisi merged commit b883b0b into leanprover:master Apr 14, 2026
27 checks passed
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.

1 participant