diff --git a/Taskfile.yml b/Taskfile.yml index b22de46fb..a03a36918 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -108,7 +108,7 @@ tasks: dev:daemon: desc: archied only, live-reloading via air (prefer `task dev`) cmds: - - air + - air -build.args_bin="-config-overlay,deployments/dev.toml" dev:gateway: desc: archie-gateway only, no live-reload (prefer `task dev`) diff --git a/deployments/dev.toml b/deployments/dev.toml new file mode 100644 index 000000000..90a827019 --- /dev/null +++ b/deployments/dev.toml @@ -0,0 +1,3 @@ +# Match Vite's API/event proxy without changing the installed configuration. +[web] +listen = "127.0.0.1:8484" diff --git a/internal/app/archied/bootstrap.go b/internal/app/archied/bootstrap.go index 32f8c72a4..1103c70ab 100644 --- a/internal/app/archied/bootstrap.go +++ b/internal/app/archied/bootstrap.go @@ -281,7 +281,7 @@ func (b *boot) openStores(ctx context.Context) error { log.Error("close store", "err", err) } }) - return nil + return b.openChatSessions(ctx) } func (b *boot) openChatSessions(_ context.Context) error { //nolint:unparam // context keeps the composition phase contract aligned with other openers diff --git a/internal/app/archied/chat_store_composition_test.go b/internal/app/archied/chat_store_composition_test.go index 5438f1b76..40bf19547 100644 --- a/internal/app/archied/chat_store_composition_test.go +++ b/internal/app/archied/chat_store_composition_test.go @@ -7,22 +7,19 @@ 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) { cfg := config.Config{DBPath: filepath.Join(t.TempDir(), "tasks.db")} cfg.Services.Gateway.Target = "127.0.0.1:1" - st, err := store.Open(t.Context(), cfg.DBPath) - if err != nil { + b := &boot{cfg: cfg, log: slog.Default(), web: &webui.Server{Cfg: config.NewHolder(cfg)}} + t.Cleanup(b.cleanup) + if err := b.openStores(t.Context()); err != nil { t.Fatal(err) } - t.Cleanup(func() { _ = st.Close() }) - b := &boot{cfg: cfg, st: st, log: slog.Default(), web: &webui.Server{Cfg: config.NewHolder(cfg)}} - t.Cleanup(b.cleanup) - if err := b.openChatSessions(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(); err != nil { diff --git a/internal/app/archied/gateway.go b/internal/app/archied/gateway.go index 425a9ad49..8d15cb75b 100644 --- a/internal/app/archied/gateway.go +++ b/internal/app/archied/gateway.go @@ -38,9 +38,6 @@ func RunGateway(ctx context.Context, options GatewayOptions) error { if err := b.openStores(ctx); err != nil { return err } - if err := b.openChatSessions(ctx); err != nil { - return err - } b.loadCatalog(ctx, options.Config) url, token := b.cfg.NATS.URL, "" var nc *natsio.Conn