Conversation
…rom module package (#84) Phase 4 engine decomposition progress: - Move Trigger interface to interfaces/ package (module.Trigger is now a type alias) - Add EventEmitter and MetricsRecorder interfaces in interfaces/ - Add TriggerRegistrar interface for registry abstraction - Create engine_module_bridge.go to isolate remaining module/ imports - Update engine.go fields to use interface types instead of concrete module types - Fix mock GetService to support interface assignment (matching real modular behavior) - Add 10 new tests for requires.plugins validation (15 test runs with subtests) Closes #84 (partial) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR continues the Phase 4 engine decomposition by moving key interface definitions out of module/ into interfaces/, reducing direct engine→module coupling while keeping backward compatibility via type aliases. It also introduces a small “bridge” file to concentrate remaining unavoidable module/ dependencies and adds tests around requires.plugins validation.
Changes:
- Extracted
Trigger,EventEmitter, andMetricsRecorderinterfaces intointerfaces/(withmodule.Triggerkept as a type alias). - Updated
engine.goto use the extracted interface types and moved remainingmodule-dependent helpers intoengine_module_bridge.go. - Expanded
engine_test.gowithrequires.pluginsvalidation tests and adjusted the mock app’sGetServicebehavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/api/plugin.go | Minor constructor formatting adjustment (no functional change). |
| module/trigger.go | Replaced in-package Trigger interface with a type alias to interfaces.Trigger; clarified registry interface satisfaction. |
| module/query_handler_test.go | Removed trailing whitespace line. |
| module/command_handler_test.go | Removed trailing whitespace line. |
| interfaces/trigger.go | New canonical Trigger + TriggerRegistrar interfaces to decouple engine from module. |
| interfaces/events.go | New EventEmitter + MetricsRecorder interfaces for engine observability dependencies. |
| engine_module_bridge.go | New bridge helpers to isolate remaining module/ imports and keep engine.go cleaner. |
| engine.go | Switched trigger/event/metrics-related fields and signatures to use interfaces/ types; delegated plugin wiring/metrics logic to bridge helpers. |
| engine_test.go | Added requires.plugins validation tests; updated mock GetService reflection logic. |
| if out != nil { | ||
| // Get reflect values | ||
| outVal := reflect.ValueOf(out) | ||
| if outVal.Kind() != reflect.Pointer { | ||
| return fmt.Errorf("out parameter must be a pointer") | ||
| } | ||
|
|
||
| // Dereference the pointer | ||
| outVal = outVal.Elem() | ||
| if !outVal.CanSet() { | ||
| return fmt.Errorf("out parameter cannot be set") | ||
| } | ||
|
|
||
| // Set the value if compatible | ||
| svcVal := reflect.ValueOf(svc) | ||
| if !svcVal.Type().AssignableTo(outVal.Type()) { | ||
| return fmt.Errorf("service type %s not assignable to out parameter type %s", | ||
| svcVal.Type(), outVal.Type()) | ||
| svcType := svcVal.Type() | ||
| targetType := outVal.Type() | ||
|
|
There was a problem hiding this comment.
mockApplication.GetService can panic in edge cases: if a service is registered with a nil value, reflect.ValueOf(svc) becomes invalid and svcVal.Type() will panic; and if the caller passes a nil pointer as out, outVal.Elem() will panic. Add guards for svc == nil and outVal.IsNil() (before Elem/Type) and return a clear error (or set a nil value) to keep this mock safe and closer to modular.StdApplication behavior.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
… feedback (#148) * Initial plan * refactor: address code review feedback on engine_module_bridge and engine_test Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
The function was closed with a mismatched `)` instead of `}` and had 2-space indented closing brace for the if block instead of tab-indented. This caused `expected statement, found ')'` errors, breaking all build/vet/test CI checks on any branch touching this file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@copilot open a new pull request to apply changes based on the comments in this thread and #136 (review) |
…ailure, remove duplicate admin tests (#151) * Initial plan * fix: address review comments - EventEmitter doc, registerPluginTrigger error handling, remove duplicate admin tests Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
|
@copilot Address all linter, build, and test issues regardless whether they pre-existed or not. |
…aulting Remove hardcoded default password fallback in the RDS driver. The Create method now returns an error if master_password is not provided, preventing insecure defaults from being used in production. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The flag was referenced but not declared, causing build failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…153) * Initial plan * fix: restore missing multiWorkflowAddr flag definition in cmd/server/main.go Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Co-authored-by: Jonathan Langevin <codingsloth@pm.me>
Summary
Phase 4 engine decomposition — move interface types from
module/tointerfaces/to break the engine→module dependency:interfaces/trigger.go:Triggerinterface +TriggerRegistrar(satisfied by*module.TriggerRegistry)interfaces/events.go:EventEmitter(satisfied by*module.WorkflowEventEmitter) +MetricsRecorder(satisfied by*module.MetricsCollector)engine_module_bridge.go: Isolates remainingmodule/imports into factory functions, with doc explaining Phase 5 blockersengine.go: Fields now use interface types;RegisterTriggertakesinterfaces.Triggermodule/trigger.go:type Trigger = interfaces.Trigger(type alias, backward compatible)requires.pluginsvalidation, mockGetServicefixed for interface assignmentWhat's done
interfaces/What remains (Phase 5)
StepRegistry/StepFactory/PipelineStep/Pipelinestill inmodule/(70+ files would need updating)Closes #84 (partial)
Test plan
go test ./...— 88 packages passgo test -race .— cleangolangci-lint run— 0 issues🤖 Generated with Claude Code