Repository navigation
fix: Report watched file changes promptly with watchdog 7, and react to a touch - #577
Open
kinyoklion wants to merge 1 commit into
Open
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
…to a touch watchdog 7 on Windows holds notifications for the observer timeout, one second by default, and delivers none while another file in the directory changes more often. The watcher now uses a 100 ms timeout. watchdog 7 reports a touch as an attrib event, which now counts as a change. After scheduling a watch, the watcher yields so that the reader thread of watchdog 6 on Windows asks for notifications before the setup goes on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
async_*siblings (or N/A). N/A: the file watcher serves both clients.Related issues
This resolves the SDK findings of the Windows stability assessment for the overrides work: plans/python-overrides-windows-test-stability.md in sdk-scratchpad.
Describe the solution you've provided
All three changes are in
Watcher, inldclient/impl/integrations/files/filedata.py, which the file-based override source uses in watching mode.timeout=0.1. On Linux, the timeout only sets how often the idle inotify loop wakes.watchdog>=3.0.0, so this affects any Windows deployment that selectsChangeDetection.WATCHING.os.utime, as anattribevent. Earlier versions reported it asmodified.attrib, so touching a file to force a reload stopped working in watching mode, while it still works in polling mode.attribnow counts as a change. A plain read does not produce it, so the reloads stay quiet. The reloader's content digest still skips applying an unchanged file.Tests in
test_filedata.py:Describe alternatives you've considered
watchdog<7in thetest-filesourceextra. Applications bring their own watchdog, so a pin would only hide the behavior from CI.attrib. That would leave watching and polling behaving differently for the same file.Additional context
Testing:
mypy,isortandpycodestyleare clean.This PR merges cleanly with #574 and #576.
Not in this PR, from Finding 6 of the assessment. None of these come from the overrides work:
test_async_migrator.pythat is too tight for Windows clocks;main;feat/overridesred in 4 of 5 runs and needs its own investigation before the merge intomain.The assessment also recommends reporting the watchdog 7 behavior upstream; that is not done yet.
Opened from termag
Note
Overview
Updates the file
Watcherin watching mode so override/data reloads behave reliably with watchdog 6–7, especially on Windows.The observer now uses a 100 ms delivery timeout instead of watchdog’s 1 s default, so changes are reported quickly and are not indefinitely delayed when another file in the same directory keeps notifying.
attribis treated as a content-relevant event so a mtime-only touch triggers a reload again under watchdog 7. After each directory watch is scheduled, a thread yield (time.sleep(0)) avoids missing an immediate post-start change on watchdog 6 for Windows.New watcher tests cover sub-second latency, detection alongside a busy log file, and mtime-only updates.
Reviewed by Cursor Bugbot for commit 546a7f5. Bugbot is set up for automated code reviews on this repo. Configure here.