A-231: one reader of the invoke by which an asker names a build seat's queue
catalogue.QueueInvoke reads seat:<seat>.accept.<queue>, the form an asker names the queue it asks in its manifest's invokes; the validator, the indexer's served-verb edge and the grants part read it here. Builds: design 47 G §544, §601, A-231 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -17,6 +17,15 @@ func TestAManifestMaySayWhatItInvokes(t *testing.T) {
|
||||
if len(m.Invokes) != 2 || m.Invokes[1] != "*" {
|
||||
t.Fatalf("invokes not read: %v", m.Invokes)
|
||||
}
|
||||
// An asker names a build seat's queue as seat:<seat>.accept.<queue> (design 47 G A-231), and nothing else reads as one.
|
||||
for invoke, want := range map[string]string{"seat:node-build-go.accept.check": "node-build-go/check",
|
||||
"seat:node-build-go.run": "", "node-build-go.accept.check": "", "seat:node-build-go.accept.": "",
|
||||
"seat:node-build-go.accept.check.mesh-catalog": "", "*": ""} {
|
||||
seat, queue, ok := QueueInvoke(invoke)
|
||||
if got := seat + "/" + queue; ok != (want != "") || ok && got != want {
|
||||
t.Errorf("QueueInvoke(%q) = %s, %v; want %q", invoke, got, ok, want)
|
||||
}
|
||||
}
|
||||
// And that its own secrets are the core's credentials (issue 774): read, and written back as said.
|
||||
for raw, core := range map[string]bool{`{"module":"bus","version":"1","core-credentials":true}`: true, `{"module":"app","version":"1"}`: false} {
|
||||
m, err := decodeForTest([]byte(raw))
|
||||
|
||||
@@ -18,3 +18,15 @@ func SeatInvoke(invoke string) (seat, verb string, ok bool) {
|
||||
seat, verb, ok = strings.Cut(rest, ".")
|
||||
return seat, verb, ok && seat != "" && verb != ""
|
||||
}
|
||||
|
||||
// QueueInvoke splits an invoke `seat:<seat>.accept.<queue>`, by which an asker names a build seat's queue it asks (design 47 G
|
||||
// §544, §601, A-231), into its seat and queue; ok is false for anything else. The one reader of that form: the manifest
|
||||
// validator, the indexer's served-verb edge and the grants part read it here.
|
||||
func QueueInvoke(invoke string) (seat, queue string, ok bool) {
|
||||
seat, verb, ok := SeatInvoke(invoke)
|
||||
if !ok {
|
||||
return "", "", false
|
||||
}
|
||||
queue, ok = strings.CutPrefix(verb, "accept.")
|
||||
return seat, queue, ok && queue != "" && !strings.Contains(queue, ".")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user