From effdc0936e49cf081fdb17dc985d6f7ca85d4f0d Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 11 Nov 2026 21:38:55 +0100 Subject: [PATCH] G seatdef: the definition reader takes a state's view and a verb's by-caller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G §699, §616, §656, §621 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ --- go/seatdef/seatdef.go | 5 +++++ go/seatdef/seatdef_test.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/go/seatdef/seatdef.go b/go/seatdef/seatdef.go index 143657a5..fa1dc6e6 100644 --- a/go/seatdef/seatdef.go +++ b/go/seatdef/seatdef.go @@ -221,6 +221,9 @@ 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, §656). + ByCaller bool `json:"by-caller,omitempty"` } // The streams an accepted kind may ride (design 47 G §415). @@ -407,6 +410,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 (`.`, a part between angle brackets, diff --git a/go/seatdef/seatdef_test.go b/go/seatdef/seatdef_test.go index e68e2969..b2b8a8ce 100644 --- a/go/seatdef/seatdef_test.go +++ b/go/seatdef/seatdef_test.go @@ -86,6 +86,9 @@ 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":".","value":{"type":"object"}}]}`), ""}, + {"a state offered as a view (design 47 G 699)", withState(whole, `{"name":"asks","template":"state","view":true, + "key-forms":[{"key":"","value":{"type":"object"}}]}`), ""}, + {"a verb answered by the holder's process by caller (design 47 G 656)", strings.Replace(whole, `"name":"list",`, `"name":"list","by-caller":true,`, 1), ""}, {"a stream state with an age", withState(whole, `{"name":"placement","template":"events","max-age-days":7, "key-forms":[{"key":"changed.","value":{"type":"object"}}]}`), ""}, {"a state of an unknown template", withState(whole, `{"name":"asks","template":"bucket",