Repository navigation
feat(sync): create a missing config and variation from link --upsert - #1028
Merged
Merged
Conversation
A link of a source whose variation does not exist in LaunchDarkly stopped with an error, and a missing config stopped the whole plan. A link with --upsert now creates the resource in LaunchDarkly, and the config of a variation when LaunchDarkly has none. The config takes the mode of the source, or --mode, and the name of its key. --model-config-key gives the new variation a model config at its latest version. A missing config is now a row of the plan, so one such variation does not stop the others, and the message names the flag. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ctawiah
marked this pull request as ready for review
November 16, 2026 20:50
ctawiah
requested review from
btesfamariam and
nkester-ld
and removed request for
a team
November 16, 2026 20:50
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 348a314. Configure here.
nkester-ld
reviewed
Nov 16, 2026
…wers 404 A 404 of the config became a missing config for every row, so a tracked variation looked archived in LaunchDarkly, and `sync prompts --yes` deleted its local file and lock entry. A wrong --project gave the same result. The 404 is an error again for a tracked variation, and a missing config only for an untracked one, which a create can make. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
nkester-ld
approved these changes
Nov 16, 2026
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.

Context
A link of a repository source is reviewed and written in one command, and then the resource syncs. When the variation does not exist in LaunchDarkly, the plan stopped with an error that asked the user to create it in the UI first, because a descriptor has no
upsert. When the config did not exist, the read of the config failed and stopped the whole plan, including every other variation of the project. Both cases are the first step of an adoption flow: the prompt lives in code and LaunchDarkly has nothing yet.What changes
link --upsertcreates the resource in LaunchDarkly when it does not exist. For a variation it also creates the config when LaunchDarkly has none. The plan shows the row ascreate_serverwith the reasonnew, creates config "x", and the same--yesand--no-inputflags apply, because the create asks nothing.--model-config-keygives the new variation a model config at its latest version, asadddoes.--modesets the mode of a new config. Without it, the source decides: a message list makes a completion config, text makes an agent one. Both flags need--upsertand apply to a variation only.main, because the config was there at the last sync and a wrong--projectgives the same answer.server_canonicalsetting still refuses a create.--upsertcreates the tool or skill through the same publish as a managed file withupsert.CreateConfigon the API client posts the key, the name, and the mode.Design notes
Upserton the compiled resource,chooseAction, the create path ofapplyServerChange, and the publish of the attachment resolver. The only new write is the config create, which runs right before the variation create and tolerates a 409 from a config that another working copy created after the plan.link --upsertfinds it and creates the variation only.upsert: true, and a missing config now works for it the same way.Review focus
--mode, else the mode the source implies, else agent?Verification
go test ./...golangci-lint run ./...TestPromptSyncWithYesDoesNotDeleteTrackedVariationWhenConfigIs404,TestLinkUpsertCreatesTheConfigAndTheVariation,TestLinkUpsertCreatesTheVariationWithAModelConfig,TestLinkUpsertModeOverridesTheSourceMode,TestLinkWithoutUpsertNamesTheMissingConfig,TestLinkUpsertCreatesAMissingTool,TestCreateOfALinkedResourceNeedsNoSetting,TestClientCreatesConfig, andTestSourceLinkFlagsCarryTheUpsertIntent.🤖 Generated with Claude Code
Note
Overview
sync … linkcan bootstrap missing LaunchDarkly resources with--upsert: variations get a new config (when absent) plus the variation; tools/skills are created on the same publish path as managedupsertfiles. Variation-only flags--model-config-key(latest version) and--mode(agent/completion) require--upsert; default mode comes from the source when omitted.The link run carries upsert intent (
linkIntent) through planning and apply without storing it in the descriptor, so the pre- and post-descriptor reads still plan the same create.Planning no longer aborts the whole project when an untracked variation’s config is missing—it's a
create_serverrow (reason:new, creates config "…") with errors that mention--upsert. Tracked variations still hard-fail on config 404 so local files aren’t deleted on a wrong--project. Linked creates skip sync-setting checks when nothing exists server-side yet.API: new
CreateConfigPOST; execute calls it before variation create (409 tolerated). User-facing missing-resource messages now suggestlink --upsertinstead of UI-only fixes.Reviewed by Cursor Bugbot for commit d26ffb7. Bugbot is set up for automated code reviews on this repo. Configure here.