Add --select flag to bundle config-remote-sync#5579
Open
ilyakuz-db wants to merge 1 commit into
Open
Conversation
Add an opt-in --select flag to the experimental `bundle config-remote-sync`
command that restricts detected, applied, and saved changes to explicitly
named resources. The selector grammar is shared with `bundle deploy --select`
("type.name" or a unique short name) via the extracted
mutator.ResolveSelectors helper, so the two commands cannot drift apart.
Selection is plumbed separately from b.Select because that field is rejected
for non-direct engines, while config-remote-sync supports both engines.
Filtering happens after planning so ${resources.*} reference resolution is
unaffected; only the emitted changes are restricted. Default behavior without
the flag is unchanged.
This limits the blast radius of a sync run: a user syncing one resource can
no longer have an unrelated drifted resource (e.g. a dashboard whose etag
changed remotely) rewritten in the same run.
Contributor
Approval status: pending
|
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.
Changes
Add an opt-in
--selectflag to the experimentalbundle config-remote-synccommand (hidden; used by DABs in the Workspace). The flag restricts detected, applied, and saved changes to explicitly named resources. It accepts the same selector grammar asbundle deploy --select(type.nameor a unique short name), repeatable and/or comma-separated.Default behavior without the flag is unchanged.
Implementation notes:
mutator.ResolveSelectors(theResolveSelectmutator delegates to it), so the grammar and error messages cannot drift between the two commands.b.Select: that field is rejected for non-direct engines, whileconfig-remote-syncsupports both engines.DetectChangesstill plans the full resource set so${resources.*}references resolve); only the emitted change set is restricted. Unlike deploy's plan filtering, the selection is deliberately not expanded to transitive dependencies — dependencies matter for planning, not for deciding which resources may be rewritten.etag; classifying such fields asignore_remote_changesis tracked separately. Selection only limits which resources are written.Why
A full sync diffs all resources in a bundle, so a drifted-but-unrelated resource (for example a dashboard whose etag changed remotely because someone opened the draft) can have unwanted changes written into its YAML while the user is syncing a different resource. The Workspace UI knows which resource the user is editing; passing it via
--selectlimits the blast radius of one sync run to that resource.Tests
bundle/configsync.acceptance/bundle/config-remote-sync/covering: basic selection, idempotency, and no lost updates; cross-resource${resources.*.id}references; a job+dashboard bundle where selecting the job never touches the dashboard YAML (and the inverse); selector errors (unknown, malformed, ambiguous); selecting a never-deployed resource; two resources sharing one YAML file; multiple, comma-separated, and repeated selections; JSON output shape; variable restoration under selection; target overrides; missing-snapshot error parity with and without the flag.cli_defaults,multiple_resources,multiple_files,job_pipeline_task,resolve_variables— every variant passed on both engines). The entire existingconfig-remote-syncacceptance tree passes unchanged on both engines — the flag is opt-in and no existing goldens were modified. The deploy--selectacceptance tree is also unaffected by theResolveSelectorsextraction.