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

+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