aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/changes.rs
Commit message (Collapse)AuthorAgeFilesLines
* changes: type next to a mark within the texttv4 days1-1/+1
| | | | | `no_mark` typed at 0 to 4 into a text of three characters: splicing at 4 is past its end. It types at 0 to 3.
* changes: an insert may follow a mark the document holdstv4 days1-5/+35
| | | | | | | | | | | Screening asked of every operation naming an element that the element was inserted as a value or an object, inserting or not. In a document that took a mark before marks were refused, a transaction typing right after it inserts after the mark's begin or end, and was refused: every node refused the change of the node that typed, and all it wrote after. An element is written at only where a value or an object was put; an insert may follow any element of that list, as transactions insert.
* changes: a test that generates changes and asks what passes to stay soundtv4 days1-0/+234
| | | | | | | | | | | | | | Twice, crafting changes by hand missed some that pass screening's checks and break Automerge; a program generating them found three more kinds. This test does the same: on documents three honest writers wrote at once (maps, a list, a text, a counter), changes of one to four operations of every kind, at random places, naming as replaced nothing, what is there, or any operation. Each that passes the checks is applied, given back by its hash, saved and loaded, taken by a peer that lacks it, written after by an honest node, and saved and loaded again; nothing of that may fail or panic. The run is seeded, the seed named where it fails, and CHANGES_GENERATED sets how many documents (60 by default) for a longer run.
* changes: no marktv4 days1-230/+81
| | | | | | | | | | | | | Screening took marks in a text, checking that a mark's end comes at its begin or after it, by walking the elements each is inserted after back to the text's head: up to 22 s for one change of 9 KB. And it took a value put at a mark's begin or end, replacing it: sound until an honest node edits that text, then the node panics at its next sync or append, and its save doesn't load. Continuum's store writes no marks. A change with a mark's begin or end is now refused, and the walk is gone. An element written at is one a value or an object was inserted as.
* changes: no tabletv4 days1-2/+61
| | | | | | | | | | Screening took a table for a map. A table made is sound, but Automerge panics applying a change that puts a value into one, made by that change or a later one, and applying isn't caught where it panics. Transactions make a table and can't write into it; continuum's store makes none. A change making a table is refused, and so is one writing into a table the document holds.
* changes: what an operation replaces put a value or made an objecttv4 days1-3/+99
| | | | | | | | | | | | | | Screening took as replaced any operation made at that object and key without inserting: a deletion, an increment, a mark. A transaction names only what holds a value there: a counter incremented and put over names its put alone, a key put again after its deletion names nothing. Automerge takes a value put again naming its deletion, at a map's key or a list's element, and then gives back another change under its hash: a save that doesn't load, a sync that fails. A deletion naming a deletion panics as it is given back. An increment naming a deletion does the same as a put. What an operation names as replaced now put a value or made an object.
* screen: take only the operations transactions writetv4 days1-85/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Screening asked what an operation isn't: a deletion replacing nothing, a value put at a list's head without inserting, a mark ended but right after its begin. Others pass that Automerge's transactions never write, and Automerge takes them and breaks: an element written over naming as replaced the element inserted after it (an inserted element's key is the element it follows, its place is itself), an insert replacing something, a deletion or an increment inserted, an increment at a list's head, a mark ended ahead of its begin or at the head, a mark in a list. Giving such a change back panics or gives another change under its hash, and the save doesn't load. Each operation is now asked to be one transactions write (`document::changes::unwritten`): inserted, a value, an object or a mark's begin or end into a list or a text, replacing nothing; at a list's element, never its head, without inserting, replacing what is at that element; at a map's key, never inserted, a deletion or an increment replacing something; a mark's begin with its end as the next operation, both inserted. A value replaced at a list's element is the element itself or written at it, not an element inserted after it. Marks are only in a text, and a mark's end is at its begin or at an element after the begin's: their places follow from the elements each is inserted after, back to the text's head, as the change's history holds them. The document the tests write now has counters in a list and a map, an element written over, and marks over a span, the whole text, none of it, and across what was deleted and inserted since; and each case above is a test.
* changes: test what transactions never write against a document ready for ittv4 days1-8/+13
| | | | | | | | | `what_transactions_never_write_is_refused` checked changes built on the insert against a document without the deletion the insert builds on. Such a change isn't ready, and nothing is asked of it: the honest insert passed for that reason, and the two crafted from it weren't refused. Each is checked now against a document that holds what it builds on.
* screen: refuse what Automerge's transactions never writetv4 days1-1/+75
| | | | | | | | | | | Automerge 0.12.0 takes some changes that name nothing wrong, and then can't give them back: a deletion that replaces nothing, a value put at a list's head without being inserted, a mark ended where no mark began right before it. Giving the change back panics, the save doesn't load, and a sync to a peer that lacks it panics: one member stops every node it reaches. Those are refused with the other checks (`changes::Written`).
* screen: a change refused after its checks stands in for nothingtv4 days1-24/+83
| | | | | | | | | | | | | | | | Screening checks that a change is one Automerge writes (`changes::Written`) before it looks for forks and judges the rules, and the checks recorded what a change made as soon as it passed them. A fork of a change the document holds has its actor and counters: if it was checked first in a batch, and refused as forged after, its record stood in for that change's operations, outside the history of the next. An honest change writing into what the real one made was then refused, for good. Anyone could make such a fork, its hash ground to sort first. What a change made is recorded once screening takes it (`Written::taken`), and an operation named is looked for in the batch and in the document, whichever the change's history holds.
* screen: what is asked of a change, asked of its own historytv4 days1-55/+439
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* screen: refuse changes Automerge wouldn't have writtentv5 days1-1/+253
| | | | | | | | | | | | | | | | | | | | | Automerge 0.12.0 applies a change that lists an actor none of its operations names, or whose first operation is numbered below its dependencies' or near 2^32. It then gives back another change than the one it was given and saves a document that doesn't load, or panics at the next write. A member sending one stops the nodes that take it. Every change from elsewhere is looked at before Automerge sees it (`document::changes::Written`, from `access::screen::apply`, with or without a policy), and refused like one breaking a rule unless: * encoded again, it has the hash it came with; * its first operation is numbered one after the highest of its dependencies, 1 without any, as a transaction at the document's heads numbers it; * every operation it names (an object, a list's element, an operation replaced) is its own, or was made before it, in the document or by a change of the batch looked at before.
* changes: Context where it is usedtv9 days1-1/+2
| | | | | | Since load_delta is for tests (1190), nothing else in changes.rs uses anyhow's Context, and builds without tests warned of an unused import. load_delta imports it itself.
* document: tell whether a document holds a change without building ittv9 days1-6/+41
| | | | | | | | | | | | | | | With the policy's reads kept, judging a change still costs about one read (some 3.5 µs), and so does judging without a policy: what is left is At::new, which asks get_change_by_hash for each head. Automerge builds the change again from the document's operations to answer, at a cost growing with its history. Screening asks it again for every candidate and every dependency, and sync for heads. Ask by the missing dependencies instead (changes::holds), which look the hash up: one the document holds is not among them. A change queued in the document, waiting for its dependencies, isn't either; but then some are missing, and only then is it asked the slow way. Every check of whether a document holds a change goes through it.
* screen: what a node receives judged, policy or nottv9 days1-1/+3
| | | | | | | | | | | | | | | | | | | | | Review 2, N7: a node screened received changes only while its own document had a policy it enforces. A joiner's empty document has none, so its first sync, as much history as the node it joins through chose, was applied unjudged, and under signatures required unvouched; the same for any node while the policy's own change arrived with later ones. Sync messages, deltas and downloaded changes are now always screened, each change judged by the policy at its dependencies (1135), so the verdicts are the swarm's. While neither the document nor the changes hold a policy (none touches a "policy" key: inspect::touch_key), only an epoch's root is judged and nothing is placed: bench_screening, after 1188, measured placing everything at about as much again as applying (564 ms + 543 ms for 100 000 changes), judging by the rules at about five times (+2.5 s), which a document with a policy pays anyway. access.md no longer lists the joiner's first sync, nor nodes agreeing only as the policy reaches them (judged at the dependencies, they agree), as left to do; changes::load_delta is for tests now.
* access: screening received changestv10 days1-0/+27
| | | | | | | | | access::screen: a batch of received changes judged change by change, those that change what rules read applied before the next is judged; a refused change stays out with whatever builds on it, kept aside for operators; changes missing dependencies wait. Auth plan M6.
* refuse misplaced authorstv10 days1-0/+167
|
* one walk sincetv12 days1-21/+40
|
* waiting not twicetv12 days1-0/+7
|
* announce only to those behindtv12 days1-0/+43
|
* covered neighbours have ittv13 days1-9/+16
|
* delta from held headstv13 days1-10/+11
|
* add tree teststv2026-11-031-0/+35
|
* writers from authorstv2026-11-031-0/+22
|
* use Automerge as Document instead of AutoCommittv2026-10-311-13/+12
| | | | This allows a lot of operations to drop mut.
* tests write through document::testing helperstv2026-10-311-6/+5
|
* move all automerge references to documenttv2026-10-311-1/+21
|
* move changes as bytes to documenttv2026-10-311-0/+158