test: regression tests for all audit gaps — 6 enhanced + 4 new packages

Telegram: splitLongMessage (8 cases), isChatAllowed, updateMetadata (4 cases),
  panicRecoveryMiddleware, updateLoggingMiddleware, authorizedMessage, stop-while-stopped
Container: error paths, payload round-trip, overwrite, minimal payload
Events: buffer defaults, subscribe-after-close, double-close safety,
  slow-subscriber isolation, multi-subscriber ordering, publish timestamping
NATS RPC: envelope edge cases, JSON round-trip, request timeout, rollback
NellDB: empty store (6 ops), concurrent enqueue/claim (20 goroutines),
  context cancellation, oversized payload clipping, unmarshalable data,
  status transitions, events ordering, recover stale, clear terminal
Gateway tasks: empty/long title, idempotent enqueue, chat label

New packages with tests (formerly zero-test):
  internal/gate (220 lines), internal/gate/gateextract,
  internal/plugin/pluginextract, internal/workflow/wfextract

All 37 packages pass. Fixes regression gaps from audit.
This commit is contained in:
sam committed 2026-07-26 10:05:44 +10:00
1 parent 8356863712
commit e8f78dd0d5
12 files changed
+1327 -2

No files matched your search

@@ -0,0 +1,55 @@
package wfextract
import (
"reflect"
"testing"
)
func TestSymbolsContainsExpectedWorkflowEntries(t *testing.T) {
pkgKey := "github.com/samcharles93/archie-core/internal/workflow/workflow"
pkg, ok := Symbols[pkgKey]
if !ok {
t.Fatalf("Symbols missing key %q", pkgKey)
}
// Core functions that must be present.
requiredFuncs := []string{
"Route", "Run", "Bootstrap", "Feasibility", "Implement",
"OpenPR", "TDD",
}
for _, name := range requiredFuncs {
v, ok := pkg[name]
if !ok {
t.Errorf("required function %q missing from Symbols", name)
continue
}
if v.Kind() != reflect.Func {
t.Errorf("%s kind = %v, want Func", name, v.Kind())
}
}
// Core types that must be present as pointers.
requiredTypes := []string{
"AgentStage", "Outcome", "Registry", "Stage",
"TaskContext", "Workflow",
}
for _, name := range requiredTypes {
v, ok := pkg[name]
if !ok {
t.Errorf("required type %q missing from Symbols", name)
continue
}
if v.Kind() != reflect.Ptr {
t.Errorf("%s kind = %v, want Ptr", name, v.Kind())
}
}
}
func TestWFExtractSymbolCountReasonable(t *testing.T) {
pkgKey := "github.com/samcharles93/archie-core/internal/workflow/workflow"
pkg := Symbols[pkgKey]
// Should have at least the core functions + types (10+ entries).
if len(pkg) < 10 {
t.Errorf("expected at least 10 symbols, got %d", len(pkg))
}
}