Skip to content

fix(linear): idempotent createLabel — fall back to existing on duplicate#1165

Merged
zbigniewsobiecki merged 1 commit intomainfrom
dev
Apr 23, 2026
Merged

fix(linear): idempotent createLabel — fall back to existing on duplicate#1165
zbigniewsobiecki merged 1 commit intomainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • createLabel now catches Linear's duplicate label name GraphQL error, fetches team labels, and returns the existing one by name — making per-slot create and bulk "Create all" safe to retry without 500s.
  • 4 new unit tests cover the happy path, duplicate fallback, fallback-not-found, and non-duplicate error passthrough.

Root cause

Linear rejects issueLabelCreate with a GraphQL error (duplicate label name) when a label with the same name already exists in the team. The server was bubbling this as INTERNAL_SERVER_ERROR 500 to the dashboard.

Test plan

  • tests/unit/linear/client.test.ts — 15 tests all pass
  • pnpm typecheck clean
  • Pre-push hook passes

🤖 Generated with Claude Code

Linear returns a GraphQL error "duplicate label name" when a label with
the same name already exists in a team. Previously this surfaced as a
500 to the dashboard user. Now createLabel catches that specific error,
fetches the team's labels, and returns the existing one by name —
making the operation idempotent and the PM-wizard bulk-create banner
safe to retry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit 0e718f4 into main Apr 23, 2026
13 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/linear/client.ts 89.47% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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