Conversation
…ckage - Create interfaces/pipeline.go with EventRecorder, PipelineRunner, StepRegistryProvider - Add SetLogger, SetEventRecorder, Run methods to module.Pipeline - Alias module.EventRecorder to interfaces.EventRecorder - Update handlers/pipeline.go to use interfaces (removes module import) - Update engine.go PipelineAdder to use interfaces.PipelineRunner - Add mockPipelineRunner test to demonstrate mock-based handler testing Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bidirectional handler and module dependency in pipeline
Break handler↔module concrete-type dependency via shared interfaces package
Feb 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR decouples handlers from module concrete types by introducing a neutral interfaces package for shared contracts, enabling handler unit testing with mocks and reducing cross-package coupling.
Changes:
- Added
interfacespackage definingPipelineRunner,EventRecorder, andStepRegistryProvider. - Updated
module.Pipelineto implementinterfaces.PipelineRunner(type alias forEventRecorder, plusSetLogger,SetEventRecorder,Run). - Updated
handlers/pipeline.goandengine.goto useinterfaces.PipelineRunner, plus a new mock-based handler test.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| module/pipeline_executor.go | Aliases EventRecorder to shared interface and adds PipelineRunner methods (SetLogger, SetEventRecorder, Run). |
| interfaces/pipeline.go | Introduces shared interfaces to break handler↔module concrete-type dependency. |
| handlers/pipeline.go | Removes module dependency by storing/running pipelines via interfaces.PipelineRunner. |
| engine.go | Updates PipelineAdder signature to accept interfaces.PipelineRunner. |
| handlers/pipeline_test.go | Adds a mock PipelineRunner and verifies handler execution works with mocks. |
Contributor
|
@copilot apply changes based on the comments in this thread |
- SetLogger/SetEventRecorder now propagate to all already-registered pipelines - AddPipeline now injects logger/recorder immediately if already set on the handler - ExecuteWorkflow only calls Run() — no mutation on the hot path - Add mockEventRecorder and TestPipelineHandler_InjectionAtConfigTime test - Fix test comment: "without depending on concrete module types" Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
handlers/pipeline.go,module/pipeline_executor.go,module/pipeline_step_registry.go,engine.gointerfaces/pipeline.go— defineEventRecorder,PipelineRunner,StepRegistryProviderinterfacesmodule/pipeline_executor.go— aliasEventRecordertointerfaces.EventRecorder; addSetLogger/SetEventRecorder/Runmethods toPipelinehandlers/pipeline.go— replace*module.Pipeline/*module.StepRegistry/module.EventRecorderwithinterfaces.*; inject logger/recorder at configuration time (not per-execution) to avoid hot-path mutationsengine.go— updatePipelineAdderinterface to useinterfaces.PipelineRunnermockPipelineRunner,mockEventRecorder,TestPipelineHandler_MockRunner,TestPipelineHandler_InjectionAtConfigTimetestsOriginal prompt
💡 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.