refactor(archied): delete the daemon's unused webui.Server and UI adapters
b.web and its three adapters (skillCatalogAdapter, memoryUIAdapter,
curatorsUIAdapter) were constructed at boot but the daemon never calls
Handler() on the server and no route reads any of these fields -- the
dashboard is served by the separate archie-ui process (compose.go),
which deliberately leaves the same surfaces nil, and the daemon's
config snapshot goes through the standalone webui.BuildConfigView, not
a Server method. Removed the field, its four assignment sites, and the
three adapter files; test boot literals that carried a leftover
`web: &webui.Server{}` for no assertion-relevant reason had it
dropped, and the one test that specifically pinned b.web's store
surfaces staying nil is now moot with the field gone.
This commit is contained in:
1 parent
96610bda6e
commit
ba3d8cba21
8 files changed
+3
-216
No files matched your search
@@ -143,12 +143,6 @@ type boot struct {
|
||||
// lastReload reports the most recent reload outcome for the published
|
||||
// configuration projection. Nil until reload wiring installs it.
|
||||
lastReload func() config.ReloadStatus
|
||||
// web holds the dashboard adapters the daemon still produces for
|
||||
// surfaces that have no contract to cross on yet (skills, memory,
|
||||
// curators, channels, dashboard work requests). The daemon serves no
|
||||
// HTTP for them -- it never calls web.Handler() -- so this is the
|
||||
// producer half waiting on a route contract, not a live listener.
|
||||
web *webui.Server
|
||||
|
||||
natsClient *nats.Client
|
||||
// natsURL is the endpoint the daemon's own client connected with at
|
||||
@@ -449,7 +443,6 @@ func (b *boot) setupObservability(ctx context.Context) {
|
||||
b.addCleanup(func() { bus.Close() })
|
||||
b.channelManager = status.NewManager(channelDescriptors(cfg.Chat))
|
||||
b.cfgHolder = config.NewHolder(cfg)
|
||||
b.web = &webui.Server{Log: log.With("component", "webui"), Channels: b.channelManager, Skills: skillCatalogAdapter{b.cfgHolder}}
|
||||
// The watchdog leaves its verdict in a file on this host, so the daemon
|
||||
// reads it and publishes the outcome as an event; the dashboard renders
|
||||
// what it receives, wherever it runs (archie-core-8cda.5.4).
|
||||
@@ -593,7 +586,6 @@ func (b *boot) setupLLMAndChat() error {
|
||||
// Channel routers execute turns locally and need the SQLite TurnLedger.
|
||||
// The remote contract serves web chat; it must not replace their store.
|
||||
b.chat = &webui.ChatService{Contract: contract, Updates: b.updateService}
|
||||
b.web.WorkRequests = b.chatTasks
|
||||
b.setupReadinessProbes()
|
||||
return nil
|
||||
}
|
||||
@@ -758,7 +750,8 @@ func (b *boot) loadWorkflows(ctx context.Context) error {
|
||||
// The dashboard is served by the archie-ui process from the cutover
|
||||
// change (archie-core-8cda.5.4, PRD gate 7): the daemon runs no webui
|
||||
// listener, and [web].listen is the archie-ui process's bind address.
|
||||
// b.web stays only as the configuration snapshot's renderer.
|
||||
// The daemon still renders the configuration snapshot via the
|
||||
// standalone webui.BuildConfigView, not through a Server.
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -995,11 +988,6 @@ func (b *boot) setupMemory() error {
|
||||
return err
|
||||
}
|
||||
b.memManager = memManager
|
||||
// The dashboard is built before memory exists, so it is wired in here
|
||||
// rather than at construction.
|
||||
if b.web != nil {
|
||||
b.web.Memory = memoryUIAdapter{memManager}
|
||||
}
|
||||
|
||||
if err := memManager.Initialize("daemon"); err != nil {
|
||||
log.Warn("memory manager initialize", "err", err)
|
||||
@@ -1332,11 +1320,6 @@ func (b *boot) buildDaemon() {
|
||||
KindWorkflows: b.kindWorkflows,
|
||||
LabelWorkflows: b.labelWorkflows,
|
||||
}
|
||||
// Curator observability (archie-core-1786637489932-6): GET
|
||||
// /api/curators reads registered names, health and recent activity
|
||||
// off the live registry the daemon already holds, narrowed to the
|
||||
// webui's own view type.
|
||||
b.web.Curators = curatorsUIAdapter{b.curatorRegistry}
|
||||
// Consumer mapping/binding surfaces resolve from b.stateStore (the State
|
||||
// Store contract adapter): local by default, remote *staterpc.Client when
|
||||
// [services.state].target is set. See docs/prds/state-store-contract.md §10.
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/channels/status"
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
func TestConfiguredNetworkGatewaysBecomeRunning(t *testing.T) {
|
||||
@@ -51,7 +50,6 @@ func TestConfiguredNetworkGatewaysBecomeRunning(t *testing.T) {
|
||||
st: st,
|
||||
stateStore: st,
|
||||
channelManager: manager,
|
||||
web: &webui.Server{},
|
||||
}
|
||||
ctx, cancel := context.WithCancel(t.Context())
|
||||
t.Cleanup(cancel)
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/gateway"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
func TestRemoteChatCompositionPreservesChannelTurnLedger(t *testing.T) {
|
||||
@@ -19,7 +18,7 @@ func TestRemoteChatCompositionPreservesChannelTurnLedger(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = st.Close() })
|
||||
b := &boot{cfg: cfg, log: slog.Default(), web: &webui.Server{}, cfgHolder: config.NewHolder(cfg), stateStore: st}
|
||||
b := &boot{cfg: cfg, log: slog.Default(), cfgHolder: config.NewHolder(cfg), stateStore: st}
|
||||
t.Cleanup(b.cleanup)
|
||||
if err := b.openStores(t.Context()); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/curator"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
// curatorsUIAdapter narrows the running curator registry to the webui-owned
|
||||
// CuratorStatus view. The webui deliberately does not link the curator
|
||||
// pass-engine contract (archie-core-8cda.5.6), so the process that owns the
|
||||
// registry supplies this adapter at bootstrap. It converts health and
|
||||
// activity records to their wire views; it never hands the UI a live
|
||||
// engine.
|
||||
type curatorsUIAdapter struct{ r *curator.Registry }
|
||||
|
||||
var _ webui.CuratorStatus = curatorsUIAdapter{}
|
||||
|
||||
func (a curatorsUIAdapter) Names() []string { return a.r.Names() }
|
||||
|
||||
func (a curatorsUIAdapter) Health(ctx context.Context) map[string]webui.CuratorHealthView {
|
||||
health := a.r.Health(ctx)
|
||||
views := make(map[string]webui.CuratorHealthView, len(health))
|
||||
for name, h := range health {
|
||||
views[name] = webui.CuratorHealthView{Status: string(h.Status), Message: h.Message}
|
||||
}
|
||||
return views
|
||||
}
|
||||
|
||||
func (a curatorsUIAdapter) Activity(name string) (webui.CuratorActivity, bool) {
|
||||
activity, ok := a.r.Activity(name)
|
||||
if !ok {
|
||||
return webui.CuratorActivity{}, false
|
||||
}
|
||||
view := webui.CuratorActivity{
|
||||
LastRunAt: activity.LastRunAt,
|
||||
LastRunActions: activity.LastRunActions,
|
||||
Recent: make([]webui.CuratorActionView, 0, len(activity.Recent)),
|
||||
}
|
||||
for _, a2 := range activity.Recent {
|
||||
view.Recent = append(view.Recent, webui.CuratorActionView{
|
||||
At: a2.At,
|
||||
Type: a2.Type,
|
||||
Detail: a2.Detail,
|
||||
Reason: a2.Reason,
|
||||
})
|
||||
}
|
||||
return view, true
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"github.com/samcharles93/archie-core/internal/memory"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
// memoryUIAdapter narrows the running memory runtime to the webui-owned
|
||||
// MemoryStatus view. The webui deliberately does not link the memory
|
||||
// package (archie-core-8cda.5.6), so the process that owns the runtime
|
||||
// supplies this adapter at bootstrap. It renders names, readiness, and the
|
||||
// tool vocabulary by name; it never hands the UI a live tool.
|
||||
type memoryUIAdapter struct{ m *memory.Manager }
|
||||
|
||||
var _ webui.MemoryStatus = memoryUIAdapter{}
|
||||
|
||||
func (a memoryUIAdapter) Builtin() webui.MemoryProviderHandle {
|
||||
return memoryProviderUIAdapter{a.m.Builtin()}
|
||||
}
|
||||
|
||||
func (a memoryUIAdapter) External() webui.MemoryProviderHandle {
|
||||
return memoryProviderUIAdapter{a.m.External()}
|
||||
}
|
||||
|
||||
// memoryProviderUIAdapter converts one provider's runtime tool entries into
|
||||
// the webui's name/description view. A nil provider renders as absent.
|
||||
type memoryProviderUIAdapter struct{ p memory.MemoryProvider }
|
||||
|
||||
func (a memoryProviderUIAdapter) Name() string { return a.p.Name() }
|
||||
func (a memoryProviderUIAdapter) IsAvailable() bool { return a.p.IsAvailable() }
|
||||
func (a memoryProviderUIAdapter) ToolViews() []webui.MemoryToolView {
|
||||
if a.p == nil {
|
||||
return nil
|
||||
}
|
||||
schemas := a.p.GetToolSchemas()
|
||||
views := make([]webui.MemoryToolView, 0, len(schemas))
|
||||
for _, t := range schemas {
|
||||
views = append(views, webui.MemoryToolView{Name: t.Name, Description: t.Description})
|
||||
}
|
||||
return views
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workintake"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
// TestBuildDaemonCarriesWorkflowRoutingBindings pins the composition hop in the
|
||||
@@ -34,7 +33,6 @@ func TestBuildDaemonCarriesWorkflowRoutingBindings(t *testing.T) {
|
||||
log: slog.New(slog.DiscardHandler),
|
||||
st: storeA,
|
||||
stateStore: storeB,
|
||||
web: &webui.Server{},
|
||||
kindWorkflows: workflow.KindWorkflows{workintake.KindBug: "custom-bug"},
|
||||
labelWorkflows: workflow.LabelWorkflows{"security": "security-review"},
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
package archied
|
||||
|
||||
import (
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/skill"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
// skillCatalogAdapter serves the webui's skill catalogue view from the
|
||||
// runtime cataloguer. The webui deliberately does not link internal/skill
|
||||
// (archie-core-8cda.5.6), so the process that owns the config and the
|
||||
// runtime supplies this adapter at bootstrap.
|
||||
type skillCatalogAdapter struct{ cfg *config.Holder }
|
||||
|
||||
var _ webui.SkillCatalog = skillCatalogAdapter{}
|
||||
|
||||
// Skills discovers and renders the catalogue: project, explicitly shared,
|
||||
// and user-global skills; earlier roots win when names collide. A discovery
|
||||
// failure renders as an empty catalogue -- the page answers "what can
|
||||
// Archie do" from whatever loaded, never a failed dashboard.
|
||||
func (a skillCatalogAdapter) Skills() []webui.SkillView {
|
||||
cfg := a.cfg.Get()
|
||||
roots := skill.DefaultRoots(cfg.WorkDir, cfg.SkillsDir)
|
||||
catalog, err := skill.CatalogRoots(roots...)
|
||||
if err != nil {
|
||||
return []webui.SkillView{}
|
||||
}
|
||||
views := make([]webui.SkillView, 0, len(catalog))
|
||||
for _, entry := range catalog {
|
||||
views = append(views, webui.SkillView{
|
||||
Name: entry.Name,
|
||||
Description: entry.Description,
|
||||
Workflow: entry.Workflow,
|
||||
Source: skillSource(entry.Root, cfg.WorkDir, cfg.SkillsDir),
|
||||
})
|
||||
}
|
||||
return views
|
||||
}
|
||||
|
||||
// skillSource labels where a skill was loaded from.
|
||||
//
|
||||
// sharedDir is checked first: when it equals workDir the roots collapse to one
|
||||
// entry, and matching workDir first labelled every shared skill as a project
|
||||
// skill.
|
||||
func skillSource(root, workDir, sharedDir string) string {
|
||||
switch root {
|
||||
case sharedDir:
|
||||
return "shared skills"
|
||||
case workDir:
|
||||
return "project skills"
|
||||
default:
|
||||
return "user-global skills"
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/config"
|
||||
"github.com/samcharles93/archie-core/internal/daemon"
|
||||
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
|
||||
taskactionstore "github.com/samcharles93/archie-core/internal/infrastructure/taskactions"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
)
|
||||
|
||||
// openSecondStore opens a second, independent *store.Store on a fresh temp
|
||||
@@ -47,7 +44,6 @@ func TestBuildDaemonRoutesTaskStoreThroughStateStore(t *testing.T) {
|
||||
log: slog.New(slog.DiscardHandler),
|
||||
st: storeA,
|
||||
stateStore: storeB,
|
||||
web: &webui.Server{},
|
||||
}
|
||||
b.buildDaemon()
|
||||
|
||||
@@ -68,48 +64,6 @@ func TestBuildDaemonRoutesTaskStoreThroughStateStore(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestSetupObservabilityKeepsStoreSurfacesOutOfTheDaemonWebui proves the
|
||||
// cutover's composition rule: the daemon's webui is the configuration
|
||||
// snapshot's renderer, so it carries the config Holder and provenance and
|
||||
// no store surfaces -- the dashboard's store-backed reads resolve in the
|
||||
// UI process from its own State Store client (pinned by archieui's
|
||||
// compose tests), and a store handle here would be an unused second
|
||||
// authority.
|
||||
func TestSetupObservabilityKeepsStoreSurfacesOutOfTheDaemonWebui(t *testing.T) {
|
||||
storeA, err := store.Open(t.Context(), filepath.Join(t.TempDir(), "store-a.db"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = storeA.Close() })
|
||||
storeB := openSecondStore(t)
|
||||
|
||||
b := &boot{
|
||||
cfg: config.Config{},
|
||||
log: slog.New(slog.DiscardHandler),
|
||||
st: storeA,
|
||||
stateStore: storeB,
|
||||
doc: &configuration.Document{},
|
||||
agentStatus: &daemon.AgentStatus{},
|
||||
}
|
||||
t.Cleanup(b.cleanup)
|
||||
b.setupObservability(t.Context())
|
||||
|
||||
if b.cfgHolder == nil {
|
||||
t.Fatal("cfgHolder is nil; the daemon renders the configuration snapshot it publishes (archie-core-ymut)")
|
||||
}
|
||||
for name, surface := range map[string]any{
|
||||
"Store": b.web.Store,
|
||||
"Captures": b.web.Captures,
|
||||
"Mappings": b.web.Mappings,
|
||||
"Bindings": b.web.Bindings,
|
||||
"CaptureIntake": b.web.CaptureIntake,
|
||||
} {
|
||||
if surface != nil {
|
||||
t.Errorf("webui %s is wired; the daemon serves no dashboard after the cutover", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestTaskActionsRoutesThroughStateStore proves the daemon's operator task
|
||||
// action service wraps b.stateStore (the contract adapter), so an operator
|
||||
// approve/cancel/archive action mutates the same store the daemon lifecycle
|
||||
|
||||
Reference in new issue
Block a user