Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: tighten module doc and clean up the winget test temp dir

[._.]/ Adam Eivy283aa3bcfd7b
diff --git a/server/lib/llamaCppInstall.js b/server/lib/llamaCppInstall.js
index 7f4a6609a2..6e7adfb095 100644
--- a/server/lib/llamaCppInstall.js
+++ b/server/lib/llamaCppInstall.js
@@ -10,8 +10,9 @@
* is what lets the LLMs page name the command that actually works instead of
* telling a Windows user to run Homebrew.
*
- * Pure: every entry point takes the platform (and, for the WinGet paths, the
- * environment) as an argument, so both branches are coverable from either OS.
+ * Pure, and free of ambient platform detection: the plan takes the platform as
+ * an argument and the WinGet path helpers take the environment, so both
+ * branches are coverable from either OS.
*/
// The WinGet helpers below always reason about WINDOWS paths, whatever host is
diff --git a/server/services/llamaServerManager.test.js b/server/services/llamaServerManager.test.js
index 79e9349d39..730f9da3b1 100644
--- a/server/services/llamaServerManager.test.js
+++ b/server/services/llamaServerManager.test.js
@@ -803,12 +803,20 @@ describe('llamaServerManager', () => {
};
});
+ // Set by the PATH-adoption test below, which needs a real directory on disk
+ // for its existsSync probe; torn down here so a failed assertion can't leak it.
+ let wingetTmpDir = null;
+
beforeEach(() => {
resetForTest({ platform: 'win32' });
vi.stubEnv('LOCALAPPDATA', 'C:\\Users\\example\\AppData\\Local');
});
- afterEach(() => vi.unstubAllEnvs());
+ afterEach(async () => {
+ vi.unstubAllEnvs();
+ if (wingetTmpDir) await rm(wingetTmpDir, { recursive: true, force: true });
+ wingetTmpDir = null;
+ });
it('names the winget command on a host with no llama-server', async () => {
vi.spyOn(processEnv, 'findCommandOnPath').mockReturnValue(null);
@@ -872,6 +880,7 @@ describe('llamaServerManager', () => {
// running PortOS never inherits — so a perfectly successful install would
// otherwise report "llama-server was not found on PATH" until a restart.
const localAppData = await mkdtemp(join(tmpdir(), 'portos-winget-'));
+ wingetTmpDir = localAppData;
const links = join(localAppData, 'Microsoft', 'WinGet', 'Links');
await mkdir(links, { recursive: true });
vi.stubEnv('LOCALAPPDATA', localAppData);
@@ -888,8 +897,8 @@ describe('llamaServerManager', () => {
await expect(installLlamaServer()).resolves.toMatchObject({ success: true });
expect((process.env.PATH || '').split(delimiter)).toContain(links);
- await rm(localAppData, { recursive: true, force: true });
});
+
it('rejects install with a winget hint rather than a Homebrew one', async () => {
vi.spyOn(commandExistsModule, 'commandExists').mockResolvedValue(false);