Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct mtime for useFsEventsOnParentDirectory events #57877

Closed

Conversation

llllvvuu
Copy link

@llllvvuu llllvvuu commented Mar 21, 2024

Fixes #57792

Problem

On macOS Sonoma, getModifiedTime(fileOrDirectory) will return the wrong mtime for file change events in FileSystemEntryKind.Directory watchers, since foo/bar.ts modification will not bump foo/ mtime nor will the event itself specify an mtime. This will cause file modifications to not be picked up when running tsc --watch --watchFile usefseventsonparentdirectory.

Solution

Change getModifiedTime(fileOrDirectory) to getModifiedTime(filename), where filename is calculated by passing through entryKind.

Testing

Provided regression test which fails on main. The macOS Sonoma behavior is modeled by the mock filesystem using a new option modifyFileWithoutModifyDirectory.

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 21, 2024
@llllvvuu
Copy link
Author

@microsoft-github-policy-service agree

@llllvvuu llllvvuu force-pushed the fix/useFsEventsOnParentDirectory branch from 99dd525 to d7638e8 Compare March 21, 2024 08:49
@llllvvuu llllvvuu force-pushed the fix/useFsEventsOnParentDirectory branch from 387b84e to bb645e3 Compare March 21, 2024 10:21
@llllvvuu llllvvuu force-pushed the fix/useFsEventsOnParentDirectory branch from bb645e3 to ea8b8c6 Compare March 21, 2024 10:22
@llllvvuu llllvvuu marked this pull request as ready for review March 21, 2024 10:48
Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isnt the right fix and #57938 addresses the issue instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tsc --watch via directory-level fsevents not working on macOS 14.4
3 participants