Skip to content

refactor: remove PipelineHandler getter from pipelinesteps plugin#118

Merged
intel352 merged 5 commits intomainfrom
refactor/issue-60-remove-plugin-handler-getter
Feb 23, 2026
Merged

refactor: remove PipelineHandler getter from pipelinesteps plugin#118
intel352 merged 5 commits intomainfrom
refactor/issue-60-remove-plugin-handler-getter

Conversation

@intel352
Copy link
Contributor

Summary

  • Removes the PipelineHandler() getter from plugins/pipelinesteps/plugin.go — callers no longer reach inside the plugin to configure it
  • Plugin now implements SetStepRegistry() and SetLogger() optional interfaces, which the engine's LoadPlugin() detects and calls automatically
  • Plugin adds a WiringHook that injects dependencies into the handler and registers it as a named service (pipeline-workflow-handler)
  • cmd/server/main.go discovers the handler via service registry lookup when needed (e.g., for wiring SetEventRecorder post-start)
  • Engine's LoadPlugin() now supports stepRegistrySetter and slogLoggerSetter optional interfaces for all plugins

Closes #60

Test plan

  • go build ./... passes
  • go test ./... — all tests pass
  • golangci-lint run — 0 issues (verified by pre-push hook)

🤖 Generated with Claude Code

intel352 and others added 2 commits February 23, 2026 03:26
Move handler wiring from cmd/server/main.go into the plugin's own
lifecycle via optional setter interfaces and a wiring hook:

- Plugin implements SetStepRegistry() and SetLogger() — engine's
  LoadPlugin() detects and calls these after registering factories
- Plugin adds a WiringHook that injects dependencies into the
  PipelineWorkflowHandler and registers it as a named service
- cmd/server/main.go no longer reaches inside the plugin — it
  discovers the handler via service registry lookup when needed
  (e.g., to wire SetEventRecorder post-start)

Closes #60

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The plugin now configures itself internally via optional-interface injection
and a WiringHook rather than exposing a concrete handler reference to callers.

- engine.LoadPlugin() detects SetStepRegistry/SetLogger optional interfaces
  and injects the engine's step registry and slog.Logger into plugins after
  workflow handlers are registered
- Plugin.WiringHooks() wires those injected dependencies into the handler
  and registers it under PipelineHandlerServiceName in the app service registry
- cmd/server/main.go no longer retains a pipelinePlugin variable; EventRecorder
  wiring in registerPostStartServices looks up the handler via the service registry
- engine_pipeline_test.go finds the handler via type assertion instead of getter
- Removed pipelineEventSetter interface and pipelineHandler serviceComponents field

Closes #60

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 23, 2026 08:26
Copy link
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

Refactors the pipelinesteps plugin integration so callers no longer access a concrete handler via a plugin-specific getter, and instead rely on engine-driven optional interface injection and service registry discovery.

Changes:

  • Removed PipelineHandler() getter from plugins/pipelinesteps and added optional SetStepRegistry() / SetLogger() setters plus a wiring hook that registers the handler as a named service.
  • Extended StdEngine.LoadPlugin() to inject step registry and (optionally) a *slog.Logger into plugins that implement the new setter interfaces.
  • Updated server wiring and tests to discover the pipeline handler via the service registry rather than via direct plugin access.

Reviewed changes

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

Show a summary per file
File Description
plugins/pipelinesteps/plugin.go Removes handler getter; adds optional setters + wiring hook; registers handler under a constant service name
engine.go Adds optional-interface injection for step registry and *slog.Logger during plugin load
cmd/server/main.go Removes direct plugin handler wiring; wires EventRecorder via service-registry lookup post-start
engine_pipeline_test.go Updates tests to locate the pipeline handler from the engine’s handler list
cmd/server/main_test.go Adjusts tests for updated buildEngine signature
plugins/http/plugin_test.go Formatting-only change
Comments suppressed due to low confidence (2)

plugins/pipelinesteps/plugin.go:145

  • app.RegisterService errors are currently ignored. If registration fails (e.g., name collision), the PipelineWorkflowHandler won’t be discoverable via the service registry and post-start wiring (SetEventRecorder) will silently not happen. Return the error (or at least log it) so mis-wiring fails fast and is diagnosable.
				// Register the handler as a service so callers can discover it
				// (e.g. to wire SetEventRecorder post-start) without a plugin-specific getter.
				_ = app.RegisterService(PipelineHandlerServiceName, p.pipelineHandler)
				return nil

cmd/server/main.go:871

  • If the pipeline handler service is missing from the registry or doesn’t implement SetEventRecorder, this branch becomes a silent no-op and pipeline execution events won’t be recorded without any signal. Consider adding a Debug/Warn log when the service isn’t found and when the type assertion fails, to make misconfiguration visible in production.
		if svc, ok := engine.GetApp().SvcRegistry()[pluginpipeline.PipelineHandlerServiceName]; ok {
			if ph, ok := svc.(eventRecorderSetter); ok {
				recorder := evstore.NewEventRecorderAdapter(app.stores.eventStore)
				ph.SetEventRecorder(recorder)
				logger.Info("Wired EventRecorder to PipelineWorkflowHandler")
			}
		}

Copilot AI review requested due to automatic review settings February 23, 2026 09:23
Copy link
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

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

plugins/pipelinesteps/plugin.go:145

  • app.RegisterService returns an error (e.g., duplicate service name). Ignoring it here can silently break post-start wiring that relies on this service being present. Consider handling the error and returning it from the wiring hook (or at least logging it) so BuildFromConfig fails fast if the handler service cannot be registered.
				// Register the handler as a service so callers can discover it
				// (e.g. to wire SetEventRecorder post-start) without a plugin-specific getter.
				_ = app.RegisterService(PipelineHandlerServiceName, p.pipelineHandler)
				return nil

The handlers package import was left behind after PR changes removed all
usage of the package from cmd/server/main.go, causing build and lint failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@intel352 intel352 merged commit 4caa62e into main Feb 23, 2026
14 checks passed
@intel352 intel352 deleted the refactor/issue-60-remove-plugin-handler-getter branch February 23, 2026 09:50
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.

Plugin exposes concrete handler type via getter (plugins/pipelinesteps/plugin.go)

2 participants