Skip to content

Add explicit read-only validation of the remote sync path#5944

Draft
pietern wants to merge 1 commit into
mainfrom
validate-ensure-remote-path
Draft

Add explicit read-only validation of the remote sync path#5944
pietern wants to merge 1 commit into
mainfrom
validate-ensure-remote-path

Conversation

@pietern

@pietern pietern commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Why

bundle validate validates the remote workspace.file_path only incidentally, via the sync.New constructor's EnsureRemotePathIsUsable call, which also creates the directory as a side effect. An upcoming refactor centralizes the sync file-list computation and stops constructing a syncer during validation, which would silently drop this check. This PR extracts the check into an explicit, read-only ValidateRemoteFilePath validator (using the existing EnsureRemotePathIsUsable with dryRun=true, so no directory is created), wired into bundle validate. Behavior for bundle deploy and the sync commands is unchanged.

What

  • New read-only validator ValidateRemoteFilePath (bundle.RO) in bundle/config/validate/, checking only workspace.file_path. It calls sync.EnsureRemotePathIsUsable(..., dryRun=true) — the single source of truth shared with deploy — so there is no mkdir side effect. It skips when there are no sync paths (mirroring FilesToSync) or when file_path is empty.
  • Wired into the slow Validate() set alongside FilesToSync().
  • Unit tests: directory → no diagnostics; non-directory → one diag.Error with the path; no-sync-paths → skip. No MkdirsByPath expectation is set, so an unexpected mutating call fails the test (proves the dry run).
  • Acceptance test under acceptance/bundle/validate/remote_file_path/.

Scope / transition

This is deliberately single-purpose. sync.New, FilesToSync, files.GetSync, and EnsureRemotePathIsUsable's implementation are intentionally not modified, so bundle deploy and the sync commands keep creating the remote directory as before.

During this transition bundle validate reports the destination error twice for a bad path — once from the new validator (with a location), once from FilesToSync via sync.New. This is the accepted, brief redundancy. A follow-up PR removes the check from sync.New by moving EnsureRemotePathIsUsable(dryRun=false) to the syncer launch path (RunOnce/RunContinuous), which covers deploy/sync/bundle-sync (all of which construct-then-launch) while making sync construction free of remote calls.

Note on the acceptance test

bundle validate runs its slow validators in parallel (bundle.ApplyParallel) and streams diagnostics in completion order, so full output is not deterministically ordered when multiple validators emit. The test captures full output to a LOG.validate file (excluded from the golden) and asserts a sorted projection of the diagnostic lines, so it is stable.

This pull request and its description were written by Isaac.

@github-actions

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

5 files changed
Suggested: @shreyas-goenka
Also eligible: @denik, @janniklasrose, @andrewnester, @lennartkats-db, @anton-107

/bundle/ - needs approval

Files: bundle/config/validate/validate.go, bundle/config/validate/validate_remote_file_path.go, bundle/config/validate/validate_remote_file_path_test.go
Suggested: @shreyas-goenka
Also eligible: @denik, @janniklasrose, @andrewnester, @lennartkats-db, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/validate-remote-file-path.md, docs/superpowers/specs/2026-07-16-validate-remote-file-path-design.md
Based on git history:

  • @shreyas-goenka -- recent work in bundle/config/validate/, .nextchanges/bundles/

Any maintainer (@andrewnester, @anton-107, @denik, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: eeb68e3

Run: 29502386246

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 227 1120 4:38
💚​ aws windows 4 4 229 1118 6:51
💚​ aws-ucws linux 4 4 316 1036 8:13
💚​ aws-ucws windows 4 4 318 1034 8:19
💚​ azure linux 4 4 227 1119 4:47
💚​ azure windows 4 4 229 1117 6:49
💚​ azure-ucws linux 4 4 318 1033 9:25
💚​ azure-ucws windows 4 4 320 1031 8:11
💚​ gcp linux 4 4 226 1121 4:36
💚​ gcp windows 4 4 228 1119 6:44
8 interesting tests: 4 RECOVERED, 4 SKIP
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
6:36 azure-ucws windows TestAccept
6:27 aws windows TestAccept
6:22 aws-ucws windows TestAccept
6:21 azure windows TestAccept
6:20 gcp windows TestAccept
3:04 gcp linux TestAccept
3:02 azure linux TestAccept
2:54 aws-ucws linux TestAccept
2:51 aws linux TestAccept
2:50 azure-ucws linux TestAccept

@pietern
pietern marked this pull request as draft July 16, 2026 12:30
@pietern
pietern force-pushed the validate-ensure-remote-path branch from a52656b to f1a5fcb Compare July 16, 2026 12:33
bundle validate currently checks that workspace.file_path is a usable
remote destination only as a side effect of building a file syncer:
FilesToSync -> files.GetSync -> sync.New, whose constructor calls
EnsureRemotePathIsUsable. That call also creates the directory as a side
effect, which is undesirable from a read-only validator.

An upcoming refactor centralizes the sync file-list computation and stops
constructing a syncer during validation, which would silently drop this
destination check. Extract it into an explicit, read-only
ValidateRemoteFilePath validator that calls EnsureRemotePathIsUsable with
dryRun=true, so the path is asserted to be a directory/repo without
creating it. Wire it into the slow Validate() set.

sync.New is intentionally left untouched, so bundle deploy and the sync
commands keep creating the remote directory as before. During this
transition bundle validate reports the destination error twice (once from
this validator, once from FilesToSync via sync.New); a follow-up PR removes
the check from sync.New by moving it to the syncer launch path.

Co-authored-by: Isaac
@pietern
pietern force-pushed the validate-ensure-remote-path branch from f1a5fcb to eeb68e3 Compare July 16, 2026 13:28
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