Repository navigation
Support GitLab: custom-domain detection + MR list/detailed - #814
Conversation
Two GitLab holes shipped together since they're useless apart.
Detection: add detectPlatformCore(runtime, host) in pr-provider.ts,
bound as detectPlatform(host) in server/pr.ts (mirrors checkAuthCore
-> checkPRAuth). Layered cheap->expensive: host-name fast path
(gitlab/github substrings, no I/O), then a single
`glab auth status --hostname <host>` probe for ambiguous custom
domains; success -> gitlab. glab-absent (ENOENT) and glab-unauthed
fall through to the historical github default (no regression). The
daemon endpoint now uses `await detectPlatform(host)` instead of
host.includes("gitlab"); the per-cwd 30s cache means the probe runs
at most once per project per window.
List: implement fetchGlMRList / fetchGlMRDetailedList against
projects/:id/merge_requests?per_page=30&state=all via the existing
apiArgs/parsePaginatedArray helpers, with exported pure mappers
mapGlMrToListItem / mapGlMrToDetailedItem. Wire pr-provider's
fetchPRList/fetchPRDetailedList to dispatch to them instead of [].
Known GitLab limitation (deliberate): the MR-list endpoint omits
per-MR additions/deletions (fetching them is one extra call per MR,
~30 for the dashboard), so detailed items use additions:0, deletions:0
and reviewDecision:"" (approvals are a separate endpoint, out of scope
for v1). Everything else populates: commentCount (user_notes_count),
updatedAt, isDraft (draft || work_in_progress), branches, state.
GitHub path untouched. Unit tests cover the mappers against a
hand-written merge_requests fixture and detectPlatformCore across
github.com / gitlab.com / gitlab.example.com / github.acme.com /
ambiguous code.company.com (probe success, auth-fail, ENOENT).
…ceholder/+0-0 Fix pass on the GitLab MR support from the prior commit, addressing a 4-model adversarial review. - pr-gitlab.ts: fetchGlMRList/fetchGlMRDetailedList no longer silently return [] on a non-zero glab exit (403/network/rate-limit looked identical to 'zero MRs'). Both now console.error(stderr) and throw via a shared fetchGlMRRaw() helper (dedups the identical glab call). - daemon/server.ts: the /daemon/projects/prs[/detailed] catch now returns error:'fetch-failed' + message instead of a bare empty list, so a failed fetch is distinguishable from an empty repo. GitHub benefits too. - contracts.ts: add 'fetch-failed' to the PR(Detailed)ListResponse error union. git-dashboard-store.ts + LandingPage PRList surface it with a 'Failed to load merge/pull requests' message reusing the existing no-cli/auth-failed display pattern. - LandingPage.tsx: remove the stale 'GitLab MR listing coming soon' placeholder; GitLab now falls through to the shared empty state. - pr.ts: detectPlatform now caches host->platform for the daemon lifetime (the probe ran up to ~4x on a cold ambiguous-host load) and bounds the glab auth probe with a 5s Promise.race timeout (PRRuntime.runCommand has no timeout option) so a slow self-hosted host can't hang the dashboard. - PRRow.tsx: render an em dash instead of a misleading +0/-0 for GitLab, whose MR-list endpoint omits per-MR additions/deletions (platform now threaded onto GitDashboardPR). - pr-gitlab.test.ts: add fake-runtime tests asserting the exact glab args, --hostname for self-hosted, and that a non-zero exit now throws.
Fix pass (4-model adversarial review)Pushed Fix 1 — Stop silent-empty on fetch failure (unanimous Act-On). Fix 2 — Remove stale "GitLab MR listing coming soon" placeholder (Act-On). Replaced with fall-through to the shared zero-PR empty state. Edit is confined to the placeholder region (~L633); the Fix 3 — Cache platform per host + bound the probe (unanimous Act-On). Fix 4 — Fix 5 — Dedup + fetch test (Consider). The two identical Verification
Notable behavior change
Follow-up (out of scope for this pass)Deeper GHE-vs-GitLab host verification beyond the credential probe was deliberately deferred. Fix 1's error surfacing already de-opaques the misclassification case (a wrong platform guess now produces a visible |
What
Makes Plannotator's project dashboard actually work for GitLab users. Two holes that are useless apart, shipped together:
code.company.com) was misdetected as GitHub, so the daemon ranghagainst a GitLab server and failed silently.fetchPRList/fetchPRDetailedListreturned[]for GitLab, so the dashboard showed "No pull requests found" even with open MRs.Changes
Detection (
packages/shared/pr-provider.ts,packages/server/pr.ts,packages/server/daemon/server.ts)detectPlatformCore(runtime, host)inpr-provider.ts, bound asdetectPlatform(host)inserver/pr.ts— mirrors the existingcheckAuthCore→checkPRAuthpattern.gitlab/githubsubstrings, zero I/O), then for ambiguous custom domains a singleglab auth status --hostname <host>probe whose success means GitLab.glab-absent (ENOENT) andglab-unauthed both fall through to the historical github default — no regression for any host that worked before./daemon/projects/prs[/detailed]endpoint now callsawait detectPlatform(host)instead ofhost.includes("gitlab"). The existing per-cwd 30s cache means the probe runs at most once per project per window.MR list (
packages/shared/pr-gitlab.ts,packages/shared/pr-provider.ts)fetchGlMRList/fetchGlMRDetailedListagainstprojects/:id/merge_requests?per_page=30&state=all, using the existingapiArgs(handles--hostnamefor self-hosted) andparsePaginatedArrayhelpers.mapGlMrToListItem/mapGlMrToDetailedItemso they're unit-testable without spawningglab. Field mapping:iid→number/id,author.username→author,web_url→url,source_branch→headBranch,target_branch→baseBranch; stateopened→open,merged→merged,closed/locked→closed.pr-provider.tsdispatches GitLab to these instead of returning[].Deliberate GitLab limitation (confirmed tradeoff)
GitLab's MR-list endpoint does not return per-MR
additions/deletions. Fetching them needs one extra API call per MR (~30 for the dashboard), which is unacceptable for a list view. Detailed items therefore setadditions: 0, deletions: 0andreviewDecision: ""(GitLab approvals are a separate endpoint, out of scope for v1). Everything else populates:commentCount(fromuser_notes_count),updatedAt,isDraft(draftor legacywork_in_progress), branches, and state.Verification
bun test(root): 1345 pass, 0 fail. Newpr-gitlab.test.tscases cover both mappers against a hand-writtenmerge_requestsJSON fixture (opened/merged/closed/locked/draft, null author, falsy-zerouser_notes_count, legacywork_in_progress) anddetectPlatformCoreacrossgithub.com,gitlab.com,gitlab.example.com,github.acme.com, and an ambiguouscode.company.com(probe success → gitlab; auth-fail → github; ENOENT → github), asserting the fast paths never shell out.bun run typecheck: clean across all five tsconfigs (shared, ai, server, ui, pi-extension).githubbranch of every dispatcher is unchanged.Deferred
glabis not installed/authed on this machine, so the optionalcurl /daemon/projects/prs?cwd=<gitlab repo>check was not run. Unit tests are the gate per the task spec.additions/deletionsleft at0for GitLab detailed items (limitation above).reviewDecision(approvals) not fetched — separate endpoint, out of scope for v1.