From c4742e70178f1ab7208f38bd42b7e81d1dc921d9 Mon Sep 17 00:00:00 2001 From: Yanuo Ma Date: Fri, 6 Mar 2026 23:47:26 -0500 Subject: [PATCH] fix(test): remove duplicate on_file_select call causing flaky CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unstage_hunk test called explorer.on_file_select() for the staged file immediately after open_codediff_and_wait(), but the explorer already auto-selects that same file on startup when all changes are staged. The two concurrent async git operations raced — on slower Windows/macOS CI runners the callbacks would interfere, leaving modified_revision unset and failing the assertion. Remove the redundant on_file_select() call and let the explorer's built-in auto-selection handle it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/ui/explorer/hunk_operations_spec.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/ui/explorer/hunk_operations_spec.lua b/tests/ui/explorer/hunk_operations_spec.lua index 05ab1985..08120af9 100644 --- a/tests/ui/explorer/hunk_operations_spec.lua +++ b/tests/ui/explorer/hunk_operations_spec.lua @@ -338,13 +338,10 @@ describe("Hunk operations (side-by-side)", function() local tabpage, session, explorer = open_codediff_and_wait(repo) local lifecycle = require("codediff.ui.lifecycle") - -- Select the file in the staged group - explorer.on_file_select({ - path = "file1.txt", - status = "M", - git_root = repo.dir, - group = "staged", - }) + -- The explorer auto-selects file1.txt in the "staged" group because + -- all changes are staged and there are no unstaged files. We just + -- wait for that async selection to finish rather than issuing a + -- duplicate on_file_select call that would race with the auto-select. -- Wait for staged view (modified_revision == ":0") and 2 hunks local staged_ready = vim.wait(8000, function()