Join 9: claude-code adopts its licence binding's first view through its views reader (A-134)

The manager says binding.changed.<consumer>: the module's views reader hears it by the adoption
and asks the first view (FirstBinding) once its subscription is taken, instead of a subscription
of the exact subject of its own.

Builds: design 47 G A-134

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 02:03:14 +01:00
parent 22a90d4267
commit dafa0691ad
3 changed files with 47 additions and 16 deletions
@@ -1,6 +1,7 @@
package main
import (
"context"
"encoding/json"
"os"
"path/filepath"
@@ -9,6 +10,8 @@ import (
"strings"
"testing"
"time"
"git.novox.be/novox/mesh-sdk/go/views"
)
var now = time.Now().UnixMilli()
@@ -595,6 +598,20 @@ func TestTheFirstViewOfTheBindingIsApplied(t *testing.T) {
if _, err := FirstBinding(p, ask, writer(w)); err != nil || len(asked) != 6 || asked[5] != VaultGet {
t.Fatalf("a start asked %v", asked)
}
// A-134: the first view is the follower the module's views reader adopts on binding.changed.<consumer>; its answer
// applies the binding as FirstBinding does.
r := &views.Reader{Module: Module}
f := bindingsFollower(p, ask, writer(w), func(done string, err error) {
if err != nil || !strings.Contains(done, `"generation":9`) {
t.Errorf("the adopted first view applied %q, %v", done, err)
}
})
if err := r.Adopt(f, Manager, BindingChangedEvent, func(context.Context, []byte) error { return nil }); err != nil || !r.Follows(Manager+".bindings") {
t.Fatalf("the bindings follower is not adopted: %v", err)
}
if err := f.Start(context.Background()); err != nil || len(asked) != 9 {
t.Fatalf("the adopted first view: %v, asked %v", err, asked)
}
raw, _ := os.ReadFile("../../module.json")
var m struct {
Consumes, Invokes []string