[Repo Assist] fix: improve test infrastructure resilience (flaky diagnostics + cleanup failures)#1520
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
When the language server does not publish any diagnostics (e.g. for error-free code), the Observable.bufferSpan window completes with an empty IList. The previous Seq.last call threw 'The input sequence was empty', causing intermittent test failures in tests like the InlayHint voption 'show: for custom function' test. Change Seq.last to Seq.tryLast |> Option.defaultValue [||] to return an empty diagnostics array instead of throwing when no diagnostic notifications are received. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On some platforms (notably macOS with .NET 10), Directory.Delete with recursive=true can fail with 'Directory not empty' when background SDK processes (e.g., hot reload daemon) still hold file locks. This caused 15 test failures in Go-to-definition tests on macOS+net10.0 CI matrix. Change dotnetCleanup to retry once after 200ms and then silently ignore cleanup failures. Stale build artifacts from a previous run are not critical -- tests still produce correct results. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
29 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes two pre-existing flaky test infrastructure issues that cause intermittent CI failures.
Fix 1:
waitForLatestDiagnosticsthrows on empty diagnostics bufferFile:
test/FsAutoComplete.Tests.Lsp/Utils/Server.fsProblem:
waitForLatestDiagnosticscalledSeq.laston the buffered diagnostic notifications. When the language server produces no diagnostic notifications (e.g., for error-free code),Observable.bufferSpancompletes with an empty buffer andSeq.lastthrows:This caused 15 test failures in
Go to definition tests.GoTo Testson themacos-15 / net10.0 / TransparentCompilerCI matrix (pre-existing failures visible onmainbranch, run #2908).Fix: Wrap the deletion in a try-catch, retry once after 200ms (for transient locks), and then silently continue if cleanup still fails. Stale build artifacts don't prevent tests from running correctly.
Test Status
Build: ✅
dotnet build test/FsAutoComplete.Tests.Lsp -f net8.0— 0 errors, 0 new warnings.Formatting: ✅
dotnet fantomas --check— both files pass.These are test-infrastructure-only changes (no production code modified). The fixes remove sources of intermittent CI failure without changing any test assertions or test logic.
Closes #700 (partially — the dotnetCleanup fix addresses one source of test flakiness)