Skip to content

fix(github): show pull request status for anchors and subpages - #2055

Merged
tellaho merged 1 commit into
mainfrom
tho/github-pr-link-suffixes
Oct 30, 2026
Merged

tellaho merged 1 commit into
mainfrom
tho/github-pr-link-suffixes

Conversation

@tellaho

@tellaho tellaho commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Category: fix
User Impact: Pull request links show their status icon even when the URL includes an anchor or a pull request subpage.

Problem: Links such as https://github.com/block/buzz-app/pull/2043#top fell back to the generic GitHub icon. Links to /commits, /checks, /changes, and /files had the same problem.

Solution: Recognize the parent pull request for badge rendering and share its status lookup across URL variants. Keep the complete authored URL for navigation and preserve the panel's existing handling of destinations it cannot display.

File changes

src/bundled/github/references.ts
Add an opt-in mode that identifies a parent pull request from anchors and subpages, retaining existing URL validation and default panel matching.

src/bundled/github/index.tsx
Use parent pull request recognition when selecting the status badge renderer.

src/bundled/github/PullLink.tsx
Subscribe to the canonical pull request's state while retaining the authored link's destination and label.

src/bundled/github/references.test.ts
Cover anchors, queries, nested subpages, invalid hosts and PR numbers, and unchanged panel matching.

src/bundled/github/PullLink.test.tsx
Verify that URL variants render the PR badge, share one status request, and pass their complete URL through on click.

Reproduction steps

  1. Post a message containing a plain PR link and variants ending in #top, /commits, /checks?check_run_id=1, and /changes#diff-123.
  2. Confirm that every variant displays the same pull request status icon.
  3. Open the links and confirm their complete destinations are preserved.

Validation

At 400d7b8ddcd88acc561bf61553ba9731201bdfe2:

  • bin/pnpm exec vitest run src/bundled/github src/features/conversation/MessageLink.test.tsx src/features/panels/service.test.tsx — 320 tests passed in 21 files.
  • bin/pnpm typecheck passed; commit hooks passed.
  • New regression tests failed before the production fix and passed afterward.
  • The author tested the change in the running app and confirmed the result shown below.
  • No browser journeys were added or removed. Independent review and hosted CI remain pending; a separate agent walkthrough in the live app has not been performed.

Screenshot

Cropped from the author's real-app test capture to show the anchored link and its status icon.

After: PR link ending in #top
Anchored pull request link displays its status icon

Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@feedback.communities.buzz.xyz>
Signed-off-by: Taylor Ho <[email protected]>
@tellaho

tellaho commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Adversarial review by Princess Donut, an AI agent, posted from Taylor's GitHub account on Taylor's behalf.

Reviewed head: 400d7b8ddcd88acc561bf61553ba9731201bdfe2. Verdict: I found no blocking or material problems, so this needs no changes. This comment is not an approval.

What I checked

Area Result
The panel stays strict The panel's matches (src/bundled/github/index.tsx:73), github_link_pr (:159), Solo pull links (solo-pull.ts:44) and the store's keyOf all still call parseGitHubReference without pullSubtargets. Only the badge renderer (index.tsx:113) and PullLink opt in.
Clicking a link PullLink still passes the full href. openLink calls panelOpening (ChannelsPage.tsx:1579), which uses the strict panel matcher. An anchored or subpage link therefore opens its exact GitHub destination, not the panel. The new PullLink test checks onOpenLink receives each full URL.
State lookup The store keys and fetches by the strict canonical URL (keyOf; url.split("/").at(-1) at pull-states.ts:402). Passing the parsed parent identity rather than the raw URL is therefore required, and correct. A raw …/pull/7/checks would fall through keyOf as "not a pull request" and read as failed. Keeping the opt-in in PullLink instead of widening keyOf keeps agents' watches and panel lookups strict. That is the better place for it.
Parser boundaries Host, scheme, port and credentials checks still run before the new branch. issues/N stays strict. pull/0, numbers above the 32-bit limit, and 23oops are rejected. .. segments are normalized by URL before splitting. An encoded %2F stays inside the segment and fails the number check. The tests cover each of these, and the lookalike-host and credential cases now also cover the opt-in.
Other changes Switching rest.join("/") to rest[0] changes nothing for issues and commit, which still need rest.length === 1. Only one place resolves link renderers (MessageLink.tsx:94). The composer still reads nothing (live is false), so typing a subpath causes no reads.

Noted, no change needed

  • Any subpath gets a badge. …/pull/7/<anything> shows PR 7's state, including subpages GitHub doesn't have. I'm leaving this as is: the link sits inside PR 7, and GitHub still decides where it lands. Limiting it to a list of known subpages would break whenever GitHub adds one.

Validation

I read the code and traced the call paths at this head. I didn't rerun the suites: Carl's recorded run covered 320 tests across the GitHub plugin, message links and panel service, and CI is running the full suite.

@tellaho
tellaho marked this pull request as ready for review October 30, 2026 22:46
@tellaho
tellaho requested a review from a team as a code owner October 30, 2026 22:46

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Reviewed 400d7b8. No actionable findings. Canonical PR badge state preserves authored link destinations; parser, component, and isolated Chromium/WebKit checks passed. An oversized-message WebKit pointer issue at narrow width/enlarged text remains unattributed; live GitHub/relay and native integration were not exercised.

@tellaho
tellaho merged commit f4720ce into main Oct 30, 2026
40 checks passed
@tellaho
tellaho deleted the tho/github-pr-link-suffixes branch October 30, 2026 23:02
shellz-n-stuff added a commit that referenced this pull request Oct 31, 2026
Picks up the month-boundary StatusEditor test fix (#2064).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* origin/main: (56 commits)
  perf(sidebar): subscribe to selected live and list facts (#1966)
  feat(desktop): align the sign-in callback page with web branding (#2038)
  Show linked PRs in Solo headers and move idle huddles to Chat actions (#1968)
  feat(messages): mark edited messages with "(edited)" (#2020)
  feat(desktop): bundle the buzz CLI in every package (#2027)
  feat(plugins): open a plugin page from buzz://plugin links (#2053)
  feat(plugins): managed plugin sources (#2052)
  test(browser): prevent sampled clock pause races (#1955)
  test: fix month-boundary and Sonner mount races in StatusEditor and RelayStaff tests (#2064)
  test: stop tests leaving temp dirs and a flake-check fixture behind (#1977)
  fix(messages): release Virtua's held range when scrolling stops (#2032)
  test(mcp): allow protection checks in bundled help fixture (#2061)
  fix(emoji): recover transient image failures without reopening chats (#2000)
  test: wait for dialog focus, reach a reading position, re-sign pair() (#1975)
  feat(plugins): sign builderlab in through the native fi session in fi builds (#1461)
  feat(agents): offer bundled Buzz help (#2033)
  fix(github): show pull request status for anchors and subpages (#2055)
  fix(dialogs): focus safe controls and task inputs (#2021)
  fix(composer): truncate workspace names at narrow widths (#2043)
  AIDA-2287: Refresh public channel search incrementally (#2023)
  ...

Signed-off-by: Alex Rosenzweig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants