T4: a waiting read lists an ask handed out and not acknowledged, marked again

mesh/queue.waiting reads from each worker's acknowledgement floor, so an ask a worker holds or
handed back is listed with again: true; the holder tells the two apart by its own state taken.

Builds: design 47 H2 §777, H-A-410 (second addendum)
This commit is contained in:
2026-11-22 01:01:59 +01:00
parent 917195a302
commit a6a16c897b
2 changed files with 26 additions and 7 deletions
@@ -231,7 +231,7 @@ func TestABundlePullsAndSettlesThroughItsModulesBus(t *testing.T) {
}
var got []string
for _, a := range w.Asks {
got = append(got, fmt.Sprintf("%s:%s:%v", a.Module, a.ID, a.AgeSeconds < 60))
got = append(got, fmt.Sprintf("%s:%s:%v", a.Module, a.ID, a.AgeSeconds < 60)+map[bool]string{true: ":again"}[a.Again])
}
if strings.Join(got, ",") != want {
t.Errorf("waiting is %s, want %s", raw, want)
@@ -255,8 +255,23 @@ func TestABundlePullsAndSettlesThroughItsModulesBus(t *testing.T) {
if _, err := building.Seat("waiting", json.RawMessage(`{"seat":"operator-channel"}`), nil); err == nil {
t.Error("the holder read the queue of a seat it holds no worker on")
}
if _, err := building.Seat("pull", json.RawMessage(`{"worker":"SEAT_NODE_BUILD_GO_DELIVERY_worker","wait_ms":1000}`), nil); err != nil {
raw, err = building.Seat("pull", json.RawMessage(`{"worker":"SEAT_NODE_BUILD_GO_DELIVERY_worker","wait_ms":1000}`), nil)
if err != nil || json.Unmarshal(raw, &p) != nil {
t.Fatal(raw, err)
}
// a pulled ask, held or handed back, is listed again (the holder tells the two apart by its state taken); one acknowledged
// is gone
waiting("mesh-delivery-pipeline:ask2:true:again,mesh-delivery-pipeline:ask3:true")
if _, err := building.Seat("settle", json.RawMessage(`{"id":"`+p.ID+`","fate":"nak-after","delay_ms":60000}`), nil); err != nil {
t.Fatal(err)
}
waiting("mesh-delivery-pipeline:ask3:true") // the pulled ask is taken, no longer waiting
waiting("mesh-delivery-pipeline:ask2:true:again,mesh-delivery-pipeline:ask3:true")
raw, err = building.Seat("pull", json.RawMessage(`{"worker":"SEAT_NODE_BUILD_GO_DELIVERY_worker","wait_ms":1000}`), nil)
if err != nil || json.Unmarshal(raw, &p) != nil {
t.Fatal(raw, err)
}
if _, err := building.Seat("settle", json.RawMessage(`{"id":"`+p.ID+`","fate":"ack"}`), nil); err != nil {
t.Fatal(err)
}
waiting("mesh-delivery-pipeline:ask2:true:again")
}