Round 1: the pin tests merged (test budget), KVWatch's doc says what folds
mesh/delivery merged: source.main moved to novox/mesh-host@89475bb0cfec

The review of fe9533c1: a new test function raised a count already over the
budget, so two broker-pin tests are one; KVWatch no longer yields every
change, and its doc says so (issue 1966).

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
This commit is contained in:
2026-11-08 00:38:36 +01:00
parent fe9533c186
commit 4f1e92160a
2 changed files with 8 additions and 9 deletions
+3 -7
View File
@@ -61,8 +61,8 @@ func server(t *testing.T) (address string, fingerprint string) {
return listener.Addr().String(), Fingerprint(der)
}
// The right broker is accepted; and a malformed pin is caught before connecting, rather than at the handshake, so a mistyped
// token fails while a person is looking at it (two tests merged).
// The right broker is accepted, a different one refused, and a malformed pin is caught before connecting, rather than at
// the handshake, so a mistyped token fails while a person is looking at it (three tests merged).
func TestTheRightBrokerIsAcceptedAndAMalformedPinRefused(t *testing.T) {
address, pin := server(t)
conn, err := dialPinned(address, pin, 5*time.Second)
@@ -76,15 +76,11 @@ func TestTheRightBrokerIsAcceptedAndAMalformedPinRefused(t *testing.T) {
t.Errorf("%q was accepted as a fingerprint", bad)
}
}
}
func TestADifferentBrokerIsRefused(t *testing.T) {
// The case the pin exists for: something else answering at that address. Since the host
// applies whatever the link delivers, connecting to the wrong mesh is the whole machine.
address, _ := server(t)
_, other := server(t)
_, err := dialPinned(address, other, 5*time.Second)
_, err = dialPinned(address, other, 5*time.Second)
if err == nil {
t.Fatal("a broker presenting a different certificate was accepted")
}
+5 -2
View File
@@ -23,8 +23,11 @@ type KVUpdate struct {
// KVBus is a link that can watch a bucket's keys: the node agent follows its wants and its compositions with it, and
// never polls.
type KVBus interface {
// KVWatch yields the keys of the bucket matching the pattern now, a Caught update, then every change, until ctx ends
// or the link does (the channel is then closed). A bucket the node's account may not read is an error. The pattern
// KVWatch yields the keys of the bucket matching the pattern now, a Caught update, then the changes, until ctx ends
// or the link does (the channel is then closed). It never holds the bus client back: while the reader does not take,
// a key's changes fold into its newest (a delete included), so a reader sees each key's latest state, not every
// change, and a key still queued from before Caught is handed before Caught with its newest value; across keys the
// order is the order each key was first queued. A bucket the node's account may not read is an error. The pattern
// may be several, separated by spaces (WatchPatterns), watched as one: a node's assignment in either form of its
// keys (research 072 row 37).
KVWatch(ctx context.Context, bucket, pattern string) (<-chan KVUpdate, error)