Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(test): normalize path separators in the machineName guard's exemption lookup
enes8c52a9ea91eb
diff --git a/src/renderer/lib/machineName.guard.test.ts b/src/renderer/lib/machineName.guard.test.tsindex 056a44dd7..dbd210b57 100644--- a/src/renderer/lib/machineName.guard.test.ts+++ b/src/renderer/lib/machineName.guard.test.ts@@ -14,8 +14,21 @@ import { describe, expect, it } from 'vitest'* COMMENTS ARE NOT SCANNED. They are not shown to anyone, they carry real history ("a Mac→SSH* node"), and rewriting them would bury the actual copy change in noise.*/+const REPO_ROOT = join(__dirname, '..', '..', '..')const ROOTS = ['src/renderer', 'src/shared']+/**+ * Guard comparisons use one separator regardless of the host running Vitest.+ *+ * `relative()` answers in the HOST's separator, while the exemption keys below are written with+ * POSIX slashes — so on Windows `ALLOWED.has(rel)` missed every entry, the exempt files were+ * scanned after all, and the suite failed on copy that is correct (issue #746). Same rule, same+ * helper shape, as `fs-atomic.guard.test.ts` and `localStore.guard.test.ts`.+ */+function normalizedSourcePath(value: string): string {+ return value.replace(/\\/g, '/')+}+/** Files where naming a Mac is the CORRECT answer, each with the reason it is exempt. */const ALLOWED = new Map<string, string>([[@@ -57,8 +70,8 @@ describe('no user-visible copy calls this machine a Mac', () => {it('finds none outside the documented exemptions', () => {const offenders: string[] = []for (const root of ROOTS) {- for (const file of sourceFiles(join(process.cwd(), root))) {- const rel = relative(process.cwd(), file)+ for (const file of sourceFiles(join(REPO_ROOT, root))) {+ const rel = normalizedSourcePath(relative(REPO_ROOT, file))if (ALLOWED.has(rel)) continuereadFileSync(file, 'utf8').split('\n')@@ -75,8 +88,37 @@ describe('no user-visible copy calls this machine a Mac', () => {it('keeps the exemption list honest — every entry still exists and still says Mac', () => {for (const [rel, why] of ALLOWED) {- const src = readFileSync(join(process.cwd(), rel), 'utf8')+ const src = readFileSync(join(REPO_ROOT, rel), 'utf8')expect(BANNED.test(src), `${rel} no longer needs its exemption (${why})`).toBe(true)}})++ it('every exemption actually matches a file the scan walked', () => {+ // The assertion above reads each exempt file by PATH, so it passes even when the scan's own+ // lookup never matched it — which is exactly how the Windows separator bug hid: the exempt+ // files were scanned and reported as offenders while this test stayed green. Comparing against+ // the scan's OWN keys is what makes a key that stops matching fail HERE, naming the exemption,+ // instead of failing above and naming innocent copy.+ const scanned = new Set(+ ROOTS.flatMap((root) => sourceFiles(join(REPO_ROOT, root))).map((file) =>+ normalizedSourcePath(relative(REPO_ROOT, file))+ )+ )+ for (const rel of ALLOWED.keys()) {+ expect(scanned.has(rel), `${rel} is exempt but the scan never produced that key`).toBe(true)+ }+ })++ it('normalizes exemption keys on both POSIX and Windows-shaped paths', () => {+ expect(normalizedSourcePath('src/renderer/lib/machineName.ts')).toBe(+ 'src/renderer/lib/machineName.ts'+ )+ expect(normalizedSourcePath(String.raw`src\renderer\lib\machineName.ts`)).toBe(+ 'src/renderer/lib/machineName.ts'+ )+ // A Windows-shaped path must reach the SAME exemption the POSIX one does.+ for (const rel of ALLOWED.keys()) {+ expect(ALLOWED.has(normalizedSourcePath(rel.replace(/\//g, '\\')))).toBe(true)+ }+ })})