Repository navigation
Description
What happens
On macOS, a pynix lsp subprocess spawned by pytest_lsp answers
textDocument/didOpen far too late. The client waits for
textDocument/publishDiagnostics, the 120 s deadline of
test-support/deadline.py fires, and the test fails.
The answer does arrive. It arrives after the deadline. The teardown of the
test records it:
pytest_lsp/protocol.py:53 in _handle_notification
future.set_result(params)
concurrent.futures._base.InvalidStateError: CANCELLED: <Future ... state=cancelled>
set_result on a cancelled future is _handle_notification receiving the
notification after the deadline cancelled the waiter. So this is slowness, and
not a deadlock.
What it is not
The same server, spawned by hand over real stdio, answers the same didOpen
for the same file in 1.0 s. Measured on macOS 26.5.1 arm64, against
pynix/tests/test_lsp/module_system/config1.nix. Each of these was tried, and
none of them changed the 1.0 s:
- the exact
client_capabilities("visual-studio-code")that the fixture sends,
rather than an empty capability set; initializewith and withoutrootUri;- the
NIX_CONFIGthat_configure_worker_local_storesexports, and
NANOPYNIX_TEST_SYSTEM_STORE=1; - draining the stderr of the server, and leaving it undrained.
It is not one test poisoning another either: the test fails the same way when
it is the only test of the run.
So the difference is the process that pytest runs in, and not the protocol, the
capabilities, the environment or the order.
Why it matters twice
It cost a CI run. test-darwin-nix_2_34 in run 31949782513 reached 94 %
and then hit the 30-minute cap of caps.suite, inside these tests. Four of
them at 120 s each is eight minutes of a thirty-minute job.
It cost
8000
the debugging. The fixture gives a bare timeout and no server
state, so the list above took six experiments by hand to establish. A test
layer that hides what failed is a defect of its own.
What was done meanwhile
The five behavioural tests moved to pynix/tests/test_lsp_protocol.py, on the
lsp_wire fixture: the same pytest_lsp.LanguageClient, the same
capabilities, the same JSON-RPC framing and serialization, and both halves in
one process with a live reference to the server. The same five assertions run
in 3.4 s there, against 10 minutes of deadlines over stdio.
test_lsp_e2e.py keeps what only a real process can answer: that the packaged
pynix lsp entry point starts and negotiates initialize.
Acceptance
- A document round trip against a spawned
pynix lspanswers in a second on
macOS, as it does when the same server is driven by hand. - The reason the pytest process changes it is written down.
test_lsp_e2e.pygets its document round-trip test back, ungated.- The fixture reports the stderr of the server on a failure, so the next
timeout arrives with evidence.
Refs #182
Activity
test(pynix): move the LSP behaviour tests to the tier that can be read
ci(darwin): give the macOS suite its own cap, at 45 minutes
Lillecarl commentedon Aug 16, 2026
Duplicate of #73, which recorded the same five tests, the same 120-second
deadline and the same
InvalidStateError: CANCELLEDteardown — on Linux,in run 30712707907. So this is not macOS-specific, as this issue claimed. The
macOS job makes it deterministic rather than causing it.
Everything here is now a comment on #73. Closing in favour of that one.
docs(tests): point the LSP notes at #44, the issue that already had it
test(pynix): move the LSP behaviour tests to the tier that can be read
ci(darwin): give the macOS suite its own cap, at 45 minutes
docs(tests): point the LSP notes at #44, the issue that already had it