feat(panel): links to a pull request's own comments on GitHub open in its tab
Merged
DA
12d ago+526+526+012345678901234567890123456789-132-132-012345678901234567890123456789
Stacked on #3884, which adds the thread link and the jumps. This is item 4 of the deep-links work: a link in a PR's description or comments that points at one of that PR's own comments on GitHub now opens in the Pull request tab instead of the browser.
What it does
pull-request-anchors.ts (anchorIn) reads a GitHub link against the conversation the tab already read:
| Link | Opens |
|---|---|
…/pull/N#discussion_r<id>, …/pull/N/files#r<id> | The thread that comment stands in, a reply included, through the thread's own Luke link route (LINK_PLACE.PULL_REQUEST_THREAD, Conversation) from #3884 |
…/pull/N#issuecomment-<id>, …/pull/N#pullrequestreview-<id> | That entry in the Conversation: scrolled to its centre, ringed, and focused |
| Anything else: another PR, the page with no fragment, or a comment the read didn't reach (the earlier entries left on GitHub, say) | GitHub, as before |
The match uses the url each entry and thread comment already carries, so it needs no service change.
How
OpenHereFirst(use-open-link): asks the tab's opener first and any place's opener around it after, so the Inbox's own opener still works.Anchoredwraps only the PR's own words: the description, entries and thread comments, in either view. "N more replies on GitHub" and "N earlier comments on GitHub" still leave for GitHub on purpose.- Landing: the hook from #3884 now lands any card, keyed by a thread's id or an entry's page (
useLandedEntry). - Filters: Hide resolved and Hide bots now take a set of kept keys, so an entry brought into view stays visible even when a filter would hide it.
Tests
pull-request-anchors.test:- a line comment's link names its thread: on the page, under the Files tab, through a reply, and whatever the case of owner and repo
- comment and review links name their entries
- another PR, another repo, the page alone, an unread comment, a
#diff-…anchor, or a non-GitHub host names nothing
agent-pull-request-tab.test: in the description, a#discussion_rlink takes the thread's route; an#issuecommentlink rings and focuses the note; an unread#issuecomment-99still opens GitHub.
Checks
- panel tsc, the touched panel suites, oxlint, biome and knip pass.
- Desktop/panel only, no service change, so no Preview run is needed.
Made with Luke