🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(linear): option to sync issue labels onto tasks (#22392)
Rdmclin25c357c14a458
diff --git a/apps/server/src/routers/lambda/__tests__/linear.test.ts b/apps/server/src/routers/lambda/__tests__/linear.test.tsindex a7ea24ba1e4..fd2b21e1abd 100644--- a/apps/server/src/routers/lambda/__tests__/linear.test.ts+++ b/apps/server/src/routers/lambda/__tests__/linear.test.ts@@ -1035,6 +1035,39 @@ describe('linearRouter', () => {);});+ it('brings labels along on a rule run only when that run asks for them', async () => {+ const connection = await connect({ userId });+ mocks.getToken.mockResolvedValue('token');+ mocks.runSync.mockResolvedValue({ ok: true });+ mocks.syncByFilter.mockResolvedValue(syncResult);+ const rule = await caller({ userId }).createSyncRule({+ connectionId: connection.id,+ projectId,+ stateTypes: ['completed'],+ teamId: 'team-1',+ teamName: 'Engineering',+ });++ const plain = await caller({ userId }).startRuleSync({ ruleId: rule.id });+ await new LinearSyncJobService(serverDB, userId).run(plain.id);+ expect(mocks.syncByFilter).toHaveBeenLastCalledWith(+ 'token',+ expect.anything(),+ expect.objectContaining({ syncLabels: undefined }),+ );++ const labelled = await caller({ userId }).startRuleSync({+ ruleId: rule.id,+ syncLabels: true,+ });+ await new LinearSyncJobService(serverDB, userId).run(labelled.id);+ expect(mocks.syncByFilter).toHaveBeenLastCalledWith(+ 'token',+ expect.anything(),+ expect.objectContaining({ syncLabels: true }),+ );+ });+it('leaves archived issues out of a rule run unless that run asks for them', async () => {const connection = await connect({ userId });mocks.getToken.mockResolvedValue('token');diff --git a/apps/server/src/routers/lambda/linear.ts b/apps/server/src/routers/lambda/linear.tsindex 0220d447ab3..d0841bbda07 100644--- a/apps/server/src/routers/lambda/linear.ts+++ b/apps/server/src/routers/lambda/linear.ts@@ -169,6 +169,8 @@ export const linearRouter = router({issueIds: z.array(z.string().min(1)).min(1).max(MAX_IMPORT_ISSUES),/** Also copy each issue's Linear comments onto its task. */syncComments: z.boolean().optional(),+ /** Also bring each issue's Linear labels onto its task, creating the missing ones. */+ syncLabels: z.boolean().optional(),}),).mutation(async ({ ctx, input }) => {@@ -182,6 +184,7 @@ export const linearRouter = router({kind: 'issues',projectId: input.projectId,syncComments: input.syncComments || undefined,+ syncLabels: input.syncLabels || undefined,});return { id };}),@@ -273,6 +276,8 @@ export const linearRouter = router({ruleId: z.string().uuid(),/** Also copy each issue's Linear comments onto its task. */syncComments: z.boolean().optional(),+ /** Also bring each issue's Linear labels onto its task, creating the missing ones. */+ syncLabels: z.boolean().optional(),}),).mutation(async ({ ctx, input }) => {@@ -296,6 +301,7 @@ export const linearRouter = router({projectId: rule.projectId,ruleId: rule.id,syncComments: input.syncComments || undefined,+ syncLabels: input.syncLabels || undefined,},);return { id };diff --git a/apps/server/src/routers/lambda/taskLabel.ts b/apps/server/src/routers/lambda/taskLabel.tsindex 3bffdec9258..bdf525cd875 100644--- a/apps/server/src/routers/lambda/taskLabel.ts+++ b/apps/server/src/routers/lambda/taskLabel.ts@@ -1,4 +1,4 @@-import { TASK_LABEL_NAME_MAX_LENGTH } from '@lobechat/types';+import { TASK_LABEL_COLOR_PATTERN, TASK_LABEL_NAME_MAX_LENGTH } from '@lobechat/types';import { TRPCError } from '@trpc/server';import { z } from 'zod';@@ -16,9 +16,7 @@ import { resolveTaskOrThrow } from '@/server/services/task/utils';* every member who sees the shared label fetch an attacker resource).* Constrain it to a hex literal wherever it can be written.*/-const hexColor = z- .string()- .regex(/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i, 'INVALID_LABEL_COLOR');+const hexColor = z.string().regex(TASK_LABEL_COLOR_PATTERN, 'INVALID_LABEL_COLOR');const labelName = z.string().trim().min(1).max(TASK_LABEL_NAME_MAX_LENGTH);const labelIds = z.array(z.string().min(1).max(64)).max(50);diff --git a/apps/server/src/services/linear/__tests__/issueSync.labels.integration.test.ts b/apps/server/src/services/linear/__tests__/issueSync.labels.integration.test.tsnew file mode 100644index 00000000000..45fa3af7b74--- /dev/null+++ b/apps/server/src/services/linear/__tests__/issueSync.labels.integration.test.ts@@ -0,0 +1,336 @@+// @vitest-environment node+import { type LobeChatDatabase } from '@lobechat/database';+import { getTestDB } from '@lobechat/database/test-utils';+import { eq } from 'drizzle-orm';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';++import { TaskModel } from '@/database/models/task';+import { TaskExternalLinkModel } from '@/database/models/taskExternalLink';+import { TaskLabelModel } from '@/database/models/taskLabel';+import { users } from '@/database/schemas';++import type * as IssuesModule from '../issues';+import type { LinearIssue } from '../issues';+import { LinearIssueSyncService } from '../issueSync';++const linear = vi.hoisted(() => ({+ getLinearIssuesByIds: vi.fn(),+ getLinearProjectTeamIds: vi.fn(),+ listLinearIssueComments: vi.fn(),+ listLinearIssues: vi.fn(),+}));+vi.mock('../issues', async (importOriginal) => ({+ ...(await importOriginal<typeof IssuesModule>()),+ getLinearIssuesByIds: linear.getLinearIssuesByIds,+ getLinearProjectTeamIds: linear.getLinearProjectTeamIds,+ listLinearIssueComments: linear.listLinearIssueComments,+ listLinearIssues: linear.listLinearIssues,+}));++const userId = 'linear-issue-sync-labels-user';+const otherUserId = 'linear-issue-sync-labels-other';+const TOKEN = 'token';+const TEAM = 'team-1';++// Module-level: the first call migrates a fresh database.+const db: LobeChatDatabase = await getTestDB();++const issue = (overrides: Partial<LinearIssue> & { id: string }): LinearIssue => ({+ description: `Body of ${overrides.id}`,+ identifier: `ENG-${overrides.id}`,+ priority: 2,+ state: { name: 'Todo', type: 'unstarted' },+ team: { id: TEAM, key: 'ENG' },+ title: `Issue ${overrides.id}`,+ updatedAt: '2026-10-01T00:00:00.000Z',+ url: `https://linear.app/acme/issue/ENG-${overrides.id}`,+ ...overrides,+});++/** Serve the given issues to both the filtered listing and the by-id lookup. */+const serve = (issues: LinearIssue[]) => {+ linear.listLinearIssues.mockImplementation(async () => ({ hasMore: false, issues }));+ linear.getLinearIssuesByIds.mockImplementation(async (_token: string, ids: string[]) =>+ issues.filter((item) => ids.includes(item.id)),+ );+};++const filter = { stateTypes: ['backlog', 'unstarted', 'started'] as const, teamId: TEAM };++const linkedTask = async (externalId: string, scopeUserId = userId) => {+ const [link] = await new TaskExternalLinkModel(db, scopeUserId).findByExternalIds('linear', [+ externalId,+ ]);+ return link ? new TaskModel(db, scopeUserId).findById(link.taskId) : null;+};++beforeEach(async () => {+ vi.clearAllMocks();+ await db.delete(users).where(eq(users.id, userId));+ await db.delete(users).where(eq(users.id, otherUserId));+ await db.insert(users).values([{ id: userId }, { id: otherUserId }]);+});++afterEach(async () => {+ vi.restoreAllMocks();+ await db.delete(users).where(eq(users.id, userId));+ await db.delete(users).where(eq(users.id, otherUserId));+});++describe('LinearIssueSyncService labels (real PostgreSQL)', () => {+ const labels = (+ ...nodes: { color?: string; name: string; parent?: { color?: string; name: string } }[]+ ) => ({ labels: { nodes } });+ const rule = { ...filter, stateTypes: [...filter.stateTypes] };+ const syncLabels = { syncLabels: true };++ const taskLabelNames = async (externalId: string) => {+ const task = await linkedTask(externalId);+ const rows = await new TaskLabelModel(db, userId).getTaskLabels(task!.id);+ return rows.map((label) => label.name).sort();+ };++ it('leaves labels alone unless the run asks for them', async () => {+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) })]);++ await new LinearIssueSyncService(db, userId).syncByFilter(TOKEN, rule);++ expect(await taskLabelNames('1')).toEqual([]);+ expect(await new TaskLabelModel(db, userId).query()).toEqual([]);+ });++ it('creates missing labels with their color and reuses one that exists', async () => {+ const model = new TaskLabelModel(db, userId);+ const existing = await model.create({ color: '#111111', name: 'bug' });+ serve([+ issue({+ id: '1',+ ...labels({ color: '#EB5757', name: 'Bug' }, { color: '#4CB782', name: 'Backend' }),+ }),+ issue({ id: '2', ...labels({ color: '#4CB782', name: 'Backend' }) }),+ ]);++ const result = await new LinearIssueSyncService(db, userId).syncByFilter(+ TOKEN,+ rule,+ syncLabels,+ );++ expect(result).toMatchObject({ created: 2, labelsSynced: 2, skippedCount: 0 });+ expect(await taskLabelNames('1')).toEqual(['Backend', 'bug']);+ expect(await taskLabelNames('2')).toEqual(['Backend']);+ const registry = await model.query();+ expect(registry).toHaveLength(2);+ expect(registry.find((label) => label.id === existing.id)?.color).toBe('#111111');+ expect(registry.find((label) => label.name === 'Backend')?.color).toBe('#4CB782');+ });++ it("mirrors a Linear label group and drops a color that isn't a hex literal", async () => {+ serve([+ issue({+ id: '1',+ ...labels({+ color: 'url(https://evil.example/x)',+ name: 'Bug',+ parent: { color: '#5E6AD2', name: 'Type' },+ }),+ }),+ ]);++ await new LinearIssueSyncService(db, userId).syncByFilter(TOKEN, rule, syncLabels);++ const registry = await new TaskLabelModel(db, userId).query();+ const group = registry.find((label) => label.name === 'Type');+ expect(group).toMatchObject({ color: '#5E6AD2', isGroup: true });+ expect(registry.find((label) => label.name === 'Bug')).toMatchObject({+ color: null,+ isGroup: false,+ parentId: group?.id,+ });+ expect(await taskLabelNames('1')).toEqual(['Bug']);+ });++ it('follows changes in Linear and keeps changes made on the task', async () => {+ const service = new LinearIssueSyncService(db, userId);+ const model = new TaskLabelModel(db, userId);+ serve([issue({ id: '1', ...labels({ name: 'A' }, { name: 'B' }) })]);+ await service.syncByFilter(TOKEN, rule, syncLabels);++ // On the task: B taken off, and a label of its own added.+ const task = await linkedTask('1');+ const [mine] = await model.findOrCreateMany([{ name: 'Mine' }]);+ const [b] = await model.findByNames(['B']);+ await model.changeTaskLabels(task!.id, { add: [mine.id], remove: [b.id] });++ // In Linear: A removed, C added, B untouched.+ serve([+ issue({+ id: '1',+ updatedAt: '2026-10-02T00:00:00.000Z',+ ...labels({ name: 'B' }, { name: 'C' }),+ }),+ ]);+ await service.syncByFilter(TOKEN, rule, syncLabels);++ expect(await taskLabelNames('1')).toEqual(['C', 'Mine']);+ // The label itself stays for other tasks; only this task lost it.+ expect((await model.findByNames(['A'])).map((label) => label.name)).toEqual(['A']);+ });++ it('labels tasks synced before, and does not write again when nothing changed', async () => {+ const service = new LinearIssueSyncService(db, userId);+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) })]);+ await service.syncByFilter(TOKEN, rule);+ expect(await taskLabelNames('1')).toEqual([]);++ await service.syncByFilter(TOKEN, rule, syncLabels);+ expect(await taskLabelNames('1')).toEqual(['Bug']);++ // Still known after a display refresh, which replaces the rest of the metadata.+ serve([issue({ id: '1', updatedAt: '2026-10-02T00:00:00.000Z', ...labels({ name: 'Bug' }) })]);+ await service.syncByFilter(TOKEN, rule);+ const task = await linkedTask('1');+ const model = new TaskLabelModel(db, userId);+ const [bug] = await model.findByNames(['Bug']);+ await model.removeTaskLabels(task!.id, [bug.id]);++ await service.syncByFilter(TOKEN, rule, syncLabels);+ expect(await taskLabelNames('1')).toEqual([]);+ });++ it('attaches one label per group when the registry groups two of an issue together', async () => {+ const model = new TaskLabelModel(db, userId);+ const group = await model.create({ isGroup: true, name: 'Kind' });+ await model.create({ name: 'Bug', parentId: group.id });+ await model.create({ name: 'Feature', parentId: group.id });+ serve([issue({ id: '1', ...labels({ name: 'Bug' }, { name: 'Feature' }) })]);++ const result = await new LinearIssueSyncService(db, userId).syncByFilter(+ TOKEN,+ rule,+ syncLabels,+ );++ expect(result.skippedCount).toBe(0);+ expect(await taskLabelNames('1')).toEqual(['Bug']);+ });++ it('skips a name the registry holds as a group, keeping the other labels', async () => {+ await new TaskLabelModel(db, userId).create({ isGroup: true, name: 'Bug' });+ serve([issue({ id: '1', ...labels({ name: 'Bug' }, { name: 'Backend' }) })]);++ const result = await new LinearIssueSyncService(db, userId).syncByFilter(+ TOKEN,+ rule,+ syncLabels,+ );++ expect(result.skippedCount).toBe(0);+ expect(await taskLabelNames('1')).toEqual(['Backend']);+ });++ it('does not count a task none of whose labels could be attached', async () => {+ await new TaskLabelModel(db, userId).create({ isGroup: true, name: 'Bug' });+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) })]);++ const result = await new LinearIssueSyncService(db, userId).syncByFilter(+ TOKEN,+ rule,+ syncLabels,+ );++ expect(result.labelsSynced).toBeUndefined();+ });++ it('reads the same name when cutting a long one leaves a space at the end', async () => {+ const name = `${'a'.repeat(63)} tail`;+ serve([issue({ id: '1', ...labels({ name }) })]);++ await new LinearIssueSyncService(db, userId).syncByFilter(TOKEN, rule, syncLabels);++ expect(await taskLabelNames('1')).toEqual(['a'.repeat(63)]);+ });++ it('counts the tasks whose labels changed, and none when nothing did', async () => {+ const service = new LinearIssueSyncService(db, userId);+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) }), issue({ id: '2' })]);+ await service.syncByFilter(TOKEN, rule);++ const first = await service.syncByFilter(TOKEN, rule, syncLabels);+ expect(first.labelsSynced).toBe(1);++ const second = await service.syncByFilter(TOKEN, rule, syncLabels);+ expect(second.labelsSynced).toBeUndefined();+ });++ it('works the change out from what is recorded now, not from an older read', async () => {+ const service = new LinearIssueSyncService(db, userId);+ serve([issue({ id: '1', ...labels({ name: 'A' }) })]);+ await service.syncByFilter(TOKEN, rule, syncLabels);+ // Another run moved the task on from A to C after this run read the link.+ serve([issue({ id: '1', ...labels({ name: 'C' }) })]);+ await service.syncByFilter(TOKEN, rule, syncLabels);++ // Stale only outside a transaction: the batch is old, the read under the lock is not.+ const read = TaskExternalLinkModel.prototype.findByExternalIds;+ const stale = vi+ .spyOn(TaskExternalLinkModel.prototype, 'findByExternalIds')+ .mockImplementation(async function (this: TaskExternalLinkModel, provider, ids) {+ const rows = await read.call(this, provider, ids);+ if ((this as unknown as { db: unknown }).db !== db) return rows;+ return rows.map((row) => ({ ...row, metadata: { ...row.metadata, syncedLabels: ['a'] } }));+ });+ serve([issue({ id: '1', ...labels({ name: 'B' }) })]);+ await service.syncByFilter(TOKEN, rule, syncLabels);+ stale.mockRestore();++ expect(await taskLabelNames('1')).toEqual(['B']);+ });++ it('imports picked issues with their labels', async () => {+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) })]);++ await new LinearIssueSyncService(db, userId).importIssues(TOKEN, ['1'], syncLabels);++ expect(await taskLabelNames('1')).toEqual(['Bug']);+ });++ it('labels the task of a linked issue Linear closed since', async () => {+ const service = new LinearIssueSyncService(db, userId);+ serve([issue({ id: '1' })]);+ await service.syncByFilter(TOKEN, rule);++ linear.listLinearIssues.mockImplementation(async () => ({ hasMore: false, issues: [] }));+ linear.getLinearIssuesByIds.mockImplementation(async () => [+ issue({+ id: '1',+ state: { name: 'Done', type: 'completed' },+ ...labels({ name: 'Bug' }),+ }),+ ]);+ const result = await service.syncByFilter(TOKEN, rule, syncLabels);++ expect(result.closed).toBe(1);+ expect(await taskLabelNames('1')).toEqual(['Bug']);+ });++ it('reports a failed label write and retries it on the next run', async () => {+ const service = new LinearIssueSyncService(db, userId);+ serve([issue({ id: '1', ...labels({ name: 'Bug' }) })]);+ const record = vi+ .spyOn(TaskExternalLinkModel.prototype, 'recordSyncedLabels')+ .mockRejectedValueOnce(new Error('boom'));++ const failed = await service.syncByFilter(TOKEN, rule, syncLabels);++ expect(failed.created).toBe(1);+ expect(failed.skipped).toEqual([{ identifier: 'ENG-1', reason: 'labelsFailed' }]);+ // Rolled back with the record, so the retry is not mistaken for a label removed on the task.+ expect(await taskLabelNames('1')).toEqual([]);++ record.mockRestore();+ const retried = await service.syncByFilter(TOKEN, rule, syncLabels);+ expect(retried.skippedCount).toBe(0);+ expect(await taskLabelNames('1')).toEqual(['Bug']);+ });+});diff --git a/apps/server/src/services/linear/__tests__/issues.test.ts b/apps/server/src/services/linear/__tests__/issues.test.tsindex 0b5d7cb9d29..d052e25e587 100644--- a/apps/server/src/services/linear/__tests__/issues.test.ts+++ b/apps/server/src/services/linear/__tests__/issues.test.ts@@ -111,6 +111,18 @@ describe('archived issues', () => {});});+describe('issue labels', () => {+ it('reads each label with its color and group, which a sync needs to create it', async () => {+ fetchMock.mockImplementation(async () => reply(emptyIssues));++ await listLinearIssues('token', { stateTypes: ['completed'], teamId: 'team-pkg' });++ expect(requestBody(fetchMock.mock.calls[0]).query).toContain(+ 'nodes { name color parent { name color } }',+ );+ });+});+describe('getLinearProjectTeamIds', () => {it('reads every page of the teams a project belongs to', async () => {fetchMockdiff --git a/apps/server/src/services/linear/__tests__/syncJob.test.ts b/apps/server/src/services/linear/__tests__/syncJob.test.tsindex c42d9d457fa..fd368cf2e55 100644--- a/apps/server/src/services/linear/__tests__/syncJob.test.ts+++ b/apps/server/src/services/linear/__tests__/syncJob.test.ts@@ -127,6 +127,18 @@ describe('mergeLinearSyncResults', () => {).toMatchObject({ closed: 3, created: 100, skippedCount: 1, unchanged: 100 });});+ it('adds up tasks every round labeled, resumed or not', () => {+ expect(+ mergeLinearSyncResults(result({ labelsSynced: 4 }), result({ labelsSynced: 1 }), {+ resumed: false,+ }).labelsSynced,+ ).toBe(5);+ expect(+ mergeLinearSyncResults(result({ labelsSynced: 4 }), result({}), { resumed: true })+ .labelsSynced,+ ).toBe(4);+ });+it('adds up comments every round copied, resumed or not', () => {expect(mergeLinearSyncResults(result({ commentsImported: 4 }), result({ commentsImported: 1 }), {diff --git a/apps/server/src/services/linear/issueLabels.ts b/apps/server/src/services/linear/issueLabels.tsnew file mode 100644index 00000000000..416c374be45--- /dev/null+++ b/apps/server/src/services/linear/issueLabels.ts@@ -0,0 +1,40 @@+import { TASK_LABEL_COLOR_PATTERN, TASK_LABEL_NAME_MAX_LENGTH } from '@lobechat/types';++import type { LinearIssue } from './issues';++/** A Linear label as a task label: its name, color and the group it sits in. */+export interface LinearLabelSpec {+ color: string | null;+ group?: { color: string | null; name: string };+ /** Compares names the way the label registry does: trimmed and case-insensitive. */+ key: string;+ name: string;+}++const toLabelName = (name: string) => name.trim().slice(0, TASK_LABEL_NAME_MAX_LENGTH).trim();++/**+ * Label colors are rendered into an inline `background`, and this one comes from+ * outside, so anything but a hex literal is dropped like the router does.+ */+const toLabelColor = (color?: string | null) =>+ color && TASK_LABEL_COLOR_PATTERN.test(color) ? color : null;++export const linearLabelKey = (name: string) => toLabelName(name).toLowerCase();++/** The labels of an issue, once each. */+export const linearIssueLabels = (issue: LinearIssue): LinearLabelSpec[] => {+ const labels = new Map<string, LinearLabelSpec>();+ for (const { color, name, parent } of issue.labels?.nodes ?? []) {+ const key = linearLabelKey(name);+ if (!key || labels.has(key)) continue;+ const groupName = parent ? toLabelName(parent.name) : '';+ labels.set(key, {+ color: toLabelColor(color),+ group: groupName ? { color: toLabelColor(parent?.color), name: groupName } : undefined,+ key,+ name: toLabelName(name),+ });+ }+ return [...labels.values()];+};diff --git a/apps/server/src/services/linear/issueSync.ts b/apps/server/src/services/linear/issueSync.tsindex 0301ebb1e6c..c4d7816f573 100644--- a/apps/server/src/services/linear/issueSync.ts+++ b/apps/server/src/services/linear/issueSync.ts@@ -7,6 +7,7 @@ import type {LinearSyncResult,LinearSyncSkipReason,TaskItem,+ TaskLabel,} from '@lobechat/types';import { isLinearNoProject } from '@lobechat/types';import debug from 'debug';@@ -19,12 +20,14 @@ import {TaskExternalLinkModel,type TaskExternalLinkWithTask,} from '@/database/models/taskExternalLink';+import { TaskLabelModel } from '@/database/models/taskLabel';import type { LobeChatDatabase } from '@/database/type';import { TaskService } from '../task';import { findTasksInOpenGoals } from '../task/archiveGuard';import { LinearApiError } from './client';import { linearCommentToContent } from './issueComments';+import { linearIssueLabels, linearLabelKey, type LinearLabelSpec } from './issueLabels';import {getArchivedLinearIssuesByIds,getLinearIssuesByIds,@@ -218,7 +221,11 @@ export class LinearIssueSyncService {async importIssues(accessToken: string,issueIds: string[],- options: { syncComments?: boolean; targetProjectId?: string | null } = {},+ options: {+ syncComments?: boolean;+ syncLabels?: boolean;+ targetProjectId?: string | null;+ } = {},): Promise<LinearSyncResult> {const issues = await getLinearIssuesByIds(accessToken, issueIds);const result = emptyResult();@@ -240,6 +247,7 @@ export class LinearIssueSyncService {{ createClosed: true, targetProjectId: options.targetProjectId },result,);+ if (options.syncLabels) await this.syncLabels(issues, result);if (options.syncComments) {await this.syncComments(accessToken,@@ -263,7 +271,8 @@ export class LinearIssueSyncService {* created; an unimported issue only marks the result `truncated`.** With `syncComments`, the comments of every issue read are copied onto its- * task, so running again also fills in tasks imported without them.+ * task, so running again also fills in tasks imported without them. With+ * `syncLabels`, so are its labels.*/async syncByFilter(accessToken: string,@@ -272,6 +281,7 @@ export class LinearIssueSyncService {noCreate?: boolean;startAfter?: string;syncComments?: boolean;+ syncLabels?: boolean;targetProjectId?: string | null;} = {},): Promise<LinearFilterSyncResult> {@@ -314,6 +324,7 @@ export class LinearIssueSyncService {},result,);+ if (options.syncLabels) await this.syncLabels(issues, result);if (options.syncComments) {await this.syncComments(accessToken,@@ -368,6 +379,16 @@ export class LinearIssueSyncService {for (const issue of fetched) {if (CLOSED_STATE_TYPES.has(issue.state.type)) closing.push(issue.id);}+ if (options.syncLabels) {+ // Only those being closed: an open issue the filter misses is left to+ // the rule that lists it. Unlike comments, tasks already closed get no+ // catch-up, which would mean reading their issues again on every run.+ const closingIds = new Set(closing);+ await this.syncLabels(+ fetched.filter((issue) => closingIds.has(issue.id)),+ result,+ );+ }}// Issues archived since their task closed, which Linear also does on its// own after a while. A closed task is not reread above, and a run without@@ -825,6 +846,134 @@ export class LinearIssueSyncService {});}+ /**+ * Bring these issues' labels onto their tasks, creating the labels not in the+ * registry yet. Only what changed in Linear since the last sync is applied, so+ * labels a person added or removed on the task stay that way, except that a+ * grouped label Linear adds replaces its sibling, as attaching one always does.+ * A label already in the registry is reused as it is, whatever its color or group.+ * Only tasks the caller can see get labels. A failure skips the labels of the+ * tasks it reaches, reported `labelsFailed` and retried by the next run, while+ * the task writes of this run still count.+ */+ private async syncLabels(issues: LinearIssue[], result: LinearSyncResult): Promise<void> {+ if (issues.length === 0) return;+ const links = await this.visibleLinks(issues.map((issue) => issue.id));++ const changes = issues.flatMap((issue) => {+ const link = links.get(issue.id);+ if (!link) return [];+ const labels = linearIssueLabels(issue);+ const { added, removed } = labelDelta(labels, link.metadata?.syncedLabels);+ if (added.length === 0 && removed.length === 0) return [];+ return [{ added, labels, link }];+ });+ if (changes.length === 0) return;++ let registry: Map<string, TaskLabel>;+ try {+ registry = await this.ensureLabels(changes.flatMap((change) => change.added));+ } catch (error) {+ log('create labels failed: %O', error);+ for (const { link } of changes) skip(result, link.externalIdentifier, 'labelsFailed');+ return;+ }++ for (const { labels, link } of changes) {+ try {+ const changed = await this.applyLabelChange(link, labels, registry);+ if (changed) result.labelsSynced = (result.labelsSynced ?? 0) + 1;+ } catch (error) {+ log('sync labels of %s failed: %O', link.externalIdentifier, error);+ skip(result, link.externalIdentifier, 'labelsFailed');+ }+ }+ }++ /** The registry's label for each of these, created if missing, by {@link linearLabelKey}. */+ private async ensureLabels(labels: LinearLabelSpec[]): Promise<Map<string, TaskLabel>> {+ const model = new TaskLabelModel(this.db, this.userId, this.workspaceId);+ const groups = new Map(+ (+ await model.findOrCreateMany(+ labels.flatMap(({ group }) => (group ? [{ ...group, isGroup: true }] : [])),+ )+ )+ // A label of that name that is not a group cannot hold others: stay ungrouped.+ .filter((label) => label.isGroup)+ .map((label) => [linearLabelKey(label.name), label.id]),+ );++ const rows = await model.findOrCreateMany(+ labels.map(({ color, group, name }) => ({+ color,+ name,+ parentId: group ? groups.get(linearLabelKey(group.name)) : undefined,+ })),+ );+ return new Map(rows.map((label) => [linearLabelKey(label.name), label]));+ }++ /**+ * Apply one issue's label change and record it in one transaction. The change+ * is worked out again under the task's row lock: another run of a different rule+ * may have applied labels since the batch was read, and a change based on that+ * older read would leave its labels on the task, unknown to later syncs. Locks+ * follow the order of every other writer: labels, then the task, then the link.+ * False when no label of the task was affected, such as one the registry cannot+ * attach.+ */+ private async applyLabelChange(+ link: TaskExternalLinkWithTask,+ labels: LinearLabelSpec[],+ registry: Map<string, TaskLabel>,+ ): Promise<boolean> {+ return this.db.transaction(async (tx) => {+ const labelModel = new TaskLabelModel(tx, this.userId, this.workspaceId);+ await labelModel.lockForShare(+ labels.flatMap(({ key }) => {+ const label = registry.get(key);+ return label ? [label.id] : [];+ }),+ );+ const tasks = new TaskModel(tx, this.userId, this.workspaceId);+ if (!(await tasks.lockForUpdate(link.taskId))) return false;+ const linkModel = new TaskExternalLinkModel(tx, this.userId, this.workspaceId);+ const [current] = await linkModel.findByExternalIds('linear', [link.externalId]);+ if (!current || current.taskId !== link.taskId) return false;++ const { added, removed } = labelDelta(labels, current.metadata?.syncedLabels);+ if (added.length === 0 && removed.length === 0) return false;++ // A label group's name is not attachable, and the registry's own grouping can+ // put two labels of one issue in the same group, which a task cannot carry. The+ // others still count as synced: retrying them would swap siblings on every run.+ const groupsTaken = new Set<string>();+ const add: string[] = [];+ for (const { key } of added) {+ const label = registry.get(key);+ // Only a run that raced this one asks for a label the batch did not create.+ if (!label) throw new Error(`Label not resolved in this run: ${key}`);+ if (label.isGroup) continue;+ if (label.parentId) {+ if (groupsTaken.has(label.parentId)) continue;+ groupsTaken.add(label.parentId);+ }+ add.push(label.id);+ }++ const remove = (await labelModel.findByNames(removed))+ .filter((label) => !label.isGroup)+ .map((label) => label.id);+ await labelModel.changeTaskLabels(link.taskId, { add, remove });+ await linkModel.recordSyncedLabels(+ link.id,+ labels.map((label) => label.key),+ );+ return add.length > 0 || remove.length > 0;+ });+ }+/** Links in this scope whose task the caller can still see. */private async visibleLinks(externalIds: string[]) {const links = await this.linkModel.findByExternalIds('linear', [...new Set(externalIds)]);@@ -837,6 +986,16 @@ export class LinearIssueSyncService {}}+/** What changed in Linear since these labels were last applied to the task. */+const labelDelta = (labels: LinearLabelSpec[], syncedLabels: string[] | undefined) => {+ const synced = new Set(syncedLabels);+ const current = new Set(labels.map((label) => label.key));+ return {+ added: labels.filter((label) => !synced.has(label.key)),+ removed: [...synced].filter((key) => !current.has(key)),+ };+};+const skip = (result: LinearSyncResult, identifier: string, reason: LinearSyncSkipReason) => {result.skippedCount = (result.skippedCount ?? 0) + 1;if (result.skipped.length < MAX_SKIPPED_ENTRIES) result.skipped.push({ identifier, reason });diff --git a/apps/server/src/services/linear/issues.ts b/apps/server/src/services/linear/issues.tsindex 81977a1bd95..c94f969a583 100644--- a/apps/server/src/services/linear/issues.ts+++ b/apps/server/src/services/linear/issues.ts@@ -19,7 +19,14 @@ export interface LinearIssue {description?: string | null;id: string;identifier: string;- labels?: { nodes: { name: string }[] };+ labels?: {+ nodes: {+ color?: string | null;+ name: string;+ /** The label group it sits in; a group itself is never on an issue. */+ parent?: { color?: string | null; name: string } | null;+ }[];+ };parent?: { id: string } | null;priority: number;project?: { id: string; name: string } | null;@@ -35,7 +42,7 @@ const ISSUE_FIELDS = `state { name type }parent { id }assignee { displayName }- labels(first: 10) { nodes { name } }+ labels(first: 20) { nodes { name color parent { name color } } }project { id name }team { id key }`;diff --git a/apps/server/src/services/linear/syncJob.ts b/apps/server/src/services/linear/syncJob.tsindex 521a1926a7d..41a3441096d 100644--- a/apps/server/src/services/linear/syncJob.ts+++ b/apps/server/src/services/linear/syncJob.ts@@ -67,11 +67,13 @@ export const mergeLinearSyncResults = (if (!previous) return latest;const archived = (previous.archived ?? 0) + (latest.archived ?? 0);const commentsImported = (previous.commentsImported ?? 0) + (latest.commentsImported ?? 0);+ const labelsSynced = (previous.labelsSynced ?? 0) + (latest.labelsSynced ?? 0);const written = {...(archived ? { archived } : {}),closed: previous.closed + latest.closed,...(commentsImported ? { commentsImported } : {}),created: previous.created + latest.created,+ ...(labelsSynced ? { labelsSynced } : {}),updated: previous.updated + latest.updated,};if (!resumed) return { ...latest, ...written };@@ -332,6 +334,7 @@ export class LinearSyncJobService {const sync = new LinearIssueSyncService(this.db, this.userId, this.workspaceId);const options = {syncComments: metadata.syncComments,+ syncLabels: metadata.syncLabels,targetProjectId: metadata.projectId,};diff --git a/locales/ar/integration.json b/locales/ar/integration.jsonindex a779e36138d..7c7942893df 100644--- a/locales/ar/integration.json+++ b/locales/ar/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "مغلقة في Linear ولم يتم استيرادها أبدًا","linear.sync.job.skipReason.commentsFailed": "تمت مزامنة المهمة، ولكن تعذرت مزامنة تعليقاتها؛ ستُعاد المحاولة في المزامنة التالية","linear.sync.job.skipReason.failed": "لم يتم كتابتها؛ ستتم إعادة المحاولة في المزامنة التالية",+ "linear.sync.job.skipReason.labelsFailed": "تمت مزامنة المهمة، ولكن لم يتمكن من مزامنة التصنيفات؛ ستتم إعادة المحاولة في المزامنة التالية","linear.sync.job.skipReason.live": "مؤرشفة في Linear، لكن المهمة لديها جدول زمني نشط أو هدف مفتوح؛ ستؤرشفها مزامنة لاحقة","linear.sync.job.skipReason.missing": "لم يعد موجودًا في Linear أو غير مرئي لهذا الاتصال","linear.sync.job.skipReason.running": "المهمة قيد التشغيل، لذا لم يتم إغلاقها",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "مزامنة التعليقات","linear.sync.options.syncCommentsDesc": "انسخ تعليقات كل قضية من Linear إلى نشاط المهمة، مع الاحتفاظ بالكاتب والوقت","linear.sync.options.syncCommentsRuleDesc": "المهام التي تمت مزامنتها بالفعل تحصل أيضًا على التعليقات التي تفتقدها",+ "linear.sync.options.syncLabels": "مزامنة التصنيفات",+ "linear.sync.options.syncLabelsDesc": "أضف تصنيفات Linear لكل قضية إلى المهمة، مع إنشاء أي تصنيفات غير موجودة بعد",+ "linear.sync.options.syncLabelsRuleDesc": "المهام التي لا تزال هذه القاعدة تطابقها تحصل أيضًا على تغييرات التصنيفات التي تم إجراؤها في Linear","linear.sync.options.syncTitle": "خيارات المزامنة","linear.sync.project.connect": "اتصال Linear","linear.sync.project.description": "حوّل قضايا Linear إلى مهام لهذا المشروع، واحدة تلو الأخرى أو من خلال قاعدة فريق أو مشروع محفوظة. المزامنة باتجاه واحد: لا يتم تغيير أي شيء في Linear.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "تمت إضافة {{count}} تعليقات","linear.sync.result.created": "{{count}} تم إنشاؤها","linear.sync.result.keptLocalEdits": "{{count}} تم الاحتفاظ بالتعديلات المحلية",+ "linear.sync.result.labelsSynced": "تم تحديث التصنيفات على {{count}} مهمة","linear.sync.result.skipped": "{{count}} تم تخطيها","linear.sync.result.truncated": "تبقى المزيد من القضايا، قم بالمزامنة مرة أخرى للمتابعة","linear.sync.result.upToDate": "محدث بالفعل",diff --git a/locales/bg-BG/integration.json b/locales/bg-BG/integration.jsonindex 0f7598293c4..8e50215a91f 100644--- a/locales/bg-BG/integration.json+++ b/locales/bg-BG/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Затворено в Linear и никога не е било импортирано","linear.sync.job.skipReason.commentsFailed": "Задачата е синхронизирана, но коментарите ѝ не можаха да бъдат синхронизирани; следващата синхронизация ще ги опита отново","linear.sync.job.skipReason.failed": "Не можа да бъде записано; следващата синхронизация ще го опита отново",+ "linear.sync.job.skipReason.labelsFailed": "Задачата е синхронизирана, но етикетите й не можаха да бъдат; следващата синхронизация ще ги опита отново","linear.sync.job.skipReason.live": "Архивирана в Linear, но задачата има активен график или отворена цел; по-късна синхронизация ще я архивира","linear.sync.job.skipReason.missing": "Вече не е в Linear или не е видимо за тази връзка","linear.sync.job.skipReason.running": "Задачата е в процес на изпълнение, затова не беше затворена",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Синхронизиране на коментари","linear.sync.options.syncCommentsDesc": "Копира коментарите в Linear за всяка задача в активността на съответната задача, запазвайки автора и времето","linear.sync.options.syncCommentsRuleDesc": "Вече синхронизираните задачи също получават липсващите си коментари",+ "linear.sync.options.syncLabels": "Синхронизиране на етикети",+ "linear.sync.options.syncLabelsDesc": "Добавете етикетите на всяка задача от Linear към задачата, създавайки такива, които все още не съществуват",+ "linear.sync.options.syncLabelsRuleDesc": "Синхронизираните задачи, които това правило все още съвпада, също получават промените в етикетите, направени в Linear","linear.sync.options.syncTitle": "Опции за синхронизация","linear.sync.project.connect": "Свържете Linear","linear.sync.project.description": "Превърнете задачите от Linear в задачи на този проект, една по една или чрез запазено правило за екип или проект. Синхронизацията е еднопосочна: нищо в Linear няма да бъде променено.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} добавени коментари","linear.sync.result.created": "{{count}} създадени","linear.sync.result.keptLocalEdits": "{{count}} запазени локални редакции",+ "linear.sync.result.labelsSynced": "Етикетите са актуализирани на {{count}} задачи","linear.sync.result.skipped": "{{count}} пропуснати","linear.sync.result.truncated": "остават още задачи, синхронизирайте отново, за да продължите","linear.sync.result.upToDate": "Вече е актуално",diff --git a/locales/de-DE/integration.json b/locales/de-DE/integration.jsonindex 77c3a121d1d..1908fd5f262 100644--- a/locales/de-DE/integration.json+++ b/locales/de-DE/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "In Linear geschlossen und nie importiert","linear.sync.job.skipReason.commentsFailed": "Aufgabe synchronisiert, aber ihre Kommentare konnten nicht synchronisiert werden; die nächste Synchronisierung versucht es erneut","linear.sync.job.skipReason.failed": "Konnte nicht geschrieben werden; die nächste Synchronisierung versucht es erneut",+ "linear.sync.job.skipReason.labelsFailed": "Aufgabe synchronisiert, aber ihre Labels konnten nicht; die nächste Synchronisierung versucht es erneut","linear.sync.job.skipReason.live": "In Linear archiviert, aber die Aufgabe hat einen aktiven Zeitplan oder ein offenes Ziel; eine spätere Synchronisierung archiviert sie","linear.sync.job.skipReason.missing": "Nicht mehr in Linear vorhanden oder für diese Verbindung nicht sichtbar","linear.sync.job.skipReason.running": "Aufgabe läuft, daher wurde sie nicht geschlossen",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Kommentare synchronisieren","linear.sync.options.syncCommentsDesc": "Die Linear-Kommentare jedes Problems in die Aktivität der Aufgabe kopieren und dabei Autor und Zeit beibehalten","linear.sync.options.syncCommentsRuleDesc": "Bereits synchronisierte Aufgaben erhalten auch die fehlenden Kommentare",+ "linear.sync.options.syncLabels": "Labels synchronisieren",+ "linear.sync.options.syncLabelsDesc": "Fügen Sie die Linear-Labels jedes Problems zur Aufgabe hinzu und erstellen Sie fehlende Labels",+ "linear.sync.options.syncLabelsRuleDesc": "Synchronisierte Aufgaben, die dieser Regel weiterhin entsprechen, übernehmen auch Label-Änderungen aus Linear","linear.sync.options.syncTitle": "Synchronisierungsoptionen","linear.sync.project.connect": "Linear verbinden","linear.sync.project.description": "Verwandeln Sie Linear-Probleme in Aufgaben dieses Projekts, einzeln oder über eine gespeicherte Team- oder Projektregel. Die Synchronisierung ist einseitig: In Linear wird nichts geändert.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} Kommentare hinzugefügt","linear.sync.result.created": "{{count}} erstellt","linear.sync.result.keptLocalEdits": "{{count}} lokale Änderungen beibehalten",+ "linear.sync.result.labelsSynced": "Labels bei {{count}} Aufgaben aktualisiert","linear.sync.result.skipped": "{{count}} übersprungen","linear.sync.result.truncated": "Weitere Probleme verbleiben, synchronisieren Sie erneut, um fortzufahren","linear.sync.result.upToDate": "Bereits auf dem neuesten Stand",diff --git a/locales/en-US/integration.json b/locales/en-US/integration.jsonindex b9b7e9e6a63..353f42b0aa6 100644--- a/locales/en-US/integration.json+++ b/locales/en-US/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Closed in Linear and never imported","linear.sync.job.skipReason.commentsFailed": "Task synced, but its comments could not be; the next sync retries them","linear.sync.job.skipReason.failed": "Could not be written; the next sync retries it",+ "linear.sync.job.skipReason.labelsFailed": "Task synced, but its labels could not be; the next sync retries them","linear.sync.job.skipReason.live": "Archived in Linear, but the task has a live schedule or an open goal; a later sync archives it","linear.sync.job.skipReason.missing": "No longer in Linear, or not visible to this connection","linear.sync.job.skipReason.running": "Task is running, so it was not closed",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Sync comments","linear.sync.options.syncCommentsDesc": "Copy each issue's Linear comments into the task's activity, keeping the author and time","linear.sync.options.syncCommentsRuleDesc": "Tasks already synced also get the comments they are missing",+ "linear.sync.options.syncLabels": "Sync labels",+ "linear.sync.options.syncLabelsDesc": "Add each issue's Linear labels to the task, creating any that don't exist yet",+ "linear.sync.options.syncLabelsRuleDesc": "Synced tasks this rule still matches also pick up label changes made in Linear","linear.sync.options.syncTitle": "Sync options","linear.sync.project.connect": "Connect Linear","linear.sync.project.description": "Turn Linear issues into tasks of this project, one by one or through a saved team or project rule. Syncing is one way: nothing in Linear is changed.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} comments added","linear.sync.result.created": "{{count}} created","linear.sync.result.keptLocalEdits": "{{count}} kept local edits",+ "linear.sync.result.labelsSynced": "Labels updated on {{count}} tasks","linear.sync.result.skipped": "{{count}} skipped","linear.sync.result.truncated": "more issues remain, sync again to continue","linear.sync.result.upToDate": "Already up to date",diff --git a/locales/es-ES/integration.json b/locales/es-ES/integration.jsonindex 6aaf55e0a47..63e83c5f6ce 100644--- a/locales/es-ES/integration.json+++ b/locales/es-ES/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Cerrado en Linear y nunca importado","linear.sync.job.skipReason.commentsFailed": "La tarea se sincronizó, pero sus comentarios no; la próxima sincronización los reintentará","linear.sync.job.skipReason.failed": "No se pudo escribir; la próxima sincronización lo reintentará",+ "linear.sync.job.skipReason.labelsFailed": "Tarea sincronizada, pero no se pudieron sincronizar sus etiquetas; la próxima sincronización las reintentará","linear.sync.job.skipReason.live": "Archivada en Linear, pero la tarea tiene una programación activa o un objetivo abierto; una sincronización posterior la archivará","linear.sync.job.skipReason.missing": "Ya no está en Linear o no es visible para esta conexión","linear.sync.job.skipReason.running": "La tarea está en ejecución, por lo que no se cerró",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Sincronizar comentarios","linear.sync.options.syncCommentsDesc": "Copia los comentarios de Linear de cada problema en la actividad de la tarea, conservando el autor y la hora","linear.sync.options.syncCommentsRuleDesc": "Las tareas ya sincronizadas también reciben los comentarios que les faltan",+ "linear.sync.options.syncLabels": "Sincronizar etiquetas",+ "linear.sync.options.syncLabelsDesc": "Agregar las etiquetas de Linear de cada problema a la tarea, creando las que aún no existan",+ "linear.sync.options.syncLabelsRuleDesc": "Las tareas sincronizadas que esta regla aún coincida también recogerán los cambios de etiquetas realizados en Linear","linear.sync.options.syncTitle": "Opciones de sincronización","linear.sync.project.connect": "Conectar Linear","linear.sync.project.description": "Convierte los problemas de Linear en tareas de este proyecto, uno por uno o a través de una regla guardada de equipo o proyecto. La sincronización es unidireccional: nada en Linear se cambia.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} comentarios añadidos","linear.sync.result.created": "{{count}} creados","linear.sync.result.keptLocalEdits": "{{count}} ediciones locales mantenidas",+ "linear.sync.result.labelsSynced": "Etiquetas actualizadas en {{count}} tareas","linear.sync.result.skipped": "{{count}} omitidos","linear.sync.result.truncated": "quedan más problemas, sincroniza de nuevo para continuar","linear.sync.result.upToDate": "Ya está actualizado",diff --git a/locales/fa-IR/integration.json b/locales/fa-IR/integration.jsonindex 2f99dcac06c..c1f23150055 100644--- a/locales/fa-IR/integration.json+++ b/locales/fa-IR/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "در Linear بسته شده و هرگز وارد نشده است","linear.sync.job.skipReason.commentsFailed": "وظیفه همگامسازی شد، اما نظرات آن همگامسازی نشدند؛ همگامسازی بعدی دوباره تلاش میکند","linear.sync.job.skipReason.failed": "نمیتوانست نوشته شود؛ همگامسازی بعدی دوباره تلاش میکند",+ "linear.sync.job.skipReason.labelsFailed": "وظیفه همگامسازی شد، اما برچسبهای آن امکانپذیر نبود؛ همگامسازی بعدی دوباره تلاش میکند","linear.sync.job.skipReason.live": "در Linear بایگانی شده است، اما وظیفه یک زمانبندی فعال یا هدف باز دارد؛ همگامسازی بعدی آن را بایگانی میکند","linear.sync.job.skipReason.missing": "دیگر در Linear وجود ندارد یا برای این اتصال قابل مشاهده نیست","linear.sync.job.skipReason.running": "وظیفه در حال اجرا است، بنابراین بسته نشده است",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "همگامسازی نظرات","linear.sync.options.syncCommentsDesc": "نظرات Linear هر مسئله را با حفظ نویسنده و زمان در فعالیت وظیفه کپی کنید","linear.sync.options.syncCommentsRuleDesc": "وظایف همگامسازیشده نیز نظراتی را که از دست دادهاند دریافت میکنند",+ "linear.sync.options.syncLabels": "همگامسازی برچسبها",+ "linear.sync.options.syncLabelsDesc": "برچسبهای Linear هر مسئله را به وظیفه اضافه کنید و هر برچسبی که هنوز وجود ندارد ایجاد کنید",+ "linear.sync.options.syncLabelsRuleDesc": "وظایف همگامسازیشده که این قانون همچنان با آنها مطابقت دارد، تغییرات برچسب ایجادشده در Linear را نیز دریافت میکنند","linear.sync.options.syncTitle": "گزینههای همگامسازی","linear.sync.project.connect": "اتصال به Linear","linear.sync.project.description": "مسائل Linear را به وظایف این پروژه تبدیل کنید، بهصورت جداگانه یا از طریق قانون ذخیرهشده تیم یا پروژه. همگامسازی یکطرفه است: هیچ چیزی در Linear تغییر نمیکند.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} نظر افزوده شد","linear.sync.result.created": "{{count}} ایجاد شده","linear.sync.result.keptLocalEdits": "{{count}} ویرایشهای محلی حفظ شده",+ "linear.sync.result.labelsSynced": "برچسبها در {{count}} وظیفه بهروزرسانی شدند","linear.sync.result.skipped": "{{count}} کنار گذاشته شده","linear.sync.result.truncated": "مسائل بیشتری باقی ماندهاند، برای ادامه دوباره همگامسازی کنید","linear.sync.result.upToDate": "قبلاً بهروز شده",diff --git a/locales/fr-FR/integration.json b/locales/fr-FR/integration.jsonindex f3aa25fceda..309e5af5762 100644--- a/locales/fr-FR/integration.json+++ b/locales/fr-FR/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Fermé dans Linear et jamais importé","linear.sync.job.skipReason.commentsFailed": "Tâche synchronisée, mais ses commentaires n'ont pas pu être copiés ; la prochaine synchronisation les réessaiera","linear.sync.job.skipReason.failed": "N'a pas pu être écrit ; la prochaine synchronisation le réessaiera",+ "linear.sync.job.skipReason.labelsFailed": "Tâche synchronisée, mais ses étiquettes n'ont pas pu l'être ; la prochaine synchronisation les réessaiera","linear.sync.job.skipReason.live": "Archivée dans Linear, mais la tâche a une planification active ou un objectif ouvert ; une synchronisation ultérieure l'archivera","linear.sync.job.skipReason.missing": "N’existe plus dans Linear ou n’est pas visible pour cette connexion","linear.sync.job.skipReason.running": "La tâche est en cours d'exécution, elle n'a donc pas été fermée",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Synchroniser les commentaires","linear.sync.options.syncCommentsDesc": "Copier les commentaires Linear de chaque problème dans l'activité de la tâche, en conservant l'auteur et l'heure","linear.sync.options.syncCommentsRuleDesc": "Les tâches déjà synchronisées reçoivent également les commentaires qui leur manquent",+ "linear.sync.options.syncLabels": "Synchroniser les étiquettes",+ "linear.sync.options.syncLabelsDesc": "Ajouter les étiquettes Linear de chaque problème à la tâche, en créant celles qui n'existent pas encore",+ "linear.sync.options.syncLabelsRuleDesc": "Les tâches synchronisées correspondant encore à cette règle récupèrent également les modifications d'étiquettes effectuées dans Linear","linear.sync.options.syncTitle": "Options de synchronisation","linear.sync.project.connect": "Connecter Linear","linear.sync.project.description": "Transformez les problèmes Linear en tâches de ce projet, une par une ou via une règle d'équipe ou de projet enregistrée. La synchronisation est unidirectionnelle : rien dans Linear n'est modifié.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} commentaires ajoutés","linear.sync.result.created": "{{count}} créés","linear.sync.result.keptLocalEdits": "{{count}} modifications locales conservées",+ "linear.sync.result.labelsSynced": "Étiquettes mises à jour sur {{count}} tâches","linear.sync.result.skipped": "{{count}} ignorés","linear.sync.result.truncated": "plus de problèmes restent, synchronisez à nouveau pour continuer","linear.sync.result.upToDate": "Déjà à jour",diff --git a/locales/it-IT/integration.json b/locales/it-IT/integration.jsonindex 3789a3240e2..fdd5f5dd5dc 100644--- a/locales/it-IT/integration.json+++ b/locales/it-IT/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Chiuso in Linear e mai importato","linear.sync.job.skipReason.commentsFailed": "Attività sincronizzata, ma non è stato possibile sincronizzare i suoi commenti; la prossima sincronizzazione li riproverà","linear.sync.job.skipReason.failed": "Non è stato possibile scriverlo; la prossima sincronizzazione lo riproverà",+ "linear.sync.job.skipReason.labelsFailed": "Attività sincronizzata, ma le sue etichette non sono state sincronizzate; la prossima sincronizzazione le riproverà","linear.sync.job.skipReason.live": "Archiviato in Linear, ma l'attività ha una pianificazione attiva o un obiettivo aperto; una sincronizzazione successiva la archivierà","linear.sync.job.skipReason.missing": "Non è più in Linear o non è visibile a questa connessione","linear.sync.job.skipReason.running": "L'attività è in corso, quindi non è stata chiusa",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Sincronizza i commenti","linear.sync.options.syncCommentsDesc": "Copia i commenti Linear di ogni problema nella cronologia dell'attività, mantenendo l'autore e l'ora","linear.sync.options.syncCommentsRuleDesc": "Le attività già sincronizzate ricevono anche i commenti mancanti",+ "linear.sync.options.syncLabels": "Sincronizza etichette",+ "linear.sync.options.syncLabelsDesc": "Aggiungi le etichette di Linear di ogni problema all'attività, creando quelle che non esistono ancora",+ "linear.sync.options.syncLabelsRuleDesc": "Le attività sincronizzate che questa regola corrisponde ancora ricevono anche le modifiche alle etichette fatte in Linear","linear.sync.options.syncTitle": "Opzioni di sincronizzazione","linear.sync.project.connect": "Connetti Linear","linear.sync.project.description": "Trasforma i problemi di Linear in attività di questo progetto, uno per uno o tramite una regola salvata per team o progetto. La sincronizzazione è unidirezionale: nulla in Linear viene modificato.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} commenti aggiunti","linear.sync.result.created": "{{count}} creati","linear.sync.result.keptLocalEdits": "{{count}} modifiche locali mantenute",+ "linear.sync.result.labelsSynced": "Etichette aggiornate su {{count}} attività","linear.sync.result.skipped": "{{count}} saltati","linear.sync.result.truncated": "rimangono altri problemi, sincronizza di nuovo per continuare","linear.sync.result.upToDate": "Già aggiornato",diff --git a/locales/ja-JP/integration.json b/locales/ja-JP/integration.jsonindex 5608acc6273..186dcff17d3 100644--- a/locales/ja-JP/integration.json+++ b/locales/ja-JP/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Linearでクローズされ、インポートされませんでした","linear.sync.job.skipReason.commentsFailed": "タスクは同期されましたが、コメントを同期できませんでした。次回の同期で再試行されます","linear.sync.job.skipReason.failed": "書き込みできませんでした。次回の同期で再試行されます",+ "linear.sync.job.skipReason.labelsFailed": "タスクは同期されましたが、そのラベルはできませんでした。次回の同期で再試行されます","linear.sync.job.skipReason.live": "Linearではアーカイブされていますが、タスクに有効なスケジュールまたは未完了のゴールがあるため、後続の同期でアーカイブされます","linear.sync.job.skipReason.missing": "Linear に存在しないか、この接続からは参照できません","linear.sync.job.skipReason.running": "タスクが実行中のため、クローズされませんでした",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "コメントを同期","linear.sync.options.syncCommentsDesc": "各課題のLinearコメントをタスクのアクティビティにコピーし、投稿者と時刻を保持します","linear.sync.options.syncCommentsRuleDesc": "すでに同期されたタスクにも、不足しているコメントが追加されます",+ "linear.sync.options.syncLabels": "ラベルを同期",+ "linear.sync.options.syncLabelsDesc": "各課題のLinearラベルをタスクに追加し、まだ存在しないものは作成します",+ "linear.sync.options.syncLabelsRuleDesc": "このルールにまだ一致する同期済みタスクも、Linearで行われたラベルの変更を反映します","linear.sync.options.syncTitle": "同期オプション","linear.sync.project.connect": "Linearを接続","linear.sync.project.description": "Linearの課題をこのプロジェクトのタスクに変換します。1つずつ、または保存されたチームやプロジェクトルールを通じて同期します。同期は一方向で、Linearの内容は変更されません。",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}}件のコメントを追加","linear.sync.result.created": "{{count}}件が作成されました","linear.sync.result.keptLocalEdits": "{{count}}件のローカル編集が保持されました",+ "linear.sync.result.labelsSynced": "{{count}}件のタスクでラベルが更新されました","linear.sync.result.skipped": "{{count}}件がスキップされました","linear.sync.result.truncated": "さらに課題が残っています。同期を再実行して続行してください。","linear.sync.result.upToDate": "すでに最新です",diff --git a/locales/ko-KR/integration.json b/locales/ko-KR/integration.jsonindex 130679822b6..704308e6be3 100644--- a/locales/ko-KR/integration.json+++ b/locales/ko-KR/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Linear에서 닫혔으며 가져오지 않음","linear.sync.job.skipReason.commentsFailed": "작업은 동기화되었지만 댓글은 동기화할 수 없었음; 다음 동기화에서 다시 시도됨","linear.sync.job.skipReason.failed": "작성할 수 없었음; 다음 동기화에서 다시 시도됨",+ "linear.sync.job.skipReason.labelsFailed": "작업은 동기화되었지만 라벨은 동기화되지 않았습니다; 다음 동기화에서 다시 시도됩니다","linear.sync.job.skipReason.live": "Linear에서 보관되었지만 작업에 활성 일정 또는 열린 목표가 있어 이후 동기화에서 보관됩니다.","linear.sync.job.skipReason.missing": "Linear에 더 이상 없거나 이 연결에서 볼 수 없습니다","linear.sync.job.skipReason.running": "작업이 진행 중이므로 닫히지 않음",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "댓글 동기화","linear.sync.options.syncCommentsDesc": "각 문제의 Linear 댓글을 작업 활동에 복사하고 작성자와 시간을 유지합니다","linear.sync.options.syncCommentsRuleDesc": "이미 동기화된 작업도 누락된 댓글을 받습니다",+ "linear.sync.options.syncLabels": "라벨 동기화",+ "linear.sync.options.syncLabelsDesc": "각 문제의 Linear 라벨을 작업에 추가하고, 아직 존재하지 않는 라벨은 생성합니다",+ "linear.sync.options.syncLabelsRuleDesc": "이 규칙과 여전히 일치하는 동기화된 작업도 Linear에서 변경된 라벨을 반영합니다","linear.sync.options.syncTitle": "동기화 옵션","linear.sync.project.connect": "Linear 연결","linear.sync.project.description": "Linear 문제를 이 프로젝트의 작업으로 변환하세요. 하나씩 또는 저장된 팀 또는 프로젝트 규칙을 통해 가능합니다. 동기화는 단방향입니다: Linear에서는 아무것도 변경되지 않습니다.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}}개 댓글 추가됨","linear.sync.result.created": "{{count}}개 생성됨","linear.sync.result.keptLocalEdits": "{{count}}개 로컬 편집 유지됨",+ "linear.sync.result.labelsSynced": "{{count}}개의 작업에 라벨이 업데이트되었습니다","linear.sync.result.skipped": "{{count}}개 건너뜀","linear.sync.result.truncated": "더 많은 문제가 남아 있습니다. 계속하려면 다시 동기화하세요.","linear.sync.result.upToDate": "이미 최신 상태입니다",diff --git a/locales/nl-NL/integration.json b/locales/nl-NL/integration.jsonindex b0380e2b303..6729ff09b3b 100644--- a/locales/nl-NL/integration.json+++ b/locales/nl-NL/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Gesloten in Lineair en nooit geïmporteerd","linear.sync.job.skipReason.commentsFailed": "Taak gesynchroniseerd, maar de opmerkingen konden niet worden gesynchroniseerd; de volgende synchronisatie probeert het opnieuw","linear.sync.job.skipReason.failed": "Kon niet worden geschreven; de volgende synchronisatie probeert het opnieuw",+ "linear.sync.job.skipReason.labelsFailed": "Taak gesynchroniseerd, maar de labels konden niet worden gesynchroniseerd; de volgende synchronisatie probeert het opnieuw","linear.sync.job.skipReason.live": "Gearchiveerd in Linear, maar de taak heeft een actief schema of een open doel; een latere synchronisatie archiveert deze","linear.sync.job.skipReason.missing": "Niet meer in Linear of niet zichtbaar voor deze verbinding","linear.sync.job.skipReason.running": "Taak is bezig, dus deze is niet gesloten",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Opmerkingen synchroniseren","linear.sync.options.syncCommentsDesc": "Kopieer de Linear-opmerkingen van elk probleem naar de activiteit van de taak, met behoud van auteur en tijd","linear.sync.options.syncCommentsRuleDesc": "Taken die al gesynchroniseerd zijn, krijgen ook de opmerkingen die ze missen",+ "linear.sync.options.syncLabels": "Labels synchroniseren",+ "linear.sync.options.syncLabelsDesc": "Voeg de labels van elk probleem in Linear toe aan de taak en maak labels aan die nog niet bestaan",+ "linear.sync.options.syncLabelsRuleDesc": "Gesynchroniseerde taken die nog steeds aan deze regel voldoen, nemen ook labelwijzigingen in Linear over","linear.sync.options.syncTitle": "Synchronisatie-opties","linear.sync.project.connect": "Verbind Lineair","linear.sync.project.description": "Maak van Lineaire problemen taken van dit project, één voor één of via een opgeslagen team- of projectregel. Synchronisatie is eenrichtingsverkeer: niets in Lineair wordt gewijzigd.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} opmerkingen toegevoegd","linear.sync.result.created": "{{count}} gemaakt","linear.sync.result.keptLocalEdits": "{{count}} lokale bewerkingen behouden",+ "linear.sync.result.labelsSynced": "Labels bijgewerkt op {{count}} taken","linear.sync.result.skipped": "{{count}} overgeslagen","linear.sync.result.truncated": "meer problemen blijven over, synchroniseer opnieuw om door te gaan","linear.sync.result.upToDate": "Al up-to-date",diff --git a/locales/pl-PL/integration.json b/locales/pl-PL/integration.jsonindex 93ab1ee2c23..2fef2dc0b2e 100644--- a/locales/pl-PL/integration.json+++ b/locales/pl-PL/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Zamknięte w Linear i nigdy nie zaimportowane","linear.sync.job.skipReason.commentsFailed": "Zadanie zsynchronizowano, ale nie udało się zsynchronizować jego komentarzy; następna synchronizacja spróbuje ponownie","linear.sync.job.skipReason.failed": "Nie można zapisać; następna synchronizacja spróbuje ponownie",+ "linear.sync.job.skipReason.labelsFailed": "Zadanie zsynchronizowane, ale jego etykiety nie mogły zostać; następna synchronizacja spróbuje ponownie","linear.sync.job.skipReason.live": "Zarchiwizowane w Linear, ale zadanie ma aktywny harmonogram lub otwarty cel; późniejsza synchronizacja je zarchiwizuje","linear.sync.job.skipReason.missing": "Nie ma go już w Linear lub nie jest widoczne dla tego połączenia","linear.sync.job.skipReason.running": "Zadanie jest w toku, więc nie zostało zamknięte",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Synchronizuj komentarze","linear.sync.options.syncCommentsDesc": "Kopiuj komentarze Linear z każdego zadania do aktywności zadania, zachowując autora i czas","linear.sync.options.syncCommentsRuleDesc": "Już zsynchronizowane zadania otrzymują także brakujące komentarze",+ "linear.sync.options.syncLabels": "Synchronizuj etykiety",+ "linear.sync.options.syncLabelsDesc": "Dodaj etykiety z Linear do zadania, tworząc te, które jeszcze nie istnieją",+ "linear.sync.options.syncLabelsRuleDesc": "Zadania zsynchronizowane, które nadal pasują do tej reguły, również przejmą zmiany etykiet w Linear","linear.sync.options.syncTitle": "Opcje synchronizacji","linear.sync.project.connect": "Połącz Linear","linear.sync.project.description": "Zamień zadania z Linear na zadania w tym projekcie, pojedynczo lub za pomocą zapisanej reguły zespołu lub projektu. Synchronizacja jest jednokierunkowa: nic w Linear nie zostanie zmienione.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "Dodano {{count}} komentarzy","linear.sync.result.created": "{{count}} utworzonych","linear.sync.result.keptLocalEdits": "{{count}} zachowanych lokalnych edycji",+ "linear.sync.result.labelsSynced": "Etykiety zaktualizowane w {{count}} zadaniach","linear.sync.result.skipped": "{{count}} pominiętych","linear.sync.result.truncated": "więcej zadań pozostało, synchronizuj ponownie, aby kontynuować","linear.sync.result.upToDate": "Już aktualne",diff --git a/locales/pt-BR/integration.json b/locales/pt-BR/integration.jsonindex 1e190bcf994..1a22e546325 100644--- a/locales/pt-BR/integration.json+++ b/locales/pt-BR/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Fechado no Linear e nunca importado","linear.sync.job.skipReason.commentsFailed": "Tarefa sincronizada, mas não foi possível sincronizar seus comentários; a próxima sincronização tentará novamente","linear.sync.job.skipReason.failed": "Não pôde ser gravado; a próxima sincronização tentará novamente",+ "linear.sync.job.skipReason.labelsFailed": "Tarefa sincronizada, mas seus rótulos não puderam ser; a próxima sincronização tentará novamente","linear.sync.job.skipReason.live": "Arquivada no Linear, mas a tarefa tem um agendamento ativo ou uma meta aberta; uma sincronização posterior a arquivará","linear.sync.job.skipReason.missing": "Não está mais no Linear ou não é visível para esta conexão","linear.sync.job.skipReason.running": "A tarefa está em execução, então não foi fechada",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Sincronizar comentários","linear.sync.options.syncCommentsDesc": "Copiar os comentários de cada tarefa no Linear para a atividade da tarefa, mantendo o autor e o horário","linear.sync.options.syncCommentsRuleDesc": "Tarefas já sincronizadas também recebem os comentários que lhes faltam",+ "linear.sync.options.syncLabels": "Sincronizar rótulos",+ "linear.sync.options.syncLabelsDesc": "Adicionar os rótulos do Linear de cada tarefa à tarefa, criando os que ainda não existem",+ "linear.sync.options.syncLabelsRuleDesc": "Tarefas sincronizadas que esta regra ainda corresponde também recebem alterações de rótulos feitas no Linear","linear.sync.options.syncTitle": "Opções de sincronização","linear.sync.project.connect": "Conectar ao Linear","linear.sync.project.description": "Transforme tarefas do Linear em tarefas deste projeto, uma por uma ou através de uma regra de equipe ou projeto salva. A sincronização é unidirecional: nada no Linear é alterado.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} comentários adicionados","linear.sync.result.created": "{{count}} criadas","linear.sync.result.keptLocalEdits": "{{count}} edições locais mantidas",+ "linear.sync.result.labelsSynced": "Rótulos atualizados em {{count}} tarefas","linear.sync.result.skipped": "{{count}} ignoradas","linear.sync.result.truncated": "mais tarefas restantes, sincronize novamente para continuar","linear.sync.result.upToDate": "Já está atualizado",diff --git a/locales/ru-RU/integration.json b/locales/ru-RU/integration.jsonindex dde0bac5d6c..4926ff197a4 100644--- a/locales/ru-RU/integration.json+++ b/locales/ru-RU/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Закрыто в Linear и никогда не импортировалось","linear.sync.job.skipReason.commentsFailed": "Задача синхронизирована, но комментарии к ней не удалось синхронизировать; следующая синхронизация повторит попытку","linear.sync.job.skipReason.failed": "Не удалось записать; следующая синхронизация повторит попытку",+ "linear.sync.job.skipReason.labelsFailed": "Задача синхронизирована, но её метки не удалось; следующая синхронизация повторит попытку","linear.sync.job.skipReason.live": "Задача архивирована в Linear, но у неё есть активное расписание или открытая цель; более поздняя синхронизация заархивирует её","linear.sync.job.skipReason.missing": "Больше нет в Linear или недоступно для этого подключения","linear.sync.job.skipReason.running": "Задача выполняется, поэтому она не была закрыта",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Синхронизировать комментарии","linear.sync.options.syncCommentsDesc": "Копировать комментарии каждой задачи из Linear в активность задачи, сохраняя автора и время","linear.sync.options.syncCommentsRuleDesc": "Уже синхронизированные задачи также получат недостающие комментарии",+ "linear.sync.options.syncLabels": "Синхронизировать метки",+ "linear.sync.options.syncLabelsDesc": "Добавить метки Linear каждой задачи, создавая те, которые ещё не существуют",+ "linear.sync.options.syncLabelsRuleDesc": "Синхронизированные задачи, которые всё ещё соответствуют этому правилу, также получат изменения меток, сделанные в Linear","linear.sync.options.syncTitle": "Параметры синхронизации","linear.sync.project.connect": "Подключить Linear","linear.sync.project.description": "Превратите задачи Linear в задачи этого проекта, по одной или через сохраненное правило команды или проекта. Синхронизация односторонняя: в Linear ничего не изменяется.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} комментариев добавлено","linear.sync.result.created": "{{count}} создано","linear.sync.result.keptLocalEdits": "{{count}} сохранено локальных изменений",+ "linear.sync.result.labelsSynced": "Метки обновлены на {{count}} задачах","linear.sync.result.skipped": "{{count}} пропущено","linear.sync.result.truncated": "остались задачи, синхронизируйте снова, чтобы продолжить","linear.sync.result.upToDate": "Уже актуально",diff --git a/locales/tr-TR/integration.json b/locales/tr-TR/integration.jsonindex 9a206a560c9..504adc48f6d 100644--- a/locales/tr-TR/integration.json+++ b/locales/tr-TR/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Linear'da kapatıldı ve hiç içe aktarılmadı","linear.sync.job.skipReason.commentsFailed": "Görev senkronize edildi, ancak yorumları yapılamadı; bir sonraki senkronizasyon bunları yeniden deneyecek","linear.sync.job.skipReason.failed": "Yazılamadı; bir sonraki senkronizasyon bunu yeniden deneyecek",+ "linear.sync.job.skipReason.labelsFailed": "Görev senkronize edildi, ancak etiketleri senkronize edilemedi; bir sonraki senkronizasyon bunları yeniden deneyecek","linear.sync.job.skipReason.live": "Linear'da arşivlendi, ancak görevin etkin bir zamanlaması veya açık bir hedefi var; daha sonraki bir senkronizasyon bunu arşivleyecek","linear.sync.job.skipReason.missing": "Artık Linear’da yok veya bu bağlantı tarafından görülemiyor","linear.sync.job.skipReason.running": "Görev çalışıyor, bu yüzden kapatılmadı",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Yorumları senkronize et","linear.sync.options.syncCommentsDesc": "Her sorunun Linear yorumlarını, yazarı ve zamanı koruyarak görevin etkinliğine kopyalayın","linear.sync.options.syncCommentsRuleDesc": "Zaten senkronize edilmiş görevler, eksik olan yorumları da alır",+ "linear.sync.options.syncLabels": "Etiketleri senkronize et",+ "linear.sync.options.syncLabelsDesc": "Her sorunun Linear etiketlerini göreve ekleyin, henüz mevcut olmayanları oluşturun",+ "linear.sync.options.syncLabelsRuleDesc": "Bu kuralla eşleşen senkronize edilmiş görevler, Linear'da yapılan etiket değişikliklerini de alır","linear.sync.options.syncTitle": "Senkronizasyon seçenekleri","linear.sync.project.connect": "Linear'ı bağla","linear.sync.project.description": "Linear sorunlarını bu projenin görevlerine dönüştürün, tek tek veya kaydedilmiş bir takım veya proje kuralı aracılığıyla. Senkronizasyon tek yönlüdür: Linear'da hiçbir şey değişmez.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "{{count}} yorum eklendi","linear.sync.result.created": "{{count}} oluşturuldu","linear.sync.result.keptLocalEdits": "{{count}} yerel düzenleme korundu",+ "linear.sync.result.labelsSynced": "{{count}} görevde etiketler güncellendi","linear.sync.result.skipped": "{{count}} atlandı","linear.sync.result.truncated": "daha fazla sorun kaldı, devam etmek için tekrar senkronize edin","linear.sync.result.upToDate": "Zaten güncel",diff --git a/locales/vi-VN/integration.json b/locales/vi-VN/integration.jsonindex 94c6c6dd07b..6a8cf67e2db 100644--- a/locales/vi-VN/integration.json+++ b/locales/vi-VN/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "Đã đóng trong Linear và chưa bao giờ được nhập","linear.sync.job.skipReason.commentsFailed": "Nhiệm vụ đã đồng bộ, nhưng không thể đồng bộ các bình luận của nó; lần đồng bộ tiếp theo sẽ thử lại chúng","linear.sync.job.skipReason.failed": "Không thể ghi; lần đồng bộ tiếp theo sẽ thử lại",+ "linear.sync.job.skipReason.labelsFailed": "Nhiệm vụ đã được đồng bộ, nhưng các nhãn không thể; lần đồng bộ tiếp theo sẽ thử lại","linear.sync.job.skipReason.live": "Đã lưu trữ trong Linear, nhưng nhiệm vụ có lịch đang hoạt động hoặc mục tiêu đang mở; lần đồng bộ sau sẽ lưu trữ nó","linear.sync.job.skipReason.missing": "Không còn trong Linear hoặc kết nối này không xem được","linear.sync.job.skipReason.running": "Nhiệm vụ đang chạy, vì vậy nó không được đóng",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "Đồng bộ bình luận","linear.sync.options.syncCommentsDesc": "Sao chép bình luận Linear của mỗi vấn đề vào hoạt động của nhiệm vụ, giữ nguyên tác giả và thời gian","linear.sync.options.syncCommentsRuleDesc": "Các nhiệm vụ đã đồng bộ cũng nhận được các bình luận còn thiếu",+ "linear.sync.options.syncLabels": "Đồng bộ nhãn",+ "linear.sync.options.syncLabelsDesc": "Thêm các nhãn của từng vấn đề trong Linear vào nhiệm vụ, tạo bất kỳ nhãn nào chưa tồn tại",+ "linear.sync.options.syncLabelsRuleDesc": "Các nhiệm vụ đã đồng bộ mà quy tắc này vẫn khớp cũng sẽ nhận các thay đổi nhãn được thực hiện trong Linear","linear.sync.options.syncTitle": "Tùy chọn đồng bộ","linear.sync.project.connect": "Kết nối Linear","linear.sync.project.description": "Biến các vấn đề Linear thành nhiệm vụ của dự án này, từng cái một hoặc thông qua một quy tắc nhóm hoặc dự án đã lưu. Đồng bộ là một chiều: không có gì trong Linear bị thay đổi.",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "Đã thêm {{count}} bình luận","linear.sync.result.created": "{{count}} đã tạo","linear.sync.result.keptLocalEdits": "{{count}} giữ lại chỉnh sửa cục bộ",+ "linear.sync.result.labelsSynced": "Nhãn đã được cập nhật trên {{count}} nhiệm vụ","linear.sync.result.skipped": "{{count}} đã bị bỏ qua","linear.sync.result.truncated": "còn nhiều vấn đề, đồng bộ lại để tiếp tục","linear.sync.result.upToDate": "Đã cập nhật",diff --git a/locales/zh-CN/integration.json b/locales/zh-CN/integration.jsonindex 9d248875676..b53bf0c8ceb 100644--- a/locales/zh-CN/integration.json+++ b/locales/zh-CN/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "在 Linear 中已关闭,未导入","linear.sync.job.skipReason.commentsFailed": "任务已同步,但评论未能同步,下次同步会重试","linear.sync.job.skipReason.failed": "写入失败,下次同步会重试",+ "linear.sync.job.skipReason.labelsFailed": "任务已同步,但标签未能同步,下次同步会重试","linear.sync.job.skipReason.live": "已在 Linear 归档,但任务还有生效中的定时或未结束的目标,之后的同步会归档","linear.sync.job.skipReason.missing": "Linear 中已不存在,或当前连接无权访问","linear.sync.job.skipReason.running": "任务正在运行,未关闭",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "同步评论","linear.sync.options.syncCommentsDesc": "把 Issue 下的 Linear 评论导入到任务活动,保留原作者和时间","linear.sync.options.syncCommentsRuleDesc": "已同步的任务也会补上缺少的评论",+ "linear.sync.options.syncLabels": "同步标签",+ "linear.sync.options.syncLabelsDesc": "把 Issue 的 Linear 标签加到任务上,没有的标签会自动新建",+ "linear.sync.options.syncLabelsRuleDesc": "规则仍匹配的已同步任务也会跟上 Linear 中的标签变更","linear.sync.options.syncTitle": "同步选项","linear.sync.project.connect": "连接 Linear","linear.sync.project.description": "把 Linear Issue 同步为本项目的任务,可以逐个导入,也可以按团队或 Linear 项目保存规则。同步是单向的,不会修改 Linear。",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "新增评论 {{count}} 条","linear.sync.result.created": "新建 {{count}} 个","linear.sync.result.keptLocalEdits": "{{count}} 个保留本地修改",+ "linear.sync.result.labelsSynced": "更新了 {{count}} 个任务的标签","linear.sync.result.skipped": "跳过 {{count}} 个","linear.sync.result.truncated": "还有更多 Issue,请再次同步以继续","linear.sync.result.upToDate": "已是最新",diff --git a/locales/zh-TW/integration.json b/locales/zh-TW/integration.jsonindex 20bd1bbd165..3437e827324 100644--- a/locales/zh-TW/integration.json+++ b/locales/zh-TW/integration.json@@ -97,6 +97,7 @@"linear.sync.job.skipReason.closed": "在 Linear 中已關閉且從未匯入","linear.sync.job.skipReason.commentsFailed": "任務已同步,但其留言無法同步;下一次同步會重試","linear.sync.job.skipReason.failed": "無法寫入;下一次同步會重試",+ "linear.sync.job.skipReason.labelsFailed": "任務已同步,但其標籤無法同步;下一次同步會重試","linear.sync.job.skipReason.live": "已在 Linear 中封存,但任務有執行中的排程或未完成的目標;之後的同步會將其封存","linear.sync.job.skipReason.missing": "Linear 中已不存在,或目前的連線無權存取","linear.sync.job.skipReason.running": "任務正在執行,因此未被關閉",@@ -132,6 +133,9 @@"linear.sync.options.syncComments": "同步留言","linear.sync.options.syncCommentsDesc": "將每個問題的 Linear 留言複製到任務的活動記錄中,並保留作者與時間","linear.sync.options.syncCommentsRuleDesc": "已同步的任務也會補上缺少的留言",+ "linear.sync.options.syncLabels": "同步標籤",+ "linear.sync.options.syncLabelsDesc": "將每個問題的 Linear 標籤添加到任務中,創建尚不存在的標籤",+ "linear.sync.options.syncLabelsRuleDesc": "此規則仍匹配的已同步任務也會獲得 Linear 中標籤的更改","linear.sync.options.syncTitle": "同步選項","linear.sync.project.connect": "連接 Linear","linear.sync.project.description": "將 Linear 問題轉換為此專案的任務,可以逐一轉換或通過已儲存的團隊或專案規則進行。同步是單向的:Linear 中的內容不會被更改。",@@ -144,6 +148,7 @@"linear.sync.result.commentsImported": "已新增 {{count}} 則留言","linear.sync.result.created": "{{count}} 個已建立","linear.sync.result.keptLocalEdits": "{{count}} 個保留了本地編輯",+ "linear.sync.result.labelsSynced": "已更新 {{count}} 個任務的標籤","linear.sync.result.skipped": "{{count}} 個被跳過","linear.sync.result.truncated": "還有更多問題,請再次同步以繼續","linear.sync.result.upToDate": "已是最新",diff --git a/packages/database/src/models/__tests__/taskExternalLink.test.ts b/packages/database/src/models/__tests__/taskExternalLink.test.tsindex 7d52a5b63a1..d6e048dd754 100644--- a/packages/database/src/models/__tests__/taskExternalLink.test.ts+++ b/packages/database/src/models/__tests__/taskExternalLink.test.ts@@ -38,6 +38,22 @@ afterEach(async () => {});describe('TaskExternalLinkModel', () => {+ it('keeps recorded labels through a display refresh, which replaces the rest', async () => {+ const model = new TaskExternalLinkModel(db, userId);+ const task = await new TaskModel(db, userId).create({ instruction: 'one' });+ const { id } = await model.create({ ...link(task.id), metadata: { stateName: 'Todo' } });++ await model.recordSyncedLabels(id, ['bug']);+ await model.update(id, { metadata: { stateName: 'Done' } });++ const [row] = await model.findByExternalIds('linear', ['issue-1']);+ expect(row.metadata).toEqual({ stateName: 'Done', syncedLabels: ['bug'] });++ await model.recordSyncedLabels(id, []);+ const [cleared] = await model.findByExternalIds('linear', ['issue-1']);+ expect(cleared.metadata.syncedLabels).toEqual([]);+ });+it('maps an external item to at most one task per scope', async () => {const model = new TaskExternalLinkModel(db, userId);const tasks = new TaskModel(db, userId);diff --git a/packages/database/src/models/__tests__/taskLabel.test.ts b/packages/database/src/models/__tests__/taskLabel.test.tsindex a034148dae7..3b89788a7ba 100644--- a/packages/database/src/models/__tests__/taskLabel.test.ts+++ b/packages/database/src/models/__tests__/taskLabel.test.ts@@ -41,6 +41,70 @@ const expectCode = async (promise: Promise<unknown>, code: TaskLabelError['code'};describe('TaskLabelModel registry', () => {+ it('locks labels for sharing inside a transaction, ignoring ids it cannot use', async () => {+ const label = await workspace.create({ name: 'Bug' });++ await expect(+ serverDB.transaction((tx) =>+ new TaskLabelModel(tx, userId, workspaceId).lockForShare([label.id, 'not-a-uuid']),+ ),+ ).resolves.toBeUndefined();+ await expect(workspace.lockForShare([])).resolves.toBeUndefined();+ });++ describe('findOrCreateMany', () => {+ it('creates what is missing and returns existing labels untouched', async () => {+ const existing = await workspace.create({ color: '#EB5757', name: 'Bug' });++ const labels = await workspace.findOrCreateMany([+ { color: '#111111', name: 'bug' },+ { color: '#4CB782', name: ' Backend ' },+ { name: 'backend' },+ ]);++ expect(labels).toHaveLength(2);+ expect(labels.find((label) => label.id === existing.id)?.color).toBe('#EB5757');+ expect(labels.find((label) => label.name === 'Backend')?.color).toBe('#4CB782');+ expect(await workspace.query()).toHaveLength(2);+ });++ it('stays in its scope', async () => {+ await workspace.create({ name: 'Bug' });++ const [label] = await personal.findOrCreateMany([{ name: 'Bug' }]);++ expect(label.workspaceId).toBeNull();+ expect(await personal.query()).toHaveLength(1);+ expect(await workspace.query()).toHaveLength(1);+ });++ it('nests only under a group', async () => {+ const group = await workspace.create({ isGroup: true, name: 'Type' });+ const plain = await workspace.create({ name: 'Plain' });++ const [label] = await workspace.findOrCreateMany([{ name: 'Bug', parentId: group.id }]);++ expect(label.parentId).toBe(group.id);+ await expectCode(+ workspace.findOrCreateMany([{ name: 'Other', parentId: plain.id }]),+ 'INVALID_PARENT',+ );+ });++ it('takes one row per name, however many uses of it there are', async () => {+ // Six parameters a row: this many rows would exceed what a statement can bind.+ const uses = Array.from({ length: 12_000 }, (_, index) => ({+ name: index % 2 ? 'Bug' : 'bug',+ }));++ expect(await workspace.findOrCreateMany(uses)).toHaveLength(1);+ });++ it('returns nothing for nothing', async () => {+ expect(await workspace.findOrCreateMany([])).toEqual([]);+ });+ });+it('scopes labels per workspace and per personal owner', async () => {await personal.create({ name: 'Mine' });await workspace.create({ color: '#EB5757', name: 'Shared' });diff --git a/packages/database/src/models/taskExternalLink.ts b/packages/database/src/models/taskExternalLink.tsindex d45e00f8545..b1dabbcd5d0 100644--- a/packages/database/src/models/taskExternalLink.ts+++ b/packages/database/src/models/taskExternalLink.ts@@ -92,12 +92,12 @@ export class TaskExternalLinkModel {.update(taskExternalLinks).set({...rest,- // Display metadata is replaced, but the comment bookkeeping a sync- // recorded is kept: read and written in the row update itself, so a+ // Display metadata is replaced, but the comment and label bookkeeping a+ // sync recorded is kept: read and written in the row update itself, so a// refresh working from an older read never drops what was recorded since....(metadata? {- metadata: sql`jsonb_strip_nulls(jsonb_build_object('commentsSynced', ${taskExternalLinks.metadata} -> 'commentsSynced', 'syncedCommentIds', ${taskExternalLinks.metadata} -> 'syncedCommentIds')) || ${JSON.stringify(metadata)}::jsonb`,+ metadata: sql`jsonb_strip_nulls(jsonb_build_object('commentsSynced', ${taskExternalLinks.metadata} -> 'commentsSynced', 'syncedCommentIds', ${taskExternalLinks.metadata} -> 'syncedCommentIds', 'syncedLabels', ${taskExternalLinks.metadata} -> 'syncedLabels')) || ${JSON.stringify(metadata)}::jsonb`,}: {}),lastSyncedAt: new Date(),@@ -120,6 +120,17 @@ export class TaskExternalLinkModel {.where(and(this.scope(), eq(taskExternalLinks.id, id)));}+ /** Record the issue's labels as applied to the link's task. */+ async recordSyncedLabels(id: string, labels: string[]): Promise<void> {+ await this.db+ .update(taskExternalLinks)+ .set({+ metadata: sql`jsonb_set(${taskExternalLinks.metadata}, '{syncedLabels}', ${JSON.stringify(labels)}::jsonb)`,+ updatedAt: new Date(),+ })+ .where(and(this.scope(), eq(taskExternalLinks.id, id)));+ }+private selectWithTask() {return this.db.select({diff --git a/packages/database/src/models/taskLabel.ts b/packages/database/src/models/taskLabel.tsindex 523787e2802..c26f3492c4d 100644--- a/packages/database/src/models/taskLabel.ts+++ b/packages/database/src/models/taskLabel.ts@@ -176,6 +176,46 @@ export class TaskLabelModel {return row;};+ /**+ * Find the labels with these names, creating the missing ones; returns every+ * label named, new or not. An existing label is kept as it is, whatever color+ * or group was asked for, and the first of several with one name decides. A+ * label a concurrent caller just created is found rather than failing, which+ * is what sets this apart from {@link create}.+ */+ findOrCreateMany = async (+ params: Pick<CreateTaskLabelParams, 'color' | 'isGroup' | 'name' | 'parentId'>[],+ ): Promise<TaskLabelItem[]> => {+ // One row per name: callers pass a label per use, which can outgrow the+ // bind parameters a statement may hold.+ const unique = new Map<string, (typeof params)[number]>();+ for (const item of params) {+ const key = item.name.trim().toLowerCase();+ if (!unique.has(key)) unique.set(key, item);+ }+ const items = [...unique.values()];+ if (items.length === 0) return [];+ for (const item of items) {+ await this.assertValidParent(item.parentId, item.isGroup ?? false);+ }++ await this.db+ .insert(taskLabels)+ .values(+ items.map((item) =>+ this.payload({+ color: item.color ?? null,+ isGroup: item.isGroup ?? false,+ name: item.name.trim(),+ parentId: item.parentId ?? null,+ }),+ ),+ )+ .onConflictDoNothing();++ return this.findByNames(items.map((item) => item.name));+ };+update = async (id: string, value: UpdateTaskLabelParams): Promise<TaskLabelItem | undefined> => {const current = await this.findById(id);if (!current) throw new TaskLabelError('LABEL_NOT_FOUND', `Label not found: ${id}`);@@ -384,6 +424,22 @@ export class TaskLabelModel {return labels;};+ /**+ * Hold these labels for the rest of the transaction, as an assignment does, for a+ * writer that must lock a task before it knows which of them it attaches. Assigning+ * takes labels before the task, so taking them first keeps that order.+ */+ lockForShare = async (labelIds: string[]): Promise<void> => {+ const ids = labelIds.filter(isUuid);+ if (ids.length === 0) return;+ await this.db+ .select({ id: taskLabels.id })+ .from(taskLabels)+ .where(and(inArray(taskLabels.id, ids), this.ownership()))+ .orderBy(asc(taskLabels.id))+ .for('share');+ };+/** Validate a label set for assignment without writing anything. */assertAssignable = async (labelIds: string[]): Promise<void> => {await this.resolveAssignable(labelIds);diff --git a/packages/locales/src/default/integration.ts b/packages/locales/src/default/integration.tsindex 06ac515fbd3..4ddc6e0fccb 100644--- a/packages/locales/src/default/integration.ts+++ b/packages/locales/src/default/integration.ts@@ -124,6 +124,8 @@ export default {'linear.sync.job.skipReason.commentsFailed':'Task synced, but its comments could not be; the next sync retries them','linear.sync.job.skipReason.failed': 'Could not be written; the next sync retries it',+ 'linear.sync.job.skipReason.labelsFailed':+ 'Task synced, but its labels could not be; the next sync retries them','linear.sync.job.skipReason.live':'Archived in Linear, but the task has a live schedule or an open goal; a later sync archives it','linear.sync.job.skipReason.missing': 'No longer in Linear, or not visible to this connection',@@ -165,6 +167,11 @@ export default {"Copy each issue's Linear comments into the task's activity, keeping the author and time",'linear.sync.options.syncCommentsRuleDesc':'Tasks already synced also get the comments they are missing',+ 'linear.sync.options.syncLabels': 'Sync labels',+ 'linear.sync.options.syncLabelsDesc':+ "Add each issue's Linear labels to the task, creating any that don't exist yet",+ 'linear.sync.options.syncLabelsRuleDesc':+ 'Synced tasks this rule still matches also pick up label changes made in Linear','linear.sync.options.syncTitle': 'Sync options','linear.sync.project.connect': 'Connect Linear','linear.sync.project.description':@@ -177,6 +184,7 @@ export default {'linear.sync.result.archived': '{{count}} archived','linear.sync.result.closed': '{{count}} closed','linear.sync.result.commentsImported': '{{count}} comments added',+ 'linear.sync.result.labelsSynced': 'Labels updated on {{count}} tasks','linear.sync.result.created': '{{count}} created','linear.sync.result.keptLocalEdits': '{{count}} kept local edits','linear.sync.result.skipped': '{{count}} skipped',diff --git a/packages/types/src/linear.ts b/packages/types/src/linear.tsindex de50089c8ad..81d82de2927 100644--- a/packages/types/src/linear.ts+++ b/packages/types/src/linear.ts@@ -99,6 +99,14 @@ export interface LinearIssueLinkMetadata {* new ones. Sync bookkeeping, not display: a display refresh keeps it.*/syncedCommentIds?: string[];+ /**+ * The issue's Linear labels (lowercased names) when they were last applied to+ * the task. A sync applies only what changed in Linear since, so a label removed+ * from the task in LobeHub stays removed. One added there stays too, unless a+ * grouped label Linear adds replaces it as its sibling. Sync bookkeeping, not+ * display: a display refresh keeps it.+ */+ syncedLabels?: string[];teamKey?: string;}@@ -156,6 +164,8 @@ export type LinearSyncSkipReason =| 'failed'/** The task was synced, but its Linear comments were not; the next sync retries them. */| 'commentsFailed'+ /** The task was synced, but its Linear labels were not; the next sync retries them. */+ | 'labelsFailed'/** Picked for import, but Linear no longer returns it (deleted, or not visible). */| 'missing';@@ -169,6 +179,8 @@ export interface LinearSyncResult {created: number;/** Tasks edited in LobeHub, so their name, instruction and priority were kept. */keptLocalEdits: number;+ /** Tasks whose labels changed to follow Linear. Absent in older results. */+ labelsSynced?: number;/** The first skipped issues with why; `skippedCount` holds the full count. */skipped: { identifier: string; reason: LinearSyncSkipReason }[];/** Every skipped issue, including those past the `skipped` list. Absent in older results. */@@ -245,6 +257,8 @@ export interface LinearSyncJobMetadata {ruleId?: string;/** Copy each issue's Linear comments onto its task as task comments. */syncComments?: boolean;+ /** Bring each issue's Linear labels onto its task, creating the missing ones. */+ syncLabels?: boolean;}export interface LinearSyncJobView {diff --git a/packages/types/src/task/label.ts b/packages/types/src/task/label.tsindex e9d465ad87e..8ef237bbd43 100644--- a/packages/types/src/task/label.ts+++ b/packages/types/src/task/label.ts@@ -30,6 +30,12 @@ export interface TaskLabelRef {/** Longest label name accepted by the router, CLI and agent tools. */export const TASK_LABEL_NAME_MAX_LENGTH = 64;+/**+ * The only color values a label may hold: chips render them straight into an+ * inline `background`, so anything else is a CSS injection point.+ */+export const TASK_LABEL_COLOR_PATTERN = /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;+/*** Separator for addressing a grouped label by path (`Type/Bug`). Names are* unique per scope, so the bare name also resolves; the path form only readsdiff --git a/src/features/Projects/LinearSync/ImportIssuesContent.tsx b/src/features/Projects/LinearSync/ImportIssuesContent.tsxindex a5a6e931254..69cfc3b3d52 100644--- a/src/features/Projects/LinearSync/ImportIssuesContent.tsx+++ b/src/features/Projects/LinearSync/ImportIssuesContent.tsx@@ -44,6 +44,8 @@ const ImportIssuesContent = memo<LinearIssueImportModalOptions>(const [selected, setSelected] = useState<Set<string>>(() => new Set());// Comments carry much of an issue's context, so they come along unless unchecked.const [syncComments, setSyncComments] = useState(true);+ // So do labels, which is how a task is found again among the others.+ const [syncLabels, setSyncLabels] = useState(true);// Archived issues stay out, as in Linear, unless asked for.const [includeArchived, setIncludeArchived] = useState(false);const [starting, setStarting] = useState<'import' | 'rule' | null>(null);@@ -115,6 +117,7 @@ const ImportIssuesContent = memo<LinearIssueImportModalOptions>(issueIds: [...selected],projectId,syncComments,+ syncLabels,}),);@@ -134,7 +137,7 @@ const ImportIssuesContent = memo<LinearIssueImportModalOptions>(ruleId = rule.id;setSavedRuleId(rule.id);}- return linearService.startRuleSync(ruleId, { includeArchived, syncComments });+ return linearService.startRuleSync(ruleId, { includeArchived, syncComments, syncLabels });});const leaveRunning = () => {@@ -229,8 +232,10 @@ const ImportIssuesContent = memo<LinearIssueImportModalOptions>(<ImportOptionsincludeArchived={includeArchived}syncComments={syncComments}+ syncLabels={syncLabels}onIncludeArchivedChange={changeIncludeArchived}onSyncCommentsChange={setSyncComments}+ onSyncLabelsChange={setSyncLabels}/></>) : null}diff --git a/src/features/Projects/LinearSync/ImportOptions.tsx b/src/features/Projects/LinearSync/ImportOptions.tsxindex d0ff710467e..bdf07bcd50f 100644--- a/src/features/Projects/LinearSync/ImportOptions.tsx+++ b/src/features/Projects/LinearSync/ImportOptions.tsx@@ -22,7 +22,9 @@ interface ImportOptionsProps {includeArchived: boolean;onIncludeArchivedChange: (checked: boolean) => void;onSyncCommentsChange: (checked: boolean) => void;+ onSyncLabelsChange: (checked: boolean) => void;syncComments: boolean;+ syncLabels: boolean;}interface OptionProps {@@ -50,7 +52,14 @@ Option.displayName = 'LinearImportOption';/** What an import brings along besides the issues themselves. */const ImportOptions = memo<ImportOptionsProps>(- ({ includeArchived, onIncludeArchivedChange, onSyncCommentsChange, syncComments }) => {+ ({+ includeArchived,+ onIncludeArchivedChange,+ onSyncCommentsChange,+ onSyncLabelsChange,+ syncComments,+ syncLabels,+ }) => {const { t } = useTranslation('integration');return (@@ -65,6 +74,12 @@ const ImportOptions = memo<ImportOptionsProps>(label={t('linear.sync.options.syncComments')}onChange={onSyncCommentsChange}/>+ <Option+ checked={syncLabels}+ desc={t('linear.sync.options.syncLabelsDesc')}+ label={t('linear.sync.options.syncLabels')}+ onChange={onSyncLabelsChange}+ /><Optionchecked={includeArchived}desc={t('linear.sync.options.includeArchivedDesc')}diff --git a/src/features/Projects/LinearSync/LinearSyncEntry.tsx b/src/features/Projects/LinearSync/LinearSyncEntry.tsxindex 85ab5d80d2b..cd678268316 100644--- a/src/features/Projects/LinearSync/LinearSyncEntry.tsx+++ b/src/features/Projects/LinearSync/LinearSyncEntry.tsx@@ -26,9 +26,13 @@ const LinearSyncEntry = memo<LinearSyncEntryProps>(({ projectId }) => {const syncRules = useLinearSyncRules(shown ? projectId : null);const syncJobs = useLinearSyncJobs(shown ? projectId : null);const refreshTaskList = useTaskStore((s) => s.refreshTaskList);+ const refreshTaskLabels = useTaskStore((s) => s.refreshTaskLabels);// A sync started here may end after its dialog was closed; its tasks then- // appear in the list below.- useLinearSyncJobNotifier(syncJobs.data, refreshTaskList);+ // appear in the list below, along with any labels it created.+ useLinearSyncJobNotifier(syncJobs.data, () => {+ void refreshTaskList();+ void refreshTaskLabels();+ });if (!shown) return null;diff --git a/src/features/Projects/LinearSync/SyncRules.test.tsx b/src/features/Projects/LinearSync/SyncRules.test.tsxindex 65aa8849902..5daca5343c6 100644--- a/src/features/Projects/LinearSync/SyncRules.test.tsx+++ b/src/features/Projects/LinearSync/SyncRules.test.tsx@@ -74,6 +74,7 @@ describe('SyncRules', () => {expect(linearServiceMocks.startRuleSync).toHaveBeenCalledWith('rule-1', {includeArchived: false,syncComments: true,+ syncLabels: true,}),);});diff --git a/src/features/Projects/LinearSync/SyncRules.tsx b/src/features/Projects/LinearSync/SyncRules.tsxindex 7216ffc5d58..7fb83569e18 100644--- a/src/features/Projects/LinearSync/SyncRules.tsx+++ b/src/features/Projects/LinearSync/SyncRules.tsx@@ -77,6 +77,8 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, proje// Tucked into each rule's sync menu; applies to the next run of any rule, and// re-running with it on fills in the comments already-synced tasks lack.const [syncComments, setSyncComments] = useState(true);+ // Likewise for labels: a run also labels the tasks it reads that were synced without them.+ const [syncLabels, setSyncLabels] = useState(true);// Off by default, as in Linear; on, a run also reaches the rule's archived issues.const [includeArchived, setIncludeArchived] = useState(false);const optionItems: DropdownItem[] = [@@ -91,6 +93,15 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, projeonCheckedChange: setSyncComments,type: 'checkbox',},+ {+ checked: syncLabels,+ closeOnClick: false,+ desc: t('linear.sync.options.syncLabelsRuleDesc'),+ key: 'syncLabels',+ label: t('linear.sync.options.syncLabels'),+ onCheckedChange: setSyncLabels,+ type: 'checkbox',+ },{checked: includeArchived,closeOnClick: false,@@ -129,7 +140,7 @@ const SyncRules = memo<SyncRulesProps>(({ connections, jobs, onJobStarted, projeconst runRule = async (rule: LinearSyncRuleView) => {setStarting(rule.id);try {- await linearService.startRuleSync(rule.id, { includeArchived, syncComments });+ await linearService.startRuleSync(rule.id, { includeArchived, syncComments, syncLabels });onJobStarted();} catch (error) {toast.error(linearSyncErrorMessage(error, t));diff --git a/src/features/Projects/LinearSync/utils.test.ts b/src/features/Projects/LinearSync/utils.test.tsindex 706230dd568..e59e2e54f3c 100644--- a/src/features/Projects/LinearSync/utils.test.ts+++ b/src/features/Projects/LinearSync/utils.test.ts@@ -57,6 +57,9 @@ describe('formatLinearSyncResult', () => {expect(formatLinearSyncResult(result({ commentsImported: 3, updated: 1 }), t)).toBe('linear.sync.result.updated:1 · linear.sync.result.commentsImported:3',);+ expect(formatLinearSyncResult(result({ labelsSynced: 4 }), t)).toBe(+ 'linear.sync.result.labelsSynced:4',+ );expect(formatLinearSyncResult(result({ commentsImported: 2 }), t)).toBe('linear.sync.result.commentsImported:2',);diff --git a/src/features/Projects/LinearSync/utils.ts b/src/features/Projects/LinearSync/utils.tsindex 1000998b35f..3549f7d22bc 100644--- a/src/features/Projects/LinearSync/utils.ts+++ b/src/features/Projects/LinearSync/utils.ts@@ -82,6 +82,7 @@ export const formatLinearSyncResult = (result.archived && t('linear.sync.result.archived', { count: result.archived }),result.commentsImported &&t('linear.sync.result.commentsImported', { count: result.commentsImported }),+ result.labelsSynced && t('linear.sync.result.labelsSynced', { count: result.labelsSynced }),result.keptLocalEdits &&t('linear.sync.result.keptLocalEdits', { count: result.keptLocalEdits }),skipped && t('linear.sync.result.skipped', { count: skipped }),diff --git a/src/services/linear.ts b/src/services/linear.tsindex a407e9209ca..18c1bb269fc 100644--- a/src/services/linear.ts+++ b/src/services/linear.ts@@ -39,6 +39,7 @@ class LinearService {issueIds: string[];projectId: string;syncComments?: boolean;+ syncLabels?: boolean;}) => lambdaClient.linear.startImport.mutate(params);cancelSync = async (projectId: string, jobId: string) =>@@ -62,7 +63,7 @@ class LinearService {/** Starts a background run of a saved rule; returns the job id. */startRuleSync = async (ruleId: string,- options: { includeArchived?: boolean; syncComments?: boolean } = {},+ options: { includeArchived?: boolean; syncComments?: boolean; syncLabels?: boolean } = {},) => lambdaClient.linear.startRuleSync.mutate({ ruleId, ...options });}