Skip to content

feat(sync): resolve automatic source identity - #789

Draft
ctawiah wants to merge 8 commits into
ctawiah/AIC-3335/parse-local-synced-resourcesfrom
ctawiah/AIC-3336/git-repo-identity
Draft

ctawiah wants to merge 8 commits into
ctawiah/AIC-3335/parse-local-synced-resourcesfrom
ctawiah/AIC-3336/git-repo-identity

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Context

Gonfalon stores sync manifests by source so future plans can compare the same local workspace with the saved baseline. The CLI therefore needs a stable source identity without asking users to maintain another file or choose an identity manually.

Git identity is preferred because it remains stable across clones and contributors. A private installation and workspace hash provides a deterministic fallback for local directories that are not connected to Git. This PR only resolves identity for later requests and does not perform planning or synchronization.

Summary

  • Normalizes equivalent SSH and HTTPS remotes to the same Git source identifier.
  • Persists a private installation ID in the existing ldcli user configuration.
  • Falls back to a hash of the installation ID and canonical workspace path when Git identity is unavailable.
  • Prefers Git automatically, handles symlinks, and exposes no source-selection flag.
  • Adds no source metadata file to the customer workspace.

Verification

  • go test ./internal/config -count=1
  • go test ./internal/sync/... -count=1
  • Focused lint for the changed configuration and sync packages

ldcli sync must run in an initialized git repository. Derive a stable
repoIdentifier from origin so LaunchDarkly can track the same repo
across branches.
@ctawiah
ctawiah requested a review from a team as a code owner September 9, 2026 22:23
@ctawiah
ctawiah marked this pull request as draft September 9, 2026 22:23
@ctawiah
ctawiah added this pull request to stack #790 September 9, 2026 22:28

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ 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.

Comment thread internal/sync/git.go Outdated

origin, err := git.output(root, "remote", "get-url", "origin")
if err != nil || origin == "" {
return Repo{}, ErrNoOrigin

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 618753a. Configure here.

Comment thread internal/sync/git.go Outdated
userHost, path, found := strings.Cut(s, ":")
if !found || path == "" || strings.Contains(userHost, "/") {
return "", "", false
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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.
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3336/git-repo-identity branch from ac311e0 to 88c4896 Compare September 9, 2026 22:56
@ctawiah ctawiah changed the title feat(sync): identify git repos and require origin for sync feat(sync): derive typed Git source identity Sep 11, 2026
@ctawiah
ctawiah removed this pull request from stack #790 September 11, 2026 23:01
@ctawiah
ctawiah changed the base branch from ctawiah/AIC-3335/parse-local-synced-resources to ctawiah/AIC-3335/compile-local-variations September 11, 2026 23:01
@ctawiah
ctawiah added this pull request to stack #795 September 11, 2026 23:01
Base automatically changed from ctawiah/AIC-3335/compile-local-variations to ctawiah/AIC-3335/parse-local-synced-resources September 11, 2026 23:50
@ctawiah
ctawiah removed this pull request from stack #795 September 11, 2026 23:51
@ctawiah ctawiah changed the title feat(sync): derive typed Git source identity feat(sync): resolve automatic source identity Sep 11, 2026
@ctawiah
ctawiah added this pull request to stack #799 September 11, 2026 23:51
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3336/git-repo-identity branch from 59abee7 to 755c0b0 Compare September 14, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant