Give the uplink seat its verbs, staged until its holders serve them (hq ADR 0241)

What a machine resolves through and over which links had no tool: the
resolver file and its writer, and each link with its routes and resolvers,
are now verbs of node-uplink, the same whatever manages the network. A verb
required at once would refuse every holder before the catalogue could serve
it, and a stored one would be required by an older controller, so it is
staged: promised and routed, never stored, and not yet a condition of
holding.
This commit is contained in:
jochen
2026-10-07 20:16:16 +02:00
parent f6aea4bfbb
commit 161e676b97
4 changed files with 153 additions and 2 deletions
+2
View File
@@ -62,6 +62,8 @@ func (i *Inventory) Seats(ctx context.Context) ([]catalogue.Seat, error) {
func (i *Inventory) SeedSeats(ctx context.Context, defaults []catalogue.Seat) (int, error) {
var added int
for _, s := range defaults {
// A verb still staged is never stored (catalogue.Seat.Staged).
s = s.Stored()
accepts, emits, serves, err := protocolJSON(s)
if err != nil {
return added, err
+22
View File
@@ -156,3 +156,25 @@ func TestTheControllersVerbsInTheRowAreTheBinarys(t *testing.T) {
t.Fatal("a verb this binary adds was not added")
}
}
// A verb still staged (novox/hq ADR 0241) is never in the store's row: a controller older than it reads
// the row and would require what no holder of its time serves.
func TestAStagedVerbIsNotSeeded(t *testing.T) {
inv := ForTest(t)
if _, err := inv.SeedSeats(t.Context(), catalogue.DefaultSeats()); err != nil {
t.Fatal(err)
}
// Seeded twice: the second widens, and must not add it either.
if _, err := inv.SeedSeats(t.Context(), catalogue.DefaultSeats()); err != nil {
t.Fatal(err)
}
got, err := inv.Seats(t.Context())
if err != nil {
t.Fatal(err)
}
for _, s := range got {
if s.Name == "node-uplink" && len(s.Serves) != 0 {
t.Fatalf("the row keeps %v", s.Serves)
}
}
}