| ... | @@ -584,6 +584,40 @@ describe("buildThreadActionItems", () => { | ... | @@ -584,6 +584,40 @@ describe("buildThreadActionItems", () => { |
| 584 | expect(item?.description).toBe("T3 Code · #feat/search"); | 584 | expect(item?.description).toBe("T3 Code · #feat/search"); |
| 585 | }); | 585 | }); |
| 586 | | 586 | |
| | 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 | |
| 587 | it("prefers renderDescription when provided", () => { | 621 | it("prefers renderDescription when provided", () => { |
| 588 | const [item] = buildThreadActionItems({ | 622 | const [item] = buildThreadActionItems({ |
| 589 | threads: [makeThread({ branch: "feat/search", worktreePath: "/tmp/wt" })], | 623 | threads: [makeThread({ branch: "feat/search", worktreePath: "/tmp/wt" })], |