Skip to content

fix(reporting/gitlab): bump client-go to v1.9.1, widen IDs to int64 - #7398

Merged
tarunKoyalwar merged 1 commit into
devfrom
gitlab-tracker-v1
May 12, 2026
Merged

fix(reporting/gitlab): bump client-go to v1.9.1, widen IDs to int64#7398
tarunKoyalwar merged 1 commit into
devfrom
gitlab-tracker-v1

Conversation

@ShubhamRasal

@ShubhamRasal ShubhamRasal commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

Upgrade the GitLab tracker to work with gitlab.com/gitlab-org/api/client-go v1.x. The v1 release widened ID fields from int to int64 across the API surface (User.ID, Issue.ID, ListOptions.Page/PerPage, assignee slices). Currently nuclei is pinned at v0.130.1 so SDK consumers wanting a current client-go version (notably pd-agent) carry a local replace directive in their go.mod. This PR bumps to v1.9.1 and adjusts the tracker source to match.

Changes

Dependency:

  • gitlab.com/gitlab-org/api/client-go v0.130.1v1.9.1
  • Transitive: google.golang.org/protobuf v1.36.6v1.36.11 (pulled by go mod tidy)

Source — pkg/reporting/trackers/gitlab/gitlab.go, 5 line changes:

  • Integration.userID: intint64
  • assigneeIDs: []int{i.userID}[]int64{i.userID}
  • IssueID: strconv.FormatInt(int64(issue.ID), 10)FormatInt(issue.ID, 10) (ID is already int64)
  • Same for createdIssue.ID
  • ListOptions.Page / PerPage now require int64; cast at the call site

UpdateIssue and CreateIssueNote signatures also widened (issue intissue int64), but gitlab.Issue.IID is already int64 in v1.x, so existing issue.IID arguments compile unchanged.

What stays the same

Options.DuplicateIssuePageSize / DuplicateIssueMaxPages remain int. That struct is user-facing YAML; YAML ints round-trip into int64 fine, so there's no reason to widen the public surface. The cast happens at the call site only.

Test plan

  • go build ./... clean
  • go vet ./... clean
  • go build ./pkg/reporting/trackers/gitlab/ clean
  • Unit tests with httptest.Server mocking the four endpoints (GET /user, POST /projects/:id/issues, GET /projects/:id/issues, PUT /projects/:id/issues/:iid). Worth writing because the int64 bump is the kind of change that compiles fine but can encode wrong if a forgotten cast silently truncates. Will add in a follow-up commit on this PR.
  • Live smoke against a real GitLab project: create test project on gitlab.com, run nuclei with a reporting YAML pointing at it, verify issues created/deduplicated/closed.

Why pd-agent cares

pd-agent currently carries a replace gitlab.com/gitlab-org/api/client-go => … directive to use a compatible version locally. Once this PR lands and gets tagged in a nuclei release, pd-agent can drop that replace entirely.

Summary by CodeRabbit

  • Chores

    • Updated Go module dependencies to latest versions for improved stability and security.
  • Refactor

    • Improved GitLab integration data handling to ensure compatibility with updated API requirements.

Review Change Stack

client-go v1.x widened ID fields from int to int64 across the API surface
(User.ID, Issue.ID, ListOptions.Page/PerPage). Adjust the tracker to the
new signatures: Integration.userID, the assignee slice, the FormatInt
arguments, and ListOptions casts.

Keep Options.DuplicateIssuePageSize / DuplicateIssueMaxPages as int —
that struct is user-facing YAML and YAML ints round-trip into int64 fine.
Cast at the call site only.

UpdateIssue and CreateIssueNote signatures also widened, but issue.IID
is already int64 in v1.x, so existing call sites compile unchanged.
@ShubhamRasal ShubhamRasal self-assigned this May 12, 2026
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 038d9f16-4d6e-452c-8563-c553e89852fc

📥 Commits

Reviewing files that changed from the base of the PR and between d65c795 and ddcae35.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • go.mod
  • pkg/reporting/trackers/gitlab/gitlab.go

Walkthrough

This PR upgrades the GitLab API client library from v0.130.1 to v1.9.1, accompanied by type compatibility changes in the Integration implementation. The userID field and related pagination/assignee handling switch from int to int64 types to match the updated API library.

Changes

GitLab API Client Upgrade and Type Compatibility

Layer / File(s) Summary
Dependency version updates
go.mod
gitlab-org/api/client-go upgraded to v1.9.1 (from v0.130.1); google.golang.org/protobuf updated to v1.36.11 (from v1.36.6).
Type adaptation for int64 compatibility
pkg/reporting/trackers/gitlab/gitlab.go
Integration.userID changed from int to int64; CreateIssue builds assigneeIDs as []int64; IssueID formatting uses strconv.FormatInt directly; findIssueByTitle pagination parameters set as int64 values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A hop through versions, clean and bright,
From zero-one-three-oh to one-nine-one—just right!
Int becomes int64, precision takes the stage,
The GitLab tracker adapts with grace to a newer age.
Types align with types, the harmony is neat,
A dependency dance makes the upgrade complete! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: bumping the GitLab client library to v1.9.1 and widening ID types to int64, which are the core modifications across both go.mod and gitlab.go.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gitlab-tracker-v1

Comment @coderabbitai help to get the list of available commands and usage tips.

@ShubhamRasal
ShubhamRasal marked this pull request as ready for review May 12, 2026 10:22
@auto-assign
auto-assign Bot requested a review from Mzack9999 May 12, 2026 10:22
@tarunKoyalwar
tarunKoyalwar merged commit 7bded8a into dev May 12, 2026
7 checks passed
@tarunKoyalwar
tarunKoyalwar deleted the gitlab-tracker-v1 branch May 12, 2026 10:58
@tarunKoyalwar
tarunKoyalwar removed the request for review from Mzack9999 May 12, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants