GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(search): find threads by their branch PR number by tris203 · Pull Request #14658 · pingdotgg/t3code

fix(search): find threads by their branch PR number #14658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
maria-rcks merged 4 commits into pingdotgg:main from tris203:t3code/search-by-linked-pr-number-evidence
Oct 11, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(search): find threads by their branch PR number #14658

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
f09a7c7
fix(search): find threads by linked PR number
tris203 Sep 22, 2026
26cc71e
fix(search): show the PR number for multi-token searches
tris203 Oct 1, 2026
7e4c384
Merge remote-tracking branch 'origin/main' into pr-14658
maria-rcks Oct 11, 2026
6fae402
fix(web): track the badge query in command palette thread items
maria-rcks Oct 11, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

18 changes: 16 additions & 2 deletions 18 apps/web/src/components/CommandPalette.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ import {
CommandPaletteMetaDot,
ThreadCommandSubtitle,
} from "./ThreadCommandSubtitle";
import { ThreadRowLeadingStatus, ThreadRowTrailingStatus } from "./ThreadStatusIndicators";
import {
ThreadRowLeadingStatus,
ThreadRowTrailingStatus,
ThreadSearchPullRequestNumber,
} from "./ThreadStatusIndicators";
import { primaryServerKeybindingsAtom, primaryServerProvidersAtom } from "../state/server";
import {
applyProviderInstanceSettings,
Expand Down Expand Up @@ -1323,7 +1327,16 @@ function OpenCommandPaletteDialog(props: {
sortOrder: clientSettings.sidebarThreadSortOrder,
icon: <MessageSquareIcon className={ITEM_ICON_CLASS} />,
renderLeadingContent: (thread) => <ThreadRowLeadingStatus thread={thread} />,
renderTrailingContent: (thread) => <ThreadRowTrailingStatus thread={thread} />,
renderTrailingContent: (thread) => (
<>
<ThreadSearchPullRequestNumber
thread={thread}
query={threadSearchQuery}
settled={thread.settledOverride === "settled"}
/>
<ThreadRowTrailingStatus thread={thread} />
</>
),
renderDescription: (thread, { projectTitle }) => {
const modelInstanceId =
thread.runtime?.providerInstanceId ?? thread.modelSelection.instanceId;
Expand Down Expand Up @@ -1383,6 +1396,7 @@ function OpenCommandPaletteDialog(props: {
providerEntryByEnvironmentAndInstanceId,
threadContentMatchByKey,
threadSearch.query,
threadSearchQuery,
threads,
],
);
Expand Down
22 changes: 22 additions & 0 deletions 22 apps/web/src/components/Sidebar.logic.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
resolveThreadRowClassName,
resolveThreadStatusPill,
resolveWorkingStartedAt,
pullRequestMatchesSearchQuery,
searchSidebarThreads,
shouldClearThreadSelectionOnMouseDown,
shouldShowSidebarV2Duration,
Expand Down Expand Up @@ -994,6 +995,27 @@ describe("resolveSidebarThreadStatus", () => {
});
});

describe("pullRequestMatchesSearchQuery", () => {
const branchPullRequest = {
projectId: ProjectId.make("project"),
repository: "pingdotgg/t3code",
number: 123,
url: "https://github.com/pingdotgg/t3code/pull/123",
};

it("matches when every query token appears in the PR's terms", () => {
expect(pullRequestMatchesSearchQuery({ branchPullRequest }, "123")).toBe(true);
expect(pullRequestMatchesSearchQuery({ branchPullRequest }, "pingdotgg/t3code #123")).toBe(
true,
);
});

it("rejects queries with a token the PR does not carry, and blank queries", () => {
expect(pullRequestMatchesSearchQuery({ branchPullRequest }, "rebase 123")).toBe(false);
expect(pullRequestMatchesSearchQuery({ branchPullRequest }, " ")).toBe(false);
});
});

describe("searchSidebarThreads", () => {
const searchThread = (id: string, title: string, project: string) => ({
environmentId: localEnvironmentId,
Expand Down
17 changes: 16 additions & 1 deletion 17 apps/web/src/components/Sidebar.logic.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
type ThreadSortInput,
} from "../lib/threadSort";
import type { SidebarThreadSummary, Thread } from "../types";
import { cn } from "../lib/utils";
import { cn, normalizeSearchText } from "../lib/utils";
import { isLatestRunSettled } from "../session-logic";
import { resolveServerBackedAppStageLabel } from "../branding.logic";

Expand Down Expand Up @@ -1110,6 +1110,21 @@ export function searchSidebarThreads<
return [...titleMatches, ...contentMatches];
}

/**
* Whether a PR's search terms contain every whitespace-separated token of the
* query. Search results use this to pick the PR number to show, so it has to
* accept the multi-token queries the command palette matches on.
*/
export function pullRequestMatchesSearchQuery(
pullRequest: Parameters<typeof threadPullRequestSearchTerms>[0],
query: string,
): boolean {
const normalizedQuery = normalizeSearchText(query);
if (normalizedQuery.length === 0) return false;
const haystack = normalizeSearchText(threadPullRequestSearchTerms(pullRequest).join(" "));
return normalizedQuery.split(" ").every((token) => haystack.includes(token));
}

export function filterSidebarProjectScopeItems<TItem extends { readonly value: string }>(input: {
items: readonly TItem[];
query: string;
Expand Down
40 changes: 36 additions & 4 deletions 40 apps/web/src/components/Sidebar.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ import {
synchronizeTerminalPulse,
type TerminalStatusIndicator,
useLinkedThreadPullRequest,
ThreadSearchPullRequestNumber,
} from "./ThreadStatusIndicators";
import { resolveSnoozePresets, snoozeWakeLabel, type SnoozePreset } from "./Sidebar.snooze";
import { ProjectFavicon, type ProjectFaviconProject } from "./ProjectFavicon";
Expand Down Expand Up @@ -2233,6 +2234,7 @@ function latestRunDiff(
}

const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
isSettled: boolean;
thread: SidebarThreadSummary;
project: EnvironmentProject | null;
projectDisplayName: string | null;
Expand Down Expand Up @@ -2332,11 +2334,12 @@ const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
tabIndex={-1}
aria-selected={props.isHighlighted}
aria-current={accessibility.current}
aria-describedby={`${props.resultId}-pr`}
aria-label={accessibility.label}
onMouseMove={props.onHighlight}
onClick={props.onSelect}
className={cn(
"flex min-h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-1 text-left text-sm outline-none",
"group/sidebar-row group/v2-row flex min-h-9 w-full cursor-pointer items-center gap-2.5 rounded-md px-2.5 py-1 text-left text-sm outline-none",
props.isHighlighted || props.isRouteActive
? "bg-sidebar-row-active text-sidebar-foreground"
: "text-sidebar-muted-foreground/75 hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
Expand All @@ -2347,12 +2350,40 @@ const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props: {
}
>
{props.project ? (
<ProjectFavicon project={props.project} className="size-4 shrink-0" />
<ProjectFavicon
project={props.project}
className={cn(
"size-4 shrink-0 transition-opacity",
props.isSettled &&
!props.isRouteActive &&
!props.isHighlighted &&
"opacity-40 grayscale group-hover/sidebar-row:opacity-100 group-hover/sidebar-row:grayscale-0",
)}
/>
) : null}
<span className="flex min-w-0 flex-1 flex-col">
<span className="flex min-w-0 items-center gap-2.5">
<span className="min-w-0 flex-1 truncate">{thread.title}</span>
<span className="shrink-0 text-xs text-muted-foreground/55 tabular-nums">
<span
className={cn(
"min-w-0 flex-1 truncate",
props.isSettled
? "font-normal text-secondary-label/70 group-hover/sidebar-row:text-foreground"
: "font-medium text-foreground",
(props.isHighlighted || props.isRouteActive) && "text-foreground",
thread.titleRegeneration != null && "opacity-55",
)}
>
{thread.title}
</span>
<span id={`${props.resultId}-pr`} className="contents">
<ThreadSearchPullRequestNumber
thread={thread}
query={props.searchQuery}
enabled={leaseLiveStatus}
settled={props.isSettled}
/>
</span>
<span className="w-8 shrink-0 text-right text-xs text-muted-foreground/55 tabular-nums">
{threadTimeLabel(thread)}
</span>
</span>
Expand Down Expand Up @@ -5167,6 +5198,7 @@ export default function Sidebar() {
);
return (
<SidebarSearchResultRow
isSettled={settledThreadKeys.has(threadKey)}
key={threadKey}
thread={thread}
project={
Expand Down
85 changes: 84 additions & 1 deletion 85 apps/web/src/components/ThreadStatusIndicators.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ import {
type ThreadPullRequestBadge,
} from "@t3tools/shared/threadPullRequests";
import { useRender } from "@base-ui/react/use-render";
import { type ReactNode, type AnimationEvent, type MouseEvent, type ReactElement } from "react";
import {
type ReactNode,
type AnimationEvent,
type MouseEvent,
type ReactElement,
type ComponentProps,
} from "react";
import { cn } from "../lib/utils";

import { parseChangeRequestUrl } from "../lib/openPullRequestLink";
Expand All @@ -38,6 +44,7 @@ import { vcsEnvironment } from "../state/vcs";
import { useUiStateStore } from "../uiStateStore";
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
import {
pullRequestMatchesSearchQuery,
resolveThreadLastVisitedAt,
resolveThreadStatusPill,
type ThreadStatusPill,
Expand Down Expand Up @@ -1037,3 +1044,79 @@ export function ThreadRowTrailingStatus({ thread }: { thread: SidebarThreadSumma
</span>
);
}

/** Number presentation for compact thread search results. */
function ThreadPullRequestNumber({
number,
className,
...props
}: ComponentProps<"span"> & { number: number }) {
return (
<span {...props} className={cn("shrink-0 text-xs tabular-nums", className)}>
#{number}
</span>
);
}

function settledPrHoverColorClass(state: NonNullable<ThreadPr>["state"], isDraft = false): string {
switch (state) {
case "open":
if (isDraft) {
return "group-hover/sidebar-row:text-zinc-500 dark:group-hover/sidebar-row:text-zinc-400/80";
}
return "group-hover/sidebar-row:text-emerald-600 dark:group-hover/sidebar-row:text-emerald-300/90";
case "merged":
return "group-hover/sidebar-row:text-violet-600 dark:group-hover/sidebar-row:text-violet-300/90";
case "closed":
return "group-hover/sidebar-row:text-red-600 dark:group-hover/sidebar-row:text-red-300/90";
}
}

export function ThreadSearchPullRequestNumber({
thread,
query,
enabled = true,
settled = false,
}: {
thread: SidebarThreadSummary;
query: string;
enabled?: boolean;
settled?: boolean;
}) {
const matchedLink = visibleThreadPullRequests(thread.pullRequests).find((pr) =>
pullRequestMatchesSearchQuery({ pullRequests: [pr] }, query),
);
const fallbackCandidates =
thread.pullRequests.length === 0
? [thread.linkedPullRequest, thread.branchPullRequest]
: [thread.branchPullRequest];
const legacyReference = matchedLink
? undefined
: fallbackCandidates.find(
(pr) => pr != null && pullRequestMatchesSearchQuery({ linkedPullRequest: pr }, query),
);
const legacyStatus = useLinkedThreadPullRequest(
thread.environmentId,
legacyReference,
enabled,
undefined,
legacyReference,
);
const reference = matchedLink ?? legacyReference;
const linked = matchedLink ? linkedPullRequestSnapshotStatus(matchedLink) : legacyStatus;
const status = prStatusIndicator(linked?.pr ?? null, linked?.sourceControlProvider);
return reference ? (
<ThreadPullRequestNumber
number={reference.number}
className={
settled
? cn(
"text-secondary-label transition-colors",
linked?.pr && settledPrHoverColorClass(linked.pr.state, linked.pr.isDraft),
)
: (status?.colorClass ?? "text-secondary-label")
}
aria-label={status?.tooltip ?? `Pull request #${reference.number}`}
/>
) : null;
}
25 changes: 25 additions & 0 deletions 25 packages/shared/src/threadPullRequests.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,31 @@ describe("chain selection and badge state", () => {
});

describe("threadPullRequestSearchTerms", () => {
it.each([undefined, [], [link(34)]])(
"searches the branch PR alongside existing links (%j)",
(pullRequests) => {
const branchPullRequest = {
projectId: ProjectId.make("project"),
repository: "pingdotgg/t3code",
number: 11809,
url: "https://github.com/pingdotgg/t3code/pull/11809",
};
const terms = threadPullRequestSearchTerms({
pullRequests,
branchPullRequest,
linkedPullRequest: {
...branchPullRequest,
number: 12,
url: "https://github.com/pingdotgg/t3code/pull/12",
},
});
for (const query of ["11809", "#11809", "pingdotgg/t3code#11809", branchPullRequest.url]) {
expect(terms.some((term) => term.includes(query))).toBe(true);
}
expect(terms).toContain(pullRequests?.length ? "#34" : "#12");
},
);

it("includes completed and unsynced links but excludes dismissed links", () => {
const terms = threadPullRequestSearchTerms({
pullRequests: [
Expand Down
25 changes: 17 additions & 8 deletions 25 packages/shared/src/threadPullRequests.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -308,21 +308,30 @@ export function resolveThreadPullRequestBadge(
return { kind: "pull-request", others: visible.length - 1, state };
}

/** Search terms for visible PR links, including the legacy single-link projection. */
/** Search terms for visible PR links, the legacy projection, and the branch PR. */
export function threadPullRequestSearchTerms(thread: {
readonly pullRequests?: ReadonlyArray<ThreadPullRequestLink> | undefined;
readonly linkedPullRequest?: ThreadLinkedPullRequest | null | undefined;
readonly branchPullRequest?: ThreadLinkedPullRequest | null | undefined;
}): string[] {
const branch = thread.branchPullRequest;
const terms = branch
? [`#${branch.number}`, `${branch.repository}#${branch.number}`, branch.url]
: [];
if (thread.pullRequests !== undefined && thread.pullRequests.length > 0) {
return visibleThreadPullRequests(thread.pullRequests).flatMap((link) => [
`#${link.number}`,
`${link.repository}#${link.number}`,
link.url,
link.snapshot?.title ?? "",
]);
return terms.concat(
visibleThreadPullRequests(thread.pullRequests).flatMap((link) => [
`#${link.number}`,
`${link.repository}#${link.number}`,
link.url,
link.snapshot?.title ?? "",
]),
);
}
const legacy = thread.linkedPullRequest;
return legacy ? [`#${legacy.number}`, `${legacy.repository}#${legacy.number}`, legacy.url] : [];
return legacy
? terms.concat([`#${legacy.number}`, `${legacy.repository}#${legacy.number}`, legacy.url])
: terms;
}

/** Older V2 event payloads stored one link; an explicit empty array means it was unlinked. */
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.