test(lsp): end every check of a test server in its batch, not after 40 ms #269
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/268-hover-test-main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #268
Cause
A wall-clock flake, not an interaction of the landed commits.
LanguageServer.receivetakes the check of the documents a batch opened or changed for at mostcheckBudget(stepBudget, 40 ms of wall clock,continueChecks); a request that waits for that check (checkedRequests: hover, completion, definition, ...) is answered in the batch only when the check ends within that budget, otherwise by a laterstep(). The test sentdidOpenand the hover in one batch and read only that batch's answers, so when tier A's four lanes loaded the runner and the check took longer than 40 ms, the hover had no answer yet:answerOfgavenulland the markdown was"".Evidence:
0a1a03f0,596b50a6or90e233aatouchescompiler/src/language-server/or this test.main13d7e718(a completion item of a deprecated declaration carries the tag ..., the completion answer missing:"null"), runs 534 and 609 (the first keystroke builds them for every module ...,runs.length() == 2), run 468 (a body whose inferred result changes checks the bodies that call it, the diagnostics not published with the batch).Fix
started()(and through itcheckedWith) setscheckBudgettoInt.maximum: every check a batch begins ends in that batch, whatever the speed of the machine. The tests of the slicing already set it to0and so take one statement per slice, which does not depend on the clock either. A test server now uses one of these two budgets, never the 40 ms of the real transport. Only the test file changes; the server and its default stay as they are.Approved at
2990ac8.started()is the single constructor of the checked-request tests,checkedWithgoes through it, and the slicing tests still setcheckBudget = 0afterwards. CI is green on this head (tier A, gates).checkBudgetis avarof the server (server.trb:99), so the assignment is valid;Int.maximummakesspent >= checkBudgetnever fire, so a check ends in its batch. The remaining directLanguageServer.oversites (life cycle, symbols, tests of a file) use requests outsidecheckedRequests, so they do not depend on the budget.compiler/tests/language-server.test.trb, matches #268; server and default untouched.Non-blocking: the doc comment says every test server has no time budget, while the three direct
LanguageServer.oversites keep the default (harmless today, as none of them waits for a check).