watch: resolve event path before matching trigger path by maxpetrusenkoagent · Pull Request #13870 · docker/compose · GitHub
Skip to content

watch: resolve event path before matching trigger path#13870

Draft
maxpetrusenkoagent wants to merge 1 commit into
docker:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-23-docker-compose-13743
Draft

watch: resolve event path before matching trigger path#13870
maxpetrusenkoagent wants to merge 1 commit into
docker:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-23-docker-compose-13743

Conversation

@maxpetrusenkoagent

@maxpetrusenkoagent maxpetrusenkoagent commented Jun 23, 2026

Copy link
Copy Markdown

What I did

When loadDevelopmentConfig processes the develop.watch trigger path (e.g., ./src), it resolves it to its real path via filepath.EvalSymlinks. However, watchRule.Matches was comparing raw inotify event paths directly against this resolved trigger path, causing the IsChild check to silently fail on Linux in two scenarios:

  1. Symlinks: the event path goes through a symlink pointing to the watched directory
  2. Case sensitivity (issue [BUG] docker compose watch fails to sync file changes for Node.js app when using bind mounts on Linux #13743): on Linux case-sensitive filesystem, inotify reports the actual filesystem path (e.g., /PROJECT/src/foo.js) which may differ in case from the resolved trigger path

This caused docker compose watch sync actions to be silently skipped when file changes occurred.

How to test

  1. Set up a project with develop.watch and a bind mount target
  2. Run docker compose watch
  3. Modify a file in the watched directory
  4. Before fix: sync is not triggered
    After fix: sync triggers correctly

Related issue

Fixes #13743

When loadDevelopmentConfig processes the develop.watch trigger path, it
resolves it via filepath.EvalSymlinks. However, when an inotify event
fires on Linux, the reported path may differ from the original trigger
path in two ways:

1. Symlinks: the event path may go through a symlink that points to
   the same directory as the trigger path.
2. Case sensitivity: on Linux's case-sensitive filesystem, inotify
   reports the actual filesystem path which may differ in case from
   the path as originally specified in the compose file.

This causes watchRule.Matches to fail the IsChild check and silently
skip the sync action, as reported in issue docker#13743.

The fix: resolve the event path via filepath.EvalSymlinks and clean
it before comparing with the trigger path, mirroring what
loadDevelopmentConfig does during config loading. The original event
path is preserved as HostPath so the sync operation uses the correct
source path.

Fixes docker#13743

Signed-off-by: maxpetrusenkoagent <max.petrusenko.agent@gmail.com>
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.

[BUG] docker compose watch fails to sync file changes for Node.js app when using bind mounts on Linux

1 participant