Skip to content

Add dispatcher routing support for VulnerabilityEvent#385

Merged
flc1125 merged 4 commits into3.xfrom
copilot/add-vulnerabilityevent-dispatcher
Mar 9, 2026
Merged

Add dispatcher routing support for VulnerabilityEvent#385
flc1125 merged 4 commits into3.xfrom
copilot/add-vulnerabilityevent-dispatcher

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

  • Add VulnerabilityListener interface to listeners.go
  • Add vulnerabilityListeners field to Dispatcher struct
  • Add VulnerabilityListener type check in RegisterListeners
  • Add RegisterVulnerabilityListener method
  • Add case *gitlab.VulnerabilityEvent to Dispatch switch
  • Add processVulnerabilityEvent function
  • Copy vulnerability JSON fixture from upstream client to testdata/webhooks/
  • Add test cases in dispatcher_test.go
  • Fix gofumpt lint formatting
Original prompt

This section details on the original issue you should resolve

<issue_title>Support dispatcher routing for VulnerabilityEvent</issue_title>
<issue_description>## Background

The upstream GitLab Go client already supports parsing VulnerabilityEvent in ParseWebhook(...):

However, the dispatcher in this repository does not currently support routing *gitlab.VulnerabilityEvent.

Problem

Although VulnerabilityEvent can already be parsed by the upstream client, it cannot be dispatched further in this project, which effectively makes it unsupported here.

Expected

Add dispatcher support for VulnerabilityEvent, including:

  • listener definition
  • listener registration
  • a Dispatch(...) branch
  • the corresponding handler function
  • basic tests

Acceptance Criteria

  • Dispatcher.Dispatch(...) can handle *gitlab.VulnerabilityEvent
  • dispatching *gitlab.VulnerabilityEvent no longer returns ErrUnsupportedEvent
  • registered listeners are invoked correctly</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: flc1125 <14297703+flc1125@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dispatcher routing for VulnerabilityEvent Add dispatcher routing support for VulnerabilityEvent Mar 9, 2026
@flc1125 flc1125 marked this pull request as ready for review March 9, 2026 04:26
Copilot AI review requested due to automatic review settings March 9, 2026 04:27
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.07%. Comparing base (82748aa) to head (c785285).
⚠️ Report is 2 commits behind head on 3.x.

Files with missing lines Patch % Lines
dispatcher.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              3.x     #385      +/-   ##
==========================================
+ Coverage   92.55%   93.07%   +0.51%     
==========================================
  Files           1        1              
  Lines         215      231      +16     
==========================================
+ Hits          199      215      +16     
  Misses         11       11              
  Partials        5        5              

☔ 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.

@dosubot dosubot bot added enhancement New feature or request go Pull requests that update Go code labels Mar 9, 2026
@flc1125
Copy link
Copy Markdown
Owner

flc1125 commented Mar 9, 2026

@copilot fix lint

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end dispatcher support for GitLab *gitlab.VulnerabilityEvent, so vulnerability webhooks parsed by client-go can be routed to registered listeners instead of returning ErrUnsupportedEvent.

Changes:

  • Introduces VulnerabilityListener with OnVulnerability(ctx, *gitlab.VulnerabilityEvent).
  • Extends Dispatcher to register and dispatch vulnerability events (RegisterVulnerabilityListener, Dispatch case, processVulnerabilityEvent).
  • Adds a vulnerability webhook fixture and corresponding dispatch test coverage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
listeners.go Adds the VulnerabilityListener interface to the listener set.
dispatcher.go Wires vulnerability listeners into registration and dispatch routing.
testdata/webhooks/vulnerability.json Adds a vulnerability webhook payload fixture used by tests.
dispatcher_test.go Exercises vulnerability dispatch through DispatchRequest and validates handler invocation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: flc1125 <14297703+flc1125@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 9, 2026

@copilot fix lint

Fixed in 4e31839 — the //nolint:lll comment on the wiki page line needed to be aligned to match the new vulnerability entry above it (gofumpt requirement).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@flc1125 flc1125 merged commit c6c9974 into 3.x Mar 9, 2026
10 of 11 checks passed
@flc1125 flc1125 deleted the copilot/add-vulnerabilityevent-dispatcher branch March 9, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dispatcher routing for VulnerabilityEvent

3 participants