Repository navigation
fix(watch): skip sync+exec triggers on bind-mounted paths - #14328
Conversation
A sync into a path that is also bind-mounted writes back to the host, which the watcher sees as a new change and syncs again, looping forever. isSync, which gates the bind mount check, missed sync+exec, so only sync and sync+restart triggers were skipped with a warning. Include sync+exec in isSync. This also makes initial_sync apply to sync+exec triggers, as it does for the other sync+x actions. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Guillaume Lours <glours@users.noreply.github.com>
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ndeloof
left a comment
There was a problem hiding this comment.
LGTM. sync+exec was the only syncing action missing from isSync(), so a sync+exec trigger on a bind-mounted path was monitored and looped on its own write-back; it is now skipped with the same warning as sync and sync+restart.
Checked locally on the PR head: go test -race ./pkg/compose -run Watch and golangci-lint on pkg/compose pass. The new tests cover every action against a bind-mounted path (the syncing ones are skipped, restart/rebuild stay monitored) and the initial sync for sync+exec.
Both side effects are intended and documented: the throwaway-target workaround is now skipped too (see the maintainer comment on #14326), and initial_sync now applies to sync+exec like the other sync+x actions, without running the exec hook, as sync+restart does not restart either.
What this PR does
isSync()gates the check that skips watch triggers whose path is also bind-mounted, and theinitial_synchandling. It didn't listsync+exec, so async+exectrigger on a bind-mounted path was monitored instead of skipped with a warning. Its sync writes back to the host, the watcher sees it as a new change, and it loops forever.Add
sync+exectoisSync(), so it's handled likesyncandsync+restart. As a consequence,initial_syncnow also applies tosync+exectriggers, as it does for the othersync+xactions.sync+exectriggers whose host path is bind-mounted are now skipped with the existing warning, whatever theirtarget.Related issue
Related to #14326
(not mandatory) A picture of a cute animal, if possible in relation to what you did
