Skip to content

lspcheck 0.7.0

Latest

Choose a tag to compare

@github-actions github-actions released this 21 Nov 01:47
· 4 commits to main since this release
a627cd5

This release lets a profile set the client capabilities lspcheck sends, and fixes verdicts that didn't match what
lspcheck observed, mostly in the cancellation and lifecycle checks. Some verdicts change from 0.6.0, each to what
lspcheck actually saw: C1, C2, C3, K1, L4, L6, L7 and L9 can go from fail to pass, error or N/E; C1, C2, L1,
L2, L9, R1 and R4 from pass to fail or error; and L2 and R3 from error to pass or fail. The entries
below say when.

Added

  • Profiles accept [client.capabilities], a table merged over lspcheck's client capabilities in every initialize
    it sends. The profile wins where both set a key (objects merge key by key; arrays and scalars replace lspcheck's),
    and lspcheck's own capabilities stay where the profile is silent. Two values are refused because lspcheck couldn't
    judge under them: textDocument.synchronization.dynamicRegistration = true, and a general.positionEncodings
    entry other than utf-8, utf-16 or utf-32. A set that isn't of the LSP 3.17 ClientCapabilities type once
    merged is refused, naming the key and the scenarios affected. A key LSP 3.17 doesn't define is sent anyway, with a
    warning on stderr. L2 judges the server's positionEncoding against the offer actually sent, and names a profile's
    offer in its detail. When the capabilities set workspace.workspaceFolders = false, lspcheck sends no
    workspaceFolders param; rootUri still names the workspace. The placeholder capabilities = "default" is refused
    with a message showing the table form.

Fixed

  • L2 now judges the positionEncoding of every scenario's first initialize, each against the offer sent with
    it, not only the lifecycle scenario's. A server that chose an encoding it wasn't offered in another scenario passed
    L2, while D1 and the other position checks there said "not judged, see L2". The failure names the scenarios and the
    offer, and a violation seen fails L2 even when the lifecycle scenario couldn't finish initializing. A first
    initialize answered only after --startup-timeout ran out is judged from the result lspcheck read later. When no
    violation was seen but a scenario's first initialize got no result lspcheck saw while it missed output (such as a
    frame over --max-frame-mib), L2 is ERROR, naming the scenario, instead of passing. The report links the
    transcript of the scenario L2's verdict came from. --only L2 now runs every scenario.
  • K1 no longer fails on a MethodNotFound for a request the server may have withdrawn with
    client/unregisterCapability. Its answer isn't judged when, before it, lspcheck had read any
    client/registerCapability or client/unregisterCapability for the request's registration method
    (textDocument/semanticTokens for the semantic tokens requests, textDocument/rename for prepareRename),
    whatever its id or document selector, or when the client capabilities let the server register the method
    dynamically and lspcheck missed output between the initialize answer and the MethodNotFound. lspcheck doesn't track
    which registrations are in force, so a server that sends a stray registration and then wrongly answers
    MethodNotFound isn't failed. Such a request is still sent, and the detail names it and why. This applies in the
    capabilities and mutation scenarios, and K1 with nothing else to judge is N/E.
  • C1 and R4 no longer pass when the server answers their request with a message carrying the id but no
    well-formed outcome, by J5's rules: exactly one of result and error, and the error an object with an integer
    code (signed 32-bit) and a string message. So neither, both, error: null and error: {} don't count. Such a message still
    fails J5. C1 and R4 now wait past it for a proper answer with that id until the request's deadline, and fail only if
    none comes and they read the whole wait; their detail then says such a message came. Only a response read once
    lspcheck registered the request (just before writing it) counts, so R4 no longer takes a reply that came before it. Other checks still take such a
    message as the request's reply, so one malformed reply doesn't stall every later wait. R4 no longer calls the answer
    it took after such a message "likely id mangling", but still lists any other response with that id.
  • C2 can now fail only on a response carrying an id never sent, or on a plain request after the cancels that gets
    no proper answer in time. It now cancels a plain request of its own that the server has answered properly, rather
    than C1's cancelled request. A response with that request's id after its cancel makes C2 error, whatever it holds,
    RequestCancelled (-32800) included, since it may be a late second answer (which J2 fails). If the plain request got
    only a message with its id, C2 doesn't cancel it, since it may still be pending, and is error unless cancelling the
    unknown id fails it. C2 no longer passes after cancelling only an id never sent when C1's request went unanswered:
    it now tests both cases. A second response to C1's request now fails C1 whenever it arrives before exit; it
    used to fail C2 instead when it came after C2's cancels. C1 now watches for a second response until exit, so
    output lspcheck missed anywhere in that span makes a C1 pass error.
  • C1 and C2 no longer fail when an answer they waited for arrives after --timeout but before exit.
    --timeout is lspcheck's limit, not the protocol's: C1 judges such an answer as usual, and a plain request after
    C2's cancels answered that late makes C2 error (and C3 is then judged as usual). Output lspcheck missed before
    exit, such as a frame over --max-frame-mib, could have held such an answer, so it now makes a missing answer
    error rather than fail.
  • C3 now fails only on a MethodNotFound (-32601) response without an id whose error message names
    $/cancelRequest as a whole word, not as part of a longer name such as $/cancelRequestMetrics, read after
    lspcheck began writing the first cancel, its code read by value as J5 does (so -32601.0 counts). Any other response without an id now gives error rather than fail,
    including one with another code that names $/cancelRequest (such as initialized failing) or that mentions
    cancelRequest only in its data. One read before the cancel was written no longer counts for C3 at all (J3 still
    judges it).
  • L6 and L7 no longer fail a server that may have been waiting on lspcheck when the exit deadline passed. A
    server still running now fails only if lspcheck saw it running a whole --exit-timeout after it last had something
    of the server's to handle (a message to take in, or a request to answer), if that was by the deadline. Once the
    session has ended, the failure stands only if lspcheck read nothing more of the server's stdout after that, every
    request the server sent had been answered in full by then, and lspcheck lost no frame and read no message that isn't
    JSON-RPC. So a request still queued at the deadline, or still being decoded behind a large frame, output written
    after it, and a request lspcheck couldn't answer now make the check error, saying which. A server that asks
    something after exit and then hangs still fails, after up to twice --exit-timeout. lspcheck also no longer fails
    a server that exited in time while lspcheck was still writing an answer to one of its requests, which a process the
    server left holding its stdin can keep going until the deadline: it now watches for the exit while it writes. An
    exit lspcheck saw only after the deadline (while it prepared a large answer, say) is error, with both times.
  • L9 no longer fails on a process that had exited before the 1 s grace after the server's exit ended, but that a
    search begun before the end of the grace and finished after it (a slow /proc read or ps) had seen. Only a search
    begun once the grace is over now counts a process as left behind. A search that fails earlier is tried again; if the
    one begun after the grace fails, L9 is error.
  • L9 now fails for a descendant that left the server's process group (with setsid, say) while its parent in the
    group is still running. lspcheck missed it until its parent exited, so L9 passed when the parent's name was in
    allow.descendants. lspcheck now finds every process descended from the group's members, and checks each one
    against the list. A pid read as a parent may pass to an unrelated process while lspcheck lists processes, so on
    Linux a process found through its parent counts only once a second listing shows the same parent, by pid and start
    time, still named by the same child; one lspcheck can't confirm makes L9 error rather than fail it. On macOS,
    where ps gives no start time precise enough, a process found through its parent always does.
  • On macOS, the ps lspcheck runs to find leftover processes now writes to a temporary file instead of a pipe. A
    process left holding its output can no longer keep a thread reading it after the search has given up, and no longer
    makes L9 error with "ps's output didn't end". lspcheck reads at most 16 MiB of it; more, or a read cut short,
    makes the search fail rather than judge from part of the list. Each search for leftover processes, and each ps
    run within it, now ends by a deadline.
  • L4 no longer fails a server that answers shutdown with an error, which LSP allows when an exception happens
    during shutdown. L4 now passes if the server keeps running after it, and the detail names the error. The error must
    be well formed by J5's rules (an integer code in the signed 32-bit range and a string message), and not
    MethodNotFound (-32601), since every server must implement shutdown. A result other than null, any other error,
    or exiting before exit still fails L4. L4 now passes only once lspcheck has seen the server still running just
    before it writes exit, so a server that exits in between fails L4 too. Its title, which JUnit reports use as the
    test name, now reads "shutdown returns null (or an error) and the server keeps running until exit".
  • L1 no longer passes when output lspcheck didn't read, such as a frame over --max-frame-mib, arrived between
    the notification it sends before initialize and the answer to initialize: that output could have been a reply
    to the notification. L1 is then error and says why. Output that comes once lspcheck has read the answer, such as a
    large log message on initialized, doesn't count. A reply lspcheck read still fails L1.
  • L7 no longer judges an exit status the server reached before lspcheck sent exit, such as a server that exits
    while a child it left behind keeps the conversation going. L7 is then not exercised, and says the server exited
    before exit was sent, as L6 already does.
  • L2 is judged from the initialize result even when lspcheck can't send initialized (or the profile's
    workspace/didChangeConfiguration) afterwards, for example because the server closed its input. L2 used to be
    error then; it now passes or fails on the result. J4, L4 and L6, which need the server initialized, are still
    error, and now say what couldn't be sent.
  • R1 now counts a reply to the non-JSON body that arrives after the plain request's answer, up to when lspcheck
    sends exit. A late response with id null and another error code than ParseError (-32700), or a result, used to be
    ignored and R1 passed saying the body was ignored. Read before lspcheck begins writing shutdown (once it has
    answered what the server asked meanwhile), it now fails R1; read after, it may be the server's error about
    shutdown, so R1 is error. A late ParseError still passes, and the
    detail now counts it instead of saying the body was ignored. The plain request must still be answered within
    --timeout.
  • R3 now fails, instead of being error, when the server leaves the plain request after the large document
    unanswered for its whole wait, which lspcheck read in full, and then sends output lspcheck can't read while it waits
    to see whether the server exits. That output came too late to hold the answer. A server that exits was already
    judged this way.