docs(store): drop residual SQLite references; fix lane lint findings

This commit is contained in:
sam committed 2026-09-24 19:39:06 +10:00
1 parent 35ebaa6ce4
commit f4b8707ba9
62 files changed
+113 -111

No files matched your search

+3 -8
View File
@@ -1,11 +1,6 @@
// Command archie-state-store hosts the State Store's gRPC contract and owns
// the single archie.db SQLite file. It is the .4.3 companion to the daemon's
// in-process State Store server: the same StateStoreService .4.2 serves, but
// extracted into its own process with its own store lifecycle.
//
// The gateway's session SQLite is owned by the separate archie-gateway process
// and is untouched here. See docs/prds/state-store-contract.md (rev. 2c) §5,
// §9 and §11.
// Command archie-state-store hosts the State Store's gRPC contract and is the
// only process that owns the PostgreSQL stores behind it. See
// docs/prds/state-store-contract.md §5, §9 and §11.
package main
import (
+2 -2
View File
@@ -5,10 +5,10 @@
//
// This is the .4.7 end-to-end verification for
// docs/prds/state-store-contract.md (rev. 2c): it proves the process owns the
// single archie.db task SQLite, serves the combined task/event/capture
// task store, serves the combined task/event/capture
// surface over one gRPC service, preserves error-sentinel fidelity across the
// wire, honours a per-call deadline, survives a restart/recovery cycle, and
// is the sole owner of the SQLite file. See §5 (binary layout), §6 (handoff),
// is the sole owner of the store. See §5 (binary layout), §6 (handoff),
// §7 (error semantics), §11 (remote adapter) and §12 step 7/8 (single owner).
package main
+1 -1
View File
@@ -1,6 +1,6 @@
// This file enforces the objective half of the UI Service deletion gate
// (docs/prds/ui-service-boundary.md, "The deletion gate is objective"). The
// composition half -- no config.Holder, no concrete *store.Store, no Gateway
// composition half -- no config.Holder, no concrete task store, no Gateway
// runtime type -- is pinned by internal/app/archieui's
// TestComposeUIServerHoldsNoDaemonState. This pins the claim that test cannot
// see: that the linked binary carries no daemon runtime at all. Go imports
+1 -1
View File
@@ -475,7 +475,7 @@ func (b *boot) loadCatalog(ctx context.Context, cfgPath string) {
b.log.Info("model catalog loaded", "providers", len(catalog.Providers), "models", len(b.catalogModels))
}
// setupObservability builds the event bus and dashboard server. Every event is logged to SQLite (stamped with its row id) and
// setupObservability builds the event bus and dashboard server. Every event is persisted (stamped with its row id) and
// then fanned out to live dashboard connections.
func (b *boot) setupObservability(ctx context.Context) {
cfg, log := b.cfg, b.log
@@ -5,10 +5,9 @@ import (
"path/filepath"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgtest"
)
@@ -5,9 +5,8 @@ import (
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/webui"
)
+1 -2
View File
@@ -6,10 +6,9 @@ import (
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/webui"
)
+3 -3
View File
@@ -138,7 +138,7 @@ func toolLimits(cfg config.Config) agentexec.ToolLimits {
const taskListOverRead = 5
// chatTaskListerAdapter gives the gateway a read view of one identity's tasks.
// gateway deliberately does not import internal/store, so the projection
// gateway deliberately does not import the task store, so the projection
// happens here, as it does for the writer and controller adapters below.
type chatTaskListerAdapter struct {
tasks func(context.Context, int) ([]workflow.Task, error)
@@ -608,7 +608,7 @@ func (a chatTaskControllerAdapter) CancelChatTask(ctx context.Context, taskID in
}
// chatTaskLogReaderAdapter gives the gateway a read view of a task's
// persisted log history without importing internal/logging or internal/store
// persisted log history without importing internal/logging or the task store
// into the gateway package. Each identity's reader is scoped to its own
// tasks: the identity bound at construction is used for authorization, so a
// model cannot read another identity's task logs by passing a different
@@ -803,7 +803,7 @@ func subscribeSystemLogs(nc *natsio.Conn, taskLogs *logging.TaskRegistry, log *s
// progress, outcome, parking) here because that worker's own *events.Bus is
// in-process and invisible to the daemon; this is the other half of the
// bridge, landing them on bus so persistAndBroadcastEvents -- the single
// choke point that inserts into the SQLite events table and fans out over
// choke point that inserts into the events table and fans out over
// SSE -- treats them exactly like every other daemon-observed event. Mirrors
// subscribeSystemLogs's demux-by-taskID shape.
func subscribeAgentEvents(nc *natsio.Conn, bus *events.Bus, log *slog.Logger) (unsubscribe func(), err error) {
+1 -2
View File
@@ -13,8 +13,6 @@ import (
"testing"
"time"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/nats-io/nats-server/v2/server"
natssrv "github.com/nats-io/nats-server/v2/test"
natsio "github.com/nats-io/nats.go"
@@ -29,6 +27,7 @@ import (
"github.com/samcharles93/archie-core/internal/forge"
"github.com/samcharles93/archie-core/internal/forgerpc"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/logging"
"github.com/samcharles93/archie-core/internal/secret"
"github.com/samcharles93/archie-core/internal/tools"
+1 -1
View File
@@ -1 +1 @@
{"url":"nats://127.0.0.1:42009","token":"PXDPQYX3SBCBW6MNZTUSB5LNDW"}
{"url":"nats://127.0.0.1:40943","token":"KL5KSFZT4PI5KIHF3GUOYXUTOQ"}
@@ -0,0 +1 @@
{"Created":"0001-01-01T00:00:00Z","Name":"","name":"QZFaSGZ6","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":5000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -0,0 +1 @@
fb9d97471241c535
@@ -1 +1 @@
{"Created":"2026-09-24T04:46:09.06756232Z","Name":"archie-daemon","durable_name":"archie-daemon","name":"archie-daemon","deliver_policy":"all","ack_policy":"explicit","ack_wait":300000000000,"max_deliver":3,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":86400000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
{"Created":"2026-09-24T09:38:53.493195549Z","Name":"archie-daemon","durable_name":"archie-daemon","name":"archie-daemon","deliver_policy":"all","ack_policy":"explicit","ack_wait":300000000000,"max_deliver":3,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":86400000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -1 +1 @@
d87c12a35c167265
989e2c19cd43eee8
@@ -0,0 +1 @@
{"Created":"2026-09-24T09:38:53.500447377Z","Name":"jRzCdtm6","name":"jRzCdtm6","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -0,0 +1 @@
620c347e0e296f80
@@ -0,0 +1 @@
{"Created":"2026-09-24T09:38:53.500003272Z","Name":"kmNsDMt5","name":"kmNsDMt5","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -0,0 +1 @@
e571c54b14192a8c
@@ -0,0 +1 @@
{"Created":"0001-01-01T00:00:00Z","Name":"","name":"nYF2oUak","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":5000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -0,0 +1 @@
52d9f8cea485537a
@@ -1 +1 @@
{"Created":"2026-09-24T04:46:09.078999729Z","Name":"s3Z87297","name":"s3Z87297","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
{"Created":"0001-01-01T00:00:00Z","Name":"","name":"s3Z87297","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":5000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -1 +1 @@
8f8b6852faee5da4
218aa24a9029a5b8
@@ -1 +1 @@
{"Created":"2026-09-24T04:46:09.079549283Z","Name":"sg9Gl4th","name":"sg9Gl4th","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
{"Created":"0001-01-01T00:00:00Z","Name":"","name":"sg9Gl4th","deliver_policy":"all","ack_policy":"explicit","ack_wait":30000000000,"max_deliver":-1,"filter_subject":"archie.reaction.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":5000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -1 +1 @@
3c91a932fe817389
4719ba6cad8cfe3c
@@ -1 +1 @@
{"Created":"2026-09-24T04:46:09.068004189Z","Name":"archie-daemon","durable_name":"archie-daemon","name":"archie-daemon","deliver_policy":"all","ack_policy":"explicit","ack_wait":300000000000,"max_deliver":3,"filter_subject":"archie.task.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":86400000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
{"Created":"2026-09-24T09:38:53.492664758Z","Name":"archie-daemon","durable_name":"archie-daemon","name":"archie-daemon","deliver_policy":"all","ack_policy":"explicit","ack_wait":300000000000,"max_deliver":3,"filter_subject":"archie.task.\u003e","replay_policy":"instant","max_waiting":512,"max_ack_pending":1000,"inactive_threshold":86400000000000,"num_replicas":0,"metadata":{"_nats.req.level":"0"}}
@@ -1 +1 @@
514bef62122c4381
424323b7dcce276c
+1 -2
View File
@@ -5,10 +5,9 @@ import (
"path/filepath"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/webui"
)
@@ -4,11 +4,10 @@ import (
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/domain/workintake"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
)
// TestBuildDaemonCarriesWorkflowRoutingBindings pins the composition hop in the
+1 -2
View File
@@ -14,10 +14,9 @@ import (
"testing"
"time"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/daemon"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
)
// notifyRecorder captures every record at every level. The other recording
+1 -1
View File
@@ -213,7 +213,7 @@ func (b *boot) openStateStore(ctx context.Context) error {
}
// stateStoreDeps assembles the store surfaces the StateStore service fronts.
// b.st is the narrow storecontract.TaskStore; the wide *store.Store also implements
// b.st is the narrow storecontract.TaskStore; the concrete store also implements
// the capture/mapping/binding surfaces, so each is asserted here (the same
// pattern the daemon's wireWebStoreSurfaces uses) and a store that lacks one
// degrades that group rather than aborting boot.
@@ -68,7 +68,7 @@ func TestOpenStateStoreAdapterRequiresTarget(t *testing.T) {
b.secrets = &secret.Registry{}
// After .4.6 the daemon and gateway no longer own archie.db in-process, so
// an empty [services.state].target is a composition error, not the old
// local *store.Store default (docs/prds/state-store-contract.md §12 step 7).
// local task-store default (docs/prds/state-store-contract.md §12 step 7).
if err := b.openStateStoreAdapter(); err == nil {
t.Fatal("empty services.state.target should error: the in-process store path is deleted")
}
@@ -98,7 +98,7 @@ func TestStateStoreSingleOwnerComposition(t *testing.T) {
b := newBootstrap()
b.secrets = &secret.Registry{}
// The daemon openStores path must not construct a local *store.Store.
// The daemon openStores path must not construct a local task store.
// openStores only resolves secrets and the forge client, then opens chat
// sessions; the task store surface comes from the remote adapter, so no
// archie.db task file is touched. This asserts openStateStoreAdapter (the
@@ -4,9 +4,8 @@ import (
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
taskactionstore "github.com/samcharles93/archie-core/internal/infrastructure/taskactions"
)
@@ -124,7 +124,7 @@ func TestInsertEventLeavesOtherKindsUnprojected(t *testing.T) {
}
}
// failingToolCallWriter stands in for a broken PocketBase side, so the
// failingToolCallWriter stands in for a broken event-capture store, so the
// never-returned-failure contract can be tested without sabotaging the real
// store.
type failingToolCallWriter struct{ err error }
+1 -1
View File
@@ -21,7 +21,7 @@ import (
//
// It is a named function so that step_vocabulary_test.go can fail if a root
// stops resolving the shipped stages, or hands a constructor a manager other
// than the one this returns; the roots themselves own a SQLite file and dial
// than the one this returns; the roots themselves open a database and dial
// gRPC, so the test asserts their wiring by parsing their bodies.
//
// Agreement is within one build: the State Store and archie-agent are
@@ -7,13 +7,12 @@ import (
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/taskactions"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/taskstate"
)
+1 -2
View File
@@ -9,12 +9,11 @@ import (
"strconv"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/webui"
)
+1 -1
View File
@@ -835,7 +835,7 @@ func (d *Daemon) botUserForTask(task *workflowtask.Task) string {
return d.Cfg.Get().BotUser
}
// drainNATS processes tasks from NATS, falling back to SQLite ClaimNext for
// drainNATS processes tasks from NATS, falling back to the task store's ClaimNext for
// requeued tasks (waiting_human approval, retry-parked) that didn't come
// through a NATS publish.
func (d *Daemon) drainNATS(ctx context.Context) {
+2 -6
View File
@@ -245,12 +245,6 @@ func TestDispatchBindingsNilDispatcherIsNoOp(t *testing.T) {
// ── helpers ──────────────────────────────────────────────────────
// openDispatchTestStore creates a fresh in-memory SQLite store for
// each dispatch test. The TempDir anchor matches store.OpenTest's
// own convention; tests rely on the same schema-migration path
// production uses (CREATE TABLE + ALTER TABLE migrations), so
// binding_id / binding_version / binding_dispatches all exist on the
// store by the time a test runs.
// dispatchStores pairs the two stores the dispatcher spans: the task store and
// the event-capture store, so a seed helper reads as one handle.
type dispatchStores struct {
@@ -259,6 +253,8 @@ type dispatchStores struct {
edaPool *pgxpool.Pool
}
// openDispatchTestStore opens fresh migrated task and event-capture stores for
// each dispatch test.
func openDispatchTestStore(t *testing.T) *dispatchStores {
t.Helper()
s := pgstore.Open(t)
+25 -16
View File
@@ -82,22 +82,9 @@ func parseCronSegment(segment string, lo, hi int) (cronSlots, error) {
}
step = n
}
first, last := lo, hi
if base != "*" {
from, to, ranged := strings.Cut(base, "-")
if !ranged && stepped {
return 0, fmt.Errorf("step in %q needs a wildcard or a range", part)
}
var err error
if first, err = cronValue(from, lo, hi); err != nil {
return 0, err
}
last = first
if ranged {
if last, err = cronValue(to, first, hi); err != nil {
return 0, err
}
}
first, last, err := cronRange(base, part, stepped, lo, hi)
if err != nil {
return 0, err
}
for v := first; v <= last; v += step {
slots |= 1 << v
@@ -106,6 +93,28 @@ func parseCronSegment(segment string, lo, hi int) (cronSlots, error) {
return slots, nil
}
// cronRange returns the values base names: every value for "*", else a
// single value or a from-to range.
func cronRange(base, part string, stepped bool, lo, hi int) (first, last int, err error) {
if base == "*" {
return lo, hi, nil
}
from, to, ranged := strings.Cut(base, "-")
if !ranged && stepped {
return 0, 0, fmt.Errorf("step in %q needs a wildcard or a range", part)
}
if first, err = cronValue(from, lo, hi); err != nil {
return 0, 0, err
}
if !ranged {
return first, first, nil
}
if last, err = cronValue(to, first, hi); err != nil {
return 0, 0, err
}
return first, last, nil
}
func cronValue(text string, lo, hi int) (int, error) {
v, err := strconv.Atoi(text)
if err != nil {
@@ -1,8 +1,8 @@
// Package storecontract is the ratified State Store contract as its
// consumers reference it: the producer-owned daemon/webui/intake store
// surfaces (docs/prds/state-store-contract.md §1, §2). It carries no
// persistence -- *store.Store (SQLite, transitional location) and
// *staterpc.Client (the remote adapter) both satisfy these interfaces --
// persistence -- internal/infrastructure/postgres and *staterpc.Client (the
// remote adapter) both satisfy these interfaces --
// so a process that only holds the contracts, such as the archie-ui
// dashboard process, can reference them without linking the SQL
// implementation.
@@ -10,9 +10,7 @@
// It is hand-written and lives in the domain layer (which owns required
// contracts), NOT under internal/contracts: that tree is the buf generate
// output and is wiped and regenerated by tools/proto.sh, which would
// delete a hand-written file there (archie-core-8cda.5.6). Relocated from
// internal/store by the UI Service deletion gate; internal/store keeps
// type aliases so daemon-side callers are unaffected.
// delete a hand-written file there (archie-core-8cda.5.6).
package storecontract
import (
@@ -230,7 +228,7 @@ type BindingTaskCreator interface {
// playbook's ledger rows on explicit request only: a playbook file missing at
// boot may be an unmounted directory, and reclaiming on that would let
// redelivered events fire again. There is deliberately no *sql.Tx: any
// transaction stays server-side inside internal/store.
// transaction stays server-side inside the store.
type PlaybookDispatcher interface {
RecordPlaybookDispatch(ctx context.Context, playbookID, playbookVersion, eventID, actionID string) error
DeletePlaybookDispatches(ctx context.Context, playbookID string) error
@@ -382,9 +380,8 @@ var (
// Resource is one control-plane resource document: the stored value for a
// kind, its revision, and the audit record written with the last write.
// Resource and ResourceWrite live here (rather than internal/store) so the
// PostgreSQL implementation and the UI-side consumers can reference them
// without linking the SQLite implementation.
// Resource and ResourceWrite live here so the UI-side consumers can reference
// them without linking the PostgreSQL implementation.
type Resource struct {
Kind string
Value []byte
@@ -7,11 +7,10 @@ import (
"strings"
"testing"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/agentexec"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
)
// storeIntegrationRunner is a minimal agentexec.Runner stub, duplicated
@@ -19,7 +18,7 @@ import (
// lives in the external workflow_test package: it needs the real
// *pgstore.TaskDB as a workflow.Store, and the package under test now owns
// workflow.Task/Status/Source, which would otherwise cycle back through
// internal/store's dependency on internal/domain/workflow.
// the store's dependency on internal/domain/workflow.
type storeIntegrationRunner struct {
result agentexec.Result
}
+2 -2
View File
@@ -33,7 +33,7 @@ const (
)
// Task is the task-execution record the workflow domain operates on.
// internal/store persists this type (persistence -> domain).
// internal/infrastructure/postgres persists this type (persistence -> domain).
type Task struct {
ID int64 `json:"id"`
Owner string `json:"owner"`
@@ -134,7 +134,7 @@ func (t Task) IsForgeBacked() bool {
}
// Store is the narrow, consumer-owned subset of the State Store contract
// that workflow stages call mid-run. *store.Store and staterpc.Client
// that workflow stages call mid-run. The PostgreSQL store and staterpc.Client
// satisfy it; this is the interface archie-agent uses over the gRPC State
// Store contract. It supersedes store.WorkflowStore.
type Store interface {
+1 -1
View File
@@ -106,7 +106,7 @@ const (
KindTurnCompleted = "turn_completed"
// EDA edit activity (bindings and mappings on the captures store). Each
// successful write on the State Store's PocketBase tables emits one
// successful write on the State Store's binding and mapping tables emits one
// event through the same task-DB path capture arrival uses, so a
// dashboard edit is visible on the activity stream without a manual
// refresh. data: id (the edited record), action (create, update,
+1 -1
View File
@@ -13,7 +13,7 @@ import (
func compressBackends() map[string]func(t *testing.T) SessionStore {
return map[string]func(t *testing.T) SessionStore{
"memory": func(*testing.T) SessionStore { return NewSessionStoreMemory() },
"postgres": func(t *testing.T) SessionStore { return newPostgresStore(t) },
"postgres": newPostgresStore,
}
}
+4 -4
View File
@@ -53,7 +53,7 @@ type ChatTaskSummary struct {
// ChatTaskLister is the read surface the task tools need. It mirrors the
// existing chatTaskWriter/chatTaskController pattern: gateway states what it
// needs and the daemon supplies an adapter over the store, so this package
// keeps its independence from internal/store.
// keeps its independence from the task store.
type ChatTaskLister interface {
ListChatTasks(ctx context.Context, identity string, limit int) ([]ChatTaskSummary, error)
}
@@ -72,7 +72,7 @@ type TaskSpawnResult struct {
// ChatTaskActor is the mutation surface task_action needs. It mirrors the
// ChatTaskLister pattern: gateway states what it needs and the daemon
// supplies an adapter over the store and runtime, so this package keeps its
// independence from internal/store.
// independence from the task store.
type ChatTaskActor interface {
// ApplyChatTaskAction executes action on taskID, scoped to identity's own
// tasks. A nil identity is an authenticated dashboard operator, who acts
@@ -85,7 +85,7 @@ type ChatTaskActor interface {
// ChatTaskLogEntry is one log line as task_logs returns it. It mirrors
// internal/logging.Entry's shape without importing that package: gateway
// keeps its independence from internal/logging the same way it already does
// from internal/store, with the daemon adapting between them.
// from the task store, with the daemon adapting between them.
type ChatTaskLogEntry struct {
Time time.Time `json:"time"`
Level string `json:"level"`
@@ -144,7 +144,7 @@ type ChatTaskLogResult struct {
// ChatTaskLogReader is the read surface task_logs needs. It mirrors the
// ChatTaskLister pattern: gateway states what it needs and the daemon
// supplies an adapter, so this package keeps its independence from
// internal/store and internal/logging.
// the task store and internal/logging.
type ChatTaskLogReader interface {
// ReadChatTaskLogs returns taskID's log entries for attempt (0 selects
// the task's current/latest attempt), scoped to identity's own tasks.
+2 -2
View File
@@ -41,7 +41,7 @@ type taskProfile struct {
// chatTaskWriter is the write surface StoreTaskCreator needs. It
// returns the created task's real database ID, not a *workflow.Task --
// gateway deliberately has no dependency on internal/store or
// gateway deliberately has no dependency on the task store or
// internal/domain/workflow; the daemon supplies an adapter closure over
// the store.TaskStore method of the same name.
type chatTaskWriter interface {
@@ -116,7 +116,7 @@ func splitOwnerRepo(s string) (owner, repo string, ok bool) {
}
// Task lifecycle statuses come from internal/taskstate, a leaf package with
// no dependencies, so gateway stays decoupled from internal/store without
// no dependencies, so gateway stays decoupled from the task store without
// keeping a hand-synced copy of the strings. The copy that used to live here
// is how the dashboard and chat ended up recording different states for the
// same operator decision.
+13 -4
View File
@@ -18,14 +18,14 @@ func TestTurnLedgerClaimLifecycleIsIdempotent(t *testing.T) {
name: "memory",
open: func(t *testing.T) (TurnLedger, func()) {
store := NewSessionStoreMemory()
return store.(TurnLedger), func() { _ = store.Close() }
return asTurnLedger(t, store), func() { _ = store.Close() }
},
},
{
name: "postgres",
open: func(t *testing.T) (TurnLedger, func()) {
store := newPostgresStore(t)
return store.(TurnLedger), func() { _ = store.Close() }
return asTurnLedger(t, store), func() { _ = store.Close() }
},
},
}
@@ -113,14 +113,14 @@ func TestTurnLedgerReclaimsAcrossProcessOwnersAndRejectsStaleWrites(t *testing.T
name: "memory",
open: func(t *testing.T) (TurnLedger, func()) {
store := NewSessionStoreMemory()
return store.(TurnLedger), func() { _ = store.Close() }
return asTurnLedger(t, store), func() { _ = store.Close() }
},
},
{
name: "postgres",
open: func(t *testing.T) (TurnLedger, func()) {
store := newPostgresStore(t)
return store.(TurnLedger), func() { _ = store.Close() }
return asTurnLedger(t, store), func() { _ = store.Close() }
},
},
}
@@ -393,3 +393,12 @@ func TestTurnRunnerCanonicalTurnIDRejectsCollidingLegacyRecord(t *testing.T) {
got, want, collidingLegacyID)
}
}
func asTurnLedger(t *testing.T, store SessionStore) TurnLedger {
t.Helper()
ledger, ok := store.(TurnLedger)
if !ok {
t.Fatalf("%T does not implement TurnLedger", store)
}
return ledger
}
@@ -212,7 +212,7 @@ func TestHandleCaptureStoresRedactedBody(t *testing.T) {
// host process's pipeline (the daemon's bus drain), already tested there.
//
// The published event is deliberately LIGHTWEIGHT (id + source only, no
// body/headers): the events table this feeds (internal/store/events.go) has
// body/headers): the events table this feeds (the State Store events table) has
// no retention or row-count prune, unlike captured_events, so embedding the
// full (up to CaptureMaxBodyBytes) payload here would duplicate it into an
// unbounded table and defeat the disk-bound guarantee InsertCapture's own
+3 -3
View File
@@ -35,14 +35,14 @@ func (s *Store) queries() *postgresdb.Queries {
return postgresdb.New(s.pool)
}
// Close is a no-op: unlike the SQLite store, this store owns no file handle
// Close is a no-op: this store owns no file handle
// or connection -- the pool belongs to the composition that opened it.
func (s *Store) Close() error { return nil }
// syntheticIssueNumberBase is the seed for a repo's first chat task. The
// COALESCE allocator adds one to the passed fallback, so the fallback here is
// base-1 and the first chat task lands on exactly base, matching the SQLite
// store's reserved JSON-safe floor (see internal/store.EnqueueChatTask).
// base-1 and the first chat task lands on exactly base: the reserved
// JSON-safe floor that keeps synthetic issue numbers clear of real ones.
const syntheticIssueNumberBase = 1_000_000_000_000_000
// taskFromRow maps the generated task row to the workflow.Task the daemon and
+1 -1
View File
@@ -26,7 +26,7 @@ import (
// --- state_db ---
// statusCounter is the read-only store surface the state_db probe needs.
// The daemon's *store.Store satisfies it; the probe never depends on the
// The task store satisfies it; the probe never depends on the
// full task-lifecycle interface.
type statusCounter interface {
StatusCounts(ctx context.Context) (map[string]int, error)
@@ -29,7 +29,7 @@ func TestCaptureListsExceedUnaryMessageLimit(t *testing.T) {
t.Fatal(mapErr)
}
// ListUndispatchedCaptures only returns sources with an armed binding
// (edastore.ArmedBindingsForSource), so "large" needs one taken through the
// (ArmedBindingsForSource), so "large" needs one taken through the
// public draft -> pending_approval -> armed lifecycle.
id, err := eda.InsertBinding(t.Context(), binding.Binding{
Name: "large binding", Matcher: binding.Matcher{Source: "large"},
@@ -31,7 +31,7 @@ type contract interface {
storecontract.ApplyStatusStore
}
// edaContract is the event-capture half, which the PocketBase store serves.
// edaContract is the event-capture half, which the PostgreSQL EDA store serves.
// It is a separate interface because no single type implements both halves
// any more: that split is the point of the migration, not an accident.
type edaContract interface {
+1 -1
View File
@@ -1,4 +1,4 @@
// Package staterpc adapts the State Store contract (internal/store's
// Package staterpc adapts the State Store contract (internal/domain/storecontract's
// producer-owned surfaces plus the consumer-owned workflow.Store) to gRPC.
// See docs/prds/state-store-contract.md for the ratified contract this
// package implements against.
@@ -93,7 +93,7 @@ func TestCaptureStreamsCarryTheAdminToken(t *testing.T) {
if mapErr != nil {
t.Fatal(mapErr)
}
// (edastore.ArmedBindingsForSource), so "large" needs one taken through the
// (ArmedBindingsForSource), so "large" needs one taken through the
// public draft -> pending_approval -> armed lifecycle.
id, err := admin.InsertBinding(ctx, binding.Binding{
Name: "large binding", Matcher: binding.Matcher{Source: "large"},
@@ -94,7 +94,7 @@ func TestTaskLogStageFilterSurvivesTheWire(t *testing.T) {
}
// TestEventDataJSONPreservesMarshalErrorMarker pins §11's conformance
// invariant: the local store (internal/store/events.go) records a
// invariant: the store records a
// {"marshal_error":%q} marker when json.Marshal of event Data fails, so the
// remote wire must carry the same marker rather than silently emptying the
// Data on the hop.
+1 -1
View File
@@ -9,7 +9,7 @@
// for "the pull request was closed without merging" -- no longer meant one
// thing.
//
// internal/gateway deliberately does not import internal/store, so it kept a
// internal/gateway deliberately does not import the task store, so it kept a
// hand-synced copy of the status strings with a comment asking future editors
// to keep them aligned. That is the same defect one level down. This package
// has no dependencies, so both can import it and the copy can go.
+1 -2
View File
@@ -25,11 +25,10 @@ import (
"testing"
"time"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/infrastructure/postgres/pgstore"
)
func newTestServer(t *testing.T) *Server {