feat(state): carry channel lifecycle from the Messaging Service to the dashboard

archie-core-8cda.6.8's carrier. The service now records channel lifecycle and has
nowhere to put it: /api/channels answered with nothing because
webui.Server.Channels had no production source, and reload answered 501 for the
same reason. This adds the surface the register decided on, following the split
archie-core-ymut established for config snapshots -- a pair of administrative RPCs
whose writer is one process and whose reader is the UI -- and wires both ends.

Wire and store: PutChannelStatus / ListChannelStatus, with ChannelStatus carrying
id, name, state, detail, configured, reload_supported and observed_at. The store
holds one row per channel and replaces the reported set, so a channel the reporter
no longer mentions is deleted rather than left standing as a stale "running"; an
empty report clears the table, because hosting no channels is a fact worth
reporting. A row without an id is refused: it could never be replaced or removed
by a later report.

Writer: the service publishes on every lifecycle transition through a coalescing
signal -- a burst of transitions is one write, since a reader only wants the latest
state of every channel -- plus a start-up report and a final report after shutdown,
so a stopped service leaves the store honest. A failed write is logged and retried
on the next signal; the dashboard losing channel state is worth a warning and never
worth failing a channel start over.

Reader: webui.Server.Channels becomes a source rather than a concrete manager, and
webui.RemoteChannelStatus reads the store the way RemoteConfigView reads the config
snapshot. A store it cannot reach reports nothing rather than a stale "running",
and a state the reader does not recognise is carried through rather than dropped.

The contract's own index gains the group in the same change that adds the RPCs --
a surface the grouped table does not list is one nobody finds -- and the count moves
to 51. The register records why the surface is the State Store rather than a
resource kind, and why reload gets its own surface rather than a field here: reading
status must not be able to retrigger an action, a transient request is not
distinguishable from state once anything polls it, and it would invert the
writer/reader relationship the precedent establishes.

Verified: task check exit 0. New coverage: the store's replace-the-set semantics
and its refusal of an id-less row, the reader's mapping including an unknown state,
and the publisher's start-up, transition and final reports.
This commit is contained in:
sam committed 2026-09-22 08:04:44 +10:00
1 parent fb265f2ad0
commit d6f526ce4f
23 files changed
+1445 -406

No files matched your search

