node-tools: a stopping tool runner takes its subscriptions down, so callers meet no responders (issue 721)

The runner answered each call it did not take once its stop began with the typed fault
stopping (#90). Callers built before mesh-sdk read it as the callee's refusal and ended their
kept call, and no edge delivered the new answer after its readers. Now, once told to stop,
the runner first drains every subscription it answers calls on (a tool's, a seat verb's and
a seat proof's) and subscribes none again, then finishes the calls in flight within
drain-bound. A call made after the stop meets no responders at once, a transport fault every
caller of every mesh-sdk already waits out, until the new runner subscribes. A call that
still reached it is answered nothing, as H-A-369 has it. The typed answer goes whole: the
reply's error-kind, KindedError, ErrorKindStopping and the bundle's error data.

Tests: 721/AC4 in the bus (a call and a proof after the stop meet no responders within a
second, the call in flight is answered, a subject served after the stop is refused) and in
launch (a call that still reaches the runner gets no answer and no typed fault); the whole
test meets no responders while a call is still in flight, before the drain bound.

Builds: design 47 H2 H-A-570 (1), (3) (mesh-tools' part), amending §813 (12) as H-A-369 has it
This commit is contained in:
2026-11-23 16:35:15 +01:00
parent e8f58540ee
commit 662b05ca5a
9 changed files with 162 additions and 123 deletions
+12 -8
View File
@@ -181,9 +181,6 @@ func TestAProofIsAskedAndAnsweredAndNeverKept(t *testing.T) {
if string(body) == `{"cut":true}` {
return nil, unansweredProof{}
}
if string(body) == `{"stopping":true}` {
return nil, stoppingFault{}
}
return json.RawMessage(`{"linked":true}`), nil
})
if err != nil {
@@ -198,11 +195,6 @@ func TestAProofIsAskedAndAnsweredAndNeverKept(t *testing.T) {
if string(answer) != `{"linked":true}` {
t.Fatalf("the proof was answered %s", answer)
}
// A proof after the stop is answered the typed fault stopping, never silence (design 47 H2 H-A-542).
if raw, err := conn.SeatProve("telegram", "mesh.seat.intake.proof.code.telegram", json.RawMessage(`{"stopping":true}`)); err != nil ||
!strings.Contains(string(raw), `"error-kind":"stopping"`) {
t.Errorf("a proof after the stop was answered %s, %v; want its error-kind stopping", raw, err)
}
// A proof arriving after the stop, or cut at the bound, is answered nothing (design 47 H2 §813 (12), H-A-369): the
// answerer handles proofs in order, so the first reply on one inbox after a cut proof and a whole one is the whole one's.
raw, err := nats.Connect(mt.URL(t))
@@ -237,6 +229,18 @@ func TestAProofIsAskedAndAnsweredAndNeverKept(t *testing.T) {
}
}
}
// 721/AC4: at its stop the runner takes its proofs' subscriptions down with the rest (design 47 H2 H-A-570 (1)): a proof
// after it meets no responders, never an answer of the old runner's, and a proof answered after it is not subscribed.
conn.StopAnswering()
if raw, err := conn.SeatProve("telegram", "mesh.seat.intake.proof.code.telegram", json.RawMessage(`{"code":"123456"}`)); err == nil ||
!strings.Contains(err.Error(), "nothing answers") {
t.Errorf("a proof after the stop was answered %s, %v; want no responders", raw, err)
}
if _, err := conn.SeatAnswer("messenger", "mesh.seat.intake.proof.code.*", func(string, json.RawMessage) (json.RawMessage, error) {
return nil, nil
}); err == nil {
t.Error("a proof answered after the stop was subscribed")
}
}
func TestAnAskerReadsItsOwnRecordAndNoOther(t *testing.T) {