refactor(daemon): drop assigned-but-unread composition handles
Three exported Daemon fields were wired by the composition root and read nowhere: CapabilityHost (*plugin.Host), Curators (*curator.Registry) and ToolRegistry (*tools.Registry). No field access exists anywhere in the repo, and git history shows no read ever existed. Each handle has a live owner outside the daemon: the curator registry/runtime is boot-owned (the curator isolation invariant keeps it off the agent loop), the capability host is lifecycle-owned by the composition root and consumed by the control plane, and the tool registry is consumed by chat, curator and MCP wiring. Keeping the daemon copies was decorative wiring, so the fields, their composition assignments and the now-unused plugin/curator imports go together. The daemon architecture test now refuses the three names, and the plugin host contract test refuses a CapabilityHost: handle on the daemon alongside the PluginRegistry: one it already refused.
This commit is contained in:
1 parent
88fb3c4f03
commit
f69ce1db56
4 files changed
+21
-23
No files matched your search
@@ -1588,7 +1588,6 @@ func (b *boot) buildDaemon() {
|
||||
Bus: b.bus,
|
||||
Forge: b.forgeClient,
|
||||
Trees: b.trees,
|
||||
CapabilityHost: b.capabilityHost,
|
||||
Storage: b.storeBackend,
|
||||
Log: log,
|
||||
Tasks: b.natsClient,
|
||||
@@ -1597,7 +1596,7 @@ func (b *boot) buildDaemon() {
|
||||
StateStoreGrants: b.stateStoreGrants,
|
||||
ContainerPool: b.containerPool,
|
||||
KitLauncher: b.kitLauncher,
|
||||
ToolRegistry: b.toolReg,
|
||||
Guardrails: b.guardrails,
|
||||
Identities: b.identityRunners,
|
||||
RootIdentityID: identity.StableID(configuredIdentityNames(b.cfg)[0]),
|
||||
TaskLogs: b.taskLogs,
|
||||
|
||||
@@ -83,7 +83,14 @@ func TestDaemonCarriesNoLocalWorkflowExecutionState(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
forbidden := map[string]bool{"Agent": true, "Workflows": true, "CustomStages": true}
|
||||
forbiddenExecution := map[string]bool{"Agent": true, "Workflows": true, "CustomStages": true}
|
||||
// Composition handles the daemon must not carry. Each was an exported field
|
||||
// the composition root assigned and nothing read: the curator
|
||||
// registry/runtime is boot-owned (the curator isolation invariant keeps it
|
||||
// off the agent loop), the capability host is lifecycle-owned by the
|
||||
// composition root and consumed by the control plane, and the tool registry
|
||||
// is consumed by chat/curator/MCP wiring. A re-add is decorative wiring.
|
||||
forbiddenHandles := map[string]bool{"Curators": true, "CapabilityHost": true, "ToolRegistry": true}
|
||||
for _, declaration := range file.Decls {
|
||||
gen, ok := declaration.(*ast.GenDecl)
|
||||
if !ok {
|
||||
@@ -100,9 +107,12 @@ func TestDaemonCarriesNoLocalWorkflowExecutionState(t *testing.T) {
|
||||
}
|
||||
for _, field := range structure.Fields.List {
|
||||
for _, name := range field.Names {
|
||||
if forbidden[name.Name] {
|
||||
if forbiddenExecution[name.Name] {
|
||||
t.Errorf("%s carries local workflow execution field %s", typeSpec.Name.Name, name.Name)
|
||||
}
|
||||
if forbiddenHandles[name.Name] {
|
||||
t.Errorf("%s carries unread composition handle %s; the composition root owns it", typeSpec.Name.Name, name.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/container"
|
||||
"github.com/samcharles93/archie-core/internal/domain/access"
|
||||
"github.com/samcharles93/archie-core/internal/domain/binding"
|
||||
"github.com/samcharles93/archie-core/internal/domain/curator"
|
||||
"github.com/samcharles93/archie-core/internal/domain/eda/playbook"
|
||||
"github.com/samcharles93/archie-core/internal/domain/identity"
|
||||
"github.com/samcharles93/archie-core/internal/domain/mapping"
|
||||
@@ -36,7 +35,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
agentnats "github.com/samcharles93/archie-core/internal/infrastructure/agenttransport/nats"
|
||||
"github.com/samcharles93/archie-core/internal/logging"
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
"github.com/samcharles93/archie-core/internal/storage"
|
||||
"github.com/samcharles93/archie-core/internal/taskrun"
|
||||
"github.com/samcharles93/archie-core/internal/taskstate"
|
||||
@@ -208,14 +206,6 @@ type Daemon struct {
|
||||
// Storage is the pluggable storage backend for container mounts.
|
||||
// A runnable task requires it; acquireTaskContainer parks on nil.
|
||||
Storage storage.Backend
|
||||
// CapabilityHost owns validated plugin manifests and cross-family
|
||||
// lifecycle. Typed capability registries remain in their domain packages;
|
||||
// the host never exposes daemon internals or an untyped service locator.
|
||||
CapabilityHost *plugin.Host
|
||||
// Curators is the curator engine family registry (epic archie-core-yp9).
|
||||
// The runtime loop (archie-core-89x) and reference curators (i7i, gs8)
|
||||
// are driven through it; nil when the family is not composed.
|
||||
Curators *curator.Registry
|
||||
// Identities holds per-identity runner state for multi-identity mode.
|
||||
// When non-empty, Run() starts one goroutine per identity instead of
|
||||
// using the single-identity Forge/Trees/Cfg.Repos path.
|
||||
@@ -258,12 +248,6 @@ type Daemon struct {
|
||||
WorkflowEnablement(context.Context) (workflowtask.WorkflowEnablement, error)
|
||||
}
|
||||
|
||||
// ToolRegistry is the central tool registry, wired by the composition
|
||||
// root. MCP-discovered tools and built-in tools are registered here
|
||||
// and passed as CaptureTools in agent requests. Nil means no dynamic
|
||||
// tool discovery (backward compatible).
|
||||
ToolRegistry *tools.Registry
|
||||
|
||||
// TaskLogs persists each task's own log output (including a sandboxed
|
||||
// container's, which otherwise disappears at AutoRemove) and mirrors it
|
||||
// live onto the dashboard feed, wired by the composition root. Nil
|
||||
|
||||
@@ -113,7 +113,6 @@ func TestArchiedWiresCapabilityHostLifecycle(t *testing.T) {
|
||||
"capabilityHost.Register(",
|
||||
"capabilityHost.Start(",
|
||||
"capabilityHost.Stop(",
|
||||
"CapabilityHost:",
|
||||
} {
|
||||
if !strings.Contains(wiring, required) {
|
||||
t.Errorf("cmd/archied does not contain capability-host wiring %q", required)
|
||||
@@ -126,8 +125,14 @@ func TestArchiedWiresCapabilityHostLifecycle(t *testing.T) {
|
||||
if !strings.Contains(before, "capabilityHost.Stop(") {
|
||||
t.Error("capability host cleanup must be registered before Start so failed rollback cleanup is retried")
|
||||
}
|
||||
if strings.Contains(wiring, "PluginRegistry:") {
|
||||
t.Error("daemon composition exposes divergent legacy plugin inventory")
|
||||
// The host lifecycle belongs to the composition root, which the control
|
||||
// plane and gateway consume. A CapabilityHost field on the daemon would be
|
||||
// assigned there and read nowhere -- the same defect PluginRegistry: had --
|
||||
// so both spellings are refused.
|
||||
for _, forbidden := range []string{"PluginRegistry:", "CapabilityHost:"} {
|
||||
if strings.Contains(wiring, forbidden) {
|
||||
t.Errorf("daemon composition carries an unread capability handle %q; the composition root owns the host lifecycle", forbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user