refactor(state-store): migrate capture/mapping/binding consumers to State Store (archie-core-8cda.4.4) (#772)

* feat(state-store): add daemon composition path for remote store adapter ($services.state)

Add the additive composition path the daemon's own capture consumers use
(archie-core-8cda.4.4, docs/prds/state-store-contract.md §10/§12 step 6).
bootstrap.go opens production store then resolves b.stateStore: the local
*store.Store by default, or a remote *staterpc.Client dialed to the
standalone archie-state-store gRPC service when [services.state].target is
set. Wire the dashboard CaptureStore surface from b.stateStore.

The in-process StateStore gRPC server keeps serving the daemon's SAME local
store (stateStoreDeps from b.st), not the consumer-facing b.d.* adapters:
task lifecycle (b.st) stays in-process until .4.5/.4.6 and there is no
dual-store ownership. Fail-closed on a non-loopback target without a bearer
token mirrors the standalone server's confinement (§9).

* feat(state-store): route daemon mapping consumers through the state store adapter

Migrate the MappingStore consumer to the State Store contract adapter
(archie-core-8cda.4.4 step 6, Mapping swap): the dashboard's mapping editor
(web.Mappings) and the daemon's dispatch loop (d.Mappings) resolve from
b.stateStore instead of reaching into b.st directly. Local by default,
remote *staterpc.Client when [services.state].target is set.

* feat(state-store): route daemon binding consumers through the state store adapter

Migrate the BindingStore/BindingDispatcher/BindingTaskCreator consumers to
the State Store contract adapter (archie-core-8cda.4.4 step 6, Binding
swap): the dashboard's binding editor (web.Bindings / web.BindingDispatcher)
and the daemon's dispatch loop (d.Bindings / d.BindingDispatcher /
d.BindingTaskCreator) resolve from b.stateStore instead of b.st. Local by
default, remote *staterpc.Client when [services.state].target is set.

* refactor(state-store): resolve daemon state store adapter only in daemon composition

openStores is shared with the standalone archie-gateway (RunGateway), which
does not consume the capture/mapping/binding surfaces. Resolve b.stateStore
from the daemon's own Run() composition instead, so a gateway config that
happens to carry [services.state].target can never dial (or fail closed
against) a state store it does not use. openStateStoreAdapter takes no ctx:
grpc.NewClient connects lazily, and the adapter resolution is synchronous.
This commit is contained in:
sam authored and GitHub committed 2026-09-07 04:04:34 +10:00
1 parent a59505816a
commit 5fe5ff6626
5 files changed
+239 -33

No files matched your search

+8 -4
View File
@@ -272,10 +272,14 @@ gate_max_failures = 5
# # archie-state-store server validates this; a loopback
# # bind (127.0.0.1/::1/localhost) needs no token. Non-loopback
# # without a token fails closed (docs/prds/state-store-contract.md §9).
# # This surface is consumed by the standalone
# # archie-state-store binary (.4.3); the
# # daemon does not read it yet -- it still serves the
# # State Store gRPC service in-process today.
# # The standalone archie-state-store binary (.4.3) consumes
# # this surface; the daemon reads [services.state].target to
# # route its own capture/mapping/binding consumers to the
# # remote store (docs/prds/state-store-contract.md §10/§12 step 6).
# # Task lifecycle stays in-process and the daemon still serves
# # the State Store gRPC service in-process until that path is
# # deleted (.4.6); flipping this during .4.4 routes only the
# # capture/mapping/binding contracts remotely.
# NATS is the sole autonomous workflow handoff. mode changes only where the
# broker runs; every workflow still runs in a managed task container: