delivery: a turn never holds the check of heads that wait in it, so two approved merges in one turn never hold each other's carry (ADR 0548 §3; issue 568, review round 1)
mesh/delivery merged: source.main moved to novox/mesh-sdk@89c5838176b2
mesh/delivery-group group feat/548-one-check merged: every member is merged
mesh/check checking 9c61918ac36f on 85fa8511c4b3 | novox/mesh-sdk#88 in group feat/548-one-check

This commit is contained in:
2026-10-26 12:12:53 +01:00
parent f5c233a928
commit 9c61918ac3
2 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -202,9 +202,9 @@ func TestGateValuesRoundTrip(t *testing.T) { // 1201/AC4
t.Errorf("the turn lacks %s: %s", field, data) t.Errorf("the turn lacks %s: %s", field, data)
} }
} }
// ADR 0548 §3: a turn holds off every check but the one of a waiting delivery's own heads. // ADR 0548 §3: a turn holds off every check but those of the heads that wait in it, whoever else waits there.
if !TurnHolds(tu, "fedcba987654") || TurnHolds(Turn{Waiting: tu.Waiting[:1]}, tu.Waiting[0].Heads) || !TurnHolds(tu, tu.Waiting[0].Heads) { if !TurnHolds(tu, "fedcba987654") || TurnHolds(tu, tu.Waiting[0].Heads) || TurnHolds(tu, tu.Waiting[1].Heads) || TurnHolds(Turn{}, "fedcba987654") {
t.Error("TurnHolds: a turn holds other heads' checks and never its only delivery's own") t.Error("TurnHolds: a turn holds other heads' checks and never the check of heads waiting in it")
} }
for name, dec := range map[string]func([]byte) error{ for name, dec := range map[string]func([]byte) error{
"turn": func(b []byte) error { _, err := DecodeTurn(b); return err }, "turn": func(b []byte) error { _, err := DecodeTurn(b); return err },
+9 -5
View File
@@ -117,15 +117,19 @@ func (t Turn) check() error {
return nil return nil
} }
// TurnHolds says whether a turn holds off the check of the heads: it names a delivery of other heads. The check of a waiting // TurnHolds says whether a turn holds off the check of the heads: it names deliveries, and none of them of these heads. A
// delivery's own heads (the carry its merge waits for) is never held by its own turn. // turn never holds the check of heads that wait in it (the carry a waiting merge needs): two approved merges in one turn whose
// trunk moved would otherwise each hold the other's carry, and neither would ever merge (review of ADR 0548's build, round 1).
func TurnHolds(t Turn, heads string) bool { func TurnHolds(t Turn, heads string) bool {
if len(t.Waiting) == 0 {
return false
}
for _, w := range t.Waiting { for _, w := range t.Waiting {
if w.Heads != heads { if w.Heads == heads {
return true return false
} }
} }
return false return true
} }
// EncodeTurn is t as JSON at Version; it refuses a turn with no delivery, a repository that is not lowercase <owner>/<name>, // EncodeTurn is t as JSON at Version; it refuses a turn with no delivery, a repository that is not lowercase <owner>/<name>,