fix: handle recursive watcher ignore paths correctly#13756
fix: handle recursive watcher ignore paths correctly#13756ManManavadaria wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix Docker Compose watch startup failures when an ignored path is unreadable by pushing ignore handling down into the watcher layer. In the codebase, that primarily affects how pkg/compose constructs file watchers and how pkg/watch traverses directories on different platforms.
Changes:
- Added an ignore matcher parameter to the watcher API and threaded it through Compose watch setup.
- Updated the naive watcher to skip ignored directories during recursive traversal and to suppress permission errors for ignored paths during startup walks.
- Adjusted Darwin watcher and test fixture construction to use the new watcher signature.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/watch/watcher_naive.go |
Adds ignore-aware traversal and permission handling to the non-fsevents watcher implementation. |
pkg/watch/watcher_darwin.go |
Updates the Darwin watcher constructor signature to match the new watcher API. |
pkg/watch/notify_test.go |
Updates test fixture setup to call NewWatcher with an ignore matcher. |
pkg/watch/notify.go |
Extends the exported watcher constructor to accept an ignore matcher. |
pkg/compose/watch.go |
Builds ignore matchers from watch triggers and passes them into watcher creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
1e22d66 to
bba54a8
Compare
bba54a8 to
4ab735b
Compare
|
/review |
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
This PR correctly applies ignore rules to the watcher layer for Linux/Windows (naive watcher) and handles permission errors from ignored paths during recursive directory traversal. However, there are two issues worth addressing:
- macOS (Darwin) — the
ignoreparameter is silently discarded, so the fix does not apply on macOS. - Multi-trigger ignore OR-logic — merging all trigger ignore matchers with OR logic at the watcher layer can cause directories needed by one trigger to be skipped because another trigger ignores them.
Reviewed 6 files: pkg/compose/watch.go, pkg/watch/notify.go, pkg/watch/notify_test.go, pkg/watch/watcher_darwin.go, pkg/watch/watcher_naive.go, pkg/watch/watcher_naive_test.go
4ab735b to
43cc3f0
Compare
Signed-off-by: ManManavadaria <manmanavadaria@gmail.com>
…nd apply review fixes Signed-off-by: ManManavadaria <manmanavadaria@gmail.com>
- Add multiNotify and watcher methods for grouped per-path watches - Centralize per-path multi-watcher behavior so the naive watcher flow stays the same - Add intersectPathMatcher implementing PathMatcher for shared roots - Remove unnecessary conditions in the naive watcher as per feedback Signed-off-by: ManManavadaria <manmanavadaria@gmail.com>
- Store PathMatcher on fseventNotify and filter events with shouldIgnore and shouldNotify, matching the naive watcher Signed-off-by: ManManavadaria <manmanavadaria@gmail.com>
43cc3f0 to
cf46c2c
Compare
|
Hi @glours, Thanks for the valuable feedback. Based on the review comments, I’ve refactored the per-path trigger watchers and Please review the changes and share your feedback. Thanks! |
What I did
Applied ignore rules at the watcher layer and updated recursive traversal to skip ignored files/directories, ensuring permission errors from paths in the ignore list do not fail watch.
Related issue
fixes #13750
(not mandatory) A picture of a cute animal, if possible in relation to what you did