Skip to content

test: the extension against a real engine - #2

Merged
sajonaro merged 1 commit into
activity-bar-panelfrom
engine-e2e-test
Oct 3, 2026
Merged

sajonaro merged 1 commit into
activity-bar-panelfrom
engine-e2e-test

Conversation

@sajonaro

@sajonaro sajonaro commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Why

The extension's tests check its own JavaScript. None of them would notice writ changing underneath it. A capability that writ-lsp stops advertising, or a CLI flag that gets renamed, leaves the extension running and quietly doing nothing.

What

test/engine.test.js spawns the writ-lsp the extension would find and talks LSP to it. It uses vscode-jsonrpc, which is already installed as the client's transport, so there is no new dependency.

  • Startup: the reply to initialize must include serverInfo, full-document sync, hover, outline and completion.
  • Diagnostics: a good model gets no errors, and a broken one gets an error with a range.
  • Editor features: the outline, hover, completion and shutdown all have to work.
  • Command lines: every shape src/commands.js builds 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-lsp or no node_modules, the test prints a skip, so scripts/test.sh still needs nothing installed. Setting WRIT_E2E_REQUIRED=1 turns that skip into a failure. writ's new downstream image sets it, on the writ-lang/writ downstream-image branch.

Expected failure until writ sends serverInfo

Against writ main, 21 of 23 checks succeed. The two serverInfo checks fail because the server doesn't send it yet, even though engine.js and the panel read it. The writ change that adds it sits on a local lsp-server-info branch, 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 and src/locate.js.

🤖 Generated with Claude Code

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>
@sajonaro
sajonaro merged commit cdca344 into activity-bar-panel Oct 3, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant