fix(coding-agent): isolate autoload-disabled package test from real home directory (#7167)

* fix(coding-agent): isolate autoload-disabled package test from real home directory

The test asserted result.skills is exactly empty, but resolve() also
scans ~/.agents/skills via getHomeDir(). On machines where that
directory is populated the test failed; CI runners have no
~/.agents/skills, so it always passed there. Stub HOME to the temp
dir with the same save/restore pattern used by neighbouring tests.

* fix(coding-agent): use vi.stubEnv for home directory isolation

Replaces the manual try/finally save/restore with vi.stubEnv plus
vi.unstubAllEnvs in afterEach, shrinking the fix to two added lines.

* fix(coding-agent): plant decoy user skill so the empty-skills assertion cannot pass vacuously

With an empty sandbox, result.skills equal to [] could not distinguish
the package skill being correctly excluded from skill resolution being
broken entirely. A decoy skill in the stubbed HOME's .agents/skills
proves scanning still works while the package skill stays excluded.

* fix(coding-agent): simplify home isolation test
This commit is contained in:
Thomas Mustier 2026-07-28 07:40:26 +01:00 • committed by GitHub
parent b63403a50f
commit 063fb963c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1702,6 +1702,7 @@ Content`,
});
it("should resolve autoload-disabled package entries as positive-only without a global package", async () => {
vi.stubEnv("HOME", tempDir);
const pkgDir = join(tempDir, "positive-only-pkg");
mkdirSync(join(pkgDir, "extensions"), { recursive: true });
mkdirSync(join(pkgDir, "skills", "foo"), { recursive: true });