Skip to content

Add dispatcher support for project webhooks#387

Merged
flc1125 merged 2 commits into3.xfrom
codex/add-dispatcher-support-project-webhook-event
Mar 9, 2026
Merged

Add dispatcher support for project webhooks#387
flc1125 merged 2 commits into3.xfrom
codex/add-dispatcher-support-project-webhook-event

Conversation

@Codex
Copy link
Copy Markdown
Contributor

@Codex Codex AI commented Mar 9, 2026

Project webhook events were parsed by the upstream client but not routed by this dispatcher, so ProjectWebhookEvent payloads returned ErrUnsupportedEvent and listeners never ran.

  • Event wiring: Added ProjectListener/OnProject interface, dispatcher slice/registration, dispatch switch branch, and handler to process *gitlab.ProjectWebhookEvent.
  • Tests & fixtures: Added testdata/webhooks/project.json and extended dispatcher tests to assert project webhooks dispatch and invoke listeners.

Example:

dispatcher := NewDispatcher(RegisterListeners(myProjectListener{}))
dispatcher.Dispatch(ctx, &gitlab.ProjectWebhookEvent{Name: "Flight"})
Original prompt

This section details on the original issue you should resolve

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

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

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

Problem

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

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

Acceptance Criteria

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

Comments on the Issue (you are @codex[agent] in this section)

@Codex Codex AI changed the title [WIP] Add dispatcher support for ProjectWebhookEvent Add dispatcher support for project webhooks Mar 9, 2026
@flc1125 flc1125 marked this pull request as ready for review March 9, 2026 08:28
Copilot AI review requested due to automatic review settings March 9, 2026 08:28
@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 93.30%. Comparing base (c6c9974) to head (6e2bd8d).
⚠️ Report is 1 commits behind head on 3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              3.x     #387      +/-   ##
==========================================
+ Coverage   93.07%   93.30%   +0.23%     
==========================================
  Files           1        1              
  Lines         231      239       +8     
==========================================
+ Hits          215      223       +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
@flc1125 flc1125 merged commit 75ee35d into 3.x Mar 9, 2026
13 checks passed
@flc1125 flc1125 deleted the codex/add-dispatcher-support-project-webhook-event branch March 9, 2026 08:30
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

This PR adds full dispatcher support for *gitlab.ProjectWebhookEvent, which was already parseable by the upstream GitLab Go client but could not be routed by this project's dispatcher (returning ErrUnsupportedEvent). It follows the standard workflow documented in CONTRIBUTING.md for adding a new webhook event.

Changes:

  • Added ProjectListener/OnProject interface and all dispatcher wiring (projectListeners slice, RegisterProjectListener, RegisterListeners branch, Dispatch switch case, processProjectEvent)
  • Added testdata/webhooks/project.json fixture with a project_create payload
  • Extended dispatcher_test.go with the "project" table entry, ProjectListener interface compliance check, and OnProject handler asserting key fields

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
listeners.go Adds ProjectListener interface with OnProject method, correctly positioned in alphabetical order
dispatcher.go Adds all five dispatcher integration points: listener slice, RegisterProjectListener, RegisterListeners type-check, Dispatch switch case, and processProjectEvent handler
dispatcher_test.go Adds test table entry, interface compliance assertion, and OnProject method asserting Name and PathWithNamespace from the fixture
testdata/webhooks/project.json Minimal valid project_create payload with "name": "Flight" and "path_with_namespace": "flightjs/flight" matching test assertions

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

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 ProjectWebhookEvent

3 participants