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
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
|
|
|
|
|
package setup
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2026-03-29 21:34:46 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
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
|
|
|
)
|
|
|
|
|
|
2026-03-29 21:34:46 +00:00
|
|
|
func TestConfig_GenerateBuildConfig_Good_Go(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateBuildConfig("/tmp/myapp", TypeGo)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
text := config.Value.(string)
|
|
|
|
|
assert.Contains(t, text, "# myapp build configuration")
|
|
|
|
|
assert.Contains(t, text, "type: go")
|
|
|
|
|
assert.Contains(t, text, "name: myapp")
|
|
|
|
|
assert.Contains(t, text, "main: ./cmd/myapp")
|
|
|
|
|
assert.Contains(t, text, "cgo: false")
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConfig_GenerateBuildConfig_Bad_Unknown(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateBuildConfig("/tmp/myapp", TypeUnknown)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
assert.NotEmpty(t, config.Value.(string))
|
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
|
|
|
}
|
|
|
|
|
|
2026-03-29 22:35:34 +00:00
|
|
|
func TestConfig_GenerateBuildConfig_Ugly_WailsNestedPath(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateBuildConfig("/tmp/workspaces/team-console", TypeWails)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
text := config.Value.(string)
|
|
|
|
|
assert.Contains(t, text, "name: team-console")
|
|
|
|
|
assert.Contains(t, text, "type: wails")
|
|
|
|
|
assert.Contains(t, text, "main: ./cmd/team-console")
|
2026-03-29 22:35:34 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:34:46 +00:00
|
|
|
func TestConfig_GenerateTestConfig_Good_Go(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateTestConfig(TypeGo)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
assert.Contains(t, config.Value.(string), "go test")
|
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
|
|
|
}
|
|
|
|
|
|
2026-03-29 22:35:34 +00:00
|
|
|
func TestConfig_GenerateTestConfig_Bad_Unknown(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateTestConfig(TypeUnknown)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
text := config.Value.(string)
|
|
|
|
|
assert.Contains(t, text, "# Test configuration")
|
|
|
|
|
assert.NotContains(t, text, "commands:")
|
2026-03-29 22:35:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConfig_GenerateTestConfig_Ugly_WailsUsesGoSuite(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
config := GenerateTestConfig(TypeWails)
|
|
|
|
|
require.True(t, config.OK)
|
|
|
|
|
text := config.Value.(string)
|
|
|
|
|
assert.Contains(t, text, "go test ./...")
|
|
|
|
|
assert.Contains(t, text, "go test -race ./...")
|
2026-03-29 22:35:34 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:34:46 +00:00
|
|
|
func TestConfig_ParseGitRemote_Good_CommonFormats(t *testing.T) {
|
|
|
|
|
tests := map[string]string{
|
|
|
|
|
"https://github.com/dAppCore/go-io.git": "dAppCore/go-io",
|
|
|
|
|
"git@github.com:dAppCore/go-io.git": "dAppCore/go-io",
|
|
|
|
|
"ssh://git@forge.lthn.ai:2223/core/agent.git": "core/agent",
|
|
|
|
|
"ssh://git@forge.lthn.ai:2223/core/agent": "core/agent",
|
|
|
|
|
"git@forge.lthn.ai:core/agent.git": "core/agent",
|
|
|
|
|
"/srv/git/core/agent.git": "srv/git/core/agent",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for remote, want := range tests {
|
|
|
|
|
assert.Equal(t, want, parseGitRemote(remote), remote)
|
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:34:46 +00:00
|
|
|
func TestConfig_ParseGitRemote_Bad_Empty(t *testing.T) {
|
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
|
|
|
assert.Equal(t, "", parseGitRemote(""))
|
2026-03-29 21:34:46 +00:00
|
|
|
assert.Equal(t, "", parseGitRemote("origin"))
|
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
|
|
|
}
|
|
|
|
|
|
2026-03-29 22:35:34 +00:00
|
|
|
func TestConfig_ParseGitRemote_Ugly_WhitespaceAndTrailingSlash(t *testing.T) {
|
|
|
|
|
remote := " https://github.com/dAppCore/go-io.git/ "
|
|
|
|
|
assert.Equal(t, "dAppCore/go-io", parseGitRemote(remote))
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
func TestConfig_TrimRemotePath_Good(t *testing.T) {
|
|
|
|
|
assert.Equal(t, "core/go-io", trimRemotePath("/core/go-io.git"))
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 22:35:34 +00:00
|
|
|
func TestConfig_TrimRemotePath_Bad_Empty(t *testing.T) {
|
|
|
|
|
assert.Equal(t, "", trimRemotePath(""))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConfig_TrimRemotePath_Ugly_RepeatedSlashes(t *testing.T) {
|
|
|
|
|
assert.Equal(t, "core/go-io", trimRemotePath("///core/go-io.git///"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConfig_RenderConfig_Good_SingleSection(t *testing.T) {
|
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
|
|
|
sections := []configSection{
|
|
|
|
|
{Key: "project", Values: []configValue{{Key: "name", Value: "test"}}},
|
|
|
|
|
}
|
2026-03-29 23:01:10 +00:00
|
|
|
result := renderConfig("Test", sections)
|
|
|
|
|
require.True(t, result.OK)
|
|
|
|
|
assert.Contains(t, result.Value.(string), "name: test")
|
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
|
|
|
}
|
2026-03-29 22:35:34 +00:00
|
|
|
|
|
|
|
|
func TestConfig_RenderConfig_Bad_UnsupportedValue(t *testing.T) {
|
|
|
|
|
sections := []configSection{
|
|
|
|
|
{Key: "project", Values: []configValue{{Key: "name", Value: func() {}}}},
|
|
|
|
|
}
|
2026-03-29 23:01:10 +00:00
|
|
|
result := renderConfig("Test", sections)
|
|
|
|
|
assert.False(t, result.OK)
|
|
|
|
|
assert.Error(t, result.Value.(error))
|
2026-03-29 22:35:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConfig_RenderConfig_Ugly_EmptySections(t *testing.T) {
|
2026-03-29 23:01:10 +00:00
|
|
|
result := renderConfig("", nil)
|
|
|
|
|
require.True(t, result.OK)
|
|
|
|
|
assert.Equal(t, "", result.Value.(string))
|
2026-03-29 22:35:34 +00:00
|
|
|
}
|