klinux / klinux/gocdnext

VCS PR lifecycle ingestion: equalize GitLab + Bitbucket with GitHub

Open
#123 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
7
Forks
3
Avg merge
2h 12m
Merged PRs (30d)
30

Description

Follow-up to #122 (#112 phase 1), which landed PR lifecycle ingestion (opened_at / approved_at / merged_at / merge_shavcs_pull_requests) for GitHub only. This issue tracks bringing GitLab and Bitbucket to parity so DORA lead-time decomposition (Coding / Review stages) works regardless of provider. Do it when there's a real need (a GitLab/Bitbucket user wants the bottleneck card).

Scope

Mirror the GitHub work in the existing provider-uniform webhook path:

  • GitLab (merge_request + approval events):
    • merge_request payload → opened_at (object_attributes.created_at), merged_at + merge SHA (merge_commit_sha on action merge).
    • Approvals: the Merge request approval webhook (object_attributes.action = 'approved') → approved_at. (GitLab emits approvals on the same MR hook with an approved action, or a dedicated event depending on version — confirm.)
    • Repo key: project.path_with_namespace.
  • Bitbucket (pullrequest:* events):
    • pullrequest:createdopened_at; pullrequest:fulfilledmerged_at + merge hash.
    • pullrequest:approvedapproved_at.
    • Repo key: repository.full_name.

Implementation notes

  • The store layer (RecordPullRequest{Opened,Approved,Merged}) and the vcs_pull_requests table are provider-agnostic already — pass provider = 'gitlab' | 'bitbucket'. Only the parsers + the webhook routing/dispatch need new code.
  • Add the lifecycle persistence alongside the existing handleGitLabMergeRequest / handleBitbucketPullRequest (mirror recordGitHubPR), and route the new approval events.
  • Parser unit tests + an end-to-end handler test per provider (mirror pr_lifecycle_test.go).

Done when

GitLab and Bitbucket PRs/MRs populate the same lifecycle timestamps as GitHub, with tests, so the phase-2 correlation + bottleneck card are provider-uniform.

Refs #112, #122.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing handleGitLabMergeRequest and handleBitbucketPullRequest paths, then compare them with recordGitHubPR and pr_lifecycle_test.go. Confirm the provider-specific approval webhook payloads before adding parser and handler coverage. Done means both providers persist opened, approved, and merged timestamps plus merge identifiers, with parser and end-to-end tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.