A-177: a compiled seat verb carries its approval mark

catalogue.Verb gains NeedsApproval, copied by SeatsFromDefinitions from the
definition's verb, so the manifest validator and every reader of the seat
list read a verb's mark from one place. Compiled only, never read from a
manifest's own verb.

Builds: design 46 7-approval-mark §2, §4; lead answer A-177

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 05:43:12 +01:00
parent f440ffa3fc
commit 8b08bffd3b
3 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ func SeatFromDefinition(d seatdef.Definition) Seat {
for _, v := range d.Verbs {
s.Serves = append(s.Serves, Verb{Name: v.Name, Description: v.Description,
Input: seatdef.ResolveRefs(v.Input, d.Defs), Output: seatdef.ResolveRefs(v.Answer, d.Defs),
Optional: v.Optional, Replaces: v.Replaces})
Optional: v.Optional, Replaces: v.Replaces, NeedsApproval: v.NeedsApproval})
}
for _, st := range d.States {
s.States = append(s.States, st.Name)
+6
View File
@@ -109,4 +109,10 @@ func TestSeatRead(t *testing.T) {
len(s.AcceptedOn) != 1 || s.AcceptedOn[0] != "check.step" {
t.Errorf("the seat's states = %v, views = %v, accepted on = %v", s.States, s.Views, s.AcceptedOn)
}
// A-177 (design 46 approval mark §2, §4): a compiled verb carries its definition's approval mark.
marked := SeatFromDefinition(seatdef.Definition{Seat: "node-login-shell",
Verbs: []seatdef.Verb{{Name: "execute", NeedsApproval: true}, {Name: "read"}}})
if len(marked.Serves) != 2 || !marked.Serves[0].NeedsApproval || marked.Serves[1].NeedsApproval {
t.Errorf("the compiled verbs' marks = %+v", marked.Serves)
}
}
+5
View File
@@ -37,6 +37,11 @@ type Verb struct {
// A command line is matched by its words in order, the first being the command's name; `edit
// /etc/hosts` and `HOSTALIASES` name the guard's two local work-arounds for a mesh name.
Replaces []string `json:"replaces,omitempty"`
// NeedsApproval is the verb's approval mark as its seat's definition gives it (seatdef.Verb.NeedsApproval): the
// operator approves a call of it first, for every holder (design 46 *The approval mark* §2, §4; lead answer A-177),
// read from here by the manifest validator and every reader of the seat list. Never read from a manifest's own
// verb (a module marks in its needs-approval) nor said: compiled from the definition alone, as Optional.
NeedsApproval bool `json:"-"`
}
func (v *Verb) UnmarshalJSON(raw []byte) error {