From 6cb4d3fd8f5024c340bd9321a434c8579cce81e7 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 13 Nov 2026 01:05:49 +0000 Subject: screen: what is asked of a change, asked of its own history A change is refused before Automerge sees it unless it is one Automerge writes (`document::changes::Written`). Three things about that, each of which let a crafted change through or parted nodes: * An operation a change names (the object written into, a list's element, an operation replaced) must be made in the change's own history, or before in the change itself, not anywhere in the document. Else a node that holds the operation takes the change and one that doesn't yet refuses it for good: nodes part by the order changes reach them. * And it must be what it is named as: an object of the kind written into, an element of that list, an operation at the place written. A change that replaces an operation elsewhere marks an unrelated value gone, and Automerge then gives back another change under its hash and saves a document that doesn't load; one that writes into an operation that made no object makes it panic. * A change that isn't its actor's first must have the one before it among its dependencies, as a transaction puts it there. A gap in an actor's numbers makes Automerge panic. What the document holds at the changes this one builds on is read there where it can be (a map's key, an object held by a map's key); else the operation's own change is decoded and the history walked back to it, no further than the operation's counter. So operations on a list's elements cost a walk each. Decoding a change can panic too (an operation naming an actor its change doesn't list): caught, and the change refused as one whose bytes aren't Automerge's. --- docs/access.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'docs/access.md') diff --git a/docs/access.md b/docs/access.md index 1b40ed2..1f9b1b4 100644 --- a/docs/access.md +++ b/docs/access.md @@ -310,10 +310,15 @@ node's actor is forged, refused, and logged as its sender's (`A peer brought cha forged`). A member can then no longer write as another member; the user a change names is still its node's word. Whatever the policy, and without one, a change is refused that Automerge itself -wouldn't have written: bytes that aren't Automerge's encoding of the change, a first -operation not numbered one after the highest of its dependencies, an operation that -names one nobody made before it (an object written into, a value replaced). Automerge -applies some of those, and then panics or saves a document that doesn't load. +wouldn't have written: bytes that aren't Automerge's encoding of the change; a first +operation not numbered one after the highest of its dependencies; a change that isn't +its actor's first and doesn't build on the one before; an operation naming one that +wasn't made in the change's own history, or that isn't what it is named as (the +object written into, the element of that list, a value replaced at that place). +Automerge applies some of those, and then panics, saves a document that doesn't +load, or holds another change than the one it was given. All of it is asked of the +change and its history alone, so two nodes that hold a change's history come to the +same, whatever else they hold. In a swarm without a registry, whatever a user would need, any member may. A refused change stays out, and so does whatever builds on it; the node logs it (`Refused a -- cgit v1.3.1