authorgravatar for saphid@gmail.comAlex Southwell <saphid@gmail.com> 2026-09-17 14:49:45+10:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-17 01:49:45-03:00
log712f8cad32bf8961c3c4b53497dd65c32672d59d
tree22fb7540002ef0ba75c3d298eed0cc8f1f3e5524
parent886c83450797c46ee84ae28fc16c2208cafa965e
signature Signed by PGP key B5690EEEBB952194

feat(web): command palette search matches thread IDs (#11185)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

2 files changed, 36 insertions(+), 0 deletions(-)

apps/web/src/components/CommandPalette.logic.test.ts+34
......@@ -584,6 +584,40 @@ describe("buildThreadActionItems", () => {
584584 expect(item?.description).toBe("T3 Code · #feat/search");
585585 });
586586
587 it("surfaces threads when the query is their ID, without outranking title matches", () => {
588 const idThread = makeThread({
589 id: ThreadId.make("thread-alpha-1234"),
590 title: "Unrelated work",
591 updatedAt: "2026-03-05T00:00:00.000Z",
592 });
593 const titleThread = makeThread({
594 id: ThreadId.make("thread-other-9999"),
595 title: "Fix thread-alpha-1234 flakes",
596 updatedAt: "2026-03-04T00:00:00.000Z",
597 });
598 const items = buildThreadActionItems({
599 threads: [idThread, titleThread],
600 projectTitleById: new Map([[PROJECT_ID, "T3 Code"]]),
601 sortOrder: "updated_at",
602 icon: null,
603 runThread: async (_thread) => undefined,
604 });
605
606 const groups = filterCommandPaletteGroups({
607 activeGroups: [],
608 query: " THREAD-ALPHA-1234 ",
609 isInSubmenu: false,
610 projectSearchItems: [],
611 settingsSearchItems: [],
612 threadSearchItems: items,
613 });
614
615 expect(groups.flatMap((group) => group.items)).toEqual([
616 expect.objectContaining({ value: `thread:${titleThread.id}` }),
617 expect.objectContaining({ value: `thread:${idThread.id}` }),
618 ]);
619 });
620
587621 it("prefers renderDescription when provided", () => {
588622 const [item] = buildThreadActionItems({
589623 threads: [makeThread({ branch: "feat/search", worktreePath: "/tmp/wt" })],
apps/web/src/components/CommandPalette.logic.ts+2
......@@ -307,6 +307,8 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
307307 projectTitle ?? ``,
308308 thread.branch ?? ``,
309309 contentMatch?.snippet ?? ``,
310 // Last so pasted IDs never outrank title matches for shared substrings.
311 thread.id,
310312 ],
311313 title: thread.title,
312314 description,