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:
co-authored by
Claude Opus 4.8
parent
da4bc267cb
commit
16583343cb
@@ -50,8 +50,10 @@ void main() {
|
|||||||
// Synthetic git workspace — the C client walks up looking for
|
// Synthetic git workspace — the C client walks up looking for
|
||||||
// `.git`, hashes whatever it lands on, and connects to the
|
// `.git`, hashes whatever it lands on, and connects to the
|
||||||
// matching socket. Match it by handing the same root to the
|
// matching socket. Match it by handing the same root to the
|
||||||
// server.
|
// server. Canonicalise: the client resolves its CWD via the OS
|
||||||
workspaceRoot = Directory.systemTemp.createTempSync('clide-ws-');
|
// (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();
|
Directory('${workspaceRoot.path}/.git').createSync();
|
||||||
dispatcher = DaemonDispatcher();
|
dispatcher = DaemonDispatcher();
|
||||||
registerArgvUnwrap(dispatcher);
|
registerArgvUnwrap(dispatcher);
|
||||||
|
|||||||
@@ -231,7 +231,9 @@ void main() {
|
|||||||
Directory.current = nested;
|
Directory.current = nested;
|
||||||
final svc = FilesService.atCwd(events: RecordingEventSink());
|
final svc = FilesService.atCwd(events: RecordingEventSink());
|
||||||
// No .git anywhere on the walk → root falls back to CWD.
|
// 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();
|
await svc.shutdown();
|
||||||
} finally {
|
} finally {
|
||||||
Directory.current = saved;
|
Directory.current = saved;
|
||||||
|
|||||||
Reference in New Issue
Block a user