Fix initial watch sync for existing files - #14031
Conversation
ndeloof
left a comment
There was a problem hiding this comment.
Verified locally, end to end: with a watched file antedated to 2020 (older than the service image) and initial_sync: true, a main build never syncs it at watch startup (/app/src: No such file or directory) while this branch does. New unit tests pass, the full pkg/compose suite and lint are green.
History check on the removed filter: the image-created-time condition was born with the feature itself (#12047, second commit) as a heuristic assuming watched files are baked into the image at build time — no later commit ever relied on or fixed it, so nothing regresses by removing it. It contradicted the pulled-image half of the original #11102 use case, and the removed imageCreatedTime helper was itself fragile (required an existing container, failed the whole initial sync otherwise). Same approach as #13728, which only got cosmetic review feedback before going stale.
Note: TestWatch/debian fails identically on main and on this branch in my environment (Docker Desktop restricted host mount on /var/folders) — pre-existing, unrelated.
Trade-off acknowledged: initial sync now copies the whole watched tree at watch start; acceptable since initial_sync is opt-in.
|
One request before this can merge: the PR includes |
Signed-off-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
3c8906f to
e4979a7
Compare
|
Thanks for the approval @ndeloof. Removed Force-pushed the branch ( |
What I did
Fixes #13725.
develop.watchinitial sync filtered host files by the service image's creation time. Existing files older than the image were therefore omitted at startup, even though later filesystem events synced them normally.Initial sync now copies every eligible watched file, while preserving ignore and bind-mount filtering. The obsolete image-time lookup is removed.
Test verification
RED on upstream
main(832673c8e445b5bf0bdb4963c7d7b3f81aa46da0):GREEN with this change:
The live Engine reproduction also changed from
No such file or directoryto successfully readinghellofrom/app/src/test.txtat watch startup.Validation
Full local validation suite replayed on upstream and this branch:
golangci-lint run --build-tags e2e ./...—0 issuespkg/composeand all baseline-green unit packages passpkg/watchtests fail on both upstream and this branch; no new failures