feat(sync): resolve automatic source identity - #789
Conversation
ldcli sync must run in an initialized git repository. Derive a stable repoIdentifier from origin so LaunchDarkly can track the same repo across branches.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ 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 618753a. Configure here.
|
|
||
| origin, err := git.output(root, "remote", "get-url", "origin") | ||
| if err != nil || origin == "" { | ||
| return Repo{}, ErrNoOrigin |
There was a problem hiding this comment.
InsteadOf rewrites alter repo identifiers
Medium Severity
IdentifyRepo reads origin via git remote get-url, which expands url.*.insteadOf from the user's git config. Host-rewriting rules, including GitHub's documented SSH-over-443 setup, change the identifier so two clones of the same repository no longer match.
Reviewed by Cursor Bugbot for commit 618753a. Configure here.
| userHost, path, found := strings.Cut(s, ":") | ||
| if !found || path == "" || strings.Contains(userHost, "/") { | ||
| return "", "", false | ||
| } |
There was a problem hiding this comment.
Windows paths parsed as remotes
Low Severity
scpRemote treats a Windows drive-letter path as an SCP remote because it splits on the first colon and only rejects a host segment that contains /. IdentifyRepo then returns a fabricated identifier instead of failing the way a Unix local path does.
Reviewed by Cursor Bugbot for commit 618753a. Configure here.
Read the literal origin URL and reduce it to owner/repository. This keeps the identifier stable across branches and clone protocols without custom remote normalization.
ac311e0 to
88c4896
Compare


Summary
Adds automatic typed source identity for Git and non-Git workspaces without requiring customer-managed metadata.
Verification
go test ./internal/config -count=1go test ./internal/sync/... -count=1