A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.
TypeScript
test(daemon): run the supervisor tests on Windows, skipping server mode
Marcelitoea1bff9ea704
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.ymlindex 9b6a7aa..1f614d7 100644--- a/.github/workflows/windows.yml+++ b/.github/workflows/windows.yml@@ -94,7 +94,7 @@ jobs:pnpm --filter @gentle-dot/daemon run build:windows-stop -- --compiler "$compiler" --headers "$inputs/node-$version/include/node" --node-lib "$inputs/node.lib"if ($LASTEXITCODE -ne 0) { throw 'Native addon build failed' }- # These portable adapter tests and real-addon refusal tests stay together.- - name: App-channel tests+ # The portable adapter tests, the real-addon refusal tests, and the agent shutdown tests.+ - name: Daemon testsrun: pnpm exec vitest run packages/daemon/test/windows-stop.test.ts packages/daemon/test/windows-app-channel.test.ts packages/daemon/test/app-channel-platform.test.ts packages/daemon/test/app-channel.test.ts packages/daemon/test/app-channel-fd.test.ts packages/daemon/test/windows-app-channel-addon.test.ts packages/daemon/test/process-tree.test.ts packages/daemon/test/supervisor.test.tsdiff --git a/packages/daemon/test/supervisor.test.ts b/packages/daemon/test/supervisor.test.tsindex 40d7146..70f3ef4 100644--- a/packages/daemon/test/supervisor.test.ts+++ b/packages/daemon/test/supervisor.test.ts@@ -3,6 +3,7 @@ import { join } from "node:path";import { afterEach, describe, expect, it, vi } from "vitest";import type { AgentSupervisor } from "../src/supervisor.ts";import { fakeSupervisor, tempDir, waitFor } from "./helpers.ts";+import { itServerMode } from "./support/windows.ts";const running: AgentSupervisor[] = [];afterEach(async () => {@@ -51,20 +52,23 @@ describe("AgentSupervisor", () => {expect(supervisor.state).toBe("ready");});- it("starts the agent as the configured user, and as the daemon's own user without one (S25.8)", async () => {- const own = { uid: process.getuid?.() ?? 0, gid: process.getgid?.() ?? 0 };- const processFile = join(tempDir(), "process.json");- const env = { ...process.env, FAKE_AGENT_PROCESS_FILE: processFile };- // Without a user, the agent runs as the daemon does today.- const plain = track(fakeSupervisor({ env }));- await plain.supervisor.start();- expect(JSON.parse(readFileSync(processFile, "utf8"))).toMatchObject(own);- await plain.supervisor.stop();- const as = track(fakeSupervisor({ env, user: own }));- await as.supervisor.start();- expect(JSON.parse(readFileSync(processFile, "utf8"))).toMatchObject(own);- expect(as.supervisor.state).toBe("ready");- });+ itServerMode(+ "starts the agent as the configured user, and as the daemon's own user without one (S25.8)",+ async () => {+ const own = { uid: process.getuid?.() ?? 0, gid: process.getgid?.() ?? 0 };+ const processFile = join(tempDir(), "process.json");+ const env = { ...process.env, FAKE_AGENT_PROCESS_FILE: processFile };+ // Without a user, the agent runs as the daemon does today.+ const plain = track(fakeSupervisor({ env }));+ await plain.supervisor.start();+ expect(JSON.parse(readFileSync(processFile, "utf8"))).toMatchObject(own);+ await plain.supervisor.stop();+ const as = track(fakeSupervisor({ env, user: own }));+ await as.supervisor.start();+ expect(JSON.parse(readFileSync(processFile, "utf8"))).toMatchObject(own);+ expect(as.supervisor.state).toBe("ready");+ },+ );it.skipIf((process.getuid?.() ?? 0) === 0)("applies the user to the spawn: one it cannot take is refused",diff --git a/packages/daemon/test/support/windows.ts b/packages/daemon/test/support/windows.tsindex 7e46c11..af0e1d3 100644--- a/packages/daemon/test/support/windows.ts+++ b/packages/daemon/test/support/windows.ts@@ -1,4 +1,4 @@-import { describe } from "vitest";+import { describe, it } from "vitest";export const WINDOWS_APP_CHANNEL ="Windows admits only the native production app channel (daemon.ts startDaemon); the protocol is covered on Linux and macOS";@@ -6,14 +6,21 @@ export const WINDOWS_APP_CHANNEL =export const INHERITED_APP_CHANNEL ="Windows uses the native production channel, not inherited Unix fd 3; Linux and macOS cover fd 3";+export const SERVER_MODE =+ "Server mode runs the engine as another POSIX user (setuid); it is Linux only and covered on Linux";+const windows = process.platform === "win32";/** Only daemon tests requiring a generic Duplex app channel lack Windows coverage. */export const describeWithAppChannel: ReturnType<typeof describe.skipIf> = describe.skipIf(windows);+/** Server-mode tests are absent on Windows; desktop and generic file behavior remain active. */+export const itServerMode: ReturnType<typeof it.skipIf> = it.skipIf(windows);+export const describeWithInheritedAppChannel: ReturnType<typeof describe.skipIf> = describe.skipIf(windows);if (windows) {console.info(`Windows-only test skip: ${WINDOWS_APP_CHANNEL}`);+ console.info(`Windows-only test skip: ${SERVER_MODE}`);console.info(`Windows-only test skip: ${INHERITED_APP_CHANNEL}`);}