Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
157 lines
4.8 KiB
Go
157 lines
4.8 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestCheckConfigSetSideEffects_FederationRemote(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("federation.remote", "dolthub://org/proj")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command == "" {
|
|
t.Error("expected a suggested command")
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_SharedServerTrue(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("dolt.shared-server", "true")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt server start" {
|
|
t.Errorf("expected 'bd dolt server start', got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_SharedServerFalse(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("dolt.shared-server", "false")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt server stop" {
|
|
t.Errorf("expected 'bd dolt server stop', got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_DoltDebugTrue(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("dolt.debug", "true")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt stop && bd dolt start" {
|
|
t.Errorf("expected restart command, got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_DoltDebugFalse(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("dolt.debug", "false")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt stop && bd dolt start" {
|
|
t.Errorf("expected restart command, got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigUnsetSideEffects_DoltDebug(t *testing.T) {
|
|
effects := checkConfigUnsetSideEffects("dolt.debug")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt stop && bd dolt start" {
|
|
t.Errorf("expected restart command, got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_RoutingModeInvalid(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("routing.mode", "bogus")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "" {
|
|
t.Error("invalid routing mode should not suggest a command")
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_RoutingModeValid(t *testing.T) {
|
|
for _, mode := range []string{"auto", "maintainer", "contributor", "explicit"} {
|
|
effects := checkConfigSetSideEffects("routing.mode", mode)
|
|
if len(effects) != 0 {
|
|
t.Errorf("expected 0 effects for valid routing mode %q, got %d", mode, len(effects))
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_BackupEnabled(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("backup.enabled", "true")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_SyncGitRemote(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("sync.git-remote", "origin")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigSetSideEffects_UnknownKey(t *testing.T) {
|
|
effects := checkConfigSetSideEffects("some.random.key", "value")
|
|
if len(effects) != 0 {
|
|
t.Errorf("expected 0 effects for unknown key, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigUnsetSideEffects_FederationRemote(t *testing.T) {
|
|
effects := checkConfigUnsetSideEffects("federation.remote")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
if effects[0].Command != "bd dolt remote remove origin" {
|
|
t.Errorf("expected 'bd dolt remote remove origin', got %q", effects[0].Command)
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigUnsetSideEffects_SharedServer(t *testing.T) {
|
|
effects := checkConfigUnsetSideEffects("dolt.shared-server")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigUnsetSideEffects_BackupEnabled(t *testing.T) {
|
|
effects := checkConfigUnsetSideEffects("backup.enabled")
|
|
if len(effects) != 1 {
|
|
t.Fatalf("expected 1 effect, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestCheckConfigUnsetSideEffects_UnknownKey(t *testing.T) {
|
|
effects := checkConfigUnsetSideEffects("some.random.key")
|
|
if len(effects) != 0 {
|
|
t.Errorf("expected 0 effects for unknown key, got %d", len(effects))
|
|
}
|
|
}
|
|
|
|
func TestPrintConfigSideEffects(t *testing.T) {
|
|
// Redirect stderr to avoid test noise
|
|
old := os.Stderr
|
|
r, w, _ := os.Pipe()
|
|
os.Stderr = w
|
|
defer func() { w.Close(); r.Close(); os.Stderr = old }()
|
|
|
|
// Should not panic with empty, single, or multiple effects
|
|
printConfigSideEffects(nil)
|
|
printConfigSideEffects([]configSideEffect{})
|
|
printConfigSideEffects([]configSideEffect{
|
|
{Message: "test hint", Command: "bd test"},
|
|
})
|
|
printConfigSideEffects([]configSideEffect{
|
|
{Message: "no command hint"},
|
|
{Message: "with command", Command: "bd apply"},
|
|
})
|
|
}
|