Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(sync): refuse to link an archived variation and print Linked only when kept (AIC-4038) - #1060

Draft
nkester-ld wants to merge 2 commits into
mainfrom
AIC-4038/nkester/archived-link
Draft

nkester-ld wants to merge 2 commits into
mainfrom
AIC-4038/nkester/archived-link

Conversation

@nkester-ld

@nkester-ld nkester-ld commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Human

The bug

After detach --archive, linking the same source again with --upsert tried to create a variation with the archived key. LaunchDarkly rejected it with a 409 "variation key already exists" and a hint to retry that could never work, and ldcli still printed "Linked". Now sync sees that the key is archived and refuses before writing anything, and it prints "Linked" only once the link is kept.

Failure and reason for change

  • What failed: stage test EXP-8, 2026-11-25: detach --archive typescript-bot, then link the same source with --upsert. The create got 409 "variation key already exists" with a retry hint, and the output still said "Linked".
  • Why this changes it: we refuse clearly and never restore an archived variation for you.

Why

Ticket: AIC-4038. This is one of six independent PRs from that stage run, not a stack; it can merge on its own.

Describe the solution you've provided

Before:

$ ldcli sync prompts link … --key typescript-bot --upsert --yes
… variation key already exists … retry
Linked .launchdarkly/…/typescript-bot.ref.yaml.

After:

variation production/support/default: this variation is archived in LaunchDarkly. Restore it in LaunchDarkly, or use a different variation key.
  • Sync sends no create and writes no descriptor.
  • A .prompt.md with upsert: true and an archived key gets the same refusal.
  • "Linked" now prints after the apply, so a link that's rolled back never claims it worked.

Review focus

  • The archived check only applies to rows that would create, so an existing variation is unaffected → planResource.
  • "Linked" moved to the end of runWorkspaceSyncWithSource. It still prints when the variation synced but a later step, such as the lock write, failed, because the descriptor is kept then.

Testing

go test ./internal/sync/... ./cmd/sync/... passes.

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

🤖 Generated with Claude Code


Related Jira issue: AIC-4038: Fix medium sync bugs found in stage testing

nkester-ld and others added 2 commits November 25, 2026 08:49
… only after the link is kept

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…riation once

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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