Repository navigation
test: the extension against a real engine - #2
Merged
Merged
Conversation
The other test files check this repository's JavaScript, and none of them would notice the engine changing underneath it. That coupling is the one most likely to break silently: a capability writ-lsp stops advertising, or a flag the CLI renames, leaves the extension running and doing nothing. test/engine.test.js spawns the writ-lsp the extension would find and speaks LSP to it over vscode-jsonrpc (already installed as the client's transport): initialize and its serverInfo, full sync, hover, outline and completion advertised, diagnostics on a good and a broken model, the outline, hover, completion, and shutdown. It then runs every command-line shape src/commands.js builds - check, check --claims, show --at, derive, derive --why, compare - and asserts the CLI accepted each one (exit 0 or 1, never 2). With no writ-lsp, or no node_modules, it prints a skip and passes, so scripts/test.sh still needs nothing installed. WRIT_E2E_REQUIRED=1 turns a skip into a failure; writ's downstream image sets it. Against writ main the two serverInfo checks fail: the server does not send it yet, though engine.js and the panel read it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
The extension's tests check its own JavaScript. None of them would notice writ changing underneath it. A capability that
writ-lspstops advertising, or a CLI flag that gets renamed, leaves the extension running and quietly doing nothing.What
test/engine.test.jsspawns thewrit-lspthe extension would find and talks LSP to it. It usesvscode-jsonrpc, which is already installed as the client's transport, so there is no new dependency.initializemust includeserverInfo, full-document sync, hover, outline and completion.src/commands.jsbuilds must be accepted by the CLI. That covers check, check with claims, show, derive, derive with--why, and compare. Exit 2 means the CLI rejected the command.With no
writ-lspor nonode_modules, the test prints a skip, soscripts/test.shstill needs nothing installed. SettingWRIT_E2E_REQUIRED=1turns that skip into a failure. writ's new downstream image sets it, on the writ-lang/writdownstream-imagebranch.Expected failure until writ sends serverInfo
Against writ
main, 21 of 23 checks succeed. The twoserverInfochecks fail because the server doesn't send it yet, even thoughengine.jsand the panel read it. The writ change that adds it sits on a locallsp-server-infobranch, and with it all 23 checks succeed. I also renamed a flag on purpose to confirm the command-line checks catch it.Stacked on
activity-bar-panel, which has the test harness andsrc/locate.js.🤖 Generated with Claude Code