Files
archie/internal/app/archied/chat_store_composition_test.go
T
sam 924b02a1b0 feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime
settings through one versioned, audited control-plane API hosted on the
State Store's existing gRPC server: catalog, query, command, watch. Each
feature owns its resource, validation and commands; storage only writes
versions and audit records.

Workflows move with it. Definitions become portable YAML compiled through
a closed, typed step registry and stored as a control-plane resource, so
the yaegi interpretation paths (internal/gate, wfeval, wfextract,
gateeval, gateextract, skillbuild) are deleted rather than carried.

The UI process reads definitions as data: the JSON projection lives in
internal/domain/workflow/task so a dashboard decodes the stored
collection without linking the workflow engine, which cmd/archie-ui's
deletion gate forbids. Shipped definitions ride the catalog descriptor
rather than a bespoke REST route, keeping the API to its four operations.

archie-messaging gains -state-store-target/-state-store-token and reads
channel settings from the database, failing closed when the State Store
is unreachable: the database is authoritative for those settings.
2026-09-21 08:17:42 +10:00

46 lines
1.4 KiB
Go

package archied
import (
"log/slog"
"path/filepath"
"testing"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/store"
)
func TestRemoteChatCompositionPreservesChannelTurnLedger(t *testing.T) {
cfg := config.Config{
DBPath: filepath.Join(t.TempDir(), "tasks.db"),
Services: config.Services{config.ServiceNameGateway: {Target: "127.0.0.1:1"}},
}
st, err := store.Open(t.Context(), filepath.Join(t.TempDir(), "state-store.db"))
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = st.Close() })
b := &boot{cfg: cfg, log: slog.Default(), cfgHolder: config.NewHolder(cfg), stateStore: st, personas: gateway.NewPersonaRegistry(gateway.DefaultPersonas())}
t.Cleanup(b.cleanup)
if err := b.openStores(t.Context()); err != nil {
t.Fatal(err)
}
if b.chatSessionStore == nil {
t.Fatal("startup did not open the channel conversation store")
}
sessions := b.chatSessionStore
if err := b.setupLLMAndChat(t.Context()); err != nil {
t.Fatal(err)
}
if b.chatSessionStore != sessions {
t.Fatal("remote web chat replaced the channel conversation store")
}
ledger, ok := b.chatSessionStore.(gateway.TurnLedger)
if !ok {
t.Fatal("channel conversation store does not implement TurnLedger")
}
if err := ledger.RecoverTurns(t.Context(), "test-owner"); err != nil {
t.Fatal(err)
}
}