Revert G's mesh-sdk merge (#189): G merged half, and today's validator refuses G's delivery parts
mesh/delivery merged: source.main moved to novox/mesh-sdk@27da949140c6
mesh/check being carried to 8afc3ebdf371 on 93e0a7b50d90 | from 27da949140c6
mesh/delivery merged: source.main moved to novox/mesh-sdk@27da949140c6
mesh/check being carried to 8afc3ebdf371 on 93e0a7b50d90 | from 27da949140c6
The group feat/47-G-join11 merged 3 of 17 members on 2026-11-13; G's mesh-sdk alone on main breaks 25 trunk
modules. The operator chose to put the order right: a reader release first, then G whole. This restores main
to 8fbba810 exactly.
Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
package operatorask
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
|
||||
type warrant struct {
|
||||
Ask string `json:"ask"`
|
||||
Choice string `json:"choice"`
|
||||
}
|
||||
|
||||
// Design 47 G A-101: one asker finds the seat's holder, publishes, reads the warrant and hears decided.
|
||||
func TestTheAskerFindsTheHolderPublishesReadsTheWarrantAndHearsDecided(t *testing.T) {
|
||||
var asked []string
|
||||
call := func(key string, body any) (json.RawMessage, error) {
|
||||
asked = append(asked, key)
|
||||
return json.RawMessage(`{"seats":[{"seat":"other","holders":[{"module":"x"}]},{"seat":"router-seat","holders":[{"module":"holder"}]}]}`), nil
|
||||
}
|
||||
var bucket, id, subject string
|
||||
var published any
|
||||
var heard func(stdio.Envelope) error
|
||||
a := &Asker[warrant]{
|
||||
Module: "me", Contract: Contract{Seat: "router-seat", StateAsks: "asks"},
|
||||
Call: call,
|
||||
Record: func(b, i string) (*stdio.StateEntry, error) {
|
||||
bucket, id = b, i
|
||||
return &stdio.StateEntry{Value: json.RawMessage(`{"state":"chosen","warrant":{"ask":"a1","choice":"go"}}`)}, nil
|
||||
},
|
||||
Publish: func(s string, body any, _ string) error { subject, published = s, body; return nil },
|
||||
Subscribe: func(_ string, h func(stdio.Envelope) error) error { heard = h; return nil },
|
||||
AskSubject: func(m string) string { return "ask." + m },
|
||||
DecidedSubject: func(m string) string { return "decided." + m },
|
||||
}
|
||||
if err := a.Ask("a1", "q"); err != nil || subject != "ask.me" || published != "q" {
|
||||
t.Errorf("Ask published %v on %q: %v", published, subject, err)
|
||||
}
|
||||
state, w, err := a.Where("a1")
|
||||
if err != nil || state != "chosen" || w == nil || w.Choice != "go" || bucket != "holder_asks" || id != "a1" || len(asked) != 1 || asked[0] != "seat:mesh-module-assigner.assignments" {
|
||||
t.Errorf("Where = %q %+v %v, read %q %q after %v", state, w, err, bucket, id, asked)
|
||||
}
|
||||
var got []warrant
|
||||
if err := a.Hear(func(w warrant) error { got = append(got, w); return nil }); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := heard(stdio.Envelope{Key: "decided.me", Body: []byte(`{"ask":"a1","choice":"go"}`)}); err != nil || len(got) != 1 || got[0].Ask != "a1" {
|
||||
t.Errorf("heard %v: %v", got, err)
|
||||
}
|
||||
if err := heard(stdio.Envelope{Key: "decided.me", Body: []byte(`nope`)}); err == nil {
|
||||
t.Errorf("a body that is no warrant was taken")
|
||||
}
|
||||
// No holder: nothing is read and the reason is said.
|
||||
a.Call = func(string, any) (json.RawMessage, error) { return json.RawMessage(`{"seats":[]}`), nil }
|
||||
if _, _, err := a.Where("a1"); err == nil || !strings.Contains(err.Error(), "no module holds the seat router-seat") {
|
||||
t.Errorf("with no holder Where answered %v", err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user