Files
archie/internal/plugin/pluginextract/pluginextract_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

66 lines
1.9 KiB
Go

package pluginextract
import (
"reflect"
"testing"
)
func TestSymbolsContainsExpectedPluginEntries(t *testing.T) {
pkgKey := "github.com/samcharles93/archie-core/internal/plugin/plugin"
pkg, ok := Symbols[pkgKey]
if !ok {
t.Fatalf("Symbols missing key %q", pkgKey)
}
// LoadDir must be a function.
if v, ok := pkg["LoadDir"]; !ok {
t.Error("LoadDir missing from Symbols")
} else if v.Kind() != reflect.Func {
t.Errorf("LoadDir kind = %v, want Func", v.Kind())
}
// Registry must be a pointer type.
if v, ok := pkg["Registry"]; !ok {
t.Error("Registry missing from Symbols")
} else if v.Kind() != reflect.Pointer {
t.Errorf("Registry kind = %v, want Ptr", v.Kind())
}
// Plugin must be a pointer type.
if v, ok := pkg["Plugin"]; !ok {
t.Error("Plugin missing from Symbols")
} else if v.Kind() != reflect.Pointer {
t.Errorf("Plugin kind = %v, want Ptr", v.Kind())
}
}
func TestGeneratedWrapperHasNilGuards(t *testing.T) {
// Regression: go generate strips nil-guards from _Plugin wrapper.
// Verify that Plugin is present in the Symbols table and is an
// interface type (as expected for yaegi interface extraction).
pkgKey := "github.com/samcharles93/archie-core/internal/plugin/plugin"
pkg := Symbols[pkgKey]
pluginType, ok := pkg["Plugin"]
if !ok {
t.Fatal("Plugin missing from Symbols")
}
// Plugin is an interface type — yaegi represents interfaces
// differently from struct pointers.
kind := pluginType.Kind()
if kind != reflect.Interface && kind != reflect.Pointer {
t.Errorf("Plugin type kind = %v, want Interface or Ptr", kind)
}
// Verify WName and WVersion exist on the Plugin interface type.
// For interface types, we check the method set.
if kind == reflect.Interface {
methodCount := pluginType.Type().NumMethod()
if methodCount < 2 {
t.Errorf("Plugin interface has %d methods, expected at least 2 (Name, Version)", methodCount)
}
}
}