From 13fe00e5d22d034280e892572fd527f459a9a36e Mon Sep 17 00:00:00 2001 From: SurefireStudios <123013554+SurefireStudios@users.noreply.github.com> Date: Wed, 16 Sep 2026 00:03:42 -0700 Subject: [PATCH] fix(orchestrate): resolve test CLI paths with fileURLToPath Three test files built a filesystem path with `new URL(..., import.meta.url).pathname`. On Windows that yields a leading-slash path (`/C:/...`) that spawnSync cannot launch, so the CLI never starts and the assertions see exit status 1 instead of the expected 2. `.pathname` also leaves percent-encoding in place, so a checkout under a directory with a space breaks the same way on any platform. Use `fileURLToPath`, matching `__tests__/checkpoint-restart.test.ts` and the four other call sites already doing this in the repo. On Windows: 200 pass / 9 fail -> 208 pass / 1 fail. The remaining failure is `operator boundary > requires a current-user 0600 operator flag`, which calls `chmodSync(flag, 0o600)`; NTFS has no POSIX mode bits, so it is left untouched. No change in behaviour on macOS or Linux. --- .../orchestrate/scripts/__tests__/comment-cli.test.ts | 7 ++++--- .../orchestrate/scripts/__tests__/kickoff-dedupe.test.ts | 6 +++++- .../scripts/__tests__/prompt-plan-validation.test.ts | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/orchestrate/skills/orchestrate/scripts/__tests__/comment-cli.test.ts b/orchestrate/skills/orchestrate/scripts/__tests__/comment-cli.test.ts index e3c6954d4..f8c736a92 100644 --- a/orchestrate/skills/orchestrate/scripts/__tests__/comment-cli.test.ts +++ b/orchestrate/skills/orchestrate/scripts/__tests__/comment-cli.test.ts @@ -2,14 +2,15 @@ import { describe, expect, test } from "bun:test"; import { spawnSync } from "node:child_process"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; -import { join } from "node:path"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; import { loadKickoffThreadTsOrBail } from "../cli/comments.ts"; const TEST_SLACK_CHANNEL = "C123TEST"; -const CLI_PATH = new URL("../cli.ts", import.meta.url).pathname; -const SCRIPTS_DIR = new URL("..", import.meta.url).pathname; +const CLI_PATH = fileURLToPath(new URL("../cli.ts", import.meta.url)); +const SCRIPTS_DIR = dirname(CLI_PATH); describe("comment CLI", () => { test("Refuses to post without --task or --thread-ts", () => { diff --git a/orchestrate/skills/orchestrate/scripts/__tests__/kickoff-dedupe.test.ts b/orchestrate/skills/orchestrate/scripts/__tests__/kickoff-dedupe.test.ts index 586c4aa39..81d12185e 100644 --- a/orchestrate/skills/orchestrate/scripts/__tests__/kickoff-dedupe.test.ts +++ b/orchestrate/skills/orchestrate/scripts/__tests__/kickoff-dedupe.test.ts @@ -1,7 +1,11 @@ import { describe, expect, test } from "bun:test"; import { spawnSync } from "node:child_process"; +import { dirname } from "node:path"; +import { fileURLToPath } from "node:url"; -const SCRIPTS_DIR = new URL("..", import.meta.url).pathname; +const SCRIPTS_DIR = dirname( + fileURLToPath(new URL("../cli.ts", import.meta.url)) +); import { findActiveRootPlanner, diff --git a/orchestrate/skills/orchestrate/scripts/__tests__/prompt-plan-validation.test.ts b/orchestrate/skills/orchestrate/scripts/__tests__/prompt-plan-validation.test.ts index 033abcb9e..c852dda11 100644 --- a/orchestrate/skills/orchestrate/scripts/__tests__/prompt-plan-validation.test.ts +++ b/orchestrate/skills/orchestrate/scripts/__tests__/prompt-plan-validation.test.ts @@ -3,12 +3,13 @@ import { spawnSync } from "node:child_process"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; +import { fileURLToPath } from "node:url"; function runPromptWithPlan(plan: unknown): ReturnType { const workspace = mkdtempSync(join(tmpdir(), "orchestrate-plan-migration-")); writeFileSync(join(workspace, "plan.json"), JSON.stringify(plan, null, 2)); - const cliPath = new URL("../cli.ts", import.meta.url).pathname; + const cliPath = fileURLToPath(new URL("../cli.ts", import.meta.url)); try { return spawnSync( process.execPath,