Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Fix OK local gates for checkouts under paths with spaces (#5809)

Andrew Mikofalvy7d413f712b27
diff --git a/packages/app/src/components/handoff/dispatch-single-entry-point.test.ts b/packages/app/src/components/handoff/dispatch-single-entry-point.test.ts
index d92215352..66db6976c 100644
--- a/packages/app/src/components/handoff/dispatch-single-entry-point.test.ts
+++ b/packages/app/src/components/handoff/dispatch-single-entry-point.test.ts
@@ -1,9 +1,10 @@
import { readdirSync, readFileSync, statSync } from 'node:fs';
import { join, relative } from 'node:path';
+import { fileURLToPath } from 'node:url';
import { describe, expect, test } from 'vitest';
import { isTestOnlySourceFile } from '../../../../../test-support/test-only-source-file.mjs';
-const SRC_DIR = new URL('../..', import.meta.url).pathname;
+const SRC_DIR = fileURLToPath(new URL('../..', import.meta.url));
const ALLOWLISTED_SUBPATHS = ['lib/handoff', 'components/handoff'] as const;
diff --git a/packages/app/tests/perf/fixtures/generate-view-count-fixtures.ts b/packages/app/tests/perf/fixtures/generate-view-count-fixtures.ts
index 8476c5436..4edddda70 100644
--- a/packages/app/tests/perf/fixtures/generate-view-count-fixtures.ts
+++ b/packages/app/tests/perf/fixtures/generate-view-count-fixtures.ts
@@ -2,6 +2,7 @@
import { mkdirSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
import { MarkdownManager, OK_DIR, sharedExtensions } from '@inkeep/open-knowledge-core';
const TARGET_BYTES = 50_000;
@@ -174,7 +175,7 @@ export function generateFixture(targetViews: number, outDir: string): ConvergeRe
}
function defaultOutDir(targetViews: number): string {
- const base = dirname(new URL(import.meta.url).pathname);
+ const base = dirname(fileURLToPath(import.meta.url));
return resolve(base, `${FIXTURE_DIR_PREFIX}${targetViews}`);
}
diff --git a/packages/desktop/tests/utility/pty-flood.test.ts b/packages/desktop/tests/utility/pty-flood.test.ts
index c310bff21..aa0897424 100644
--- a/packages/desktop/tests/utility/pty-flood.test.ts
+++ b/packages/desktop/tests/utility/pty-flood.test.ts
@@ -1,7 +1,8 @@
+import { fileURLToPath } from 'node:url';
import { describe, expect, test } from 'vitest';
const NODE = Bun.which('node');
-const HARNESS = new URL('./pty-flood.harness.ts', import.meta.url).pathname;
+const HARNESS = fileURLToPath(new URL('./pty-flood.harness.ts', import.meta.url));
describe.skipIf(process.platform === 'win32')(
'PTY flood — backpressure + UTF-8 integrity (Node runtime)',
diff --git a/packages/desktop/tests/utility/pty-host-reap.test.ts b/packages/desktop/tests/utility/pty-host-reap.test.ts
index 29e42e10e..f69577f29 100644
--- a/packages/desktop/tests/utility/pty-host-reap.test.ts
+++ b/packages/desktop/tests/utility/pty-host-reap.test.ts
@@ -1,11 +1,12 @@
import { spawn as nodeSpawn } from 'node:child_process';
import { once } from 'node:events';
import { Readable } from 'node:stream';
+import { fileURLToPath } from 'node:url';
import { isProcessAlive } from '@inkeep/open-knowledge-server';
import { describe, expect, test } from 'vitest';
import { pid1Reaps } from '../../../../test-support/capabilities.test-helper.ts';
-const HARNESS = new URL('./pty-host.reap-harness.ts', import.meta.url).pathname;
+const HARNESS = fileURLToPath(new URL('./pty-host.reap-harness.ts', import.meta.url));
async function readShellPid(
stream: ReadableStream<Uint8Array>,
diff --git a/packages/server/src/local-ops/subprocess.test.ts b/packages/server/src/local-ops/subprocess.test.ts
index 2ee6586b5..7a0aba96c 100644
--- a/packages/server/src/local-ops/subprocess.test.ts
+++ b/packages/server/src/local-ops/subprocess.test.ts
@@ -1,4 +1,5 @@
import { delimiter as PATH_DELIMITER } from 'node:path';
+import { fileURLToPath } from 'node:url';
import { describe, expect, test } from 'vitest';
import { buildOverlaidEnv, runSubprocess } from './subprocess.ts';
@@ -452,7 +453,7 @@ describe('runSubprocess — synchronous spawn failure', () => {
async () => {
const proc = runSubprocess({
cliArgs: fixtureCli('process.exit(0)'),
- cwd: new URL(import.meta.url).pathname,
+ cwd: fileURLToPath(import.meta.url),
trailingArgs: [],
timeoutMs: 5000,
onLine: () => {},
diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.json
index 6fe93e8fb..e61f36e8c 100644
--- a/packages/server/tsconfig.build.json
+++ b/packages/server/tsconfig.build.json
@@ -3,5 +3,6 @@
"compilerOptions": {
"customConditions": []
},
- "include": ["src"]
+ "include": ["src"],
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test-helper.ts"]
}
diff --git a/scripts/check-i18n-new-string-translations.mjs b/scripts/check-i18n-new-string-translations.mjs
index 6f0a14773..1b5c6d510 100644
--- a/scripts/check-i18n-new-string-translations.mjs
+++ b/scripts/check-i18n-new-string-translations.mjs
@@ -3,7 +3,7 @@
import { spawnSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import { gitCleanEnv } from './git-clean-env.mjs';
const OK_ROOT = fileURLToPath(new URL('..', import.meta.url));
@@ -246,6 +246,6 @@ function main(argv) {
return 1;
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
process.exit(main(process.argv.slice(2)));
}
diff --git a/scripts/check-i18n-picker-completeness.mjs b/scripts/check-i18n-picker-completeness.mjs
index 8581150c0..50e93abb0 100644
--- a/scripts/check-i18n-picker-completeness.mjs
+++ b/scripts/check-i18n-picker-completeness.mjs
@@ -2,7 +2,7 @@
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import {
parsePoCatalog,
pluralSelectorsIn,
@@ -132,6 +132,6 @@ function main() {
return 1;
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
process.exit(main());
}
diff --git a/scripts/compute-next-beta.mjs b/scripts/compute-next-beta.mjs
index 683ece4c2..08bd58087 100644
--- a/scripts/compute-next-beta.mjs
+++ b/scripts/compute-next-beta.mjs
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process';
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import { join } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
export const FIXED_GROUP_ANCHOR = '@inkeep/open-knowledge';
const PRE_PATH = '.changeset/pre.json';
@@ -328,6 +328,6 @@ async function main() {
);
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
await main();
}
diff --git a/scripts/generate-locale-review-packet.mjs b/scripts/generate-locale-review-packet.mjs
index 030aefa92..41d17a2ff 100644
--- a/scripts/generate-locale-review-packet.mjs
+++ b/scripts/generate-locale-review-packet.mjs
@@ -2,7 +2,7 @@
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { join } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import {
parsePoCatalog,
requiredPluralCategories,
@@ -476,6 +476,6 @@ function main(argv) {
return 0;
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
process.exit(main(process.argv.slice(2)));
}
diff --git a/scripts/verify-keyring-in-packaged-dmg.mjs b/scripts/verify-keyring-in-packaged-dmg.mjs
index 8d86b22f6..b3f06aeac 100644
--- a/scripts/verify-keyring-in-packaged-dmg.mjs
+++ b/scripts/verify-keyring-in-packaged-dmg.mjs
@@ -4,6 +4,7 @@ import { spawn } from 'node:child_process';
import { cp, mkdtemp, readFile, rm, stat } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { basename, join, resolve } from 'node:path';
+import { pathToFileURL } from 'node:url';
const DEFAULT_TIMEOUT_MS = 30_000;
const STDERR_TAIL_LINES = 40;
@@ -266,6 +267,6 @@ async function defaultListAppsInMount(mountPath) {
return entries.filter((e) => e.toLowerCase().endsWith('.app'));
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
runDriver(process.argv).then((code) => process.exit(code));
}
diff --git a/scripts/verify-native-config-in-packaged-dmg.mjs b/scripts/verify-native-config-in-packaged-dmg.mjs
index 3817b8f37..15fa8b77e 100644
--- a/scripts/verify-native-config-in-packaged-dmg.mjs
+++ b/scripts/verify-native-config-in-packaged-dmg.mjs
@@ -6,6 +6,7 @@ import { cp, mkdtemp, readdir, rm } from 'node:fs/promises';
import { createRequire } from 'node:module';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
+import { pathToFileURL } from 'node:url';
const DIR_CANDIDATES = ['.', 'native', 'dist/native', 'cli/dist/native'];
@@ -177,6 +178,6 @@ async function defaultListAppsInMount(mountPath) {
return entries.filter((e) => e.toLowerCase().endsWith('.app'));
}
-if (import.meta.url === `file://${process.argv[1]}`) {
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
runDriver(process.argv).then((code) => process.exit(code));
}