39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package agent
|
|
|
|
import (
|
|
"os/exec"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestArchitecture_NoUIImportBelowAgent sichert E-04 mechanisch ab: Jede
|
|
// Ausgabe läuft über einen Event-Channel, kein Kern-Paket importiert
|
|
// internal/ui.
|
|
func TestArchitecture_NoUIImportBelowAgent(t *testing.T) {
|
|
pkgs := []string{
|
|
"nub/internal/agent",
|
|
"nub/internal/llm/...",
|
|
"nub/internal/tool/...",
|
|
"nub/internal/config",
|
|
"nub/internal/session/...",
|
|
"nub/internal/ctxasm/...",
|
|
"nub/internal/mcpc/...",
|
|
"nub/internal/skill/...",
|
|
"nub/internal/tokens/...",
|
|
}
|
|
for _, pkg := range pkgs {
|
|
out, err := exec.Command("go", "list", "-deps", "-f", "{{.ImportPath}}", pkg).CombinedOutput()
|
|
if err != nil {
|
|
// Pakete wie internal/session existieren in M1 noch nicht -> überspringen.
|
|
if strings.Contains(string(out), "matched no packages") {
|
|
continue
|
|
}
|
|
t.Fatalf("go list %s: %v\n%s", pkg, err, out)
|
|
}
|
|
for _, dep := range strings.Split(strings.TrimSpace(string(out)), "\n") {
|
|
if dep == "nub/internal/ui" || strings.HasPrefix(dep, "nub/internal/ui/") {
|
|
t.Errorf("%s transitively imports %s, which violates E-04", pkg, dep)
|
|
}
|
|
}
|
|
}
|
|
}
|