fix(ax): remove legacy core injection helpers

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-03-31 05:55:02 +00:00
parent aee6452688
commit 2b7159da7f
4 changed files with 5 additions and 59 deletions

View file

@ -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 {

View file

@ -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())

View file

@ -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

View file

@ -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) {