-
Notifications
You must be signed in to change notification settings - Fork 0
Paths
Every user-supplied path flows through canonicalCwd(p) in src/servers.ts before being used as a key.
canonicalCwd is a fs.realpathSync wrapper with a graceful fallback.
lsof reports realpath for a process's cwd. Finder, Form.FilePicker, and package.json-derived paths may not be realpath (aliases, symlinks, ~/tmp → /private/tmp, iCloud paths). Without canonicalization, string comparison returns false negatives:
- "Is this project already running?" → fails to match, spawns a duplicate
- "Is this recents entry currently running?" → fails to filter, picker shows running rows
- "Did the just-spawned server appear?" → fails, toast spins forever
The bug was silent: different OS/shell/Finder configurations produced different surface paths for the same directory, and the mismatch only showed up for symlinked setups.
Anything that produces a path used as a key should canonicalize:
-
findProjectRoot(startPath): walks up to nearestpackage.json, returns canonical -
recordSeenBatch(inrecents.ts): canonicalizes on every write and passively merges entries that resolve to the same realpath
If you add code that compares paths across boundaries (Finder/lsof/LocalStorage), route them through canonicalCwd first.