Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Normalize Windows path keys in sibling discipline guards (#7499)
Nick Gomez991c283e2c28
diff --git a/packages/app/tests/integration/e2e-stop-rules.test.ts b/packages/app/tests/integration/e2e-stop-rules.test.tsindex 61bac68aa..aa1e32b9a 100644--- a/packages/app/tests/integration/e2e-stop-rules.test.ts+++ b/packages/app/tests/integration/e2e-stop-rules.test.ts@@ -5,7 +5,7 @@ import { isTestOnlySourceFile } from '../../../../test-support/test-only-source-*/import { type Dirent, readdirSync, readFileSync } from 'node:fs';-import { dirname, join, relative } from 'node:path';+import { dirname, join, relative, win32 } from 'node:path';import { fileURLToPath } from 'node:url';import {type CallExpression,@@ -32,14 +32,13 @@ const APP_SRC_DIR = join(REPO_ROOT, APP_SOURCE_ROOT);interface FileLines {path: string;- absPath: string;source: string;lines: string[];}const unreadableScanDirs: string[] = [];-function listE2eTsFiles(): FileLines[] {+function listE2eTsFiles(relativePath: typeof relative = relative): FileLines[] {const out: FileLines[] = [];function walk(dir: string) {let entries: Dirent[];@@ -60,8 +59,7 @@ function listE2eTsFiles(): FileLines[] {if (!entry.name.endsWith('.ts')) continue;const source = readFileSync(abs, 'utf-8');out.push({- path: relative(REPO_ROOT, abs),- absPath: abs,+ path: relativePath(REPO_ROOT, abs).replaceAll('\\', '/'),source,lines: source.split('\n'),});@@ -71,7 +69,7 @@ function listE2eTsFiles(): FileLines[] {return out;}-function listAppSrcTsFiles(): FileLines[] {+function listAppSrcTsFiles(relativePath: typeof relative = relative): FileLines[] {const out: FileLines[] = [];function walk(dir: string) {for (const name of readdirSync(dir, { withFileTypes: true })) {@@ -85,8 +83,7 @@ function listAppSrcTsFiles(): FileLines[] {if (APP_SOURCE_EXCLUDED_SUFFIXES.some((suffix) => name.name.endsWith(suffix))) continue;const source = readFileSync(abs, 'utf-8');out.push({- path: relative(REPO_ROOT, abs),- absPath: abs,+ path: relativePath(REPO_ROOT, abs).replaceAll('\\', '/'),source,lines: source.split('\n'),});@@ -595,6 +592,20 @@ describe('E2E STOP rule — zero allowlist', () => {const e2eTsFiles = listE2eTsFiles();const e2eFiles = e2eTsFiles.filter((file) => isTestOnlySourceFile(file.path, 'playwright'));+ test('win32 path semantics keep slash-separated pinned keys', () => {+ const win32E2eFiles = listE2eTsFiles(win32.relative);+ const win32AppFiles = listAppSrcTsFiles(win32.relative);+ expect(+ PINNED_SPAWN_SITES.every((path) => win32E2eFiles.some((file) => file.path === path)),+ ).toBe(true);+ expect(+ win32AppFiles.some((file) => file.path === 'packages/app/src/editor/DocumentContext.tsx'),+ ).toBe(true);+ for (const root of E2E_SCAN_ROOTS) {+ expect(win32E2eFiles.some((file) => file.path.startsWith(`${root}/`))).toBe(true);+ }+ });+test('there are E2E files to check (sanity)', () => {expect(unreadableScanDirs,@@ -602,16 +613,16 @@ describe('E2E STOP rule — zero allowlist', () => {).toEqual([]);expect(e2eTsFiles.length).toBeGreaterThan(0);expect(e2eFiles.length).toBeGreaterThan(0);- for (const dir of E2E_DIRS) {- const tsFromDir = e2eTsFiles.filter((file) => file.absPath.startsWith(`${dir}/`));+ for (const root of E2E_SCAN_ROOTS) {+ const tsFromDir = e2eTsFiles.filter((file) => file.path.startsWith(`${root}/`));expect(tsFromDir.length,- `no *.ts under ${relative(REPO_ROOT, dir)} — renamed, moved, or emptied?`,+ `no *.ts under ${root} — renamed, moved, or emptied?`,).toBeGreaterThan(0);- const fromDir = e2eFiles.filter((file) => file.absPath.startsWith(`${dir}/`));+ const fromDir = e2eFiles.filter((file) => file.path.startsWith(`${root}/`));expect(fromDir.length,- `no *.e2e.ts under ${relative(REPO_ROOT, dir)} — renamed, moved, or emptied?`,+ `no *.e2e.ts under ${root} — renamed, moved, or emptied?`,).toBeGreaterThan(0);}});diff --git a/packages/app/tests/integration/hook-timeout-stop-rules.test.ts b/packages/app/tests/integration/hook-timeout-stop-rules.test.tsindex 217ddd0a0..9b4ccea63 100644--- a/packages/app/tests/integration/hook-timeout-stop-rules.test.ts+++ b/packages/app/tests/integration/hook-timeout-stop-rules.test.ts@@ -1,5 +1,5 @@import { type Dirent, readdirSync, readFileSync } from 'node:fs';-import { join, relative } from 'node:path';+import { join, relative, win32 } from 'node:path';import { ts } from 'ts-morph';import { describe, expect, test } from 'vitest';import { isTestOnlySourceFile } from '../../../../test-support/test-only-source-file.mjs';@@ -12,7 +12,7 @@ interface ScannedFile {source: string;}-function listScannedTestFiles(): ScannedFile[] {+function listScannedTestFiles(relativePath: typeof relative = relative): ScannedFile[] {const out: ScannedFile[] = [];function walk(dir: string) {let entries: Dirent[];@@ -33,7 +33,10 @@ function listScannedTestFiles(): ScannedFile[] {!(isTestOnlySourceFile(entry.name, 'vitest') && entry.name.endsWith('.ts')))continue;- out.push({ path: relative(REPO_ROOT, abs), source: readFileSync(abs, 'utf-8') });+ out.push({+ path: relativePath(REPO_ROOT, abs).replaceAll('\\', '/'),+ source: readFileSync(abs, 'utf-8'),+ });}}for (const dir of SCANNED_DIRS) walk(dir);@@ -73,6 +76,11 @@ describe('hook-timeout STOP rule — beforeAll must carry an explicit timeout',expect(files.some((f) => f.path.includes('tests/conversion/'))).toBe(true);});+ test('win32 path semantics keep slash-separated scan keys', () => {+ const win32Files = listScannedTestFiles(win32.relative);+ expect(win32Files.some((file) => file.path.includes('tests/conversion/'))).toBe(true);+ });+test('every beforeAll in tests/{integration,conversion} *.test.ts passes an explicit timeout', () => {const violations: string[] = [];for (const file of files) {diff --git a/packages/server/src/console-discipline.test.ts b/packages/server/src/console-discipline.test.tsindex 13e920b1f..e3c036f73 100644--- a/packages/server/src/console-discipline.test.ts+++ b/packages/server/src/console-discipline.test.ts@@ -1,8 +1,9 @@import { readdirSync, readFileSync } from 'node:fs';-import { basename, dirname, join, relative } from 'node:path';+import { basename, dirname, join, relative, win32 } from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, test } from 'vitest';import { isTestOnlySourceFile } from '../../../test-support/test-only-source-file.mjs';+import { toPosix } from './path-utils.ts';const __dirname = dirname(fileURLToPath(import.meta.url));const SCAN_ROOT = __dirname;@@ -41,7 +42,7 @@ interface FileLines {lines: string[];}-function listScannedSourceFiles(): FileLines[] {+function listScannedSourceFiles(relativePath: typeof relative = relative): FileLines[] {const out: FileLines[] = [];function walk(dir: string) {for (const entry of readdirSync(dir, { withFileTypes: true })) {@@ -54,7 +55,7 @@ function listScannedSourceFiles(): FileLines[] {if (isTestOnlySourceFile(entry.name)) continue;if (entry.name === SELF_BASENAME) continue;out.push({- path: relative(SCAN_ROOT, abs),+ path: toPosix(relativePath(SCAN_ROOT, abs)),lines: readFileSync(abs, 'utf-8').split('\n'),});}@@ -93,6 +94,12 @@ describe('console discipline (server sources)', () => {expect(files.some((f) => f.path === 'file-watcher.ts')).toBe(true);});+ test('win32 path semantics keep slash-separated allowlist keys', () => {+ const win32Files = listScannedSourceFiles(win32.relative);+ const paths = new Set(win32Files.map((file) => file.path));+ expect([...FILE_ALLOWLIST.keys()].every((path) => paths.has(path))).toBe(true);+ });+test('every FILE_ALLOWLIST entry still exists on disk', () => {const paths = new Set(files.map((f) => f.path));for (const allowed of FILE_ALLOWLIST.keys()) {