Repository navigation
test: the hover cache test waits for the language server, and the thread run state test ignores the 2026.3 tab rebuild - #2312
Merged
lagergren merged 2 commits intoNov 27, 2026
Conversation
…erver has started testHoverIsAskedForAgainWhenAnotherFileChanges failed on main's Windows job twice (runs 45990024944 and 45993688265): the second hover, which nothing had changed for, asked the language server again and got its new answer. The language server starts in the background when the first file opens. On a slow runner it was still starting when the first hover was asked for. Since redhat-developer#2208, LSPHoverSupport records the modification count of the project's language servers when it sends a hover, and asks again once a server has started or stopped since. The end of that start therefore made the second hover ask again, as designed. The project's PSI modification count did not change. The test now waits for the language server to start before the first hover. The other tests of the class are not affected: the definition support does not use the language servers' count, and a start does not change the PSI count.
…telliJ 2026.3 rebuilds for a new session tab testAThreadWhichContinuedAloneRunsAndShowsNoFramesOfItsStop adds a session listener after the stop and checks that the 'continued' event of the worker rebuilds the views (settingsChanged). In IntelliJ 2026.3, the frontend creates the session tab some time after the session starts. XDebugSessionTab.init then rebuilds the views: FrontendXDebuggerSession.rebuildViews runs a coroutine on the EDT, which calls XDebugSessionApi.triggerUpdate. The backend handles that with XDebugSessionImpl.frontendUpdate, which calls settingsChangedFromFrontend, and that calls settingsChanged by default. Locally this arrived 1.6 s after the session started and 85 ms before the test added its listener. On a slower runner it can arrive after the listener is added. The test would then count it and pass even if the client did not rebuild the views. In 2024.2 and 2025.3, the tab rebuilds the views at once, while the session starts. The listener now ignores settingsChangedFromFrontend. It counts only XDebugSessionImpl.rebuildViews, which the client calls when it handles the event. The client calls it synchronously on its message thread, and both platforms notify the listeners synchronously, so the count was never zero when it was asserted. The test still waits for it, with a bound, instead of asserting it at once.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2312 +/- ##
==========================================
- Coverage 58.64% 58.63% -0.02%
==========================================
Files 848 848
Lines 36674 36674
Branches 7603 7603
==========================================
- Hits 21507 21503 -4
- Misses 12169 12171 +2
- Partials 2998 3000 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Two races in tests, one commit each, for a rebase merge. Nothing in the product was wrong.
1.
FeatureCacheOtherFileChangeTesthovers only once the language server has startedtestHoverIsAskedForAgainWhenAnotherFileChangesfailed on main's Windows job twice in a row today (runs on d2ab131 and 1276e37), at line 53, "nothing has changed, so the hover is reused":Cause. Not the project's PSI modification count: logging every increment of
PsiModificationTrackershowed it, the file's stamp and itsLSPFileSupportunchanged between the two hovers. Since #2208,LSPHoverSupportalso recordsLanguageServiceAccessor.getModificationCount()when it sends a hover, and asks again once a language server started or stopped since. The mock language server starts in the background whenother.fooopens; when its start was still running at the first hover, it ended during it (updateStatus(started)on the server's listener thread moved the count from 1 to 2), and the second hover asked again, as designed. On a slow runner the start takes longer thanconfigureByText("main.foo").Fix. The test waits for the language server (
awaitLanguageServers(main)) before the first hover.Reproduction. Holding the server's
initializeuntil the first hover has read the counts makes the old test fail every time with the CI message; with the fix it passes. The definition test of the class,HoverWithoutWaitingTest,GotoDeclarationWriteActionTestandCompletionWhileTypingTestaren't exposed: only the hover uses the servers' count, and the others already wait for the language servers.2.
DAPThreadRunStateSessionTestno longer counts the views that IntelliJ 2026.3 rebuilds for a new session tabtestAThreadWhichContinuedAloneRunsAndShowsNoFramesOfItsStopcountedsettingsChangedfrom the moment it added its listener, and asserted at once that the views were built again after the worker continued.Cause. In 2026.3 the frontend creates the session tab some time after the session starts, and its
XDebugSessionTab.initrebuilds the views through an RPC to the backend,XDebugSessionImpl.frontendUpdate()→settingsChangedFromFrontend(), which callssettingsChanged()by default. In a local IU 2026.3 run it arrived 1.6 s after the start and 85 ms before the test added its listener, so it could be counted, and the test could pass without the client's own rebuild. 2024.2 and 2025.3 build the views of a new tab at once, during the start. The other risk, the client's rebuild arriving after the assertion, isn't real:DAPClient.continuedcallsrebuildViews()synchronously, and IntelliJ tells the listeners synchronously, before the ping thatwaitUntilHandledwaits for.Fix. The listener leaves out
settingsChangedFromFrontend()(no@Override: 2024.2 and 2025.3 don't declare it), and the test waits for the rebuild with a bound and a message instead of asserting at once.Proof, on IU 2026.3: with the product's rebuild switched off and the frontend's update delivered just after the listener is added, the old test passes for the wrong reason and the fixed one fails "the views of the stop are built again", as it should; with the product's rebuild, both pass.
Tests
Headless, 2024.2:
FeatureCacheOtherFileChangeTest,dap.threads.*,features.documentation.*,features.navigation.*,CompletionWhileTypingTest,CancelRequestAfterShutdownTestandServerStopPendingRequestsTest: 76 tests, no failure, error or skip.