Skip to content

feat(pull-requests): open GitLab merge requests in an MR !N tab - #1707

Merged
i098 merged 1 commit into
mainfrom
fm/cgx-n198-840-gitlab-mr
Dec 5, 2026
Merged

i098 merged 1 commit into
mainfrom
fm/cgx-n198-840-gitlab-mr

Conversation

@i098

@i098 i098 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Refs #1704
Refs #840

Summary

View PR on a GitLab merge request now opens the Code Review side panel tab, titled MR !N like the original's mergeRequestTab.title, with the merge request Summary.

What changed and why

  • Identity::from_url parses https://{host}/{group path}/{project}/-/merge_requests/{n} (nested groups) and sets a gitlab flag; url() and the new label() follow it.
  • The tab title comes from Identity::label(): MR !N for GitLab, PR #N as before.
  • Host: glab-current-user reads the account with glab api user; gh-pr-detail reads a GitLab merge request with glab api projects/:path/merge_requests/:iid and maps it to the Summary fields (branch, reviewers, note count, pipeline, status, description).
  • The thread PR summary returns the branch's open merge request (the existing glab mr list lookup), so View PR is enabled on a GitLab branch.
  • The draft and reopen button is hidden for GitLab: the original's GitLab connector capabilities have no state change call.

Out of scope: the other #840 gaps, and the Code tab diff for GitLab.

Test evidence

  • cargo clippy -p ui -p app --all-targets -- -D warnings: clean. cargo fmt --all --check: clean.
  • Linux: cargo test -p ui --lib pull_requests (19 passed), cargo test -p app --lib -- host::github_pull_requests host::git_pr pull_requests (17 passed), cargo test -p app --test pull_request_tab --test pull_requests (3 + 8 passed).
  • macOS (MacBook, headless Metal window, nice -n 19): cargo test --locked -p app --test pull_request_tab passed 3/3; the front app stayed WezTerm in every sample.
  • New tests: GitLab cases in pull_request_urls_parse_and_other_urls_do_not, merge_request_maps_to_the_summary_fields, view_pr_opens_a_gitlab_merge_request_tab.
  • Live glab on a signed-in GitLab host: not run (no GitLab account on the test hosts); the test host answers the two GitLab reads.

Before (main): View PR on a merge request URL sends it to the browser; the thread shows no tab.
After: the MR !7 tab with the merge request Summary.
No original GitLab capture exists, so there is no original-vs-ours slider.

Checklist

  • One concern in this pull request.
  • The title and every commit follow Conventional Commits.
  • cargo fmt --check is clean.
  • cargo clippy --workspace --all-targets -- -D warnings is clean. (ran for ui and app, the changed crates)
  • cargo test --workspace passes. (ran the affected tests of the changed crates, listed above)
  • A visual change passes cargo run -p parity -- --gate on macOS. (new tab state; no original GitLab capture to compare)
  • A user-visible change has a line under ## [Unreleased] in CHANGELOG.md. (this task must not edit CHANGELOG.md)

Before: View PR on a merge request URL opens no tab

After: MR !7 tab with the merge request Summary

- Parse GitLab merge request URLs into the pull request Identity, with nested group paths.
- Title the side panel tab MR !N, as the original's mergeRequestTab.title.
- Read the account and merge request detail through glab api into the Summary shape.
- Return the branch's open merge request from the thread PR summary, so View PR opens it.
- Hide the draft and reopen action for GitLab; the original's connector has no such call.

Refs #1704
Refs #840
@i098
i098 merged commit c1a3143 into main Dec 5, 2026
4 checks passed
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.

1 participant