Issue 1585, S19: the strict parser, every manifest problem function and the judge's tables (192 declarations, about 5,200 lines) and their 244 tests leave; composition keeps its own refusals and the helpers it uses. The catalogue's tests decode the manifests they build. ParseManifest, ParseManifestWith, ParseManifestForInputs, CatalogueProblems and the rest are gone; mesh-delivery-indexer/judge holds them. Claude-Session: https://claude.ai/code/session_01NcbgfJ9Gum47zkFKWRaovL
39 lines
1.7 KiB
Go
39 lines
1.7 KiB
Go
package catalogue
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// The router of novox/hq ADR 0259: it declares the operator's seat and the two kinded benches.
|
|
func router() Manifest {
|
|
return Manifest{Module: "messenger", Tools: []string{"open", "history", "notify"},
|
|
State: []StateDeclaration{{Name: "asks"}}, RunsAs: "messenger", SecretsOwner: "messenger",
|
|
DefinesSeats: []SeatDeclaration{
|
|
{Name: "operator-channel", Scope: ScopeMesh, Accepts: []string{"ask", "cancel"}, Emits: []string{"decided"},
|
|
ByCaller: []string{"ask", "cancel", "decided"}, Records: []string{"asks"},
|
|
Serves: []Verb{{Name: "open"}, {Name: "history"}, {Name: "notify"}}},
|
|
{Name: "channel", Scope: ScopeMesh, Kinded: true, Accepts: []string{"show", "edit", "send"}},
|
|
{Name: "intake", Scope: ScopeMesh, Kinded: true, Emits: []string{"choice", "link"}, Proofs: []string{"code"}},
|
|
},
|
|
Claims: []Claim{{Name: "operator-channel", Scope: ScopeMesh}},
|
|
Uses: []string{"channel"}}
|
|
}
|
|
|
|
func aChannel(module, kind string) Manifest {
|
|
return Manifest{Module: module, Claims: []Claim{
|
|
{Name: "channel", Scope: ScopeMesh, Kind: kind}, {Name: "intake", Scope: ScopeMesh, Kind: kind}}}
|
|
}
|
|
|
|
// Two kinds on one machine are two holders, and one kind on two machines is a second claimant.
|
|
func TestEachKindIsItsOwnHolderWhenResolved(t *testing.T) {
|
|
modules := []Manifest{aChannel("telegram", "telegram"), aChannel("desk-channel", "desktop")}
|
|
held, problems := checkClaims(modules, Node{Name: "anchor"}, nil, nil)
|
|
if len(problems) > 0 || len(held) != 4 {
|
|
t.Fatalf("two kinds on one machine: held %v, problems %v", held, problems)
|
|
}
|
|
_, problems = checkClaims([]Manifest{aChannel("telegram", "telegram")}, Node{Name: "home"}, held, nil)
|
|
if len(problems) == 0 {
|
|
t.Fatal("one kind held on two machines was not refused")
|
|
}
|
|
}
|