messenger: the asks it says are a bus-state entry of the events template, not a stream of its own (K-24, F6, ADR 0595, ADR 0619; issue 1966)

This commit is contained in:
2026-11-05 14:09:44 +01:00
parent a86e2ff1fc
commit 7ae2ed88c0
2 changed files with 20 additions and 11 deletions
@@ -27,6 +27,11 @@ type manifest struct {
Emits []string
Invokes []string
State []json.RawMessage
Streams []json.RawMessage
Requires []struct {
Name, Storage, Template string
Options map[string]any
}
Own map[string]string `json:"own-secrets"`
RunsAs string `json:"runs-as"`
SecretsOwner string `json:"secrets-owner"`
@@ -112,6 +117,12 @@ func TestItDeclaresTheSeatsOfAnAskAndHoldsTheOperatorChannel(t *testing.T) { //
if !reflect.DeepEqual(state, []string{"open", "sent", "asks", "identities", "walks"}) {
t.Fatalf("state %v", state)
}
// The asks it says are a bus-state entry of the events template (ADR 0595), never a stream of its own (the manifest
// validator refuses one that keeps no history, ADR 0619): offered and closed, kept seven days, readers by the grant.
if len(m.Streams) != 0 || len(m.Requires) != 1 || m.Requires[0].Template != "events" || m.Requires[0].Storage != "stream" ||
!reflect.DeepEqual(m.Requires[0].Options["events"], []any{"offered", "closed"}) || m.Requires[0].Options["max-age-days"] != float64(7) {
t.Fatalf("streams %v, requires %+v", m.Streams, m.Requires)
}
// It holds no channel's secret: only its own bus account, read by its own account alone (ADR 0259 §8).
if len(m.Own) != 1 || m.Own["broker"] == "" || m.RunsAs != "messenger" || m.SecretsOwner != "messenger" {
t.Fatalf("own secrets %v, runs as %q, secrets owned by %q", m.Own, m.RunsAs, m.SecretsOwner)
+9 -11
View File
@@ -88,18 +88,16 @@
"emits": [
"refused"
],
"streams": [
"requires": [
{
"name": "asks",
"events": [
"offered",
"closed"
],
"max-age-days": 7,
"max-mib": 64,
"grant": {
"config": "readers",
"events": "{key}"
"name": "ask-events",
"storage": "stream",
"template": "events",
"options": {
"events": ["offered", "closed"],
"max-age-days": 7,
"max-mib": 64,
"grant": {"config": "readers", "events": "{key}"}
}
}
],