refactor(store): move the producer-owned contracts to internal/contracts/store/v1

The deletion gate for the UI Service (archie-core-8cda.5.6) is objective:
go list -deps from cmd/archie-ui must show no SQL/store implementation.
internal/store's hand-written contract surfaces (TaskStore and its
component interfaces, CaptureStore, MappingStore, BindingStore,
BindingDispatcher, BindingTaskCreator, ConfigSnapshotStore) move to
internal/contracts/store/v1 (package storev1), alongside the value types
they carry (CapturedEvent, ConfigSnapshot, WorkflowStat, StageStat,
DayTokens) and the sentinel errors -- whose canonical message strings are
the wire contract and are byte-identical after the move.

internal/store keeps type aliases, so daemon-side callers (archied, the
daemon, staterpc's server side, taskactions) are unaffected. The
UI-facing packages switch to storev1 directly: webui, archieui,
captureintake, gatewayrpc, and staterpc's client/values -- which drops
internal/store and modernc.org/sqlite from the archie-ui binary's import
closure.

overlay.DeniedKeys moves to internal/infrastructure/configuration for the
same reason: webui referenced the constant and that dragged the overlay
package's SQLite store in.

The chat-contract and remaining runtime-handle decoupling continues under
the same bead.
This commit is contained in:
sam committed 2026-09-10 03:03:33 +10:00
1 parent 8dfbd3f6c0
commit 3699f51f9b
31 files changed
+455 -365

No files matched your search

+8 -8
View File
@@ -6,8 +6,8 @@ import (
"net/http"
"strconv"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/domain/binding"
"github.com/samcharles93/archie-core/internal/store"
)
// bindingRequest is the wire shape POST /api/bindings and
@@ -72,7 +72,7 @@ func (s *Server) handleBindingCreate(w http.ResponseWriter, r *http.Request) {
}
id, err := s.Bindings.InsertBinding(r.Context(), b)
if err != nil {
if errors.Is(err, store.ErrBindingOverlap) {
if errors.Is(err, storev1.ErrBindingOverlap) {
http.Error(w, "binding source overlaps an existing binding", http.StatusConflict)
return
}
@@ -150,9 +150,9 @@ func (s *Server) handleBindingUpdate(w http.ResponseWriter, r *http.Request) {
}
if err := s.Bindings.UpdateBinding(r.Context(), b); err != nil {
switch {
case errors.Is(err, store.ErrBindingNotFound):
case errors.Is(err, storev1.ErrBindingNotFound):
http.Error(w, "binding not found", http.StatusNotFound)
case errors.Is(err, store.ErrBindingOverlap):
case errors.Is(err, storev1.ErrBindingOverlap):
http.Error(w, "binding source overlaps an existing binding", http.StatusConflict)
default:
s.Log.Error("update binding", "err", err, "id", id)
@@ -181,7 +181,7 @@ func (s *Server) handleBindingDelete(w http.ResponseWriter, r *http.Request) {
return
}
if err := s.Bindings.DeleteBinding(r.Context(), id); err != nil {
if errors.Is(err, store.ErrBindingNotFound) {
if errors.Is(err, storev1.ErrBindingNotFound) {
http.Error(w, "binding not found", http.StatusNotFound)
return
}
@@ -204,11 +204,11 @@ func (s *Server) handleBindingApprove(w http.ResponseWriter, r *http.Request) {
}
if err := s.Bindings.ApproveBinding(r.Context(), id); err != nil {
switch {
case errors.Is(err, store.ErrBindingNotFound):
case errors.Is(err, storev1.ErrBindingNotFound):
http.Error(w, "binding not found", http.StatusNotFound)
case errors.Is(err, store.ErrBindingTransition):
case errors.Is(err, storev1.ErrBindingTransition):
http.Error(w, "binding cannot be approved from its current state", http.StatusConflict)
case errors.Is(err, store.ErrBindingOverlap):
case errors.Is(err, storev1.ErrBindingOverlap):
http.Error(w, "binding source overlaps an existing binding", http.StatusConflict)
default:
s.Log.Error("approve binding", "err", err, "id", id)