diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index ef600f4..38535cb 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -73,11 +73,6 @@ func NewPrep() *PrepSubsystem { } } -// prep.SetCore(c) -func (s *PrepSubsystem) SetCore(c *core.Core) { - s.ServiceRuntime = core.NewServiceRuntime(c, AgentOptions{}) -} - // c.Action("agentic.dispatch").Run(ctx, options) // c.Actions() // ["agentic.dispatch", "agentic.prep", "agentic.status", ...] func (s *PrepSubsystem) OnStartup(ctx context.Context) core.Result { diff --git a/pkg/agentic/prep_test.go b/pkg/agentic/prep_test.go index 142f40e..39069e9 100644 --- a/pkg/agentic/prep_test.go +++ b/pkg/agentic/prep_test.go @@ -208,15 +208,6 @@ func TestPrep_Subsystem_Good_Name(t *testing.T) { assert.Equal(t, "agentic", s.Name()) } -func TestPrep_SetCore_Good(t *testing.T) { - s := &PrepSubsystem{} - assert.Nil(t, s.ServiceRuntime) - - c := core.New(core.WithOption("name", "test")) - s.SetCore(c) - assert.NotNil(t, s.ServiceRuntime) -} - // --- sanitiseBranchSlug Bad/Ugly --- func TestSanitise_SanitiseBranchSlug_Bad_EmptyString(t *testing.T) { @@ -396,29 +387,6 @@ func TestPrep_NewPrep_Ugly(t *testing.T) { assert.NotNil(t, s.forge, "Forge client must not be nil") } -// --- SetCore Bad/Ugly --- - -func TestPrep_SetCore_Bad(t *testing.T) { - // SetCore with nil — should not panic - s := &PrepSubsystem{ServiceRuntime: core.NewServiceRuntime(testCore, AgentOptions{})} - assert.NotPanics(t, func() { - s.SetCore(nil) - }) -} - -func TestPrep_SetCore_Ugly(t *testing.T) { - // SetCore twice — second overwrites first - s := &PrepSubsystem{ServiceRuntime: core.NewServiceRuntime(testCore, AgentOptions{})} - c1 := core.New(core.WithOption("name", "first")) - c2 := core.New(core.WithOption("name", "second")) - - s.SetCore(c1) - assert.NotNil(t, s.ServiceRuntime) - - s.SetCore(c2) - assert.Equal(t, c2, s.Core(), "second SetCore should overwrite first") -} - // --- OnStartup Good/Bad/Ugly --- func TestPrep_OnStartup_Good_CreatesPokeCh(t *testing.T) { @@ -429,7 +397,7 @@ func TestPrep_OnStartup_Good_CreatesPokeCh(t *testing.T) { c := core.New(core.WithOption("name", "test")) s := NewPrep() - s.SetCore(c) + s.ServiceRuntime = core.NewServiceRuntime(c, AgentOptions{}) assert.Nil(t, s.pokeCh, "pokeCh should be nil before OnStartup") @@ -447,7 +415,7 @@ func TestPrep_OnStartup_Good_FrozenByDefault(t *testing.T) { c := core.New(core.WithOption("name", "test")) s := NewPrep() - s.SetCore(c) + s.ServiceRuntime = core.NewServiceRuntime(c, AgentOptions{}) assert.True(t, s.OnStartup(context.Background()).OK) } @@ -458,13 +426,13 @@ func TestPrep_OnStartup_Good_NoError(t *testing.T) { c := core.New(core.WithOption("name", "test")) s := NewPrep() - s.SetCore(c) + s.ServiceRuntime = core.NewServiceRuntime(c, AgentOptions{}) assert.True(t, s.OnStartup(context.Background()).OK) } func TestPrep_OnStartup_Bad(t *testing.T) { - // OnStartup without SetCore (nil ServiceRuntime) — panics because + // OnStartup with nil ServiceRuntime — panics because // registerCommands calls s.Core().Command(). s := &PrepSubsystem{ ServiceRuntime: nil, @@ -484,7 +452,7 @@ func TestPrep_OnStartup_Ugly(t *testing.T) { failCount: make(map[string]int), } c := core.New(core.WithOption("name", "test")) - s.SetCore(c) + s.ServiceRuntime = core.NewServiceRuntime(c, AgentOptions{}) assert.NotPanics(t, func() { _ = s.OnStartup(context.Background()) diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index dcf44d6..961a7c0 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -78,12 +78,6 @@ type Subsystem struct { var _ coremcp.Subsystem = (*Subsystem)(nil) -// c := core.New(core.WithService(monitor.Register)) -// monitorService.SetCore(c) -func (m *Subsystem) SetCore(coreApp *core.Core) { - m.ServiceRuntime = core.NewServiceRuntime(coreApp, Options{}) -} - func (m *Subsystem) handleAgentStarted(ev messages.AgentStarted) { m.mu.Lock() m.seenRunning[ev.Workspace] = true diff --git a/pkg/monitor/monitor_test.go b/pkg/monitor/monitor_test.go index fbfe063..3e83e6c 100644 --- a/pkg/monitor/monitor_test.go +++ b/pkg/monitor/monitor_test.go @@ -163,17 +163,6 @@ func TestMonitor_Shutdown_Good_NilCancel(t *testing.T) { assert.NoError(t, err) } -// --- SetCore --- - -func TestMonitor_SetCore_Good_WiresServiceRuntime(t *testing.T) { - c := core.New() - mon := New() - - assert.NotPanics(t, func() { mon.SetCore(c) }) - assert.NotNil(t, mon.ServiceRuntime) - assert.Equal(t, c, mon.Core()) -} - // --- handleAgentStarted / handleAgentCompleted --- func TestMonitor_HandleAgentStarted_Good(t *testing.T) {