Repository navigation
feat(sync): detach returns a variation to LaunchDarkly (AIC-3901, 4/5) - #1030
Closed
nkester-ld wants to merge 1 commit into
Closed
nkester-ld wants to merge 1 commit into
nkester-ld wants to merge 1 commit into
Conversation
nkester-ld
force-pushed
the
AIC-3901/nkester/code-ownership
branch
from
November 16, 2026 20:12
d3cb2c3 to
e910801
Compare
nkester-ld
changed the base branch from
main
to
AIC-3901/nkester/code-ownership-3-first-pull
November 16, 2026 20:12
This was referenced Nov 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nkester-ld
force-pushed
the
AIC-3901/nkester/code-ownership-3-first-pull
branch
from
November 17, 2026 15:03
a887e92 to
61ede04
Compare
nkester-ld
force-pushed
the
AIC-3901/nkester/code-ownership
branch
from
November 17, 2026 15:03
e910801 to
36d1b56
Compare
nkester-ld
marked this pull request as ready for review
November 17, 2026 16:14
nkester-ld
requested review from
davidbrackbill
and removed request for
a team
November 17, 2026 16:14
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 36d1b56. Configure here.
Author
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.

Human
Ensure that if we detach a variation, we make LD the SoT before removing it.
Stack (merge in order):
Why
AI Config sync is moving to two sources of truth: every variation is owned by exactly one side, LaunchDarkly (UI and API) or code (ldcli). Today ldcli never writes ownership rules, so a variation synced from code stays editable in LaunchDarkly unless someone switches it by hand, and the two copies drift. Syncing a variation from code should make it code-owned. Detaching it should hand it back to LaunchDarkly. A variation someone explicitly kept in LaunchDarkly should never be taken over by a push.
Reviewer Guide
All in
internal/sync/detach/detach.go. ReadreturnToLaunchDarkly: it reads every project's ownership first, asks once if the settings API is unavailable, then writes an exactserver_canonicalrule per project before any file is removed. A forbidden or failed return stops before anything is deleted, and names the projects already returned.prompt/runner.gopasses the settings client and error stream into detach.Summary
server_canonicalrule before removing files, so the variation returns to LaunchDarkly, can be edited in the UI, and isn't claimed again by a later push.updateSyncSettingspermission names the action and resource and leaves everything in place.Testing
go test ./... -count=1passes, and lint reports 0 issues with parts 1–3 below. Key tests:detach/ownership_test.goTestRunReturnsADetachedVariationToLaunchDarklyBeforeTheDelete, andprompt/ownership_test.goTestDetachNamesTheMissingPermissionWhenReturningToLaunchDarklyIsForbidden.Review findings not addressed (medium, test coverage only): detach's ownership read returning 403 or another error has no test, and neither does a prompt error after some projects were already returned (
returnToLaunchDarkly,confirmWithoutOwnership).Acceptance table, open questions and release notes: see part 1 (#1032).
🤖 Generated with Claude Code
Note
Overview
Detach now hands variation ownership back to LaunchDarkly before any local files or lock entries are removed, by writing
server_canonicalsync settings rules (one read pass per project, then one write per project). Tools and skills are unchanged—no ownership rules.If sync settings are missing (404), detach warns on the error stream and prompts Detach anyway? unless
--yesis set; multi-project runs resolve all projects before any write so a cancel leaves no partial rules. Forbidden or other API failures stop the operation without detaching and surface actionable permission errors (e.g.updateSyncSettings).The prompt sync runner passes the API client as
SettingsplusErrorOutputinto detach. New unit and prompt integration tests cover ordering, multi-project edge cases, and permission failures.Reviewed by Cursor Bugbot for commit 36d1b56. Bugbot is set up for automated code reviews on this repo. Configure here.
Related Jira issue: AIC-3901: [ldcli] Pushing, linking or first-pulling a variation makes it code-owned; detach returns it to LaunchDarkly