Before submitting#
Area#
apps/server
Steps to reproduce#
- Open a GitLab merge request in the pull request pane.
- Go to the Code tab.
- Click an "N unmodified lines" divider between two hunks.
Expected behavior#
The hidden lines are revealed, as they are for GitHub PRs (#5546 lists GitLab as supported). If expanding fails, an error is shown.
Actual behavior#
Nothing visible happens: no lines expand and no error appears. The error is only logged to the DevTools console.
Impact#
Major degradation or frequent failure
Version or commit#
0.0.46-nightly.20261008.2813
Environment#
macOS, desktop app, GitLab
Logs or stack traces#
PullRequestOperationError: Pull request operation diffFileContents failed: This host cannot expand unchanged pull request lines.
loadFilesForDiff @ renderDiffChildren-D8HsbUTF.js:1
loadFilesIfNecessary @ renderDiffChildren-D8HsbUTF.js:1
expandHunk @ renderDiffChildren-D8HsbUTF.js:1
handleExpandHunk @ renderDiffChildren-D8HsbUTF.js:1
handlePointerEvent @ WorkerPoolContext-D4Io5ghu.js:1
handlePointerClick @ WorkerPoolContext-D4Io5ghu.js:1
Note
Grok responding on behalf of Julius.
Thanks for the clear report and the stack trace. I traced it on current
main(5e22256). There are two separate problems here.1. The GitLab provider never wires up expansion#
The error comes from
PullRequestService.diffFileContents(apps/server/src/pullRequest/PullRequestService.ts:1901-1923). It refuses with "This host cannot expand unchanged pull request lines." whenever the host's provider has nogetDiffFileContents.GitLab can already do this read.
GitLabPullRequestCli.getMergeRequestDiffFileContents(apps/server/src/pullRequest/GitLabPullRequestCli.ts:1250-1299) was added in #5546 and has tests (GitLabPullRequestCli.test.ts~L620-780). It reads the MR'sdiff_refs(or a commit's parent for the per-commit view). Then it fetches both sides fromprojects/:id/repository/files/:path/raw?ref=<sha>, with the same 1 MB and binary limits as GitHub.The step that's missing is in
GitLabPullRequestProvider.ts. GitHub wires its CLI method into the provider (GitHubPullRequestProvider.ts:549-550), and Forgejo and Azure DevOps have their own. The GitLab provider only exposesgetDiff(GitLabPullRequestProvider.ts:231) and never setsgetDiffFileContents. So the optional method isundefined, it's left out atPullRequestService.ts:643-645, and every expand on a GitLab MR fails. The provider file at #5546's merge commit has the same gap, so this looks like an oversight from that PR rather than a later regression.The fix is likely small. Add the following to the GitLab provider, next to
getDiff, plus a provider-level test:I haven't run this against a live GitLab instance. Fork MRs and older self-managed GitLab (see #15660 / #15886) are worth a quick check once it's wired.
Bitbucket appears to be in the same state:
diff: truebut nogetDiffFileContents. It probably fails the same way, though I didn't verify that.2. The web UI swallows the failure#
Even with GitLab fixed, any expansion failure is currently invisible. That includes the existing "oversized" (>1 MB) and "binary" errors on GitHub.
createPullRequestDiffFileContentsLoaderto the diff viewer asloadDiffFiles(apps/web/src/components/pullRequest/PullRequestCodeTab.tsx:361-371, 896). The loader throws on failure (apps/web/src/lib/diffFileContents.ts:119-121).useAtomCommand's default failure reporting only does aconsole.warn(packages/client-runtime/src/state/runtime.ts:418-433). It doesn't show a toast.@pierre/diffs1.5.2FileDiff.loadFilesForDiffcatches the loader error and just callsconsole.error(dist/components/FileDiff.js:555-563). That's the trace in your report.expandHunklikely still re-renders, but with nothing loaded to reveal, so the click appears to do nothing.There's also no capability flag for expansion:
PullRequestCapabilities(packages/contracts/src/pullRequest.ts:394) only hasdiff. So the client can't hide or disable the "N unmodified lines" divider for a host that can't expand. How to surface this is a UX choice: show an error toast or inline notice when the loader fails, add anexpandcapability and hide the divider, or both. Fixing (1) removes the GitLab case either way.Summary#
getDiffFileContentsintoGitLabPullRequestProviderwith a test, and separately decide how expansion failures should be shown in the Code tab.