G V-5, V-6: a views reader writes its findings through the part's writer; a writer owns kinds and judges an owner's form
WriterFindings replaces the reader's own OwnFindings; the writer's statement carries kinds, deletes only keys of them and keeps the reader's open findings beside observe's; owner and waiting-on of none of the three forms are refused. Builds: design 47 G §639, §580, §678 Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
+12
-18
@@ -616,28 +616,22 @@ func (r *Reader) Tools(prefix string) []stdio.Tool {
|
||||
}
|
||||
}
|
||||
|
||||
// OwnFindings writes a reader's findings into its own state `findings` through its runtime, where the condition keeper
|
||||
// raises and clears conditions from them: the Findings of a Reader whose module keeps the state `findings`. Encode is
|
||||
// the module's: it turns a Finding into the state's key and value as the seat mesh-conditions' contract lays them out.
|
||||
type OwnFindings struct {
|
||||
Encode func(Finding) (key string, value []byte, err error)
|
||||
// WriterFindings writes a views reader's findings through the part's mesh-sdk writer, as kinds of the reader's own
|
||||
// (design 47 G §639, §580): the Findings of a reader, never a writer of its own. Body is the part's: it lays a Finding
|
||||
// out as the finding of the seat `mesh-conditions` (its scope, severity, source and subject are the seat's contract's,
|
||||
// not this package's); the writer's statement covers the reader's open findings beside its observe's.
|
||||
type WriterFindings struct {
|
||||
Writer *Writer
|
||||
Body func(Finding) FindingBody
|
||||
}
|
||||
|
||||
// Put writes one finding.
|
||||
func (o OwnFindings) Put(f Finding) error {
|
||||
key, value, err := o.Encode(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = stdio.State("findings").Put(key, json.RawMessage(value))
|
||||
return err
|
||||
func (o WriterFindings) Put(f Finding) error {
|
||||
return o.Writer.Write(context.Background(), o.Body(f))
|
||||
}
|
||||
|
||||
// Delete clears one finding.
|
||||
func (o OwnFindings) Delete(f Finding) error {
|
||||
key, _, err := o.Encode(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return stdio.State("findings").Delete(key)
|
||||
func (o WriterFindings) Delete(f Finding) error {
|
||||
b := o.Body(f)
|
||||
return o.Writer.Clear(context.Background(), b.Scope, b.ID, b.Kind, "the part no longer observes it")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user