TypeScript
feat(web): command palette search matches thread IDs (#11185)
Alex Southwell712f8cad32bf
diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.tsindex a295d199e11..f051900d0d4 100644--- a/apps/web/src/components/CommandPalette.logic.test.ts+++ b/apps/web/src/components/CommandPalette.logic.test.ts@@ -584,6 +584,40 @@ describe("buildThreadActionItems", () => {expect(item?.description).toBe("T3 Code · #feat/search");});+ it("surfaces threads when the query is their ID, without outranking title matches", () => {+ const idThread = makeThread({+ id: ThreadId.make("thread-alpha-1234"),+ title: "Unrelated work",+ updatedAt: "2026-03-05T00:00:00.000Z",+ });+ const titleThread = makeThread({+ id: ThreadId.make("thread-other-9999"),+ title: "Fix thread-alpha-1234 flakes",+ updatedAt: "2026-03-04T00:00:00.000Z",+ });+ const items = buildThreadActionItems({+ threads: [idThread, titleThread],+ projectTitleById: new Map([[PROJECT_ID, "T3 Code"]]),+ sortOrder: "updated_at",+ icon: null,+ runThread: async (_thread) => undefined,+ });++ const groups = filterCommandPaletteGroups({+ activeGroups: [],+ query: " THREAD-ALPHA-1234 ",+ isInSubmenu: false,+ projectSearchItems: [],+ settingsSearchItems: [],+ threadSearchItems: items,+ });++ expect(groups.flatMap((group) => group.items)).toEqual([+ expect.objectContaining({ value: `thread:${titleThread.id}` }),+ expect.objectContaining({ value: `thread:${idThread.id}` }),+ ]);+ });+it("prefers renderDescription when provided", () => {const [item] = buildThreadActionItems({threads: [makeThread({ branch: "feat/search", worktreePath: "/tmp/wt" })],diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.tsindex 48833aebc3e..e2114079e72 100644--- a/apps/web/src/components/CommandPalette.logic.ts+++ b/apps/web/src/components/CommandPalette.logic.ts@@ -307,6 +307,8 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThrprojectTitle ?? ``,thread.branch ?? ``,contentMatch?.snippet ?? ``,+ // Last so pasted IDs never outrank title matches for shared substrings.+ thread.id,],title: thread.title,description,