From 5b806d8336afe336ee8f20f411c9f101ed2ed670 Mon Sep 17 00:00:00 2001 From: Baptiste LAFOURCADE Date: Fri, 30 Oct 2026 05:43:10 +0100 Subject: [PATCH 1/2] fix(cli): give integration hooks the same timeout as integration tests A beforeEach that spawns git ran past vitest's 10s hook default on a loaded Windows runner, while tests already had 60s. Co-Authored-By: Claude Sonnet 5.5 --- cli/vitest.config.ts | 2 ++ cli/vitest.mutation.config.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/cli/vitest.config.ts b/cli/vitest.config.ts index 70ae8d0e6..18b85698c 100644 --- a/cli/vitest.config.ts +++ b/cli/vitest.config.ts @@ -41,6 +41,8 @@ export default defineConfig({ globals: false, environment: "node", testTimeout: 60000, + // A `beforeEach` that spawns git is slower than the 10s default on a loaded Windows runner. + hookTimeout: 60000, globalSetup: [ "./tests/helpers/sweep-stale-temp-dirs.ts", "./tests/helpers/throwaway-profile.ts", diff --git a/cli/vitest.mutation.config.ts b/cli/vitest.mutation.config.ts index 660b29d7d..804e61d74 100644 --- a/cli/vitest.mutation.config.ts +++ b/cli/vitest.mutation.config.ts @@ -55,6 +55,7 @@ export default defineConfig({ environment: "node", globalSetup: ["./tests/helpers/throwaway-profile.ts"], testTimeout: 60000, + hookTimeout: 60000, }, }, ], From 451bf05bddb59ab1e841b25da1e541e6f63a2956 Mon Sep 17 00:00:00 2001 From: Baptiste LAFOURCADE Date: Fri, 30 Oct 2026 05:47:07 +0100 Subject: [PATCH 2/2] test(cli): make the consent scenarios' aidd stand-in runnable on Windows The hook only finds aidd through PATHEXT there, so the extensionless stand-in was skipped and a globally installed aidd answered instead. Without one, the hand key and copy rows failed. Co-Authored-By: Claude Opus 5.5 --- .../consent-scenarios.integration.test.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cli/tests/contexts/telemetry/consent-scenarios.integration.test.ts b/cli/tests/contexts/telemetry/consent-scenarios.integration.test.ts index 9964131dd..d523c5b69 100644 --- a/cli/tests/contexts/telemetry/consent-scenarios.integration.test.ts +++ b/cli/tests/contexts/telemetry/consent-scenarios.integration.test.ts @@ -12,7 +12,7 @@ import { utimesSync, writeFileSync, } from "node:fs"; -import { delimiter, join } from "node:path"; +import { delimiter, dirname, join } from "node:path"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { type TelemetryDeps, wireTelemetry } from "../../../src/runtime/wiring/telemetry.js"; import { git, initRepository } from "../../helpers/git-sandbox.js"; @@ -38,6 +38,22 @@ const SESSION = "00000000-0000-4000-8000-000000000001"; const GATE = join(REPOSITORY_ROOT, "plugins", "aidd-telemetry", "hooks", "prompt-gate.cjs"); const FAKE_AIDD = "process.exit(0);\n"; +/** A stand-in `aidd` the way the hook looks it up on `PATH`. Windows only tries `PATHEXT` + * extensions, so a bare file is never found and the machine's own `aidd` answers instead; a + * `.cmd` with its CLI entry beside it is run with this node, not through cmd.exe. */ +function writeAiddStandIn(bin: string): void { + mkdirSync(bin, { recursive: true }); + if (process.platform === "win32") { + const entry = join(bin, "node_modules", "@ai-driven-dev", "cli", "dist", "cli.js"); + mkdirSync(dirname(entry), { recursive: true }); + writeFileSync(entry, FAKE_AIDD); + writeFileSync(join(bin, "aidd.cmd"), `@"${process.execPath}" "${entry}" %*\r\n`); + return; + } + writeFileSync(join(bin, "aidd"), `#!${process.execPath}\n${FAKE_AIDD}`); + chmodSync(join(bin, "aidd"), 0o755); +} + let box: TelemetrySandbox; let deps: TelemetryDeps; let base: number; @@ -64,9 +80,7 @@ class World { * the prompt was blocked. It reads the clock of the machine, not the faked one. */ blocks(dir: string, attended = true): boolean { const bin = join(this.sandbox.root, "bin"); - mkdirSync(bin, { recursive: true }); - writeFileSync(join(bin, "aidd"), `#!${process.execPath}\n${FAKE_AIDD}`); - chmodSync(join(bin, "aidd"), 0o755); + writeAiddStandIn(bin); const env: NodeJS.ProcessEnv = { PATH: `${bin}${delimiter}${process.env.PATH ?? ""}`, HOME: this.sandbox.home,