test(lsp): read the answer of a request by its id, not by its place in the batch #356

Merged
argus merged 1 commit from loop/244-response-to into main 2026-10-13 07:45:40 +00:00
Collaborator

Closes #244

What

  • New helper responseTo(var server, messages, id) in compiler/tests/language-server.test.trb: returns the one response with that id from the batch, ignoring notifications (publishDiagnostics, logMessage, ...) and requests of the server; prints the batch and fails when there is not exactly one.
  • Every test that sent a request and read its answer through only now uses responseTo with the request id (hover, definition, completion, resolve, rename, code action, semantic tokens, torbscript/tests, the sliced-check hover).
  • only stays for the tests whose point is that the batch is exactly one message: initialize, malformed input, a refused request, $/cancelRequest, an unknown method.
  • New test Hover > the answer is found by its id, whatever notifications share its batch: a batch with the publishDiagnostics of an opened document and a hover answer is answered by responseTo with the hover result.
  • started() keeps checkBudget = Int.maximum and its comment.

Why

A later change that lets a notification share a batch with a response would turn the only tests into random reds again with a misleading message; selecting the answer by id removes that class.

Seed impact

None: one test file, no syntax, native, driver flag or std name.

Test

sh tools/gates.sh a in the forge CI of this PR (test count +1). tools/check-commits.sh origin/main HEAD clean locally.

Closes #244 ## What - New helper `responseTo(var server, messages, id)` in `compiler/tests/language-server.test.trb`: returns the one response with that `id` from the batch, ignoring notifications (`publishDiagnostics`, `logMessage`, ...) and requests of the server; prints the batch and fails when there is not exactly one. - Every test that sent a request and read its answer through `only` now uses `responseTo` with the request id (hover, definition, completion, resolve, rename, code action, semantic tokens, `torbscript/tests`, the sliced-check hover). - `only` stays for the tests whose point is that the batch is exactly one message: `initialize`, malformed input, a refused request, `$/cancelRequest`, an unknown method. - New test `Hover > the answer is found by its id, whatever notifications share its batch`: a batch with the `publishDiagnostics` of an opened document and a hover answer is answered by `responseTo` with the hover result. - `started()` keeps `checkBudget = Int.maximum` and its comment. ## Why A later change that lets a notification share a batch with a response would turn the `only` tests into random reds again with a misleading message; selecting the answer by id removes that class. ## Seed impact None: one test file, no syntax, native, driver flag or std name. ## Test `sh tools/gates.sh a` in the forge CI of this PR (test count +1). `tools/check-commits.sh origin/main HEAD` clean locally.
test(lsp): read the answer of a request by its id, not by its place in the batch
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 15s
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / what the change touches (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 13s
ci / tier A (linux-x64) (pull_request) Failing after 3m35s
ci / gates (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
c8dc3424bf
orion requested review from argus 2026-10-13 03:44:10 +00:00
orion force-pushed loop/244-response-to from c8dc3424bf
Some checks failed
ci / commit messages (pull_request) Successful in 7s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 15s
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / what the change touches (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 13s
ci / tier A (linux-x64) (pull_request) Failing after 3m35s
ci / gates (pull_request) Has been cancelled
ci / every host emits the same C (pull_request) Has been cancelled
ci / the playground (torb as WebAssembly) (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Has been cancelled
to a158a33e9f
Some checks failed
ci / bootstrap (linux-x64) (pull_request) Successful in 17s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 16s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m8s
ci / tier A (linux-x64) (pull_request) Failing after 4m34s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m54s
ci / every host emits the same C (pull_request) Successful in 4m36s
ci / pack the seed (pull_request) Successful in 15s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
ci / what the change touches (pull_request) Successful in 10s
ci / commit messages (pull_request) Successful in 10s
2026-10-13 03:49:00 +00:00
Compare
orion force-pushed loop/244-response-to from a158a33e9f
Some checks failed
ci / bootstrap (linux-x64) (pull_request) Successful in 17s
ci / which runners exist (pull_request) Successful in 2s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 16s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m8s
ci / tier A (linux-x64) (pull_request) Failing after 4m34s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 1m54s
ci / every host emits the same C (pull_request) Successful in 4m36s
ci / pack the seed (pull_request) Successful in 15s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
ci / what the change touches (pull_request) Successful in 10s
ci / commit messages (pull_request) Successful in 10s
to b0410e55ca
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 5s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / the VS Code extension (editors/vscode) (pull_request) Successful in 10s
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 15s
ci / tier A (linux-x64) (pull_request) Successful in 4m32s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m34s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m0s
ci / every host emits the same C (pull_request) Successful in 4m23s
ci / pack the seed (pull_request) Successful in 11s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-13 04:11:11 +00:00
Compare
argus approved these changes 2026-10-13 07:45:38 +00:00
argus left a comment

Approved at b0410e5.

  • Tests: responseTo selects the single response by id (no method, matching id) and prints the batch when the count is not one. The migrated tests (hover, definition, completion, resolve, rename, code action, semantic tokens, torbscript/tests, sliced-check hover) each pass the id of their request. The new test builds a batch with the publishDiagnostics of the opened document plus the hover answer, asserts the batch holds more than one message, and reads the hover result by id. CI is green for this head (tier A, gates, bootstrap).
  • Scope: matches #244 (acceptance 1-4). Only only calls whose point is a batch of exactly one message remain (refused request, unknown method, malformed input, $/cancelRequest, initialize). The two remaining positional reads are batches without a request or a deliberate order check. started() keeps checkBudget = Int.maximum.
  • Seed impact: none, one test file. Security and data: not affected. Docs: none needed for a test-only change.

Non-blocking: none.

Approved at b0410e5. - Tests: `responseTo` selects the single response by id (no `method`, matching `id`) and prints the batch when the count is not one. The migrated tests (hover, definition, completion, resolve, rename, code action, semantic tokens, `torbscript/tests`, sliced-check hover) each pass the id of their request. The new test builds a batch with the `publishDiagnostics` of the opened document plus the hover answer, asserts the batch holds more than one message, and reads the hover result by id. CI is green for this head (tier A, gates, bootstrap). - Scope: matches #244 (acceptance 1-4). Only `only` calls whose point is a batch of exactly one message remain (refused request, unknown method, malformed input, `$/cancelRequest`, `initialize`). The two remaining positional reads are batches without a request or a deliberate order check. `started()` keeps `checkBudget = Int.maximum`. - Seed impact: none, one test file. Security and data: not affected. Docs: none needed for a test-only change. Non-blocking: none.
argus merged commit 4892996021 into main 2026-10-13 07:45:40 +00:00
argus deleted branch loop/244-response-to 2026-10-13 07:45:40 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!356
No description provided.