libs/sync: extract FileList to decouple file listing from syncing#5947
Merged
Conversation
The code in libs/sync conflated listing the files selected for sync (git-aware + include/exclude) with syncing them (snapshot diff, upload, progress). Callers that only want the list had to reach through the syncer: #5254 faked a partial Sync to call the listing method, and validate:files_to_sync builds a full Sync via sync.New, running side effects a validation pass shouldn't (writes .databricks/.gitignore, can MkdirsByPath the remote path). This extracts the real primitive so listing no longer depends on a syncer. - Add FileList (libs/sync/filelist.go): owns the filesets and the (git union include) minus exclude merge. NewFileList(...) builds it, Files(ctx) lists. - Sync composes a *FileList; (*Sync).GetFileList delegates to it. - Remove the free GetFileList; its one caller (snapshot zip builder) builds a FileList directly. - Drop the implicit ["."] default: empty paths now select nothing, matching the default engine. Every real caller already passes paths explicitly. Pure refactor, except an immutable-folder deploy with sync: {paths: []} now zips zero files instead of the whole root, aligning it with the default engine. Co-authored-by: Isaac
Group each stanza as fetch, error-check, apply with a blank line between sections; the git stanza was missing the blank line the include/exclude stanzas already had. Co-authored-by: Isaac
Collaborator
Integration test reportCommit: 4e6ec12
9 interesting tests: 4 SKIP, 3 RECOVERED, 2 flaky
Top 11 slowest tests (at least 2 minutes):
|
andrewnester
approved these changes
Jul 16, 2026
Collaborator
Integration test reportCommit: 4c07b27
526 interesting tests: 515 FAIL, 4 flaky, 3 RECOVERED, 2 KNOWN, 2 SKIP
Top 50 slowest tests (at least 2 minutes):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The code in
libs/syncconflated listing the files selected for sync (git-aware + include/exclude) with syncing them (snapshot diff, upload, progress). Callers that only want the list had to reach through the syncer: #5254 faked a partialSyncto call the listing method, andvalidate:files_to_syncbuilds a fullSyncviasync.New, running side effects a validation pass shouldn't (writes.databricks/.gitignore, canMkdirsByPaththe remote path). This extracts the real primitive so listing no longer depends on a syncer.What
FileList(libs/sync/filelist.go): owns the filesets and the(git ∪ include) − excludemerge.NewFileList(...)builds it,Files(ctx)lists.Synccomposes a*FileList;(*Sync).GetFileListdelegates to it.GetFileList; its one caller (snapshot zip builder) builds aFileListdirectly.["."]default: empty paths now select nothing, matching the default engine. Every real caller already passes paths explicitly.Behavior
Pure refactor, except an immutable-folder deploy with
sync: {paths: []}now zips zero files instead of the whole root, aligning it with the default engine.This pull request and its description were written by Isaac.