From 712f8cad32bf8961c3c4b53497dd65c32672d59d Mon Sep 17 00:00:00 2001 From: Alex Southwell Date: Thu, 17 Sep 2026 14:49:45 +1000 Subject: [PATCH] feat(web): command palette search matches thread IDs (#11185) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../components/CommandPalette.logic.test.ts | 34 +++++++++++++++++++ .../src/components/CommandPalette.logic.ts | 2 ++ 2 files changed, 36 insertions(+) diff --git a/apps/web/src/components/CommandPalette.logic.test.ts b/apps/web/src/components/CommandPalette.logic.test.ts index a295d199e11489ba3c38b407f0c075ab409860be..f051900d0d484ea1029df446eaf61dcb10877c17 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.ts index 48833aebc3ebb3320e27eb6b846fd0af94ca8825..e2114079e72978ec90f94a5f4c6dd31e0a3b6aff 100644 --- a/apps/web/src/components/CommandPalette.logic.ts +++ b/apps/web/src/components/CommandPalette.logic.ts @@ -307,6 +307,8 @@ export function buildThreadActionItems