mesh-wants is the Delivery domain's seat, defined in the delivery contracts; the indexer knows no Placement domain (issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 21:39:57 +01:00
parent df6d8e1c3b
commit 369ebd092d
16 changed files with 1540 additions and 20 deletions
@@ -348,12 +348,12 @@ func TestAMeshSDKMergeMovesOnlyTheModulesImportingAChangedPackage(t *testing.T)
}
// ADR 0636 §5, D-I3, D-I5: a seat of the mesh's own contracts is taken only from its domain's contracts module, and a move
// there is a handover in either merge order of the two trunks. `wants` (Placement) and `vault` (Identity and access) are
// there is a handover in either merge order of the two trunks. `wants` (Provisioning) and `vault` (Identity and access) are
// held by mesh-contracts as an older indexer kept them.
seat := func(name, domain string) string {
return `{"format":1,"seat":"` + name + `","scope":"mesh","grain":"seat-list","decision":"d","domain":"` + domain + `"}`
}
for name, domain := range map[string]string{"wants": "Placement", "vault": "Identity and access"} {
for name, domain := range map[string]string{"wants": "Provisioning", "vault": "Identity and access"} {
var d seatdef.Definition
if err := json.Unmarshal([]byte(seat(name, domain)), &d); err != nil {
t.Fatal(err)
@@ -365,18 +365,18 @@ func TestAMeshSDKMergeMovesOnlyTheModulesImportingAChangedPackage(t *testing.T)
t.Fatal(err)
}
}
const dropped, placement, identity = "8888888888888888888888888888888888888888", "9999999999999999999999999999999999999999", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
const dropped, provisioningDef, identity = "8888888888888888888888888888888888888888", "9999999999999999999999999999999999999999", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
seatFiles[dropped] = map[string]string{"seats/git/seat.json": git} // mesh-contracts without wants and vault
seatFiles[placement] = map[string]string{"seats/wants/seat.json": seat("wants", "Placement")}
seatFiles[provisioningDef] = map[string]string{"seats/wants/seat.json": seat("wants", "Provisioning")}
seatFiles[identity] = map[string]string{"seats/vault/seat.json": seat("vault", "Identity and access")}
domainModule := func(name string) string {
return strings.Replace(contracts, `"mesh-contracts"`, `"`+name+`"`, 1)
}
// Order 1: the domain's module merges first (its own repository) and takes wants over.
merged("novox/mesh-placement", 90, placement, forgemsg.Forge{Root: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
Trees: map[string]string{"": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"}, Manifests: map[string]string{"": domainModule("mesh-placement-contracts")}})
merged("novox/mesh-provisioning", 90, provisioningDef, forgemsg.Forge{Root: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
Trees: map[string]string{"": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"}, Manifests: map[string]string{"": domainModule("mesh-provisioning-contracts")}})
entry("wants.trunk", func(e index.SeatDefinitionEntry) bool {
return e.Module == "mesh-placement-contracts" && e.Commit == placement
return e.Module == "mesh-provisioning-contracts" && e.Commit == provisioningDef
})
// mesh-contracts then drops both: wants stays the domain module's; vault, whose module has not merged yet, is kept.
merged("novox/mesh-contracts", 91, dropped, forgemsg.Forge{Root: "dddddddddddddddddddddddddddddddddddddddd",
@@ -318,13 +318,13 @@ func TestTheControlRecords(t *testing.T) {
// ADR 0636 §5, D-I3, D-I5: a seat of the mesh's own contracts is taken only from its domain's contracts module; a
// move there is a handover in either order of the two trunks; a second definer is refused with a finding naming both.
// The seats `wants` (Placement) and `vault` (Identity and access) are held by mesh-contracts as an older indexer
// The seats `wants` (Provisioning) and `vault` (Identity and access) are held by mesh-contracts as an older indexer
// kept them; their definitions are listed from the module's `seats/` directory with no index.
seat := func(name, domain string) string {
return `{"format":1,"seat":"` + name + `","scope":"mesh","grain":"seat-list","decision":"d","domain":"` + domain + `"}`
}
for _, name := range []string{"wants", "vault"} {
dom := map[string]string{"wants": "Placement", "vault": "Identity and access"}[name]
dom := map[string]string{"wants": "Provisioning", "vault": "Identity and access"}[name]
var d seatdef.Definition
if err := json.Unmarshal([]byte(seat(name, dom)), &d); err != nil {
t.Fatal(err)
@@ -334,10 +334,10 @@ func TestTheControlRecords(t *testing.T) {
Commit: "old", Digest: digest, Definition: raw})
defs.vals[name+".trunk"] = data
}
files["c1"] = map[string]string{"seats/wants/seat.json": seat("wants", "Placement"), "seats/vault/seat.json": seat("vault", "Identity and access"),
files["c1"] = map[string]string{"seats/wants/seat.json": seat("wants", "Provisioning"), "seats/vault/seat.json": seat("vault", "Identity and access"),
"seats/lone/seat.json": seat("lone", "Core")}
files["c2"] = map[string]string{"seats/lone/seat.json": seat("lone", "Core")}
files["p1"] = map[string]string{"seats/wants/seat.json": seat("wants", "Placement")}
files["p1"] = map[string]string{"seats/wants/seat.json": seat("wants", "Provisioning")}
files["i1"] = map[string]string{"seats/vault/seat.json": seat("vault", "Identity and access")}
domainManifest := func(module string) map[string]string {
return map[string]string{meshcatalogclient.RootPath: strings.Replace(manifest, `"mesh-contracts"`, `"`+module+`"`, 1)}
@@ -354,7 +354,7 @@ func TestTheControlRecords(t *testing.T) {
// mesh-contracts defines wants and vault, seats of other domains: refused with a finding naming both modules, the
// held entries stand, and lone (Core) is taken.
mergeAt(repo, "c1", map[string]string{meshcatalogclient.RootPath: manifest})
if v, ok := findings.vals[outside]; !ok || !strings.Contains(string(v), "mesh-placement-contracts") || !strings.Contains(string(v), "mesh-identity-and-access-contracts") ||
if v, ok := findings.vals[outside]; !ok || !strings.Contains(string(v), "mesh-provisioning-contracts") || !strings.Contains(string(v), "mesh-identity-and-access-contracts") ||
!strings.Contains(string(v), "mesh-contracts defines it") {
t.Errorf("finding %s = %s, want it naming both modules", outside, v)
}
@@ -366,12 +366,12 @@ func TestTheControlRecords(t *testing.T) {
}
// Order 1: the domain's module merges first (another repository) and takes wants over; mesh-contracts then drops it and
// the entry stays the domain module's, nothing removed.
mergeAt("novox/mesh-placement", "p1", domainManifest("mesh-placement-contracts"))
if w, _ := entry("wants.trunk"); w.Module != "mesh-placement-contracts" || w.Commit != "p1" {
mergeAt("novox/mesh-provisioning", "p1", domainManifest("mesh-provisioning-contracts"))
if w, _ := entry("wants.trunk"); w.Module != "mesh-provisioning-contracts" || w.Commit != "p1" {
t.Errorf("the domain's module did not take wants over: %+v", w)
}
mergeAt(repo, "c2", map[string]string{meshcatalogclient.RootPath: manifest})
if w, _ := entry("wants.trunk"); w.Module != "mesh-placement-contracts" {
if w, _ := entry("wants.trunk"); w.Module != "mesh-provisioning-contracts" {
t.Errorf("mesh-contracts dropping wants removed or replaced the domain module's entry: %+v", w)
}
if _, ok := findings.vals[outside]; ok {
@@ -391,14 +391,14 @@ func TestTheControlRecords(t *testing.T) {
t.Errorf("said %+v: a handover removes nothing", c)
}
}
// A pull request of mesh-contracts defining a Placement seat fails its check as a definition that does not parse.
files["h2"] = map[string]string{"seats/wants/seat.json": seat("wants", "Placement")}
// A pull request of mesh-contracts defining a Provisioning seat fails its check as a definition that does not parse.
files["h2"] = map[string]string{"seats/wants/seat.json": seat("wants", "Provisioning")}
ix.ReadFile = func(_ context.Context, _, sha, p string) ([]byte, error) { return []byte(files[sha][p]), nil }
if err := ix.ApplySeatDefinitions(ctx, forgemsg.Forge{Kind: forgemsg.ForgePull, Action: forgemsg.PullUpdated, Repository: repo, Number: 11, Head: "h2",
Dirs: []string{meshcatalogclient.RootPath}, Manifests: map[string]string{meshcatalogclient.RootPath: manifest}}); err != nil {
t.Fatal(err)
}
if e, _ := entry(SeatDefinitionKey("wants", SourcePull, repo, 11)); !strings.Contains(e.Unparsed, "mesh-placement-contracts") || e.Definition != nil {
if e, _ := entry(SeatDefinitionKey("wants", SourcePull, repo, 11)); !strings.Contains(e.Unparsed, "mesh-provisioning-contracts") || e.Definition != nil {
t.Errorf("a pull request's wants from mesh-contracts = %+v, want it refused naming the domain's module", e)
}
// The verb seat-definitions: no seat lists every trunk seat with its digest (never a pull request's); a seat answers it whole.
@@ -19,9 +19,9 @@ import (
// fallbackContracts is the mesh's contracts module for a domain with no contracts module of its own.
const fallbackContracts = "mesh-contracts"
// domainsWithContracts are the domains whose seats have a contracts module of their own (ADR 0634 §7): the seven
// domainsWithContracts are the domains whose seats have a contracts module of their own (ADR 0634 §7): the six
// the milestone creates. Every other domain's seats are defined in fallbackContracts.
var domainsWithContracts = []string{"Delivery", "Placement", "Provisioning", "Identity and access", "Health and repair",
var domainsWithContracts = []string{"Delivery", "Provisioning", "Identity and access", "Health and repair",
"Connectivity", "Operator and conversation"}
// domainContracts is the module that defines a domain's seats: mesh-<domain>-contracts, the heading lowercased with