Repository navigation
test(tui): a gated scenario for /diagnostics with a server running - #113
Merged
Merged
Conversation
The third outcome of /diagnostics — "No LSP diagnostics." — was unreachable before issue #111, because the LSP client could never start; with that fixed, the string is a property worth pinning. It is only printed when a client exists, so asserting it also guards the fix: if the circle returns, the status line says "LSP not available" instead. - The stub gains a "read" mode: reading a file is what starts the server (the warmup in tool/filesystem.go is the reachable path after #111), and the scenario needs the server up before /diagnostics can say anything else. Unlike the earlier stub modes, a scenario uses this one. - The scenario is gated by LSP_TEST because it needs gopls on PATH: `make test-tui-lsp` runs it, CI's lsp job already provides gopls, and a plain `make test` skips it. - The server comes up the way a user brings it up — a file read — so the scenario is a cold-start regression guard, not a mock. Measured: gated run twice, 0 failures; the earlier ad-hoc capture showed "LSP: gopls started for /Users/yusiwen/git/mine/TinyCode" and /diagnostics reporting "No LSP diagnostics." where it previously reported "LSP not available". Not covered: the listing outcome needs real diagnostics present, and the LSP *tool* path still gates on IsAvailable() (fine while a file operation happens first).
Two CI failures in the previous commit, both mechanical: - the tui-visual job picked the file up through the *.scenario glob and ran it without gopls, because the suite skips by filename pattern (*live-*) and the new file matched none. It now has its own pattern and says which target runs it; - test-tui-lsp failed at its screenshot step because the shots directory is created by the other target, not by this one. It creates it now. Verified: with gopls off PATH the suite reports the file as skipped and stays green (the way the tui-visual job sees it); with gopls on PATH make test-tui-lsp passes, ok: 14 steps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #111 (merged as the fix this guards).
What changed
tui/testdata/scenarios/lsp-diagnostics.scenario— the/diagnosticsoutcomeNo LSP diagnostics., which is only reachable once a language server is running. Gated byLSP_TEST, so a plainmake testskips it.make test-tui-lsp— runs that scenario gated the same waymake test-lspgates thelsp/tests, and for the same reason: it needs gopls on PATH.tui/testdata/stub/openai_stub.py— areadmode. Reading a file is what starts the server (the warmup intool/filesystem.gois the reachable path after [lsp] The client can never start: every path that would start it is gated on it #111). Unlike the two stub modes added earlier in this work, a scenario actually uses this one.lspjob runsmake test-tui-lsp, next to themake test-lspstep it already had — that job already provides gopls, so the scenario is a gate there rather than a file nobody runs.docs/tui-verification.mdandAGENTS.mdlist the scenario and its gate.Why this string
No LSP diagnostics.is the third of/diagnostics'"'"'s three outcomes. Before #111 it was unreachable — the client could never start — so the scenario doubles as a regression guard: if the circle returns, the warmup never runs,IsAvailable()stays false, and the status line saysLSP not availableinstead. The listing outcome is deliberately not covered: it needs real diagnostics present.Verification
make test-tui-lsp(run 1)ok, exit 0make test-tui-lsp(run 2)ok, exit 0make test-tui-scenariosLSP_TESTLSP: gopls started for /Users/yusiwen/git/mine/TinyCode, then/diagnostics → No LSP diagnostics.Honest scope
The gated scenario ran here with gopls from this repository'"'"'s own flake (v0.23.0) on PATH — a plain shell has no gopls, which is exactly why it is gated. CI'"'"'s
lspjob is where it runs unattended.Follow-ups
lsp/tools.go:81) still gates onIsAvailable(). Fine while a file operation happens first; worth revisiting if a session only uses LSP tools.