From 4a97a60e5a90f17a006efda3b09b434275e6c447 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Wed, 23 Sep 2026 21:52:12 +0200 Subject: [PATCH] test(server): stub the background fetch in the no-upstream origin/main test The test's checkout has a remote URL, which starts the background fetch, and it was the only one not stubbing runGitFetch, so it ran real git. A remote-ref event that lands during a fetch is buffered until the fetch ends, so on a loaded runner the second refresh arrived after the 1s waitFor. Under local CPU load it failed 12 of 20 runs before, 0 of 20 after. --- .../src/server/workspace-git-service.observation.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server/src/server/workspace-git-service.observation.test.ts b/packages/server/src/server/workspace-git-service.observation.test.ts index c0534aceb6..f075e1dd47 100644 --- a/packages/server/src/server/workspace-git-service.observation.test.ts +++ b/packages/server/src/server/workspace-git-service.observation.test.ts @@ -1006,7 +1006,13 @@ describe("WorkspaceGitService checkout observation", () => { branchMergeRef: null, upstreamStatus: null, })); - const service = createService(watcher, { getCheckoutSnapshotFacts }); + // A remote URL starts the background fetch; keep it off the real git binary. + const runGitFetch = vi.fn(async () => ({ + changes: [], + nonRemoteRefsChanged: false, + error: null, + })); + const service = createService(watcher, { getCheckoutSnapshotFacts, runGitFetch }); const subscription = service.registerWorkspace({ cwd: REPO_CWD }, vi.fn()); await vi.waitFor(() => { expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(1);