agent/pkg/agentic/actions_test.go
Snider f83c753277 feat(v0.8.0): full AX migration — ServiceRuntime, Actions, quality gates, transport
go-process:
- Register factory, Result lifecycle, 5 named Action handlers
- Start/Run/StartWithOptions/RunWithOptions all return core.Result
- core.ID() replaces fmt.Sprintf, core.As replaces errors.As

core/agent:
- PrepSubsystem + monitor.Subsystem + setup.Service embed ServiceRuntime[T]
- 22 named Actions + agent.completion Task pipeline in OnStartup
- ChannelNotifier removed — all IPC via c.ACTION(messages.X{})
- proc.go: all methods via s.Core().Process(), returns core.Result
- status.go: WriteAtomic + JSONMarshalString
- paths.go: Fs.NewUnrestricted() replaces unsafe.Pointer
- transport.go: ONE net/http file — HTTPGet/HTTPPost/HTTPDo/MCP transport
- All disallowed imports eliminated from source files (13 quality gates)
- String concat eliminated — core.Concat() throughout
- 1:1 _test.go + _example_test.go for every source file
- Reference docs synced from core/go v0.8.0
- RFC-025 updated with net/http, net/url, io/fs quality gates
- lib.go: io/fs eliminated via Data.ListNames, Array[T].Deduplicate

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 01:27:46 +00:00

53 lines
1.4 KiB
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic
import (
"context"
"testing"
core "dappco.re/go/core"
"github.com/stretchr/testify/assert"
)
func TestActions_HandleDispatch_Good(t *testing.T) {
s := newPrepWithProcess()
r := s.handleDispatch(context.Background(), core.NewOptions(
core.Option{Key: "repo", Value: "go-io"},
core.Option{Key: "task", Value: "fix tests"},
))
// Will fail (no local clone) but exercises the handler path
assert.False(t, r.OK)
}
func TestActions_HandleStatus_Good(t *testing.T) {
t.Setenv("CORE_WORKSPACE", t.TempDir())
s := newPrepWithProcess()
r := s.handleStatus(context.Background(), core.NewOptions())
assert.True(t, r.OK)
}
func TestActions_HandlePoke_Good(t *testing.T) {
s := newPrepWithProcess()
s.pokeCh = make(chan struct{}, 1)
r := s.handlePoke(context.Background(), core.NewOptions())
assert.True(t, r.OK)
}
func TestActions_HandleQA_Bad_NoWorkspace(t *testing.T) {
s := newPrepWithProcess()
r := s.handleQA(context.Background(), core.NewOptions())
assert.False(t, r.OK)
}
func TestActions_HandleVerify_Bad_NoWorkspace(t *testing.T) {
s := newPrepWithProcess()
r := s.handleVerify(context.Background(), core.NewOptions())
assert.False(t, r.OK)
}
func TestActions_HandleIngest_Bad_NoWorkspace(t *testing.T) {
s := newPrepWithProcess()
r := s.handleIngest(context.Background(), core.NewOptions())
assert.False(t, r.OK)
}