RR2-1: the seat-definition reader reads by-caller and chunks on a verb, view on a state
A definition G writes marks a verb by-caller (mesh-recovery, mesh-broker, the gated verbs) or chunks, and a state as a view; the running reader refused each as a field the format does not know, so every such definition. Builds: design 47 G §621, §697, §681, §699 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -221,6 +221,12 @@ type Verb struct {
|
||||
// NeedsApproval marks the verb for every holder: the operator approves a call of it first (design 46 *The approval
|
||||
// mark* §2).
|
||||
NeedsApproval bool `json:"needs-approval,omitempty"`
|
||||
// ByCaller says the holder's process answers the verb itself and tells callers apart by the account the bus proved
|
||||
// (design 47 G §554, §621, §697).
|
||||
ByCaller bool `json:"by-caller,omitempty"`
|
||||
// Chunks says the holder's process sends the answer's file in chunks, each acknowledged by the caller, on the
|
||||
// subjects mesh.seat.<seat>.chunk.<verb>.<call>.<n> and mesh.seat.<seat>.ack.<verb>.<call>.<n> (design 47 G §681).
|
||||
Chunks bool `json:"chunks,omitempty"`
|
||||
}
|
||||
|
||||
// The streams an accepted kind may ride (design 47 G §415).
|
||||
@@ -402,6 +408,8 @@ type State struct {
|
||||
History int `json:"history,omitempty"`
|
||||
MaxAgeDays int `json:"max-age-days,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
// View is true when the seat offers the state as a view for a module to follow by `consumes` (design 47 G §699).
|
||||
View bool `json:"view,omitempty"`
|
||||
}
|
||||
|
||||
// KeyForm is one form a state's key takes: a pattern of named parts (`<asker>.<id>`, a part between angle brackets,
|
||||
|
||||
@@ -84,6 +84,8 @@ func TestADefinitionIsReadStrictlyNamingWhatIsWrong(t *testing.T) {
|
||||
`"domain":"Core","decision":"ADR 1","records":[{"name":"asks"}],`, 1), "records: a field the format does not know"},
|
||||
{"a state with a key form and a value", withState(whole, `{"name":"asks","template":"state","writer":"caller",
|
||||
"history":3,"key-forms":[{"key":"<asker>.<id>","value":{"type":"object"}}]}`), ""},
|
||||
{"a state offered as a view", withState(whole, `{"name":"asks","template":"state","view":true,
|
||||
"key-forms":[{"key":"<id>","value":{"type":"object"}}]}`), ""},
|
||||
{"a stream state with an age", withState(whole, `{"name":"placement","template":"events","max-age-days":7,
|
||||
"key-forms":[{"key":"changed.<node>","value":{"type":"object"}}]}`), ""},
|
||||
{"a state of an unknown template", withState(whole, `{"name":"asks","template":"bucket",
|
||||
@@ -142,6 +144,8 @@ func TestADefinitionIsReadStrictlyNamingWhatIsWrong(t *testing.T) {
|
||||
{"an acting rule on another kind", strings.Replace(listGrain, `"verbs":`, `"acts":[{"step":"build","on":"kind:Image"}],"verbs":`, 1), "acts[0].on"},
|
||||
{"a verb marked for approval", strings.Replace(whole, `"name":"list",`, `"name":"list","needs-approval":true,`, 1), ""},
|
||||
{"a verb marked with a word that is no boolean", strings.Replace(whole, `"name":"list",`, `"name":"list","needs-approval":"yes",`, 1), "not a seat definition's JSON"},
|
||||
{"a verb answered by its caller's account, in chunks", strings.Replace(whole, `"name":"list",`, `"name":"list","by-caller":true,"chunks":true,`, 1), ""},
|
||||
{"a verb's by-caller that is no boolean", strings.Replace(whole, `"name":"list",`, `"name":"list","by-caller":"yes",`, 1), "not a seat definition's JSON"},
|
||||
{"a bodies section", strings.Replace(whole, `"family":`, `"bodies":{"Finding":{"type":"object"}},"family":`, 1), ""},
|
||||
{"one kind on two streams", strings.Replace(whole, `"events":`,
|
||||
`"accepts":[{"name":"step","body":{},"stream":"check"},{"name":"step","body":{},"stream":"delivery"}],"events":`, 1), ""},
|
||||
|
||||
Reference in New Issue
Block a user