+18 -6
View File
@@ -348,12 +348,24 @@ What that decides, so the implementation need not invent it:
change that adds the RPCs -- the table is the contract's own index, and a
surface it does not list is a surface nobody finds.
**Left open here, deliberately.** Reload runs the other way -- the UI asks the
service to reload a channel -- and the config-snapshot precedent only describes a
writer-to-reader direction. Two candidates: a second surface carrying a request
the service observes and clears, or a field on the same surface the service
watches. Deciding it now would be choosing a lifetime for a request queue by
analogy with a status report; they are not the same object.
**Reload gets its own surface, with its own lifetime (decided 2026-09-22).** Reload
runs the other way -- the UI asks the service to reload a channel -- and the two
candidates were a request surface the service observes and clears, or a field on
the status surface the service watches. It is the first. The reasoning, recorded
because it would look arbitrary later:
- A request queue and a status report do not share a lifetime, so they should not
share a surface. A pending request is transient and has an outcome; a channel's
state is durable and has a current value.
- A "please reload" field on the status resource makes READING status capable of
RETRIGGERING an action, and makes a transient request indistinguishable from
state the moment anything polls it.
- It would also invert the writer/reader relationship the precedent establishes:
the service would have to clear a field on an object whose whole contract is
that the service reports it.
So the status surface stays writer-is-service, and the request carrier is its own
object with its own states.
`archie-core-8cda.6.9`'s component self-report is the **same shape**: a process
reporting something about itself for the UI to read. Whether it shares this
+4 -1
View File
@@ -259,11 +259,14 @@ Methods are named after the store methods so the mapping is unambiguous. `workfl
| BindingTaskCreator | `EnqueueBindingTask` |
| Config snapshot | `PutConfigSnapshot`, `GetConfigSnapshot` |
| Apply status | `PutApplyStatus`, `ListApplyStatus` |
| Channel status | `PutChannelStatus`, `ListChannelStatus` |
| Task log | `ReadTaskLog`, `StreamTaskLogContent` |
That is **49 unique contract RPCs** across one service (the `TaskEvents.Close` method is dropped).
That is **51 unique contract RPCs** across one service (the `TaskEvents.Close` method is dropped).
`Close()` is **excluded** from the wire (it is server lifecycle, not a client call) — see §11.
The channel-status pair follows the config snapshot's split for the same reason: the writer is the process that HOSTS the channels -- the Messaging Service, which alone observes whether a channel is starting, running or failed -- and the reader is the UI process. Both RPCs are administrative, so a task-scoped grant reaches neither. A channel's state is runtime state rather than a settings document, which is why it is not a `ControlPlaneService` resource kind: a failed channel is not a document anybody edits. Asking for a reload travels on its own surface rather than through this one; see `docs/architecture/migration-decisions.md`, "Channel state to the dashboard".
The config-snapshot pair was added by `archie-core-ymut` (see
`docs/architecture/migration-decisions.md`, "Dashboard configuration page"). It is the one
surface whose writer is the daemon and whose reader is the UI process, and both RPCs are
+3
View File
@@ -362,6 +362,9 @@ func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps {
if as, ok := b.st.(storecontract.ApplyStatusStore); ok {
deps.ApplyStatus = as
}
if cs, ok := b.st.(storecontract.ChannelStatusStore); ok {
deps.ChannelStatus = cs
}
return deps
}
+55 -2
View File
@@ -1,8 +1,12 @@
package archiemessaging
import (
"context"
"time"
"github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
// channelDescriptors declares the operator-facing identity of each composed
@@ -38,8 +42,57 @@ func channelDescriptors(instances []channelInstance) []status.Descriptor {
// ReportStarting and ReportRunning on whichever lifecycle they are handed.
func (s *Service) lifecycleFor(id string) channels.Lifecycle {
return channels.Lifecycle{
Starting: func() { s.status.MarkStarting(id) },
Running: func() { s.status.MarkRunning(id) },
Starting: func() { s.status.MarkStarting(id); s.signalPublish() },
Running: func() { s.status.MarkRunning(id); s.signalPublish() },
}
}
// signalPublish asks the publisher to report the current set. The signal
// coalesces: a burst of transitions is one write, because a reader only ever
// wants the latest state of every channel.
func (s *Service) signalPublish() {
if s.statusWriter == nil {
return
}
select {
case s.publish <- struct{}{}:
default:
}
}
// publishStatus writes the current set, or deletes it when the service hosts no
// channels -- an empty report is a report, and leaving the previous set standing
// would show channels that are gone.
func (s *Service) publishStatus(ctx context.Context) error {
reported := s.ChannelStatus()
rows := make([]storecontract.ChannelStatus, 0, len(reported))
for _, channel := range reported {
rows = append(rows, storecontract.ChannelStatus{
ID: channel.ID,
Name: channel.Name,
State: string(channel.State),
Detail: channel.Detail,
Configured: channel.Configured,
ReloadSupported: channel.ReloadSupported,
ObservedAt: time.Now(),
})
}
return s.statusWriter.PutChannelStatus(ctx, rows)
}
// publishLoop reports channel state until ctx ends. A failed write is logged and
// retried on the next signal: the dashboard losing channel state is worth a
// warning, and never worth failing a channel start over.
func (s *Service) publishLoop(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
case <-s.publish:
if err := s.publishStatus(ctx); err != nil && ctx.Err() == nil {
s.log.Warn("publishing channel status failed", "err", err)
}
}
}
}
@@ -0,0 +1,98 @@
package archiemessaging
import (
"context"
"fmt"
"log/slog"
"sync"
"testing"
"time"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
// recordingChannelStatusStore records every report the service publishes.
type recordingChannelStatusStore struct {
mu sync.Mutex
writes [][]storecontract.ChannelStatus
}
func (s *recordingChannelStatusStore) PutChannelStatus(_ context.Context, channels []storecontract.ChannelStatus) error {
s.mu.Lock()
defer s.mu.Unlock()
s.writes = append(s.writes, append([]storecontract.ChannelStatus(nil), channels...))
return nil
}
func (s *recordingChannelStatusStore) ChannelStatus(context.Context) ([]storecontract.ChannelStatus, error) {
return nil, nil
}
// waitForPublishedState polls the recorded reports until one carries the channel
// in want, so the assertion races the publisher rather than the clock.
func waitForPublishedState(t *testing.T, store *recordingChannelStatusStore, id, want string) {
t.Helper()
deadline := time.Now().Add(5 * time.Second)
for time.Now().Before(deadline) {
store.mu.Lock()
for _, write := range store.writes {
for _, channel := range write {
if channel.ID == id && channel.State == want {
store.mu.Unlock()
return
}
}
}
store.mu.Unlock()
time.Sleep(10 * time.Millisecond)
}
store.mu.Lock()
defer store.mu.Unlock()
t.Fatalf("no report carried %s as %q; reports were %+v", id, want, store.writes)
}
// TestServicePublishesChannelStatus is the point of archie-core-8cda.6.8: the
// report has to reach the store the dashboard reads, not stay in this process.
// Without this the surface exists and no operator ever sees it.
func TestServicePublishesChannelStatus(t *testing.T) {
writer := &recordingChannelStatusStore{}
srv, err := compose(t.Context(), deps{
ChannelStatus: writer,
Config: ResolvedConfig{
Options: Options{ShutdownTimeout: 2 * time.Second},
WebhookAddr: fmt.Sprintf("127.0.0.1:%d", freePort(t)),
Webhook: config.WebhookRoute{Path: "/smoke"},
},
Log: slog.Default(),
Chat: &recordingChatContract{routes: make(chan messaging.Inbound, 1), reply: "ok"},
})
if err != nil {
t.Fatalf("compose: %v", err)
}
ctx, cancel := context.WithCancel(t.Context())
defer cancel()
started := make(chan error, 1)
go func() { started <- srv.Start(ctx) }()
// The start-up report and the channel's own "starting" coalesce by design --
// signals coalesce, because a reader only ever wants the latest state of every
// channel -- so the first published state is either "configured" or "starting"
// depending on which side wins. What must hold is that the transitions reach
// the store, and that the last word is the truth.
waitForPublishedState(t, writer, "webhook", "running")
srv.Stop()
select {
case err := <-started:
if err != nil {
t.Fatalf("srv.Start returned %v, want a clean stop", err)
}
case <-time.After(3 * time.Second):
t.Fatal("srv.Start did not return after Stop")
}
// The final report is what leaves the store honest about a stopped service.
waitForPublishedState(t, writer, "webhook", "stopped")
}
+36 -6
View File
@@ -16,15 +16,19 @@ import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/secret"
)
type deps struct {
Config ResolvedConfig
Log *slog.Logger
Chat messaging.ChatContract
Health *health.Registry
Settings *messaging.SettingsCommand
// ChannelStatus is where the service publishes channel lifecycle for the
// dashboard. Optional: nil leaves the report in-process only.
ChannelStatus storecontract.ChannelStatusStore
Config ResolvedConfig
Log *slog.Logger
Chat messaging.ChatContract
Health *health.Registry
Settings *messaging.SettingsCommand
}
type channelInstance struct {
@@ -38,7 +42,14 @@ type Service struct {
// status owns channel lifecycle facts, one entry per composed channel. It is
// the single writer channels report through (see lifecycleFor), and the
// producer a dashboard surface reads.
status *status.Manager
status *status.Manager
// statusWriter publishes that report where the dashboard reads it. Nil means
// this composition has no store to publish to, which is the honest state for a
// test or a process run without one.
statusWriter storecontract.ChannelStatusStore
// publish coalesces a burst of transitions into one write: a reader only ever
// wants the latest state of every channel.
publish chan struct{}
cfg ResolvedConfig
log *slog.Logger
chat messaging.ChatContract
@@ -95,6 +106,8 @@ func compose(ctx context.Context, d deps) (*Service, error) {
}
srv.status = status.NewManager(channelDescriptors(srv.channels))
srv.statusWriter = d.ChannelStatus
srv.publish = make(chan struct{}, 1)
return srv, nil
}
@@ -161,6 +174,13 @@ func (s *Service) Start(ctx context.Context) error {
s.log.Info("messaging service started", "gateway_target", s.cfg.Options.Gateway.Target, "channels", len(s.channels))
if s.statusWriter != nil {
go s.publishLoop(ctx)
// Report the composed set before any channel reports itself, so a dashboard
// opened during startup shows configured channels rather than none.
s.signalPublish()
}
var wg sync.WaitGroup
for _, ch := range s.channels {
c := ch
@@ -191,6 +211,16 @@ func (s *Service) Start(ctx context.Context) error {
}
wg.Wait()
if s.statusWriter != nil {
// The final report carries the stopped states the loop above recorded.
// Its own context, because ctx is already cancelled.
finalCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), s.cfg.Options.ShutdownTimeout)
defer cancel()
if err := s.publishStatus(finalCtx); err != nil {
s.log.Warn("publishing final channel status failed", "err", err)
}
}
return nil
}
+11 -5
View File
@@ -8,6 +8,7 @@ import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/applystatus"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/controlplanerpc"
"github.com/samcharles93/archie-core/internal/infrastructure/gatewayrpc"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
@@ -32,6 +33,9 @@ func Run(ctx context.Context, o Options) error {
health := newReadinessRegistry(cfg.Options, chat)
var settings *messaging.SettingsCommand
var closeStateStore func()
// channelStatusStore is the same client, held where compose can reach it: the
// channel report is published to the store this process already dials.
var channelStatusStore storecontract.ChannelStatusStore
if cfg.Options.StateStore.Target != "" {
stateStore, closeClient, dialErr := staterpc.Dial(cfg.Options.StateStore.Target, cfg.Options.StateStore.Token)
if dialErr != nil {
@@ -59,14 +63,16 @@ func Run(ctx context.Context, o Options) error {
return fmt.Errorf("resolve database webhook secret: %w", settingsErr)
}
settings = messaging.NewSettingsCommand(messagingControlPlane{client: stateStore.ControlPlane()}).WithIdentities(stateStore)
channelStatusStore = stateStore
}
srv, err := compose(ctx, deps{
Config: cfg,
Log: log,
Chat: chat,
Health: health,
Settings: settings,
ChannelStatus: channelStatusStore,
Config: cfg,
Log: log,
Chat: chat,
Health: health,
Settings: settings,
})
if err != nil {
return err
+7
View File
@@ -75,6 +75,13 @@ func compose(d deps) *webui.Server {
if snapshots, ok := d.Store.(storecontract.ConfigSnapshotStore); ok {
srv.ConfigSource = webui.RemoteConfigView(snapshots)
}
// Channel lifecycle follows the same split as the config view: the process
// hosting the channels publishes, this one reads. Withholding it left
// /api/channels answering with nothing while channels were running
// (archie-core-8cda.6.8).
if channels, ok := d.Store.(storecontract.ChannelStatusStore); ok {
srv.Channels = webui.RemoteChannelStatus(channels)
}
// Mappings and bindings are ratified State Store contracts, and the same
// client already carries them: withholding them would degrade two pages
// that have an owner, which is a different thing from the intake surfaces
File diff suppressed because it is too large. Load diff
@@ -53,6 +53,8 @@ const (
StateStoreService_TokensByDay_FullMethodName = "/state.v1.StateStoreService/TokensByDay"
StateStoreService_PutConfigSnapshot_FullMethodName = "/state.v1.StateStoreService/PutConfigSnapshot"
StateStoreService_GetConfigSnapshot_FullMethodName = "/state.v1.StateStoreService/GetConfigSnapshot"
StateStoreService_PutChannelStatus_FullMethodName = "/state.v1.StateStoreService/PutChannelStatus"
StateStoreService_ListChannelStatus_FullMethodName = "/state.v1.StateStoreService/ListChannelStatus"
StateStoreService_PutApplyStatus_FullMethodName = "/state.v1.StateStoreService/PutApplyStatus"
StateStoreService_ListApplyStatus_FullMethodName = "/state.v1.StateStoreService/ListApplyStatus"
StateStoreService_ReadTaskLog_FullMethodName = "/state.v1.StateStoreService/ReadTaskLog"
@@ -137,6 +139,14 @@ type StateStoreServiceClient interface {
// configuration page").
PutConfigSnapshot(ctx context.Context, in *PutConfigSnapshotRequest, opts ...grpc.CallOption) (*PutConfigSnapshotResponse, error)
GetConfigSnapshot(ctx context.Context, in *GetConfigSnapshotRequest, opts ...grpc.CallOption) (*GetConfigSnapshotResponse, error)
// Channel status is what the process HOSTING the channels observes about them:
// one row per channel, written by the Messaging Service and read by the UI
// process. Administrative like the config snapshot, and for the same reason --
// a task-scoped grant reaches neither, so authorizesTaskScopedCall admits only
// the administrative token. It is runtime state rather than a settings
// document, which is why it is not a ControlPlaneService resource kind.
PutChannelStatus(ctx context.Context, in *PutChannelStatusRequest, opts ...grpc.CallOption) (*PutChannelStatusResponse, error)
ListChannelStatus(ctx context.Context, in *ListChannelStatusRequest, opts ...grpc.CallOption) (*ListChannelStatusResponse, error)
// Apply status: which version of a control-plane resource each process is
// running, and why it could not. Every process that applies a resource
// publishes; the UI process reads (docs/prds/control-plane-apply-status.md).
@@ -545,6 +555,26 @@ func (c *stateStoreServiceClient) GetConfigSnapshot(ctx context.Context, in *Get
return out, nil
}
func (c *stateStoreServiceClient) PutChannelStatus(ctx context.Context, in *PutChannelStatusRequest, opts ...grpc.CallOption) (*PutChannelStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PutChannelStatusResponse)
err := c.cc.Invoke(ctx, StateStoreService_PutChannelStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *stateStoreServiceClient) ListChannelStatus(ctx context.Context, in *ListChannelStatusRequest, opts ...grpc.CallOption) (*ListChannelStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListChannelStatusResponse)
err := c.cc.Invoke(ctx, StateStoreService_ListChannelStatus_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *stateStoreServiceClient) PutApplyStatus(ctx context.Context, in *PutApplyStatusRequest, opts ...grpc.CallOption) (*PutApplyStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(PutApplyStatusResponse)
@@ -881,6 +911,14 @@ type StateStoreServiceServer interface {
// configuration page").
PutConfigSnapshot(context.Context, *PutConfigSnapshotRequest) (*PutConfigSnapshotResponse, error)
GetConfigSnapshot(context.Context, *GetConfigSnapshotRequest) (*GetConfigSnapshotResponse, error)
// Channel status is what the process HOSTING the channels observes about them:
// one row per channel, written by the Messaging Service and read by the UI
// process. Administrative like the config snapshot, and for the same reason --
// a task-scoped grant reaches neither, so authorizesTaskScopedCall admits only
// the administrative token. It is runtime state rather than a settings
// document, which is why it is not a ControlPlaneService resource kind.
PutChannelStatus(context.Context, *PutChannelStatusRequest) (*PutChannelStatusResponse, error)
ListChannelStatus(context.Context, *ListChannelStatusRequest) (*ListChannelStatusResponse, error)
// Apply status: which version of a control-plane resource each process is
// running, and why it could not. Every process that applies a resource
// publishes; the UI process reads (docs/prds/control-plane-apply-status.md).
@@ -1051,6 +1089,12 @@ func (UnimplementedStateStoreServiceServer) PutConfigSnapshot(context.Context, *
func (UnimplementedStateStoreServiceServer) GetConfigSnapshot(context.Context, *GetConfigSnapshotRequest) (*GetConfigSnapshotResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetConfigSnapshot not implemented")
}
func (UnimplementedStateStoreServiceServer) PutChannelStatus(context.Context, *PutChannelStatusRequest) (*PutChannelStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method PutChannelStatus not implemented")
}
func (UnimplementedStateStoreServiceServer) ListChannelStatus(context.Context, *ListChannelStatusRequest) (*ListChannelStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ListChannelStatus not implemented")
}
func (UnimplementedStateStoreServiceServer) PutApplyStatus(context.Context, *PutApplyStatusRequest) (*PutApplyStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method PutApplyStatus not implemented")
}
@@ -1759,6 +1803,42 @@ func _StateStoreService_GetConfigSnapshot_Handler(srv interface{}, ctx context.C
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_PutChannelStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PutChannelStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StateStoreServiceServer).PutChannelStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: StateStoreService_PutChannelStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StateStoreServiceServer).PutChannelStatus(ctx, req.(*PutChannelStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_ListChannelStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListChannelStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StateStoreServiceServer).ListChannelStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: StateStoreService_ListChannelStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StateStoreServiceServer).ListChannelStatus(ctx, req.(*ListChannelStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_PutApplyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PutApplyStatusRequest)
if err := dec(in); err != nil {
@@ -2331,6 +2411,14 @@ var StateStoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetConfigSnapshot",
Handler: _StateStoreService_GetConfigSnapshot_Handler,
},
{
MethodName: "PutChannelStatus",
Handler: _StateStoreService_PutChannelStatus_Handler,
},
{
MethodName: "ListChannelStatus",
Handler: _StateStoreService_ListChannelStatus_Handler,
},
{
MethodName: "PutApplyStatus",
Handler: _StateStoreService_PutApplyStatus_Handler,
@@ -109,6 +109,23 @@ type ConfigSnapshotStore interface {
ConfigSnapshot(ctx context.Context) (ConfigSnapshot, bool, error)
}
// ChannelStatusStore holds channel runtime state as the process HOSTING the
// channels observes it. Same split as ConfigSnapshotStore and for the same
// reason: the writer is the Messaging Service, the reader is the UI process, and
// a task-scoped credential must reach neither.
//
// It is runtime state rather than a settings document -- a channel that is
// failed is not a document anybody edits -- which is why it is not a
// ControlPlaneService resource kind.
// See docs/architecture/migration-decisions.md, "Channel state to the dashboard".
type ChannelStatusStore interface {
// PutChannelStatus records the reporting process's whole set: a channel it no
// longer reports is removed rather than left behind, because a stale "running"
// row is a lie the dashboard would show indefinitely.
PutChannelStatus(ctx context.Context, channels []ChannelStatus) error
ChannelStatus(ctx context.Context) ([]ChannelStatus, error)
}
// ApplyStatusStore holds which version of each control-plane resource each
// process is running. Same split as ConfigSnapshotStore and for the same
// reason: the writers are the processes that apply a resource, the reader is
@@ -240,6 +257,20 @@ type ConfigSnapshot struct {
PublishedAt time.Time
}
// ChannelStatus is one channel's runtime state as the process hosting it
// reports it. ReloadSupported is a capability declaration rather than a request:
// asking for a reload travels on its own surface, because a transient request and
// a durable state do not share a lifetime.
type ChannelStatus struct {
ID string
Name string
State string
Detail string
Configured bool
ReloadSupported bool
ObservedAt time.Time
}
// ApplyStatus is one process's report about one control-plane resource kind.
//
// AppliedVersion is the version that process is running. Error is set when the
@@ -51,6 +51,7 @@ var (
_ storecontract.BindingTaskCreator = (*Client)(nil)
_ storecontract.PlaybookDispatcher = (*Client)(nil)
_ storecontract.ConfigSnapshotStore = (*Client)(nil)
_ storecontract.ChannelStatusStore = (*Client)(nil)
_ storecontract.ApplyStatusStore = (*Client)(nil)
_ identity.Repository = (*Client)(nil)
)
@@ -291,6 +292,26 @@ func (c *Client) ConfigSnapshot(ctx context.Context) (storecontract.ConfigSnapsh
return configSnapshotValue(reply.Snapshot), true, nil
}
// PutChannelStatus publishes the channel state the hosting process observes.
// Administrative, like the config snapshot pair: the server admits it on the
// administrative token only, so a task-scoped grant cannot reach it.
func (c *Client) PutChannelStatus(ctx context.Context, channels []storecontract.ChannelStatus) error {
_, err := c.client.PutChannelStatus(ctx, &pb.PutChannelStatusRequest{Channels: channelStatusesProto(channels)})
if err != nil {
return unmapError(err)
}
return nil
}
// ChannelStatus reads every reported channel.
func (c *Client) ChannelStatus(ctx context.Context) ([]storecontract.ChannelStatus, error) {
reply, err := c.client.ListChannelStatus(ctx, &pb.ListChannelStatusRequest{})
if err != nil {
return nil, unmapError(err)
}
return channelStatusesValue(reply.Channels), nil
}
// PutApplyStatus reports what this process applied for one resource kind.
// Administrative, like the config snapshot pair: a task-scoped grant cannot
// reach it.
+41 -6
View File
@@ -31,6 +31,7 @@ import (
var (
errCaptureUnavailable = status.Error(codes.Unavailable, "capture store unavailable")
errConfigSnapshotsUnavailable = status.Error(codes.Unavailable, "config snapshot store unavailable")
errChannelStatusUnavailable = status.Error(codes.Unavailable, "channel status store unavailable")
errApplyStatusUnavailable = status.Error(codes.Unavailable, "apply status store unavailable")
errMappingUnavailable = status.Error(codes.Unavailable, "mapping store unavailable")
errBindingUnavailable = status.Error(codes.Unavailable, "binding store unavailable")
@@ -59,12 +60,16 @@ const taskLogChunkBytes = 256 << 10
// codes.Unavailable) exactly as their daemon-side consumers already treat a
// nil Mappings/Bindings/BindingDispatcher/BindingTaskCreator as "disabled".
type Deps struct {
ControlPlane controlpb.ControlPlaneServiceServer
Identities identity.Repository
Grants *TaskGrants
Tasks storecontract.TaskStore
Captures storecontract.CaptureStore
ConfigSnapshots storecontract.ConfigSnapshotStore
ControlPlane controlpb.ControlPlaneServiceServer
Identities identity.Repository
Grants *TaskGrants
Tasks storecontract.TaskStore
Captures storecontract.CaptureStore
ConfigSnapshots storecontract.ConfigSnapshotStore
// ChannelStatus is the channel runtime state the process hosting the channels
// reports. Optional: nil disables the pair with codes.Unavailable, which is
// the honest answer for a store service no messaging process is writing to.
ChannelStatus storecontract.ChannelStatusStore
ApplyStatus storecontract.ApplyStatusStore
Mappings storecontract.MappingStore
Bindings storecontract.BindingStore
@@ -389,6 +394,36 @@ func (s *server) GetConfigSnapshot(ctx context.Context, _ *pb.GetConfigSnapshotR
return &pb.GetConfigSnapshotResponse{Snapshot: configSnapshotProto(snapshot), Found: true}, nil
}
func (s *server) channelStatuses() (storecontract.ChannelStatusStore, error) {
if s.deps.ChannelStatus == nil {
return nil, errChannelStatusUnavailable
}
return s.deps.ChannelStatus, nil
}
func (s *server) PutChannelStatus(ctx context.Context, r *pb.PutChannelStatusRequest) (*pb.PutChannelStatusResponse, error) {
cs, err := s.channelStatuses()
if err != nil {
return nil, err
}
if err := cs.PutChannelStatus(ctx, channelStatusesValue(r.Channels)); err != nil {
return nil, s.logErr("PutChannelStatus", err)
}
return &pb.PutChannelStatusResponse{}, nil
}
func (s *server) ListChannelStatus(ctx context.Context, _ *pb.ListChannelStatusRequest) (*pb.ListChannelStatusResponse, error) {
cs, err := s.channelStatuses()
if err != nil {
return nil, err
}
channels, err := cs.ChannelStatus(ctx)
if err != nil {
return nil, s.logErr("ListChannelStatus", err)
}
return &pb.ListChannelStatusResponse{Channels: channelStatusesProto(channels)}, nil
}
func (s *server) InsertCapture(ctx context.Context, r *pb.InsertCaptureRequest) (*pb.InsertCaptureResponse, error) {
cs, err := s.capture()
if err != nil {
@@ -407,6 +407,45 @@ func configSnapshotValue(snapshot *pb.ConfigSnapshot) storecontract.ConfigSnapsh
}
}
// channelStatusesProto and channelStatusesValue carry the channel runtime state
// the hosting process reports. The state is a string rather than an enum on the
// wire: the vocabulary belongs to internal/channels/status, and a reader that
// does not know a state it receives must show it rather than reject the report.
func channelStatusesProto(channels []storecontract.ChannelStatus) []*pb.ChannelStatus {
out := make([]*pb.ChannelStatus, 0, len(channels))
for _, channel := range channels {
out = append(out, &pb.ChannelStatus{
Id: channel.ID,
Name: channel.Name,
State: channel.State,
Detail: channel.Detail,
Configured: channel.Configured,
ReloadSupported: channel.ReloadSupported,
ObservedAt: timestamp(channel.ObservedAt),
})
}
return out
}
func channelStatusesValue(channels []*pb.ChannelStatus) []storecontract.ChannelStatus {
out := make([]storecontract.ChannelStatus, 0, len(channels))
for _, channel := range channels {
if channel == nil {
continue
}
out = append(out, storecontract.ChannelStatus{
ID: channel.Id,
Name: channel.Name,
State: channel.State,
Detail: channel.Detail,
Configured: channel.Configured,
ReloadSupported: channel.ReloadSupported,
ObservedAt: timeValue(channel.ObservedAt),
})
}
return out
}
func applyStatusProto(status storecontract.ApplyStatus) *pb.ApplyStatus {
return &pb.ApplyStatus{
Process: status.Process,
+106
View File
@@ -0,0 +1,106 @@
package store
import (
"context"
"fmt"
"time"
)
const channelStatusSchema = `
CREATE TABLE IF NOT EXISTS channel_status (
id TEXT PRIMARY KEY,
name TEXT NOT NULL DEFAULT '',
state TEXT NOT NULL DEFAULT '',
detail TEXT NOT NULL DEFAULT '',
configured INTEGER NOT NULL DEFAULT 0,
reload_supported INTEGER NOT NULL DEFAULT 0,
observed_at TEXT NOT NULL
);
`
// PutChannelStatus records the reporting process's whole set, in one
// transaction: rows it no longer reports are deleted, so a channel that stopped
// or was removed does not linger as a stale "running" the dashboard would show
// indefinitely.
func (s *Store) PutChannelStatus(ctx context.Context, channels []ChannelStatus) error {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return fmt.Errorf("store: put channel status: begin: %w", err)
}
defer func() { _ = tx.Rollback() }()
reported := make([]any, 0, len(channels)+1)
placeholders := make([]byte, 0, len(channels)*2)
for index, channel := range channels {
if channel.ID == "" {
return fmt.Errorf("store: put channel status: a channel needs an id")
}
if index > 0 {
placeholders = append(placeholders, ',')
}
placeholders = append(placeholders, '?')
reported = append(reported, channel.ID)
observed := channel.ObservedAt
if observed.IsZero() {
observed = time.Now()
}
if _, err := tx.ExecContext(ctx, `
INSERT INTO channel_status (id, name, state, detail, configured, reload_supported, observed_at)
VALUES (?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(id) DO UPDATE SET
name=excluded.name,
state=excluded.state,
detail=excluded.detail,
configured=excluded.configured,
reload_supported=excluded.reload_supported,
observed_at=excluded.observed_at`,
channel.ID, channel.Name, channel.State, channel.Detail,
channel.Configured, channel.ReloadSupported, observed.UTC().Format(configSnapshotTimeLayout)); err != nil {
return fmt.Errorf("store: put channel status %s: %w", channel.ID, err)
}
}
// An empty report is a real report -- the process hosts no channels -- and it
// clears the table rather than leaving the previous set standing.
query := `DELETE FROM channel_status`
if len(reported) > 0 {
query += ` WHERE id NOT IN (` + string(placeholders) + `)`
}
if _, err := tx.ExecContext(ctx, query, reported...); err != nil {
return fmt.Errorf("store: put channel status: prune: %w", err)
}
return tx.Commit()
}
// ChannelStatus returns every reported channel, ordered by id so a reader and a
// test see the same order twice.
func (s *Store) ChannelStatus(ctx context.Context) ([]ChannelStatus, error) {
rows, err := s.db.QueryContext(ctx, `
SELECT id, name, state, detail, configured, reload_supported, observed_at
FROM channel_status ORDER BY id`)
if err != nil {
return nil, fmt.Errorf("store: list channel status: %w", err)
}
defer func() { _ = rows.Close() }()
var channels []ChannelStatus
for rows.Next() {
var (
channel ChannelStatus
observed string
)
if err := rows.Scan(&channel.ID, &channel.Name, &channel.State, &channel.Detail,
&channel.Configured, &channel.ReloadSupported, &observed); err != nil {
return nil, fmt.Errorf("store: scan channel status: %w", err)
}
if at, err := time.Parse(configSnapshotTimeLayout, observed); err == nil {
channel.ObservedAt = at
}
channels = append(channels, channel)
}
if err := rows.Err(); err != nil {
return nil, fmt.Errorf("store: list channel status: %w", err)
}
return channels, nil
}
+79
View File
@@ -0,0 +1,79 @@
package store
import (
"testing"
"time"
)
// TestChannelStatusReplacesTheReportedSet: the process hosting the channels owns
// the set it reports, so a channel it stops reporting must disappear. Leaving it
// behind would show a stale "running" for a channel that is gone, which is worse
// than showing nothing.
func TestChannelStatusReplacesTheReportedSet(t *testing.T) {
st := openTest(t)
ctx := t.Context()
if rows, err := st.ChannelStatus(ctx); err != nil || len(rows) != 0 {
t.Fatalf("ChannelStatus on an empty store = (%+v, %v), want (none, nil)", rows, err)
}
observed := time.Date(2026, 9, 22, 8, 0, 0, 0, time.UTC)
first := []ChannelStatus{
{ID: "telegram", Name: "telegram", State: "running", Configured: true, ReloadSupported: true, ObservedAt: observed},
{ID: "webhook", Name: "webhook", State: "failed", Detail: "listen: address in use", Configured: true, ObservedAt: observed},
}
if err := st.PutChannelStatus(ctx, first); err != nil {
t.Fatalf("PutChannelStatus: %v", err)
}
rows, err := st.ChannelStatus(ctx)
if err != nil {
t.Fatalf("ChannelStatus: %v", err)
}
if len(rows) != 2 {
t.Fatalf("rows = %+v, want both channels", rows)
}
// Ordered by id, so a reader and this test see the same list twice.
if rows[0].ID != "telegram" || rows[1].ID != "webhook" {
t.Errorf("rows = %+v, want telegram then webhook", rows)
}
if rows[1].Detail != "listen: address in use" || rows[1].State != "failed" {
t.Errorf("webhook row = %+v, want the failure it reported", rows[1])
}
if !rows[0].ReloadSupported || !rows[0].Configured {
t.Errorf("telegram row = %+v, want its declared capabilities", rows[0])
}
if !rows[0].ObservedAt.Equal(observed) {
t.Errorf("ObservedAt = %v, want %v", rows[0].ObservedAt, observed)
}
// The reporter no longer mentions webhook: its row goes.
if err := st.PutChannelStatus(ctx, first[:1]); err != nil {
t.Fatalf("PutChannelStatus: %v", err)
}
rows, err = st.ChannelStatus(ctx)
if err != nil {
t.Fatalf("ChannelStatus: %v", err)
}
if len(rows) != 1 || rows[0].ID != "telegram" {
t.Fatalf("rows = %+v, want only telegram after the shorter report", rows)
}
// An empty report is a report: a process that hosts no channels clears the set
// rather than leaving the previous one standing.
if err := st.PutChannelStatus(ctx, nil); err != nil {
t.Fatalf("PutChannelStatus(empty): %v", err)
}
if rows, err := st.ChannelStatus(ctx); err != nil || len(rows) != 0 {
t.Fatalf("rows after an empty report = (%+v, %v), want none", rows, err)
}
}
// TestChannelStatusRequiresAnID: a row without an id cannot be replaced or
// removed by a later report, so it is refused at the producer rather than
// inserted as an orphan the reporter can never clear.
func TestChannelStatusRequiresAnID(t *testing.T) {
st := openTest(t)
if err := st.PutChannelStatus(t.Context(), []ChannelStatus{{State: "running"}}); err == nil {
t.Fatal("PutChannelStatus with no id = nil, want a refusal")
}
}
+5
View File
@@ -28,6 +28,7 @@ type (
TaskLogStore = storecontract.TaskLogStore
CaptureStore = storecontract.CaptureStore
ConfigSnapshotStore = storecontract.ConfigSnapshotStore
ChannelStatusStore = storecontract.ChannelStatusStore
ApplyStatusStore = storecontract.ApplyStatusStore
MappingStore = storecontract.MappingStore
BindingStore = storecontract.BindingStore
@@ -36,6 +37,7 @@ type (
PlaybookDispatcher = storecontract.PlaybookDispatcher
CapturedEvent = storecontract.CapturedEvent
ConfigSnapshot = storecontract.ConfigSnapshot
ChannelStatus = storecontract.ChannelStatus
ApplyStatus = storecontract.ApplyStatus
WorkflowStat = storecontract.WorkflowStat
StageStat = storecontract.StageStat
@@ -54,6 +56,9 @@ var (
// Compile-time check: *Store satisfies TaskStore.
var _ TaskStore = (*Store)(nil)
// Compile-time check: *Store satisfies ChannelStatusStore.
var _ ChannelStatusStore = (*Store)(nil)
// Compile-time check: *Store satisfies workflow.Store.
var _ workflow.Store = (*Store)(nil)
+1 -1
View File
@@ -57,7 +57,7 @@ func Open(ctx context.Context, path string, opts ...OpenOption) (*Store, error)
return nil, err
}
db.SetMaxOpenConns(1)
if _, err := db.ExecContext(ctx, schema+eventsSchema+capturesSchema+mappingsSchema+bindingsSchema+playbookDispatchesSchema+configSnapshotSchema+applyStatusSchema+resourcesSchema+identitiesSchema); err != nil {
if _, err := db.ExecContext(ctx, schema+eventsSchema+capturesSchema+mappingsSchema+bindingsSchema+playbookDispatchesSchema+configSnapshotSchema+channelStatusSchema+applyStatusSchema+resourcesSchema+identitiesSchema); err != nil {
return nil, errors.Join(fmt.Errorf("store: init schema: %w", err), db.Close())
}
if err := migrateTasks(ctx, db); err != nil {
+42
View File
@@ -418,6 +418,48 @@ func chatChannelConfigured(chat config.ChatConfig) bool {
// RemoteConfigView reads the projection the configuration owner published.
// The reading process cannot edit it: it has no update path, and the page is
// told so rather than offering a control that would 503.
// ChannelStatusSource reports the live state of each configured channel.
type ChannelStatusSource interface {
Snapshot() []status.Status
}
// RemoteChannelStatus reads channel state from the State Store, where the
// process hosting the channels publishes it. It is the reader half of the same
// split RemoteConfigView serves: the writer is another process and the reader is
// this one, so a reader that cannot reach the store reports nothing rather than
// inventing a state, and the page shows no channels instead of wrong ones.
func RemoteChannelStatus(channels storecontract.ChannelStatusStore) ChannelStatusSource {
return remoteChannelStatus{channels: channels}
}
type remoteChannelStatus struct {
channels storecontract.ChannelStatusStore
}
func (r remoteChannelStatus) Snapshot() []status.Status {
// The handler has no error to return, so a failed read is an empty report.
// That is the honest answer: the dashboard must not show a stale "running"
// for a channel it cannot currently ask about.
rows, err := r.channels.ChannelStatus(context.Background())
if err != nil {
return nil
}
out := make([]status.Status, 0, len(rows))
for _, row := range rows {
out = append(out, status.Status{
Descriptor: status.Descriptor{
ID: row.ID,
Name: row.Name,
Configured: row.Configured,
ReloadSupported: row.ReloadSupported,
Detail: row.Detail,
},
State: status.State(row.State),
})
}
return out
}
func RemoteConfigView(snapshots storecontract.ConfigSnapshotStore) ConfigViewSource {
return func(ctx context.Context) (ConfigView, bool, error) {
snapshot, found, err := snapshots.ConfigSnapshot(ctx)
+6 -2
View File
@@ -513,10 +513,14 @@ func TestHandleChannelsWithoutManagerIsEmpty(t *testing.T) {
func TestHandleChannelsUsesRuntimeManager(t *testing.T) {
srv := newTestServer(t)
srv.Channels = status.NewManager([]status.Descriptor{{
// Channels is a source rather than a concrete manager now: a process that
// hosts channels supplies its own, and the dashboard process supplies a reader
// over the State Store. This test drives the first.
manager := status.NewManager([]status.Descriptor{{
ID: "telegram", Name: "Telegram", Configured: true, ReloadSupported: true,
}})
srv.Channels.MarkFailed("telegram", "token rejected")
manager.MarkFailed("telegram", "token rejected")
srv.Channels = manager
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/api/channels", nil)
w := httptest.NewRecorder()
+61
View File
@@ -0,0 +1,61 @@
package webui
import (
"context"
"errors"
"testing"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
type fakeChannelStatusStore struct {
rows []storecontract.ChannelStatus
err error
}
func (f fakeChannelStatusStore) PutChannelStatus(context.Context, []storecontract.ChannelStatus) error {
return nil
}
func (f fakeChannelStatusStore) ChannelStatus(context.Context) ([]storecontract.ChannelStatus, error) {
return f.rows, f.err
}
// TestRemoteChannelStatusMapsReportedState: the dashboard process reads channel
// state another process published, so the mapping is the whole of its
// responsibility -- including carrying an unknown state through rather than
// dropping the channel, because a reader that hides a channel it does not
// recognise shows a healthy page for a channel that is down.
func TestRemoteChannelStatusMapsReportedState(t *testing.T) {
source := RemoteChannelStatus(fakeChannelStatusStore{rows: []storecontract.ChannelStatus{
{ID: "telegram", Name: "telegram", State: "running", Configured: true, ReloadSupported: true},
{ID: "webhook", Name: "webhook", State: "failed", Detail: "listen: address in use", Configured: true},
{ID: "email", Name: "email", State: "invented-later", Configured: true},
}})
snapshot := source.Snapshot()
if len(snapshot) != 3 {
t.Fatalf("Snapshot() = %+v, want all three reported channels", snapshot)
}
if snapshot[0].State != status.StateRunning || !snapshot[0].ReloadSupported {
t.Errorf("telegram = %+v, want running and reload-capable", snapshot[0])
}
if snapshot[1].State != status.StateFailed || snapshot[1].Detail == "" {
t.Errorf("webhook = %+v, want the failure and its reason", snapshot[1])
}
if snapshot[2].State != status.State("invented-later") {
t.Errorf("email state = %q, want the reported value carried through", snapshot[2].State)
}
}
// TestRemoteChannelStatusReportsNothingWhenTheStoreFails: the handler has no
// error to return, and the honest answer is an empty report. Showing a cached or
// assumed state for a channel the dashboard cannot currently ask about is how a
// dead channel keeps looking alive.
func TestRemoteChannelStatusReportsNothingWhenTheStoreFails(t *testing.T) {
source := RemoteChannelStatus(fakeChannelStatusStore{err: errors.New("state store unreachable")})
if got := source.Snapshot(); len(got) != 0 {
t.Fatalf("Snapshot() = %+v, want nothing when the store cannot answer", got)
}
}
+5 -5
View File
@@ -16,7 +16,6 @@ import (
"sync"
"time"
"github.com/samcharles93/archie-core/internal/channels/status"
controlpb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/identity"
@@ -54,10 +53,11 @@ type Server struct {
// of them is about configuration.
TaskLogs TaskLogSource
// Channels reports actual adapter lifecycle, independently of configuration
// presence. Nil preserves the configuration-only fallback for tests and
// minimal embedding.
Channels *status.Manager
// Channels reports actual adapter lifecycle, independently of configuration.
// A process that hosts channels satisfies it from its own manager; the
// dashboard process satisfies it by reading the State Store, where the
// hosting process publishes (webui.RemoteChannelStatus).
Channels ChannelStatusSource
// ReloadChannel invokes a channel-specific reload seam. Only adapters that
// explicitly support reload are wired here; nil means reload is unavailable.
+28
View File
@@ -62,6 +62,15 @@ service StateStoreService {
rpc PutConfigSnapshot(PutConfigSnapshotRequest) returns (PutConfigSnapshotResponse);
rpc GetConfigSnapshot(GetConfigSnapshotRequest) returns (GetConfigSnapshotResponse);
// Channel status is what the process HOSTING the channels observes about them:
// one row per channel, written by the Messaging Service and read by the UI
// process. Administrative like the config snapshot, and for the same reason --
// a task-scoped grant reaches neither, so authorizesTaskScopedCall admits only
// the administrative token. It is runtime state rather than a settings
// document, which is why it is not a ControlPlaneService resource kind.
rpc PutChannelStatus(PutChannelStatusRequest) returns (PutChannelStatusResponse);
rpc ListChannelStatus(ListChannelStatusRequest) returns (ListChannelStatusResponse);
// Apply status: which version of a control-plane resource each process is
// running, and why it could not. Every process that applies a resource
// publishes; the UI process reads (docs/prds/control-plane-apply-status.md).
@@ -470,6 +479,25 @@ message GetConfigSnapshotResponse {
bool found = 2;
}
// ChannelStatus is one channel's runtime state, as the process hosting it
// observes it. ReloadSupported is a capability declaration, not a request: the
// service reports it, so a reader may offer a reload action -- but asking for one
// travels on its own surface, because a transient request and a durable state do
// not share a lifetime.
message ChannelStatus {
string id = 1;
string name = 2;
string state = 3;
string detail = 4;
bool configured = 5;
bool reload_supported = 6;
google.protobuf.Timestamp observed_at = 7;
}
message PutChannelStatusRequest { repeated ChannelStatus channels = 1; }
message PutChannelStatusResponse {}
message ListChannelStatusRequest {}
message ListChannelStatusResponse { repeated ChannelStatus channels = 1; }
// ApplyStatus is one process's report about one control-plane resource kind.
// applied_version is the version that process is running; error is set when it
// could not apply what the store returned, and leaves applied_version at the