fix(archieui): let the boundary guard permit a contract-backed channel reader
The UI boundary test forbade wiring Server.Channels, and it was right about what the field used to hold: a live *status.Manager is a runtime handle this process has no business owning. It now holds a reader over the State Store's channel-status contract, which is the same shape as the Mappings, Bindings and ApplyStatus fields the guard already expects to be wired. The distinction it draws is the handle, not the name, so the assertion moves with the field and says why. Also adopts task fmt's rewrite of the reader's status construction: go fix drops the explicit embedded Descriptor, and formatter output is law here.
This commit is contained in:
2 files changed
+14
-9
No files matched your search
@@ -82,7 +82,6 @@ func TestComposeUIServerHoldsNoDaemonState(t *testing.T) {
|
||||
"RunningVersions": srv.RunningVersions,
|
||||
"Events": srv.Events,
|
||||
"Curators": srv.Curators,
|
||||
"Channels": srv.Channels,
|
||||
"LogFeed": srv.LogFeed,
|
||||
"WorkRequests": srv.WorkRequests,
|
||||
}
|
||||
@@ -91,6 +90,14 @@ func TestComposeUIServerHoldsNoDaemonState(t *testing.T) {
|
||||
t.Errorf("%s is wired; it is a daemon-owned callback or runtime handle with no contract behind it yet", name)
|
||||
}
|
||||
}
|
||||
// Channels is the same shape as Mappings/Bindings below: the field used to
|
||||
// hold a live *status.Manager, which is a runtime handle this process has no
|
||||
// business owning, and it now holds a reader over the State Store's
|
||||
// channel-status contract (webui.RemoteChannelStatus). The distinction the
|
||||
// guard draws is the handle, not the name.
|
||||
if srv.Channels == nil {
|
||||
t.Error("Channels is unwired; the channel-status pair is a State Store contract the composed client implements")
|
||||
}
|
||||
// Mappings and bindings are the other way round: ratified State Store
|
||||
// contracts, carried by the client this process already holds, so
|
||||
// leaving them nil would degrade two pages that have an owner.
|
||||
|
||||
@@ -447,14 +447,12 @@ func (r remoteChannelStatus) Snapshot() []status.Status {
|
||||
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),
|
||||
ID: row.ID,
|
||||
Name: row.Name,
|
||||
Configured: row.Configured,
|
||||
ReloadSupported: row.ReloadSupported,
|
||||
Detail: row.Detail,
|
||||
State: status.State(row.State),
|
||||
})
|
||||
}
|
||||
return out
|
||||
|
||||
Reference in new issue
Block a user