R1-2: a seat proof after the stop or cut at the bound is answered nothing

SeatAnswer answered the drain's unanswered error as {"error": "answered nothing"}; it now sends no
reply, as answerCalledOn does, so the caller's kept call meets the next runner (review round 1,
finding 2, seat.go:222).

Builds: design 47 H2 §813 (12), H-A-369
This commit is contained in:
2026-11-22 02:17:39 +01:00
parent a6a16c897b
commit e8579359b6
2 changed files with 37 additions and 1 deletions
+8 -1
View File
@@ -195,7 +195,8 @@ func (c *Conn) SeatProve(module, subject string, body json.RawMessage) (json.Raw
}
// SeatAnswer answers every proof on a subject the module's seat traffic lists among its answers, with what
// answer returns. A returned error is answered as `{"error": "<words>"}`, never as silence.
// answer returns. A returned error is answered as `{"error": "<words>"}`, never as silence, but for one that says it is
// unanswered (a proof after the stop or cut at the bound).
func (c *Conn) SeatAnswer(module, subject string, answer func(subject string, body json.RawMessage) (json.RawMessage, error)) (func(), error) {
t, err := c.trafficOf(module)
if err != nil {
@@ -219,6 +220,12 @@ func (c *Conn) SeatAnswer(module, subject string, answer func(subject string, bo
return
}
out, err := answer(msg.Subject, body)
// A proof arriving after the runner's stop, or cut at its bound, is answered nothing, as answerCalledOn does
// (design 47 H2 §813 (12), H-A-369).
var unanswered interface{ Unanswered() bool }
if errors.As(err, &unanswered) && unanswered.Unanswered() {
return
}
if err != nil {
b, _ := json.Marshal(map[string]string{"error": err.Error()})
_ = msg.Respond(b)