Skip to content

fix(watch): recognize bind-mounted paths starting with two dots - #14425

Merged
ndeloof merged 1 commit into
docker:mainfrom
ahbaqdadi:codex/fix-watch-bind-path
Oct 30, 2026
Merged

ndeloof merged 1 commit into
docker:mainfrom
ahbaqdadi:codex/fix-watch-bind-path

Conversation

@ahbaqdadi

@ahbaqdadi ahbaqdadi commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

compose watch now recognizes a bind-mounted child path whose name begins with .. (for example, ..local). The old relative-path check treated that valid child as a parent path, so Compose could watch and sync it again.

Related issue

No issue has the required status/approved label yet. This PR currently lacks the approved issue required by CONTRIBUTING.md.

Changes made

  • Use filepath.IsLocal to check whether the relative watch path stays within the bind mount.
  • Add a regression test for the mount root, an ordinary child, a ..local child, and a sibling.

Testing done

  • Unit tests: make test
  • Watch E2E: DOCKER_CONTEXT=desktop-linux make e2e-compose-standalone E2E_TEST='^TestWatchExec$'
  • Lint: make lint
  • Format: make fmt
  • Validation: make validate

Signed-off-by: Amir Baqdadi <ahbaqdadi@gmail.com>
@ahbaqdadi
ahbaqdadi marked this pull request as ready for review October 29, 2026 13:25
@ahbaqdadi
ahbaqdadi requested review from a team as code owners October 29, 2026 13:25
@ahbaqdadi
ahbaqdadi requested review from glours and ndeloof October 29, 2026 13:25

@ndeloof ndeloof left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. filepath.IsLocal is the right check: only .. and ../… are rejected, so a child named ..local is no longer taken for a parent path, and the mount root (.) is still local. The regression test fails on the ..local case with the previous code.

@ndeloof
ndeloof enabled auto-merge October 30, 2026 08:56
@ndeloof
ndeloof merged commit 57751f3 into docker:main Oct 30, 2026
61 of 64 checks passed
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants