D-1: the forms of a caller entry and the default callers of a verb's class

Text callers are still read here: G's reader refuses them only once the bootstrapped copies are lists (D-4 to D-6).

Builds: design 47 G §336, §392, §391, §68, §338

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-11 10:50:51 +01:00
parent 0036455e63
commit 2dbcc89ed2
2 changed files with 41 additions and 0 deletions
+22
View File
@@ -101,6 +101,28 @@ func CallerEntryProblem(e string) string {
"holder:<seat>@same-node", e)
}
// DefaultCallers are the callers a verb that names none takes by its class (design 47 G §391): a read takes invokers,
// persons and sessions; an act the operator and sessions; a warrant the operator. A verb that names no class is a
// read.
func DefaultCallers(class string) []string {
switch class {
case ClassAct:
return []string{CallerOperator, CallerSessions}
case ClassWarrant:
return []string{CallerOperator}
}
return []string{CallerInvokers, CallerPersons, CallerSessions}
}
// EffectiveCallers are the callers the verb is open to: the list it names, or the default of its class. A verb whose
// callers are text, as the definitions before G wrote them, names no list and takes the default.
func (v Verb) EffectiveCallers() []string {
if v.Callers != nil && !v.Callers.IsText() {
return v.Callers.List
}
return DefaultCallers(v.Class)
}
// The classes of a verb (design 47 G §391).
const (
ClassRead = "read"
+19
View File
@@ -283,3 +283,22 @@ func TestAKeptEventsStreamIsNamedFromTheSeatAndTheEvent(t *testing.T) {
t.Errorf("the stream is %s", got)
}
}
// Design 47 G §391: a verb that names no callers takes its class's default, a verb that names them keeps them.
func TestAVerbWithoutCallersTakesItsClassDefault(t *testing.T) {
for _, c := range []struct {
verb Verb
want string
}{
{Verb{}, "invokers persons sessions"},
{Verb{Class: ClassRead}, "invokers persons sessions"},
{Verb{Class: ClassAct}, "operator sessions"},
{Verb{Class: ClassWarrant}, "operator"},
{Verb{Class: ClassAct, Callers: &Callers{List: []string{"seat:mesh-broker"}}}, "seat:mesh-broker"},
{Verb{Class: ClassWarrant, Callers: &Callers{Text: "a person"}}, "operator"},
} {
if got := strings.Join(c.verb.EffectiveCallers(), " "); got != c.want {
t.Errorf("%+v is open to %q, want %q", c.verb, got, c.want)
}
}
}