From 7f78c383c9451ec0233f0b2191f009b5bf457965 Mon Sep 17 00:00:00 2001 From: Aliou Diallo Date: Sun, 1 Feb 2026 21:43:46 +0100 Subject: [PATCH] test(coding-agent): fix git-update tests to use setPackages Tests used setExtensionPaths but update() iterates packages, not extensions. All 5 non-pinned tests were silently passing as no-ops. Also add regression test for scope-aware update behavior. --- packages/coding-agent/test/git-update.test.ts | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/coding-agent/test/git-update.test.ts b/packages/coding-agent/test/git-update.test.ts index f2e0831a..72e6bdc9 100644 --- a/packages/coding-agent/test/git-update.test.ts +++ b/packages/coding-agent/test/git-update.test.ts @@ -98,8 +98,8 @@ describe("DefaultPackageManager git update", () => { git(["config", "user.email", "test@test.com"], installedDir); git(["config", "user.name", "Test"], installedDir); - // Add to settings so update() only processes this scope - settingsManager.setExtensionPaths([gitSource]); + // Add to global packages so update() processes this source + settingsManager.setPackages([gitSource]); } describe("normal updates (no force-push)", () => { @@ -207,7 +207,7 @@ describe("DefaultPackageManager git update", () => { const initialCommit = getCurrentCommit(installedDir); // Reconfigure with pinned ref - settingsManager.setExtensionPaths([`${gitSource}@${initialCommit}`]); + settingsManager.setPackages([`${gitSource}@${initialCommit}`]); // Add new commit to remote createCommit(remoteDir, "extension.ts", "// v2", "Second commit"); @@ -220,4 +220,25 @@ describe("DefaultPackageManager git update", () => { expect(getFileContent(installedDir, "extension.ts")).toBe("// v1"); }); }); + + describe("scope-aware update", () => { + it("should not install locally when source is only registered globally", async () => { + setupRemoteAndInstall(); + + // Add a new commit to remote + createCommit(remoteDir, "extension.ts", "// v2", "Second commit"); + + // The project-scope install path should not exist before or after update + const projectGitDir = join(tempDir, ".pi", "git", "github.com", "test", "extension"); + expect(existsSync(projectGitDir)).toBe(false); + + await packageManager.update(gitSource); + + // Global install should be updated + expect(getFileContent(installedDir, "extension.ts")).toBe("// v2"); + + // Project-scope directory should NOT have been created + expect(existsSync(projectGitDir)).toBe(false); + }); + }); });