Files
archie/internal/tools/provider/contract_test.go
T
sam f73b2d1c8c feat: memory manager sync/prefetch/scan/shutdown + broad in-flight epic work
Checkpoint commit covering concurrent work across several archie-core-abg
epics to avoid losing in-progress state:

- Memory manager (18.7-18.16): background sync pipeline, prefetch with
  timeout, memory-write notification, threat scanning, shutdown drain
  with abandoned-write tracking, frozen snapshot pattern. Wired
  ScanContent and NotifyMemoryToolWrite into HandleToolCall so scanning
  and notification actually apply to writes, not just exist as unused
  primitives.
- Fixed a literal unresolved merge-conflict that had been committed to
  internal/memory/scrubber/scrubber.go.
- Tool provider/registry, MCP client/transport (stdio, HTTP, SSE),
  multimodal results, disclosure.
- Pairing device auth store, rate limiting.
- Gateway compression, session store, tasks.
- Various workflow, plugin host, and agentexec updates.
2026-07-27 03:34:46 +10:00

60 lines
1.7 KiB
Go

package provider_test
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestToolProviderEngineContractExists(t *testing.T) {
t.Parallel()
source, err := os.ReadFile(filepath.Join("provider.go"))
if err != nil {
t.Fatalf("read provider.go: %v", err)
}
text := string(source)
for _, required := range []string{
"type Engine interface",
"plugin.Module",
"Discover(context.Context) ([]tools.ToolEntry, error)",
"type Registry struct",
"func (r *Registry) Register(engine Engine) error",
"func (r *Registry) Get(id string) (Engine, bool)",
} {
if !strings.Contains(text, required) {
t.Errorf("provider.go does not contain required typed-family contract %q", required)
}
}
}
func TestArchiedWiresTypedProvidersAndExecutableConsumers(t *testing.T) {
t.Parallel()
mainPath := filepath.Join("..", "..", "..", "cmd", "archied", "main.go")
source, err := os.ReadFile(mainPath)
if err != nil {
t.Fatalf("read archied main: %v", err)
}
text := string(source)
for _, required := range []string{
"toolprovider.NewRegistry(toolReg)",
"memorytoolprovider.New(memManager)",
"configuredMCPProvider(srv)",
"capabilityHost.Register(providerRegistry)",
"chatGenerateOptions(messages, toolReg",
"agentexec.NewInProcessRunner(llm, log, toolReg)",
} {
if !strings.Contains(text, required) {
t.Errorf("cmd/archied/main.go does not contain tool-provider wiring %q", required)
}
}
if strings.Contains(text, ".RegisterTools(ctx, toolReg)") {
t.Error("composition bypasses the typed provider registry with direct MCP registration")
}
if strings.Contains(text, "memManager.GetToolSchemas()") {
t.Error("composition bypasses the typed memory tool provider")
}
}