Repository navigation
Conversation
All clones of a repository shared one remote manifest as their sync baseline. A clone that was behind then looked like it changed its files back, so sync wrote the older content to LaunchDarkly or archived new variations. Each working copy now keeps its baseline in .launchdarkly/sync.lock. Engineers commit the file, so the baseline moves with the files on each pull and branch switch. The plan compares local files and LaunchDarkly with the lock. A clone that is behind pulls the newer state, and two clones that edit one variation get a conflict. The remote manifest still supplies the version of each entry. Each save sends the version that sync read, so LaunchDarkly rejects two saves of one entry at the same time. A working copy without sync.lock uses the remote manifest once, and its next sync writes the file. The review shows a note and a suggestion when another working copy synced a different state of a variation. The lock lists every tracked project, so sync no longer asks Git for deleted files.
|
Review notes. I made no code changes. 1. High: a working copy with no When I checked this with a scratch acceptance test (not committed). The remote manifest tracks In #857 the same case pulls 2. Low: if
3. Low: per-resource
|
|
Update on the High item in my earlier review (a working copy with no On #857,
So sync no longer archives or restores another branch's variation. This PR (adca116) still has |
Context
All clones of a repository shared one remote manifest as their sync baseline. The source key of that manifest comes only from the Git origin, so every clone and branch read and wrote the same baseline. Each clone has different local files, so the three-way comparison broke:
What changes
.launchdarkly/sync.lock. Engineers commit the file, so the baseline moves with the files on each pull and branch switch.sync.lockuses the remote manifest once. Its next sync writes the file.--dry-runnever writes it.syncedElsewhereandsuggestionfields.The lock file is one sorted entry per resource:
Design notes
sync.lockis the existingmanifest.Manifestsaved as YAML, so it reuses the existing validation, sorting, and entry methods.manifest.BaselineStorewraps the existingStore.Update, so batching, the 409 handling, and the read-back after an uncertain write do not change.manifest.Baselinesinterface replaces the three identicalManifestStoreinterfaces in bootstrap, detach, and prompt.Review focus
sync.locksafe?Verification
go build ./...go vet ./...go test -race ./internal/sync/... ./cmd/sync/...TestPromptStaleWorkingCopyPullsInsteadOfRevertingfails with the old shared baseline and passes with the lock.Related changes
sync.lockdetach --archiveNote
Overview
Moves the sync three-way baseline from a single shared remote manifest to a committed
.launchdarkly/sync.lockper working copy, while the remote manifest still supplies optimistic-lock versions.manifest.BaselineStoreloadssync.lock(or falls back to the remote manifest once), compares lock fingerprints to the remote to detect staleness (SyncedElsewhere), patches LaunchDarkly with versions read from the remote, then writes the updated lock. Bootstrap, detach, and prompt sync now takeBaselinesinstead of localManifestStoreinterfaces and plan/apply againstbaseline.Lock.Adds lock read/write on the local store (atomic, symlink-safe), YAML lock encoding on
manifest.Resource, and review/JSON fields for notes and git-pull suggestions when another clone synced ahead. Project discovery uses lock entries instead of Git deleted-path scanning; the file watcher ignoressync.lockupdates.Reviewed by Cursor Bugbot for commit adca116. Bugbot is set up for automated code reviews on this repo. Configure here.