8000 pynix lsp answers didOpen after the deadline, under pytest on macOS · Issue #188 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

pynix lsp answers didOpen after the deadline, under pytest on macOS #188

Closed as not planned

Description

@Lillecarl

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;
  • initialize with and without rootUri;
  • the NIX_CONFIG that _configure_worker_local_stores exports, 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 lsp answers 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.py gets 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

  1. Lillecarl commented on Aug 16, 2026

    @Lillecarl
    ContributorAuthor

    Duplicate of #73, which recorded the same five tests, the same 120-second
    deadline and the same InvalidStateError: CANCELLED teardown — 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.

  2. added
    source: nanopynix
    on Oct 19, 2026
  3. added theissue type on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: nanopynix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0