Skip to content

feat(gitlab): add GitLab API v4 client with typed responses#7120

Open
asaphko wants to merge 2 commits intomainfrom
feature/gitlab-client
Open

feat(gitlab): add GitLab API v4 client with typed responses#7120
asaphko wants to merge 2 commits intomainfrom
feature/gitlab-client

Conversation

@asaphko
Copy link
Copy Markdown
Contributor

@asaphko asaphko commented Apr 3, 2026

Introduce the GitLab integration Django app scaffold and a typed API v4 client. This is the first PR in a stacked series splitting #7028 into reviewable increments, addressing review feedback from @khvn26, @emyller, and @Zaimwa9.

Changes

  • GitLab API v4 client with functions for project listing, issue/MR search, comment posting, label management, and member listing
  • TypedDict response types following the LaunchDarkly/Grafana pattern (addresses khvn26's feedback on generating response types)
  • Dataclass query parameter types for pagination, project, and issue/MR filtering
  • Django app scaffold registered in INSTALLED_APPS
  • 18 tests with responses header validation and parametrised cases

Contributes to #7028

Review effort: 2/5

Review feedback addressed from #7028

  • TypedDict response types instead of dict[str, Any] (khvn26: "Can we generate response types from GitLab's OpenAPI schema?")
  • responses header validation instead of separate build_request_headers test (khvn26: "I'd rather the responses mocks validate expected headers")
  • Parametrised repetitive tests (Zaimwa9, khvn26: "these tests could be gathered in a single parametrised one")
  • Label conflict handled via status code, not exception parsing (emyller: "avoidable API crash")
  • Zero # type: ignore — mypy strict clean
  • Literal types for resource endpoint parameters (khvn26: "Consider making this a Literal")
  • Private helpers prefixed with _ (_build_request_headers, _build_paginated_response)
  • Cleaner function names: get_gitlab_resource_metadata, label_gitlab_resource
  • requests.params dict instead of manual URL string concatenation

🤖 Generated with Claude Code

Introduce the GitLab integration Django app with a typed API client
for GitLab v4. This is the first PR in a stacked series splitting
the GitLab integration (#7028) into reviewable increments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@asaphko asaphko requested a review from a team as a code owner April 3, 2026 13:11
@asaphko asaphko requested review from gagantrivedi and removed request for a team April 3, 2026 13:11
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 3, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 3, 2026 1:12pm
flagsmith-frontend-preview Ignored Ignored Preview Apr 3, 2026 1:12pm
flagsmith-frontend-staging Ignored Ignored Preview Apr 3, 2026 1:12pm

Request Review

@github-actions github-actions bot added api Issue related to the REST API feature New feature or request labels Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7120 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7120 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7120 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7120 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7120 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7120 Finished ✅ Results

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

❌ Patch coverage is 99.14530% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.26%. Comparing base (61ca107) to head (e1716f2).
⚠️ Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
api/integrations/gitlab/dataclasses.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7120      +/-   ##
==========================================
- Coverage   98.33%   98.26%   -0.07%     
==========================================
  Files        1337     1342       +5     
  Lines       50012    50200     +188     
==========================================
+ Hits        49180    49330     +150     
- Misses        832      870      +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  43.9 seconds
commit  11bf93f
info  🔄 Run: #15690 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  24.5 seconds
commit  e1716f2
info  🔄 Run: #15691 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  50.5 seconds
commit  11bf93f
info  🔄 Run: #15690 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  28.9 seconds
commit  e1716f2
info  🔄 Run: #15691 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  47.4 seconds
commit  11bf93f
info  🔄 Run: #15690 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  16 passed

Details

stats  16 tests across 13 suites
duration  33.5 seconds
commit  11bf93f
info  🔄 Run: #15690 (attempt 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant