microsoft / microsoft/TypeScript
FSEvents watcher drops events when requested casing differs from disk casing
@andrewbranch ci sta già lavorando.
Dal 2/9/2026.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
After https://github.com/microsoft/typescript-go/pull/4867, realpath on macOS now preserves the caller casing when the input isn't a symlink. That exposes a watch bug. WatchManager's DirWatchSet contains lowercased paths (even though they're typed as string, not tspath.Path). Those lowercased paths are given to fswatch, which works, but FSEvents then reports back events using actual disk casing. fsevents uses case-insensitive comparison to determine whether to call its callback, so the events get dropped.
I handed this to Copilot and it immediately jumped to bringing back the pre-https://github.com/microsoft/typescript-go/pull/4867 realpath behavior for directories specifically, since directories can't be hardlinks. I thought that was a really weird place to start, but technically it seems to fix the bug.
I think the more likely correct fix is either:
WatchManagershould hold both the original file casing for passing tofswatchand lowercased casing for deduplication/comparisonfswatchshould be doing case-insensitive matching on case-insensitive file systems
The latter seems like the most robust (I'm not sure if we can guarantee that the original file casing we see in tsc actually matches the disk in all cases; it seems possible that the casing of "include": ["SRC"] from a tsconfig will get preserved and we'll never be aware of the disk casing). But it also seems the most expensive and invasive, which is a bummer.
cc @jakebailey @johnfav03
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.