Skip to content

fix(kb): fix Linear connector GraphQL type errors and tag slot reuse#3961

Merged
waleedlatif1 merged 5 commits intostagingfrom
cherry/fix-linear-connector
Apr 4, 2026
Merged

fix(kb): fix Linear connector GraphQL type errors and tag slot reuse#3961
waleedlatif1 merged 5 commits intostagingfrom
cherry/fix-linear-connector

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Re-land of #3919 — cherry-picked onto clean staging after accidental branch deletion.

waleedlatif1 and others added 5 commits April 4, 2026 16:48
Clean up newTagSlotMapping into direct assignment, remove unnecessary
comment, and revert ID! back to String! to match Linear SDK types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add fieldType check to the tag slot reuse logic so a connector with
a matching displayName but different fieldType falls through to fresh
slot allocation instead of silently reusing an incompatible slot.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 4, 2026

PR Summary

Medium Risk
Moderate risk: changes how tag definitions are allocated/created during connector setup and adjusts Linear GraphQL query variable types, which could affect connector creation and syncing behavior if mismatched with existing data.

Overview
Improves knowledge-base connector creation to reuse existing tag slots when a tag definition with the same displayName and fieldType already exists, and only creates new knowledgeBaseTagDefinitions for newly allocated slots (instead of re-creating all mapped tags).

Makes the add-connector selector UI searchable by enabling Combobox search with a contextual placeholder.

Fixes Linear connector GraphQL variable typings by switching issue/team/project IDs from String! to ID! in queries to avoid type errors when filtering or fetching issues.

Reviewed by Cursor Bugbot for commit 3f13cb3. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 4, 2026 11:49pm

Request Review

@waleedlatif1 waleedlatif1 merged commit a70ccdd into staging Apr 4, 2026
7 checks passed
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 4, 2026

Greptile Summary

This PR fixes two bugs in the Linear knowledge base connector and adds a UX improvement to the connector setup UI.

  • Linear GraphQL types: Corrects scalar types for entity ID variables in GraphQL queries from String! to ID! (affects the GetIssue query and the dynamic issues-list query's $teamId/$projectId variables), matching what Linear's API schema expects
  • Tag slot reuse: When a connector is added to a knowledge base that already has matching tag definitions (same displayName + fieldType), existing tag slots are now reused rather than attempting to allocate new ones. The createTagDefinition DB call is correctly scoped to only newly-allocated slots (newTagSlots), not reused ones, preventing duplicate inserts on re-add
  • Searchable selector: The connector configuration Combobox now supports text search via the new searchable and searchPlaceholder props, improving usability when a team/project list is long

Confidence Score: 5/5

PR is safe to merge; all three changes are targeted bug fixes and a small UX improvement with no regressions

All changes are precise and well-scoped: the GraphQL type corrections match the Linear API schema, the tag slot reuse logic correctly avoids duplicate DB inserts by scoping createTagDefinition calls to only newTagSlots, and the searchable combobox is a non-breaking UI addition. No P0 or P1 issues found.

No files require special attention

Important Files Changed

Filename Overview
apps/sim/connectors/linear/linear.ts Fixes GraphQL scalar types for Linear entity IDs from String! to ID! in GetIssue query and buildIssuesQuery team/project variable definitions
apps/sim/app/api/knowledge/[id]/connectors/route.ts Adds tag slot reuse logic matching by displayName+fieldType so existing slots are reused; createTagDefinition is correctly scoped to only newTagSlots, preventing duplicate DB inserts on re-add
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-connector-modal/components/connector-selector-field.tsx Adds searchable and searchPlaceholder props to Combobox for improved UX when browsing large team/project option lists

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[POST /connectors] --> B{connector has\ntagDefinitions?}
    B -- No --> C[Skip tag slot logic]
    B -- Yes --> D[Query existing tag\ndefinitions from DB]
    D --> E[Build existingByName Map\nkeyed by displayName]
    E --> F[For each enabledDef]
    F --> G{Match by displayName\n+ fieldType?}
    G -- Yes --> H[Reuse existing slot\ntagSlotMapping id = existingSlot]
    G -- No --> I[Add to defsNeedingSlots]
    H --> J[Continue to next def]
    I --> K[allocateTagSlots\ndefsNeedingSlots, usedSlots]
    K --> L[newTagSlots = mapping]
    L --> M[Merge newTagSlots\ninto tagSlotMapping]
    M --> N{skippedTags present AND\ntagSlotMapping empty?}
    N -- Yes --> O[Return 422 error]
    N -- No --> P[DB transaction]
    P --> Q[For each entry in newTagSlots:\ncreateTagDefinition]
    Q --> R[Insert knowledgeConnector row]
    R --> S[Return 201 Created]
    J --> F
Loading

Reviews (1): Last reviewed commit: "fix(kb): enable search on connector sele..." | Re-trigger Greptile

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