From c7e137d4b466d77d775c0f1b47ebcb35c964622d Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Wed, 4 Nov 2026 06:51:15 +0000 Subject: [PATCH] test(server): settle missing-folder observation before cleanup (#8743) Wait for metadata observation setup before deleting and restoring the fixture, and flush its diagnostic trace sink after service disposal so queued appends cannot recreate files during removal. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> --- ...it-service.observation.integration.test.ts | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/packages/server/src/server/workspace-git-service.observation.integration.test.ts b/packages/server/src/server/workspace-git-service.observation.integration.test.ts index c5cefceb72..26d47918b7 100644 --- a/packages/server/src/server/workspace-git-service.observation.integration.test.ts +++ b/packages/server/src/server/workspace-git-service.observation.integration.test.ts @@ -842,9 +842,18 @@ test.skipIf(process.platform !== "linux")( }; try { await expect - .poll(() => degraded && service.getMetrics().workspaceRefreshInFlightCount === 0, { - timeout: 15_000, - }) + .poll( + () => { + const metrics = service.getMetrics(); + // Metadata observation writes a canary after the working tree degrades. + return ( + degraded && + metrics.workspaceRefreshInFlightCount === 0 && + metrics.workspaceObservationSetupInFlightCount === 0 + ); + }, + { timeout: 15_000 }, + ) .toBe(true); rmSync(cwd, { recursive: true, force: true }); await expect.poll(() => suspended, { timeout: 15_000 }).toBe(true); @@ -867,10 +876,17 @@ test.skipIf(process.platform !== "linux")( reason: "refresh-button", }); expect(snapshot.git).toMatchObject({ isGit: true, currentBranch: "restored" }); - await expect.poll(() => service.getMetrics().repositoryWorkspaceLinkCount).toBe(1); + await expect + .poll(() => service.getMetrics(), { timeout: 15_000 }) + .toMatchObject({ + repositoryWorkspaceLinkCount: 1, + workspaceObservationSetupInFlightCount: 0, + }); } finally { subscription.unsubscribe(); await service.dispose(); + // The diagnostic sink outlives Git commands and owns writes into this fixture. + await flushGitCommandTrace(); if (previousTrace === undefined) delete process.env.PASEO_GIT_TRACE_FILE; else process.env.PASEO_GIT_TRACE_FILE = previousTrace; rmSync(root, { recursive: true, force: true });