Skip to content

Watchers ignore attribute-only events unless the mtime moved - #149

Merged
raphamorim merged 1 commit into
mainfrom
rapha/watch-metadata-events
Sep 3, 2026
Merged

raphamorim merged 1 commit into
mainfrom
rapha/watch-metadata-events

Conversation

@raphamorim

Copy link
Copy Markdown
Collaborator

Both dev watchers treated attribute-only file events as changes. On Linux (relatime) the first read of a file after it was written updates its access time, inotify reports IN_ATTRIB, notify maps it to Modify(Metadata), and oj rebuilt: the TanStack Start client rebundle reads every source file, so one edit looked like an edit of every source file and rebuilt again until the access times settled, then re-armed on the next write. macOS never emits these events, which is why it was invisible locally; CI on PR #148 showed the HMR gate holding all 29 fixture files after a single edit.

Fix: oj_server::ContentChanges, chokidar's rule applied to notify events: a change is a data change or a moved mtime since the watcher last saw the file; an attribute-only event with an unchanged (or never recorded) mtime is not a change, a touch still is. Used by the plain watcher (which previously only skipped Access) and the Start watcher (which skipped nothing by kind).

Tests: unit test over synthetic notify events on a temp file (first attribute event ignored, data change recorded, moved mtime counted, access ignored, removal counted); the HMR, gate, watch and Start e2e suites pass locally; the Linux CI run is the decisive check.

🤖 Generated with Claude Code

@raphamorim
raphamorim merged commit 8fff28d into main Sep 3, 2026
4 checks passed
@raphamorim
raphamorim deleted the rapha/watch-metadata-events branch September 3, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant