Skip to content

feat(sync): reconcile variation attachments - #840

Merged
ctawiah merged 2 commits into
mainfrom
ctawiah/sync-attachment-reconciliation
Oct 8, 2026
Merged

ctawiah merged 2 commits into
mainfrom
ctawiah/sync-attachment-reconciliation

Conversation

@ctawiah

@ctawiah ctawiah commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Context

This layer connects tool and skill attachments to the prompt sync lifecycle. A synchronized variation can now reference local tool and skill files, compare them with LaunchDarkly, and update both sides without treating version numbers as content changes.

What changes

  • Stores tools as JSON files and skills as Markdown files with frontmatter.
  • Compiles referenced attachment files into the variation that owns them.
  • Fetches the latest tool and skill versions when bootstrapping or planning a sync.
  • Fingerprints canonical attachment content while keeping runtime version pins out of the fingerprint.
  • Creates or versions an attachment before updating the variation to use the returned version.
  • Records tools and skills in the manifest so later syncs have a stable baseline.
  • Groups conflicts for attachments shared by more than one variation.
  • Writes local attachment and variation changes as one transaction so a partial failure does not leave the workspace inconsistent.
  • Includes attachment files in bootstrap and detach behavior.

A synchronized workspace now uses this layout:

.launchdarkly/<project>/
  configs/<config>/<variation>.prompt.md
  tools/<tool-key>.json
  skills/<skill-key>.md

Review focus

  • Are attachment fingerprints stable across local and server round trips?
  • Is the update order safe when an attachment must be created or versioned before a variation can reference it?
  • Are exact server version pins refreshed without becoming part of the canonical content fingerprint?
  • Do shared attachment conflicts produce one consistent decision for every variation that references them?
  • Are local writes and rollbacks safe when several files are updated together?

Verification

  • go test ./internal/sync/...
  • go test ./cmd/sync
  • go test ./...
  • git diff --check

Related changes

Review the stack in this order:

  1. Confirm destructive watch actions
  2. Guarantee prompt fingerprint convergence
  3. Add searchable attachment API foundations
  4. Reconcile variation attachments
  5. Attach tools and skills to variations
  6. Render attachment-aware review output
  7. Safely clean unreferenced attachments
  8. Persist sync manifests in LaunchDarkly

Note

Overview
Adds tool and skill attachments to the prompt sync workflow so variations can reference shared tools/*.json and skills/*.md files under .launchdarkly/<project>/, compile them into sync payloads, and round-trip them with LaunchDarkly.

Local workspace: Wrappers gain tools / skills refs; compile hydrates attachment content, rejects symlinks on managed paths, and writes variations plus dependencies in one staged transaction (existing shared tool files are preserved; upsert on tools is kept across server pulls). Bootstrap fetches attachment bodies from the API and records manifest fingerprints from compiled disk state, with rollback of only files created in that operation.

Sync planning & execution: Variation create/update API payloads include attachment refs. Fingerprints hash canonical attachment content (not runtime version pins). The manifest tracks tool/skill baselines separately and prunes unreferenced entries on detach/sync. Prompt sync resolves each attachment once (create with local upsert, version on change, then pin versions on the variation), blocks execution while any conflict remains, groups conflicts when multiple variations share a changed dependency, and can refresh stale server pins after pulling LaunchDarkly content locally.

Reviewed by Cursor Bugbot for commit 5b3e174. Bugbot is set up for automated code reviews on this repo. Configure here.

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

Stale Bugbot comment from a previous run.

Comment thread internal/sync/bootstrap/bootstrap.go
Comment thread internal/sync/local/attachment.go
Comment thread internal/sync/prompt/plan.go
Comment thread internal/sync/fingerprint.go
@ctawiah
ctawiah force-pushed the ctawiah/sync-attachment-reconciliation branch 2 times, most recently from 8a9a250 to 0cde3fe Compare October 7, 2026 15:44

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

Stale Bugbot comment from a previous run.

Comment thread internal/sync/local/render.go
Base automatically changed from ctawiah/sync-attachment-foundation to main October 7, 2026 23:37
@ctawiah
ctawiah force-pushed the ctawiah/sync-attachment-reconciliation branch from 0cde3fe to c0fe431 Compare October 7, 2026 23:45

@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 c0fe431. Configure here.

Comment thread internal/sync/prompt/execute.go Outdated
Comment thread internal/sync/prompt/local_changes.go
@ctawiah
ctawiah merged commit a112461 into main Oct 8, 2026
10 checks passed
@ctawiah
ctawiah deleted the ctawiah/sync-attachment-reconciliation branch October 8, 2026 00:02
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.

2 participants