Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(kb): simplify tag slot reuse, revert Linear GraphQL types to String
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>
  • Loading branch information
waleedlatif1 and claude committed Apr 4, 2026
commit 27f9c6f0d736c81a30fbbfaae02b7bb98e9de952
7 changes: 3 additions & 4 deletions apps/sim/app/api/knowledge/[id]/connectors/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
}

const tagSlotMapping: Record<string, string> = {}
const newTagSlotMapping: Record<string, string> = {}
let newTagSlots: Record<string, string> = {}

if (connectorConfig.tagDefinitions?.length) {
const disabledIds = new Set((sourceConfig.disabledTagIds as string[] | undefined) ?? [])
Expand All @@ -168,7 +168,6 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
const usedSlots = new Set<string>(existingDefs.map((d) => d.tagSlot))
const existingByName = new Map(existingDefs.map((d) => [d.displayName, d.tagSlot]))

/** Reuse existing tag definitions that match by display name */
const defsNeedingSlots: typeof enabledDefs = []
for (const td of enabledDefs) {
const existingSlot = existingByName.get(td.displayName)
Expand All @@ -181,7 +180,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{

const { mapping, skipped: skippedTags } = allocateTagSlots(defsNeedingSlots, usedSlots)
Object.assign(tagSlotMapping, mapping)
Object.assign(newTagSlotMapping, mapping)
newTagSlots = mapping

for (const name of skippedTags) {
logger.warn(`[${requestId}] No available slots for "${name}"`)
Expand Down Expand Up @@ -215,7 +214,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
throw new Error('Knowledge base not found')
}

for (const [semanticId, slot] of Object.entries(newTagSlotMapping)) {
for (const [semanticId, slot] of Object.entries(newTagSlots)) {
const td = connectorConfig.tagDefinitions!.find((d) => d.id === semanticId)!
await createTagDefinition(
{
Expand Down
6 changes: 3 additions & 3 deletions apps/sim/connectors/linear/linear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const ISSUE_FIELDS = `
`

const ISSUE_BY_ID_QUERY = `
query GetIssue($id: ID!) {
query GetIssue($id: String!) {
issue(id: $id) {
${ISSUE_FIELDS}
}
Expand Down Expand Up @@ -147,13 +147,13 @@ function buildIssuesQuery(sourceConfig: Record<string, unknown>): {
const variables: Record<string, unknown> = {}

if (teamId) {
varDefs.push('$teamId: ID!')
varDefs.push('$teamId: String!')
filterClauses.push('team: { id: { eq: $teamId } }')
variables.teamId = teamId
}

if (projectId) {
varDefs.push('$projectId: ID!')
varDefs.push('$projectId: String!')
filterClauses.push('project: { id: { eq: $projectId } }')
variables.projectId = projectId
}
Expand Down