Fix 9.2: the gate's catalogue test reads a consumes entry naming the seat's own event as the seat, not the module
Builds: design 47 G A-30, §507 (consumes names a seat's events by the seat) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
seat "git.novox.be/novox/mesh-delivery/contracts/go/seats/meshdelivery"
|
||||
)
|
||||
|
||||
// **The gate is the only claimant of the seat `mesh-delivery` in the catalogue** (novox/hq ADR 0437 §1, ADR 0449 §4, ADR 0454,
|
||||
@@ -50,6 +52,20 @@ func TestTheCatalogueHoldsTheGateAsTheOnlyClaimantOfTheSeat(t *testing.T) {
|
||||
}
|
||||
var generic any
|
||||
_ = json.Unmarshal(raw, &generic)
|
||||
// A `consumes` entry `mesh-delivery.<event>` is the seat's event (design 47 G A-30, §507): a manifest names a
|
||||
// seat's events by the seat, so an entry naming one of the seat's own events is no module's name.
|
||||
if top, ok := generic.(map[string]any); ok {
|
||||
if entries, ok := top["consumes"].([]any); ok {
|
||||
kept := []any{}
|
||||
for _, e := range entries {
|
||||
name, _ := e.(string)
|
||||
if !slices.ContainsFunc(seat.Events(), func(ev string) bool { return name == "mesh-delivery."+ev }) {
|
||||
kept = append(kept, e)
|
||||
}
|
||||
}
|
||||
top["consumes"] = kept
|
||||
}
|
||||
}
|
||||
var walk func(v any)
|
||||
walk = func(v any) {
|
||||
switch x := v.(type) {
|
||||
|
||||
Reference in New Issue
Block a user