From 16583343cb0086c3e99701f6afcd51817df7d052 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Wed, 3 Jun 2026 10:00:29 +0200 Subject: [PATCH] canonicalize temp paths in daemon/cli tests for macOS Two tests compared a raw Directory.systemTemp path against an OS-resolved one, which diverge on macOS where /tmp is a symlink to /private/tmp: FilesService.atCwd resolves the CWD, and the clide-cli e2e server must hash the same canonical workspace the C client sees via getcwd. Resolve symlinks on both sides. Co-Authored-By: Claude Opus 4.8 (1M context) --- test/cli/clide_cli_e2e_test.dart | 6 ++++-- test/daemon/files_commands_test.dart | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/cli/clide_cli_e2e_test.dart b/test/cli/clide_cli_e2e_test.dart index 3c44c319..46063b80 100644 --- a/test/cli/clide_cli_e2e_test.dart +++ b/test/cli/clide_cli_e2e_test.dart @@ -50,8 +50,10 @@ void main() { // Synthetic git workspace — the C client walks up looking for // `.git`, hashes whatever it lands on, and connects to the // matching socket. Match it by handing the same root to the - // server. - workspaceRoot = Directory.systemTemp.createTempSync('clide-ws-'); + // server. Canonicalise: the client resolves its CWD via the OS + // (getcwd), so on macOS it hashes /private/tmp/… while a raw + // createTemp path is /tmp/… — the two hashes must agree. + workspaceRoot = Directory(Directory.systemTemp.createTempSync('clide-ws-').resolveSymbolicLinksSync()); Directory('${workspaceRoot.path}/.git').createSync(); dispatcher = DaemonDispatcher(); registerArgvUnwrap(dispatcher); diff --git a/test/daemon/files_commands_test.dart b/test/daemon/files_commands_test.dart index 701426e0..263714c6 100644 --- a/test/daemon/files_commands_test.dart +++ b/test/daemon/files_commands_test.dart @@ -231,7 +231,9 @@ void main() { Directory.current = nested; final svc = FilesService.atCwd(events: RecordingEventSink()); // No .git anywhere on the walk → root falls back to CWD. - expect(svc.root.absolute.path, nested.absolute.path); + // Compare canonical paths: on macOS the CWD resolves through the + // /tmp → /private/tmp symlink, so the raw createTemp path differs. + expect(svc.root.resolveSymbolicLinksSync(), nested.resolveSymbolicLinksSync()); await svc.shutdown(); } finally { Directory.current = saved;