A-357: a package's seat-verb call word orders its users after the verb's server
A package's `calls` names the seat verbs its code calls on a module's behalf in the invokes form; the indexer derives an edge of kind 6 from such a word against the verb's server, as from `invokes`, so every module built against the SDK is delivered after the running versions that serve its start. The path for stated capability words stays. Builds: design 47 G A-357, §47 (kind 6) Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -265,6 +265,8 @@ func edgesOf(a meshcatalog.CatalogEntry, all map[string]meshcatalog.CatalogEntry
|
||||
}
|
||||
// Kind 6 again: a package it builds against whose artifact takes `calls` (the capability words its code calls of the tool
|
||||
// runner) orders it after the artifact that `states` each word, so no manifest names the tool runner's module (§605, §545).
|
||||
// A call word in the invokes form, `seat:<seat>.<verb>` (a seat verb the package's code calls on the module's behalf),
|
||||
// orders it after the verb's server, exactly as the same word in its `invokes` would (design 47 G A-357).
|
||||
for _, name := range slices.Sorted(maps.Keys(a.Packages)) {
|
||||
for _, m := range modules {
|
||||
for _, art := range all[m].Artifacts {
|
||||
@@ -272,6 +274,13 @@ func edgesOf(a meshcatalog.CatalogEntry, all map[string]meshcatalog.CatalogEntry
|
||||
continue
|
||||
}
|
||||
for _, word := range wordsOf(all[m], art.Ref, "calls") {
|
||||
if _, _, isSeat := catalogue.SeatInvoke(word); isSeat && !slices.Contains(a.LeftOut, word) {
|
||||
for _, server := range serving.Servers(word) {
|
||||
if server != a.Module {
|
||||
add(meshcatalog.Edge{Kind: 6, From: primaryOf(all[server]), To: delivers, Word: word, Why: "calls of " + name})
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, other := range modules {
|
||||
for _, stating := range all[other].Artifacts {
|
||||
if other != a.Module && slices.Contains(wordsOf(all[other], stating.Ref, "states"), word) {
|
||||
|
||||
@@ -86,14 +86,17 @@ func TestAKindSixEdgeNamesTheFieldsALongFormInvokeRelies(t *testing.T) {
|
||||
}
|
||||
|
||||
// Design 47 G §605, §545, A-208: a module built against a package whose artifact takes `calls` is ordered after the artifact
|
||||
// that `states` each word, by an edge of kind 6 naming the word; a module built against no such package has none.
|
||||
// that `states` each word, by an edge of kind 6 naming the word; a module built against no such package has none. A-357: a
|
||||
// call word in the invokes form orders it after the verb's server, as from `invokes`, and the server after none of its own.
|
||||
func TestAModuleBuiltOnAPackageThatCallsTheToolRunnerIsOrderedAfterTheArtifactThatStatesTheWords(t *testing.T) {
|
||||
artifactsOf := func(module string, art map[string]any) map[string]any {
|
||||
return map[string]any{"module": module, "build": map[string]any{"artifacts": []any{art}}}
|
||||
}
|
||||
entries := map[string]meshcatalog.CatalogEntry{
|
||||
"sdk": {Module: "sdk", Artifacts: []meshcatalog.Artifact{{Ref: "sdk:go", Kind: "package", Language: "go", Package: &meshcatalog.ArtifactPackage{Ecosystem: EcosystemGo, Name: "git.example/sdk/go"}}},
|
||||
Manifest: artifactsOf("sdk", map[string]any{"name": "go", "calls": []any{"put-sessions", "finding-calls"}})},
|
||||
Manifest: artifactsOf("sdk", map[string]any{"name": "go", "calls": []any{"put-sessions", "finding-calls", "seat:mesh-catalog.registrations"}})},
|
||||
"catalog": {Module: "catalog", Artifacts: []meshcatalog.Artifact{{Ref: "catalog:program", Language: "go"}}, Serves: []string{"seat:mesh-catalog.registrations"},
|
||||
Packages: map[string]string{"git.example/sdk/go": "1.0.4"}},
|
||||
"runner": {Module: "runner", Artifacts: []meshcatalog.Artifact{{Ref: "runner:runtime"}},
|
||||
Manifest: artifactsOf("runner", map[string]any{"name": "runtime", "states": []any{"put-sessions"}})},
|
||||
"app": {Module: "app", Artifacts: []meshcatalog.Artifact{{Ref: "app:program", Language: "go"}}, Packages: map[string]string{"git.example/sdk/go": "1.0.4"}},
|
||||
@@ -106,10 +109,14 @@ func TestAModuleBuiltOnAPackageThatCallsTheToolRunnerIsOrderedAfterTheArtifactTh
|
||||
six = append(six, e)
|
||||
}
|
||||
}
|
||||
want := []meshcatalog.Edge{{Kind: 6, From: "runner:runtime", To: "app:program", Word: "put-sessions", Why: "calls of git.example/sdk/go"}}
|
||||
want := []meshcatalog.Edge{{Kind: 6, From: "catalog:program", To: "app:program", Word: "seat:mesh-catalog.registrations", Why: "calls of git.example/sdk/go"},
|
||||
{Kind: 6, From: "runner:runtime", To: "app:program", Word: "put-sessions", Why: "calls of git.example/sdk/go"}}
|
||||
if !slices.Equal(six, want) {
|
||||
t.Errorf("app's edges of kind 6 are %+v, want %+v", six, want)
|
||||
}
|
||||
if slices.ContainsFunc(got["catalog"].Edges, func(e meshcatalog.Edge) bool { return e.From == "catalog:program" }) {
|
||||
t.Errorf("the verb's server is ordered after itself: %+v", got["catalog"].Edges)
|
||||
}
|
||||
if len(got["other"].Edges) != 0 {
|
||||
t.Errorf("other builds on no such package, its edges %+v", got["other"].Edges)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user