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) <noreply@anthropic.com>
This commit is contained in:
Jeroen Schweitzer
2026-06-03 10:00:29 +02:00
co-authored by Claude Opus 4.8
parent da4bc267cb
commit 16583343cb
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -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);
+3 -1
View File
@@ -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;