Skip to content

Add dispatcher routing support for MilestoneWebhookEvent#384

Merged
flc1125 merged 3 commits into3.xfrom
copilot/add-dispatcher-support-milestone-webhook-event
Mar 9, 2026
Merged

Add dispatcher routing support for MilestoneWebhookEvent#384
flc1125 merged 3 commits into3.xfrom
copilot/add-dispatcher-support-milestone-webhook-event

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

*gitlab.MilestoneWebhookEvent was already parsed by the upstream client (EventTypeMilestone = "Milestone Hook") but fell through to ErrUnsupportedEvent in this dispatcher.

Changes

  • listeners.go — new MilestoneListener interface with OnMilestone method
  • dispatcher.gomilestoneListeners field, RegisterMilestoneListener, processMilestoneEvent, and Dispatch switch case for *gitlab.MilestoneWebhookEvent
  • testdata/webhooks/milestone.json — fixture for milestone webhook payload
  • dispatcher_test.go — compile-time assertion, OnMilestone impl on testListener, and test case wired to the new fixture

Usage

type MyListener struct{}

func (l *MyListener) OnMilestone(ctx context.Context, event *gitlab.MilestoneWebhookEvent) error {
    fmt.Println(event.ObjectAttributes.Title, event.Action)
    return nil
}

d := gitlabwebhook.NewDispatcher(
    gitlabwebhook.RegisterListeners(&MyListener{}),
)
Original prompt

This section details on the original issue you should resolve

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

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

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

Problem

Although MilestoneWebhookEvent 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 MilestoneWebhookEvent, including:

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

Acceptance Criteria

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

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: flc1125 <14297703+flc1125@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dispatcher routing for MilestoneWebhookEvent Add dispatcher routing support for MilestoneWebhookEvent 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:26
@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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.82%. Comparing base (82748aa) to head (f670cf4).
⚠️ Report is 1 commits behind head on 3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.x     #384      +/-   ##
==========================================
+ Coverage   92.55%   92.82%   +0.26%     
==========================================
  Files           1        1              
  Lines         215      223       +8     
==========================================
+ Hits          199      207       +8     
  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 the enhancement New feature or request label Mar 9, 2026
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 dispatcher-level support for GitLab milestone webhooks so *gitlab.MilestoneWebhookEvent no longer falls through to ErrUnsupportedEvent, aligning this repo’s dispatcher with the upstream client’s parsing support.

Changes:

  • Introduces MilestoneListener (OnMilestone) and wires it into the dispatcher registration flow.
  • Adds dispatcher routing + processing for *gitlab.MilestoneWebhookEvent.
  • Adds a milestone webhook fixture and extends dispatcher tests to cover milestone dispatching.

Reviewed changes

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

File Description
listeners.go Adds MilestoneListener interface for milestone event handling.
dispatcher.go Registers milestone listeners and dispatches milestone webhook events to them.
dispatcher_test.go Extends test listener + dispatch test matrix to validate milestone routing.
testdata/webhooks/milestone.json Adds fixture payload used by the dispatcher tests.

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

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

Labels

enhancement New feature or request 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 MilestoneWebhookEvent

3 participants