Skip to content

feat(web): add PR Link to thread copy menu - #10710

Open
flamboh wants to merge 1 commit into
pingdotgg:mainfrom
flamboh:t3code/add-pr-link-context-menu
Open

feat(web): add PR Link to thread copy menu#10710
flamboh wants to merge 1 commit into
pingdotgg:mainfrom
flamboh:t3code/add-pr-link-context-menu

Conversation

@flamboh

@flamboh flamboh commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Note

🤖 GPT-6 on behalf of Oliver

ELI5

Copy a thread's pull request URL from Copy → PR Link.

Problem

The thread Copy submenu offers its path, branch, and ID, but no PR URL.

Implementation

Add PR Link to the shared sidebar and chat-header menu when a linked or branch PR exists. Prefer the explicitly linked PR and reuse the clipboard helper and success/error toasts. Add the link icon to the web context-menu renderer.

Validated with 19 focused tests, web typecheck, targeted lint, and browser checks for linked PRs, branch PRs, no-PR visibility, and the chat header. Lint reports existing Sidebar warnings. Independent code review found no remaining issues.

UI Changes

Before

Copy menu before

After

Copy menu with PR Link

Made with GPT-6 in Codex.

Note

Add copy-PR-link action to thread context menu

  • Extends ThreadActionMenuState with a nullable prUrl field and conditionally adds the PR Link item to the Copy submenu when a URL is present
  • The sidebar and useThreadActionMenu hook resolve the PR URL from the thread's linked pull request, falling back to its branch pull request, and copy it with success/failure toasts
  • Adds a link icon to the fallback context menu renderer in contextMenuFallback.ts
  • Behavioral Change: ThreadActionMenuState adds a required prUrl field; in-tree consumers are updated, but external consumers of this shared builder must provide it

Macroscope summarized 6084827.

Summary by CodeRabbit

  • New Features

    • Added a Copy PR Link option to thread context menus when a pull request is associated with the thread.
    • Copies the pull request URL to the clipboard and displays a success or error notification.
    • Added a link icon for the new menu action.
  • Tests

    • Added coverage for displaying the PR link option only when a pull request URL is available.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6084827

Macroscope's review found this PR approvable — Adds a small, explicit Copy → PR Link action using existing thread metadata and clipboard infrastructure. Threads without a PR are unchanged, and the focused test covers conditional menu visibility.

You can add or adjust custom eligibility rules. Learn more.

@macroscopeapp macroscopeapp Bot 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.

All clear

Posted via Macroscope — Effect Service Conventions

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 8aec8994-ae13-4cb8-98be-0e973c4724b9

📥 Commits

Reviewing files that changed from the base of the PR and between d6dbe8d and 6084827.

📒 Files selected for processing (5)
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/components/threadActionMenu.logic.test.ts
  • apps/web/src/components/threadActionMenu.logic.ts
  • apps/web/src/contextMenuFallback.ts
  • apps/web/src/hooks/useThreadActionMenu.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The thread context menu now includes a conditional “PR Link” action. The action resolves pull-request URLs from thread metadata, copies the URL to the clipboard, and displays success or failure toasts.

Changes

Thread PR link copying

Layer / File(s) Summary
PR link menu contract
apps/web/src/components/threadActionMenu.logic.ts, apps/web/src/components/threadActionMenu.logic.test.ts, apps/web/src/contextMenuFallback.ts
The menu state and ID union support PR links. The Copy submenu renders the item only when a PR URL exists. Tests cover both states. The link icon is registered.
Clipboard action handling
apps/web/src/hooks/useThreadActionMenu.ts
The hook derives a PR URL, copies it, displays success or failure toasts, and handles the new menu action.
Sidebar menu wiring
apps/web/src/components/Sidebar.tsx
The sidebar resolves pull-request metadata, passes the URL to the menu builder, handles copying, and updates callback dependencies.

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

Merge Risk: ⚪ Minimal · up to 60848

Thread menus now conditionally offer PR-link copying with success and failure feedback. The supplied coverage and wiring indicate the feature is ready to merge without an identified user or production risk.

Sequence Diagram(s)

sequenceDiagram
  participant ThreadContextMenu
  participant useThreadActionMenu
  participant Clipboard
  participant Toast
  ThreadContextMenu->>useThreadActionMenu: select copy-pr-link
  useThreadActionMenu->>Clipboard: copy PR URL
  Clipboard-->>useThreadActionMenu: success or failure
  useThreadActionMenu->>Toast: show copy result
Loading

Suggested reviewers: utkarshusername, t3dotgg, maria-rcks

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description explains what changed, why it changed, and the implementation. It includes before-and-after UI screenshots and validation details. The repository checklist is not included, but the req…
Title check ✅ Passed The title clearly and concisely describes the main change: adding a PR Link option to the thread copy menu.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant