From 60920a1dcd0b1e8279c019222a6257b5242d79a6 Mon Sep 17 00:00:00 2001 From: delchev Date: Wed, 2 Sep 2026 13:21:59 +0300 Subject: [PATCH] docs(glue): a roll-up's status is relinquished when its sum returns to zero Mirrors intent-specification proposal 0030. --- docs/spec/glue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/spec/glue.md b/docs/spec/glue.md index a2290ec..779e16a 100644 --- a/docs/spec/glue.md +++ b/docs/spec/glue.md @@ -436,7 +436,7 @@ rollups: status: Status, statusWhenFull: 7, statusWhenPartial: 6 } ``` -A count roll-up keeps a counter on a parent current on the child's create / delete. With `op: sum` the roll-up keeps `field` equal to the sum of the children's `of` field, can maintain a `balance` (= `capacity - sum`), and can flip a `status` relation to `statusWhenFull` / `statusWhenPartial`. Sum roll-ups **compose transitively** across a multi-level composition (a leaf edit updates the mid total, then the top total); recomputation stops when values stop changing. +A count roll-up keeps a counter on a parent current on the child's create / delete. With `op: sum` the roll-up keeps `field` equal to the sum of the children's `of` field, can maintain a `balance` (= `capacity - sum`), and can drive a `status` relation: `statusWhenFull` once the sum reaches the capacity, `statusWhenPartial` while it is positive but below it - and, when the sum returns to zero, back to the status the roll-up displaced. The first move into one of the roll-up's two statuses records the status the parent held until then; a sum back at zero restores it, so a document whose only allocation is deleted, amended to zero or moved to another parent returns to where the allocation found it - not to a declared constant, which is wrong for every document that entered from another status. Only a status the roll-up itself set is relinquished; a status set by hand (a void, a cancellation) is never touched. Sum roll-ups **compose transitively** across a multi-level composition (a leaf edit updates the mid total, then the top total); recomputation stops when values stop changing. Roll-ups are recompute-on-event (self-healing), so they are **eventually consistent, not transactionally exact** under heavy concurrency.