Repository navigation
fix(sync): fail closed on unsafe keys and missing sync settings (AIC-3901, 5/5) - #1035
Closed
nkester-ld wants to merge 3 commits into
Closed
nkester-ld wants to merge 3 commits into
nkester-ld wants to merge 3 commits into
Conversation
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
branch
from
November 17, 2026 15:03
e910801 to
36d1b56
Compare
nkester-ld
force-pushed
the
AIC-3901/nkester/code-ownership-5-fail-closed
branch
from
November 17, 2026 15:03
69d0924 to
ad62052
Compare
…imed The sync settings client read at most 100 resources per call, so a first pull or a detach of more than 100 variations in one project failed before doing anything. The client now reads any number, one page at a time, and push drops its own batching. A push across projects is not atomic. When a later project's claim fails, the error now names the projects already recorded as code-owned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nkester-ld
marked this pull request as ready for review
November 17, 2026 16:13
nkester-ld
requested review from
tiffanylphan
and removed request for
a team
November 17, 2026 16:13
A link of a variation whose content already matched LaunchDarkly only updated the manifest, so it skipped the claim and the variation stayed unowned. A linked row now claims on that path too. A plain sync that adopts matching state still claims on its next push. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
General bug fixes we found for the process:
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
Two small fixes. Each test failed before the fix.
internal/sync/api/settings_write.go: a key becomes part of a rule pattern, so a key that isn't a LaunchDarkly key (for example*in a manifest committed to the repo) would write a wildcard rule that claims many variations. The writer now rejects the whole batch, naming the bad key, before sending anything.IsLaunchDarklyKeyininternal/sync/resource.goreuses the existing create-key pattern.prompt/state.go,bootstrap/bootstrap.goanddetach/detach.go: when the settings API answers but leaves a requested variation out (or answers with "unsupported resource kind"), the empty default counted as "no rule", so the variation was claimed and pushed. Now it fails closed with "LaunchDarkly returned no sync setting" before anything is claimed or written. A 404 (the API is unavailable) keeps its warn-and-ask behavior.prompt/conflict_test.go: its fake answered the settings read with an empty page, so four conflict tests passed only through the fail-open path. The fake now returns a setting for each resource it's asked about.Summary
Testing
go test ./... -count=1passes, and lint reports 0 issues with parts 1–4 below. New tests:TestSetSyncDirectionRejectsAKeyThatIsNotALaunchDarklyKey,TestPushFailsClosedWhenTheSyncSettingIsMissing, andTestRunFailsClosedWhenTheSyncSettingIsMissingin bootstrap and in detach.Acceptance table, open questions and release notes: see part 1 (#1032).
🤖 Generated with Claude Code
Note
Overview
Hardens sync ownership reads/writes and tightens when push, link, bootstrap, and detach are allowed to claim or return variations.
Rule writes now validate project/config/variation keys with
IsLaunchDarklyKeybefore any PATCH, so manifest keys like*cannot create wildcard ownership rules; the whole batch aborts with a named bad key.Ownership reads drop the hard 100-ID cap on
ResolveOwnershipand page requests per kind instead. Missing settings are treated as errors (ErrorSyncSettingUnavailable) when the API succeeds but omits a requested variation—bootstrap, detach, and prompt sync stop before claims or writes (404/unavailable still warn-and-continue where unchanged). New creates with nothing in LaunchDarkly yet remain exempt.Push/link claims code ownership on link even when only the manifest changes (
ActionUpdateManifest). Multi-project pushes report which projects were already claimed if a later claim fails (pushConsequence).Reviewed by Cursor Bugbot for commit 79d2733. 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