Skip to content

feat(sync): add source descriptor storage - #993

Merged
ctawiah merged 1 commit into
mainfrom
ctawiah/sync-descriptor-storage-3bbf
Nov 9, 2026
Merged

ctawiah merged 1 commit into
mainfrom
ctawiah/sync-descriptor-storage-3bbf

Conversation

@ctawiah

@ctawiah ctawiah commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Context

A linked resource needs an editable descriptor with a known path and strict validation.

What changes

  • Add the .ref.yaml path for variations, tools, and skills.
  • Read, validate, render, create, and replace descriptors atomically.
  • Validate repository-relative source paths and reject symbolic links that leave the repository.
  • Reject a descriptor when the resource has a managed file.

Design notes

  • The descriptor path owns the identity. The file repeats no project, config, or key.
  • The relationship lists are content, not mapping, so they are not part of the descriptor digest.

Review focus

  • Can a descriptor name a file outside the repository?
  • Can one resource have two local definitions?

Verification

  • make build
  • go test ./...
  • golangci-lint run ./...

Related changes

  1. refactor(sync): remove Phase 1 source references #1005: Phase 1 reference removal
  2. feat(sync): add projection and problem core #987: projection and problem core
  3. feat(sync): add the adapter core and the Markdown adapter #988: adapter core and Markdown
  4. feat(sync): add the structured document adapters #989: structured adapters
  5. feat(sync): add the Python adapter #991: Python adapter
  6. feat(sync): add the TypeScript and JavaScript adapters #992: TypeScript and JavaScript adapters
  7. This PR: descriptor storage
  8. feat(sync): compile and publish repository sources #994: compile and publish
  9. feat(sync): detach descriptor-backed sources #1003: descriptor detach
  10. feat(sync): prepare repository source links #997: link preparation
  11. feat(sync): integrate repository sources with planning and link #995: planning and link
  12. feat(sync): add the link commands #998: link commands

🤖 Generated with Claude Code


Note

Overview
Adds .ref.yaml descriptors under .launchdarkly for variations, tools, and skills, with path helpers (ReferencePath, ParseReferencePath) alongside existing managed-file layout.

Descriptor I/O lives in new reference.go: validate and normalize references, read/render YAML atomically (WriteDescriptor, WriteDescriptorFrom, RestoreDescriptor), and resolve external sources with repo-boundary checks (symlink escape, paths outside .launchdarkly). Generated/vendored/minified sources are rejected via new generated.go and enforced when linking and reading sources.

Single-definition rule: create, replace, delete, and existence checks now treat a resource as either a managed file or a descriptor—coexisting both is a definitionConflict. Symbolic links at managed paths are ignored as definitions but can be removed/replaced; DeleteDefinitions removes descriptors (not linked repo files) and handles leftover links. Replace transactions can verify linked source paths still resolve to the same file.

Detach test now simulates a failed delete with a named pipe instead of a symlink.

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

@ctawiah
ctawiah added this pull request to stack #1000 October 30, 2026 20:15
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch 2 times, most recently from 98da134 to 3fd2b94 Compare November 2, 2026 02:26
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 3fd2b94 to c9d8b35 Compare November 3, 2026 00:29
@ctawiah
ctawiah removed this pull request from stack #1000 November 3, 2026 00:32
@ctawiah
ctawiah added this pull request to stack #1004 November 3, 2026 00:34
@ctawiah
ctawiah removed this pull request from stack #1004 November 3, 2026 00:53
@ctawiah
ctawiah added this pull request to stack #1006 November 3, 2026 00:53
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from c9d8b35 to 4464be8 Compare November 4, 2026 19:46
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch 2 times, most recently from a24d059 to 9228e3e Compare November 4, 2026 22:26
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 9228e3e to 8bb59bf Compare November 4, 2026 22:52
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 319a73d to ef88797 Compare November 6, 2026 16:14

@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/reference.go Resolved
Comment thread internal/sync/local/layout.go Resolved
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from ef88797 to 953557e Compare November 6, 2026 16:47
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 953557e to ecb9fd2 Compare November 6, 2026 17:12
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from ecb9fd2 to 326ee8c Compare November 6, 2026 17:39
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 326ee8c to a91a72c Compare November 6, 2026 18:02
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from a91a72c to 9427354 Compare November 6, 2026 18:30
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 9427354 to 3475403 Compare November 6, 2026 19:08
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from 3475403 to efdc8ed Compare November 6, 2026 19:51
@ctawiah
ctawiah force-pushed the ctawiah/sync-descriptor-storage-3bbf branch from efdc8ed to 1ae2be1 Compare November 6, 2026 20:19

@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/replace.go Resolved

@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/replace.go Resolved

@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/replace.go Resolved

@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/reference.go Resolved

@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/store.go Resolved

@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/generated.go Resolved
Comment thread internal/sync/local/generated.go Resolved

@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/create.go Resolved

@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/delete.go Resolved
Add the .ref.yaml descriptor: its path for each resource kind, its validation, and its atomic create and replace. A resource has one managed file or one descriptor, never both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@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 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit dce4240. Configure here.

switch {
case err == nil:
return true, nil
return info.Mode()&os.ModeSymlink == 0, nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Existence checks break descriptor deletes

High Severity

VariationExists and ResourceExists now return true for a .ref.yaml descriptor and false for a leftover managed-path symlink, but detach and local-delete still call DeleteResources, which only removes the managed file. A descriptor-only variation therefore fails detach as missing, and a leftover variation symlink is left behind where compile still rejects it. DeleteDefinitions handles both cases and is unused.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit dce4240. Configure here.

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