Skip to content

Server-to-client requests (#48), JSON-RPC null params, red→green regressions for #21 #26 #49 - #51

Merged
MelbourneDeveloper merged 39 commits into
mainfrom
fix/issues-21-26-48-49
Nov 17, 2026
Merged

MelbourneDeveloper merged 39 commits into
mainfrom
fix/issues-21-26-48-49

Conversation

@MelbourneDeveloper

Copy link
Copy Markdown
Collaborator

TLDR

A server can now send its own requests to the editor (window/showDocument, workspace/diagnostic/refresh) and await the answer, and every fix for #21, #26, #48 and #49 now has a regression test proven red against the pre-fix code. Refs #21, #26, #48, #49.

Details

Added

  • lspkit_server::outbound (Outbound, OutboundResponse, OutboundResult, OutboundError). request(method, params) allocates a numeric JSON-RPC id and returns the frame to write plus a future for the answer. resolve(message) hands an inbound response to its waiter as Ok(result) (an absent or null result is Value::Null) or as Err(JsonRpcError). Requests and notifications are rejected with NotAResponse. An id that was never allocated, already answered or abandoned is rejected with UnknownId. Dropping a wait unregisters it.
  • impl From<u64> for lspkit::sidecar::RequestId, so an id read back off the wire can be passed to Correlator::resolve.
  • JsonRpcError now implements Display (JSON-RPC error {code}: {message}) and std::error::Error.
  • Spec entry [LSP-OUTBOUND] in docs/specs/lspkit-spec.md.
  • docs/plans/issue-fix-evidence-21-26-48-49.md: for each issue, the patch that restores the bug, the failing output, and the passing output.

Changed

  • Message::request and Message::notification leave params out of the message when it is null. JSON-RPC 2.0 allows only an object, an array, or no params at all. This changes the bytes on the wire for callers that pass Value::Null.
  • New Windows URI round-trip case: a percent-encoded UNC host and share (file://build%2Dhost/share%20one/a.rs).

Breaking changes: none at the API level. The only wire change is that a null params is now left out of the message.

How Do The Automated Tests Prove It Works?

  • lspkit-server/tests/outbound.rs
    • server_requests_resolve_from_the_editors_wire_answers: real Content-Length framing in both directions. The editor answers with a result, with null, with no result at all, and with an error. Each test checks the id on the wire, the decoded value, the error's Display text, and that pending_count drops back to 0.
    • abandoned_waits_unregister_and_unmatched_messages_are_rejected: covers a dropped wait, late answers, duplicate answers, foreign string and number ids, notifications and requests, and dropping the handle while a wait is still live (the wait ends with RecvError).
  • lspkit-server/tests/outbound_heap_leak.rs every_outbound_outcome_frees_its_heap_before_the_handle_drops: uses assert_releases_heap to show, to the byte, that answered, refused, abandoned and UnknownId waits all free their memory ([MEM-FIX-SCOPE]).
  • lspkit/tests/sidecar_correlator.rs raw_wire_ids_rebuild_the_request_id_and_resolve: a raw u64 read from JSON rebuilds the id and resolves the wait.
  • lspkit-server/tests/uri_authority.rs localhost_authority_is_the_host_not_a_folder (uri_to_path / path_to_uri mishandle network (UNC) paths, URI hosts and Windows extended-length paths #49): uses only the public API, so it compiles against the pre-fix crate and fails there.
  • Sidecar reader silently treats truncated frames as clean EOF #21: sidecar_disconnect_session.rs native_disconnects_preserve_prefix_and_payload_failures_after_valid_traffic. Cancellation regression can lose an earlier partial result #26: cli_sessions/dispatcher.rs cancel_during_a_scan_stops_the_stream_with_the_standard_error. Both run against the real diagnostic-reference binary, and the evidence doc shows each one failing once its fix is reverted.
  • Local make ci: 513/513 tests pass and every coverage threshold is met (lspkit 99.18%, lspkit-server 97.50%, sidecar 99.26%).

🤖 Generated with Claude Code

…C 3339 with std

RUSTSEC-2026-0543 (chrono) and RUSTSEC-2026-0542 (humantime). rmcp was never
called and every release requires chrono; clock.rs replaces humantime with a
civil-from-days formatter pinned by known-instant tests.
With rmcp gone the feature gated no dependency; the mcp module is always on.
MelbourneDeveloper and others added 17 commits November 18, 2026 07:06
… plan's table run on Windows

uri.rs parses every Windows path, from a URI or from a native path, into
one normalised WindowsPath (drive or UNC root, segments, trailing
separator) and renders both forms from it. All path handling stays in this
one module, and both styles share one percent decoder and one encoder.

Fixed on Windows (each was red on PR #50's uri.rs):
- A URI host can no longer reach a device path: file://%3F/C:/a.rs and
  file://./C:/a.rs are NoLocalPath, and \.\, \?\Volume{..} and
  \?\GLOBALROOT paths are InvalidPath.
- Hosts with a port, userinfo or an encoded separator are rejected.
- %2F (and %5C on Windows) inside a name is rejected on every platform,
  never split on.
- One file, one URI: the drive letter is upper case and the server name
  lower case, repeated separators collapse, and . and .. resolve.
- Names Win32 would rewrite (a trailing dot or space, NUL, CON, aux.rs)
  decode to the \?\ form, so they open the file they name.
- file:////server/share and [ipv6] hosts decode to UNC paths.
- A % not followed by two hex digits is InvalidUtf8 on every platform.

src/uri_cases.rs holds the #49 Windows plan's table once. uri_style_tests.rs
runs it through Style::Windows on every OS, and tests/uri_windows.rs runs
it through the public API on a Windows build, together with real-filesystem
rows: canonicalize output, a path over 260 characters, a junction, 8.3
names, reserved names and drive-letter case. On Windows 11, uri_windows
passes 0/10 on 384b341~1, 4/10 on PR #50 and 10/10 now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-server/lsp-profiler-dotnet workspace entries
- lsp-profiler-dotnet: backtick CoreCLR in a cfg(windows) doc comment.
  Linux CI never compiles that function, so clippy::doc_markdown only
  fired on Windows.
- website/tests/prose_test.py: resolve npm with shutil.which, because
  CreateProcess cannot find npm.cmd by its bare name. Read pages as UTF-8,
  not the Windows code page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…53)

A hostile Content-Length panicked read_message with capacity overflow and any
large claim reserved that much memory up front. FrameTooLarge now rejects it
before reading, read_message_within takes a server cap, and memory follows the
bytes that arrive.
…Time starts at 1601

century_leap_rules_hold_before_the_epoch panicked on Windows with
"overflow when subtracting duration from SystemTime": Windows SystemTime
is FILETIME-based and cannot hold 1600-02-29, so make test stopped
fail-fast on the first lsp-profiler test there.

rfc3339 now formats through rfc3339_seconds(i128). Every row is checked
through the seconds formatter on every OS, and also through SystemTime
wherever the platform can represent the instant. No row is dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h the test executable's ancestors for examples/
…o warm (#52)

clear() was the only eviction and dropped every memo, so each didClose made all
open tabs re-pull cold. forget(uri) retires the document's Salsa input on the
next query and reuses the slot for the next opened document; open/forget cycles
free exactly what they allocate.
read_line had no bound, so a header line that never ends grew memory with the
peer's bytes. One 8 KiB budget now covers every header line and terminator, so
an endless line and endless short lines both end in HeaderTooLarge.
… reference server forgets on didClose (#52)

Builds on d2a22c4 and closes three gaps that cross-check tests found:

- The retired memo stayed alive until a later pull, then until Salsa's
  next revision. forget now retires the document at once whenever no
  query holds the lock (try_lock, so it still never waits behind compiler
  work; otherwise the next query retires it first). One write to the
  retired slot then starts the next revision, which frees the replaced
  memo. forget_frees_the_closed_documents_diagnostics_before_it_returns
  checks this with a Weak, and fails if either step is removed.
- A retired slot was marked by an empty URI, so a pull of "" returned a
  clean report without analysis. A slot is now marked by an open flag.
- The reference server still called clear() on didClose. It now calls
  forget(uri), so the diagnostic_reference suites exercise forget.

Also tested: forget returns while a compiler query runs, and the queued
release applies before the next pull. All 197 lspkit-server tests pass
on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ses are a set (#52)

On top of 029e583: closes that arrive while a pull holds the state retire as
that pull releases it, not at some later pull, and repeated closes are one
queued entry. Heap tests cover idle close-all, a close during an in-flight pull
and repeated closes; each fix line has a killing mutant.
MelbourneDeveloper and others added 11 commits November 18, 2026 07:44
)

Consumers no longer need a source checkout or the release tarball.
scripts/release-assets.sh adds two kinds of asset to the GitHub Release:

- lsp-profiler-dotnet-engine-<version>-<rid>.tar.gz for linux-x64,
  linux-arm64, osx-x64, osx-arm64, win-x64 and win-arm64: the
  framework-dependent engine lsp-profiler-dotnet launches. Point
  LSP_PROFILER_DOTNET_ENGINE at the extracted executable.
- lspkit-consumer-kit-<version>.tar.gz: dotnet/fixtures (source only),
  LSP-PROFILER-SPEC.md, LSP-PULL-SPEC.md, test-support/ and
  scripts/typediagram/run-cli.mjs.

release.yml sets up .NET and writes them into DIST, so SHA256SUMS,
cosign and the attestations cover them. CI packages linux-x64 and checks
both archives' contents, so a broken script fails on a PR, not at tag
time. The lsp-profiler-dotnet e2e support honours
LSP_PROFILER_DOTNET_ENGINE, so the same suites run against a released
engine. On Windows, the extracted win-x64 asset passes every .NET e2e
session.

lsp-profiler-ui gains a CHANGELOG.md (packed) recording the breaking
0.4.0 change: buildFlamegraphHtml, apply{Profile,Memory,Leak}Decorations
and removeTestDir return Promises. Spec: [REL-CONSUMER-ASSETS].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
native_initial_read_failure_stays_visible opens a directory, which only
Unix lets a reader open and then fail on (EISDIR). On Windows that
branch (inbound.rs next_frame's read error) went uncovered, which put
lspkit::sidecar at 98.52% and lspkit at 98.85%, under their 99% floors
in make test. The Windows twin holds an exclusive byte-range lock from
another process (test-support/windows-oplock/lock.ps1, with readiness
read from its state line, never from timing). The open succeeds, and
the first read fails with ERROR_LOCK_VIOLATION, which the test pins as
"(os error 33)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CI regressions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…em intact

On Windows every capture ran through cmd.exe (shell: true), which joins
the command and its arguments unquoted. A quote or a space in any of
them was lost or split. The generator passes an absolute model path, so
a checkout under a folder with spaces broke wire generation, and
run-cli.test.mjs failed on Windows (`ab is not defined`).

Only a bare name or a .cmd/.bat shim goes through the shell now, with
the command and every argument quoted the way the Windows C runtime
parses them back. A real .exe runs directly. New tests: a .cmd shim
whose path has a space receives spaces, embedded quotes and a trailing
backslash intact, and quoteForCmd's escaping is pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et and sidecar tests

Every failure is an assertion on the whole result instead, for example
assert_eq!(uri_to_path(u).ok(), Some(path)) or
assert!(matches!(r, Err(UriError::..))). A test that needs the value
asserts first and binds it with let-else. No check was weakened.
Several are stricter: round trips compare exact URIs where they checked
only substrings.

Covers src/uri_style_tests.rs, tests/uri.rs, tests/uri_authority.rs,
tests/pull_forget.rs, pull.rs's memory test and
lspkit/tests/sidecar_disconnect_session.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th and PATHEXT

resolveAdapterPath takes a platform, but its PATH lookup used the host's
node:path, so a Windows host split a POSIX request's PATH on ';' and
joined with '\'. Four adapter-resolution tests failed on Windows, which
was the last red step of make test there. The lookup was also wrong for
real Windows requests:

- a bare `netcoredbg` never matched `netcoredbg.exe`, because PATHEXT was
  ignored;
- `env.PATH` missed the usual Windows spelling, `Path`, in a copied
  environment;
- a request for another platform used the host separator.

findOnPath(command, { env, existsSync, platform }) now owns the lookup:
path.win32 or path.posix by platform, PATH and PATHEXT read
case-insensitively on Windows, and PATHEXT names (default
.COM;.EXE;.BAT;.CMD) for a bare command there. findExecutableOnPath keeps
its public signature as a wrapper with the host's platform. New tests
cover ';', Path, PATHEXT, its default, a bare name never matching without
an extension, an explicit extension, and the host wrapper. 114/114 pass
on Windows; the suite also passes on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ler's normalize_path

Both fallbacks are explicit matches now: a path outside the reported root
is kept, and a path canonicalize cannot resolve keeps its spelling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MelbourneDeveloper
MelbourneDeveloper merged commit 697e200 into main Nov 17, 2026
10 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the fix/issues-21-26-48-49 branch November 17, 2026 21:58
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