Skip to content

fix(web): the PR badge shows for "pr 123" searches that list the thread - #44267

Closed
iamshadmantaqi wants to merge 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/pr-badge-prefix
Closed

iamshadmantaqi wants to merge 3 commits into
pingdotgg:mainfrom
iamshadmantaqi:fix/pr-badge-prefix

Conversation

@iamshadmantaqi

Copy link
Copy Markdown
Contributor

Problem

Thread search lists a thread for "pr 22889" but hides its pull request badge. Sidebar search and Cmd+K show the matching PR's badge (icon, number, state colour) beside the title when the query matched one of the thread's PRs. Thread search accepts the prefixes "pr", "pull request" and "pull", and a query in double quotes, so "#22889", "pr 22889", "PR #22889", "pull request 22889" and "#22889" all find the thread. Only the first of them shows the badge. In the sidebar, which has no match-hint line, the row then gives no sign of why it matched.

Steps (Linux, no sign-in):

  1. Link a PR to a thread (ask the agent to link_pull_request a public PR URL, or open a thread on a branch with a PR).
  2. Type #<number> in the sidebar search: the row shows the PR badge.
  3. Type pr <number> or PR #<number>: the same row is listed but the badge is gone. Same in Cmd+K.

Cause

pullRequestMatchesSearchQuery in apps/web/src/components/Sidebar.logic.ts splits the query on spaces and requires every token as a substring of "#22889 owner/repo#22889 <title>". The token "pr", "request" or a quote character is never in that text. Ranking uses scoreThreadSearch, whose threadFieldQuery strips the prefixes and quotes, so the list and the badge disagree. The badge matcher dates from #14658; the prefix stripping came later with the thread search work and the badge was not moved over.

Change

The badge is matched with scoreThreadSearch on a subject that holds only the thread's pull requests, so it shows exactly when the PR fields match the query as search reads it. One file, 16 lines; the normalizeSearchText import goes.

Behaviour note: a short repo-name word (for example "widgets") used to light the badge by substring. References now count only as search counts them (the whole query, 8 or more characters), which matches when the thread is listed at all.

Scope

Small fix of an obvious bug, steps reproduce it, so it needs no issue.

Verification

New Sidebar.logic.test.ts case "shows the number for every pull request query the search lists the thread for": for "#22889", "pr 22889", "PR #22889", "pull request 22889" and "#22889", searchSidebarThreads lists the thread and pullRequestMatchesSearchQuery is true; "22889" and "acme/widgets#22889" are true, "trim" (title only) is false.

Test commit alone, on main fe03466:

FAIL  src/components/Sidebar.logic.test.ts > pullRequestMatchesSearchQuery > shows the number for every pull request query the search lists the thread for
AssertionError: pr 22889: expected false to be true
Tests  1 failed | 95 skipped (96)

With the fix:

Test Files  1 passed (1)
Tests  96 passed (96)

vp run check:changed: format, lint, knip, typecheck (2 packages), test (2 files, 101 tests) and React Compiler (1 file) all pass.

Not verified: I did not link a real PR and look at the sidebar row; the test checks the matcher against the same query list the search accepts.

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 30e6d01 and 52eddf8.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The pull-request matcher now uses thread-search scoring instead of normalized-token substring matching. Tests compare its results with sidebar thread search for several pull-request number formats.

Changes: Pull-request search matching

Layer / File(s) Summary
Align pull-request matching with thread search
apps/web/src/components/Sidebar.logic.ts, apps/web/src/components/Sidebar.logic.test.ts
pullRequestMatchesSearchQuery builds a pull-request-only search subject and checks it with scoreThreadSearch. Tests cover prefixed, unprefixed, and repository-qualified pull-request numbers, plus a non-matching title query.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review 30e6d

This change makes the pull-request badge in sidebar search follow the same matching rules as thread listing. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the change: the PR badge is wrong for "pr 123" searches that list the thread. It follows the conventional commit form and matches the raw summary, which shows pullRequestMatchesSearchQ…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections. It gives reproduction steps, the cause in Sidebar.logic.ts, the fix, and a scope rationale for skipping …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: the PR badge is wrong for "pr 123" searches that list the thread. It follows the conventional commit form and matches the raw summary, which shows pullRequestMatchesSearchQuery now uses scoreThreadSearch so badge visibility follows thread search matching.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections. It gives reproduction steps, the cause in Sidebar.logic.ts, the fix, and a scope rationale for skipping an issue. Verification shows a failing test before the fix and passing results after. It states that the real sidebar row was not checked. The template asks for before/after screenshots for UI changes, and none are attached, but the author explains that the change was verified by a test and not by a visual check. This is a minor gap.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between fe03466 and 30e6d01.

Files selected for processing: 2

  • apps/web/src/components/Sidebar.logic.test.ts
  • apps/web/src/components/Sidebar.logic.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 27, 2026
@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants