From b8c3c1a5adaa2a64fc17bd89a943ccf1ad386373 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Nov 2026 16:33:22 +0000 Subject: store: values ordered by seq only where the policy asks for signed values The order by `seq` sat in `store::candidates`, which every swarm reads through: in a swarm that isn't strict, a string shaped like an envelope, written at the same time as a plain value or a map, was read first. What a swarm without a strict policy reads must not change for signed values. The order now applies only where the policy asks for signed values (`"values": "signed"`), as any value at the policy's place says, read as written (`signs_values`), so the policy's own reading doesn't go round. Elsewhere `candidates` is newest first, as always. It is looked at only where a place holds several values and one is an envelope. --- docs/api.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/api.md b/docs/api.md index 41a4f4d..a839f74 100644 --- a/docs/api.md +++ b/docs/api.md @@ -164,8 +164,10 @@ way on every node: * **The same key**: one write wins, the same one everywhere. "Newest" means by Automerge's operation order (the write made after seeing more changes; between equals, by the writer's actor ID), not by any clock: of two truly concurrent writes, which wins - is arbitrary, but it is the same on every node. Values their users signed come first - (Signed values, below): of those, the one its user numbered highest (`seq`). + is arbitrary, but it is the same on every node. Where the swarm's policy asks for + signed values (Signed values, below), a string that is an envelope comes before + anything else written there at once, a map too: of those, the one its user numbered + highest (`seq`), of equal ones the one with the lower SHA-256. * **Maps written at the same key** merge into one: their keys are united, each key as above. * **A write and a delete** of the same key: the write stays (a delete removes only what -- cgit v1.3.1