Skip to content

sync: skip files and directories removed during listing - #7605

Merged
denik merged 1 commit into
mainfrom
denik/sync-skip-vanished-files
Nov 15, 2026
Merged

denik merged 1 commit into
mainfrom
denik/sync-skip-vanished-files

Conversation

@denik

@denik denik commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Why

sync --watch exits with an error when a directory is removed while it lists files. The integration test TestSyncIncrementalFileOverwritesFolder hits this on Windows (azure and gcp, on main and on several PRs):

Error: cannot list files: open foo: The system cannot find the file specified.

The test removes foo/bar.txt and then foo. fs.WalkDir in libs/fileset lists the parent first and then reads foo. If foo is removed in between, the walk returns ErrNotExist, and the error ends the whole sync. Windows deletes are slower to settle, so the race shows up there. Users editing files during sync --watch or bundle sync --watch can hit the same thing.

This is not a recent regression: recursiveListFiles has walked this way for a long time, and the test has flaked since at least September.

Changes

FileSet.recursiveListFiles now skips entries under the requested path that return ErrNotExist. The next listing iteration sees the removal and deletes the remote copy as before. A requested top-level path that does not exist is still an error.

Tests

  • New unit test TestFileSet_SkipsEntryRemovedDuringListing. It uses a vfs.Path wrapper whose ReadDir of a listed directory returns ErrNotExist. Without the fix it fails with open dir1: file does not exist; with the fix it passes.
  • New unit test TestFileSet_MissingRootPathIsAnError, which keeps the existing behavior for a missing top-level path.
  • go test ./libs/fileset ./libs/sync pass.

Dashboard

error snippet
error/625 Error: cannot list files: open foo: The system cannot find the file specified.

Test: integration/cmd/sync.TestSyncIncrementalFileOverwritesFolder

This pull request and its description were written by Isaac.

fs.WalkDir lists a directory and then reads each child. If a child
directory is removed in between (e.g. while sync --watch runs), the
walk returned ErrNotExist and the whole sync command failed. Skip such
entries; the next listing picks up the removal. A missing top-level path
is still an error.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik denik added the ai-auto PRs made by AI loops & factories, label Nov 13, 2026
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 32e093a

Run: 43460598000

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 15 6:55
💚​ aws-windows-latest-4core-16gb 1 272 13 6:05
💚​ azure linux-2core-8gb 1 269 15 6:26
💚​ azure-windows-latest-4core-16gb 1 271 13 7:21
💚​ gcp linux-2core-8gb 1 270 15 7:41
💚​ gcp-windows-latest-4core-16gb 1 272 13 5:45
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 4 slowest tests (at least 2 minutes):
duration env testname
3:31 gcp-windows-latest-4core-16gb TestAccept
3:19 azure-windows-latest-4core-16gb TestAccept
3:11 aws-windows-latest-4core-16gb TestAccept
2:01 gcp-windows-latest-4core-16gb TestFilerWorkspaceFilesExtensionsReadDir

@denik
denik marked this pull request as ready for review November 13, 2026 18:16
@denik
denik requested a review from a team as a code owner November 13, 2026 18:16
@denik
denik requested review from andrewnester and rugpanov and removed request for rugpanov November 13, 2026 18:16
@denik
denik added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 8321ac9 Nov 15, 2026
28 checks passed
@denik
denik deleted the denik/sync-skip-vanished-files branch November 15, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-auto PRs made by AI loops & factories,

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants