feat(host-service,desktop): GitLab MR discussions, job logs, PR pane and workspace from MR

Draft
GE
13d ago
+988-50

What & why

Part of #6445. Follow-up to #8719 and stacked on it: only the last commit is new (compare).

GitLab merge requests get the review features GitHub PRs have, through the same glab calls as #8719:

  • Discussions: in the Review tab and the PR pane. Reading maps diff notes to review threads and other notes to conversation. Reply and resolve/unresolve work too.
  • CI job logs: "Copy job logs" works for a failed GitLab job (glab ci trace), only for jobs of the MR's own project.
  • PR pane:
    • GitLab MR links open in the pane, with content, diff (glab mr diff --raw), merge, close/reopen and ready/draft.
    • A GitLab ref keeps its host in the repo name, so the GitHub fallbacks never read it as a GitHub repo.
    • Writes reuse the GitHub path's sync-after-write.
  • Workspace from an MR:
    • The PR picker searches the project's MRs: by text, 12, !12, or the MR URL.
    • Checkout reads the branch and head from glab mr view.

+454/−13 source lines, +78 test lines.

Not covered:

  • MRs from forks (checkout refuses them).
  • The pane's commit list and +/− line counts.
  • GitLab projects inside a multi-project PR search.

How I tested it

  • Unit tests: the discussion mapping, and GitLab MR links opening the pane. GitHub-path tests run unchanged; their contexts now state "not GitLab".
  • Read paths run live against a self-managed GitLab: threads, content, search, checkout metadata, job log.
  • Write commands checked against a local fake GitLab API: reply, resolve, close/reopen, ready/draft, merge with a squash message.
  • bun test in packages/host-service: 2609 pass. bun run lint is clean.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint passes. bun run typecheck reports no errors in the changed files; the local desktop check fails on unrelated UI-library types.
  • "Allow edits from maintainers" is checked on fork PRs

Summary by cubic

GitLab merge requests get the review features GitHub PRs already have: status and approval display, CI job log copying, discussions with reply and resolve, the PR pane, and workspace creation from an MR. All calls go through the user's own glab CLI, so self-managed instances work without extra setup. GitLab repos keep their host in the repo name so they can never be read as a GitHub repo.

  • A linked MR shows its state and its head pipeline's jobs as checks; merge, create, close/reopen, and ready/draft run through glab.
  • An MR is approved only when GitLab reports approved with at least one approver; a blocking manual job stays a pending check and an optional one counts as skipped.
  • The PR picker searches one GitLab project's MRs by text, !12, 12, or the MR URL; checkout reads branch and head via glab mr view. Fork MRs are refused.
  • "Copy job logs" works only for failed jobs of the MR's own project (glab ci trace); the pane's commit list and line counts are not shown for GitLab.
  • The "View on GitHub" labels in the PR menu and card now read "Open in browser".
  • GitLab hosts are detected by asking glab whether it knows the host (confirmed hosts are remembered; unknown ones are re-asked at each refresh), not by parsing the URL.