aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
Commit message (Collapse)AuthorAgeFilesLines
* screen: what is at the policy's place found in every map on the waytv34 hours1-0/+23
| | | | | | | | | | | | | | | | A node judges what it receives once anything is at the policy's place (`Screening::policed`), as a read shows it. But a read shows the newest of the values written at once at a key, merging maps only where that one is a map: a string written at `_continuum/access` beside the map holding the policy, and newer, hides it. So the policy's place read as empty, a change putting `"signed"` into the hidden policy went unjudged where it came alone, and deleting the string left a strict policy no change was refused for. Whether anything is at the policy's place is asked of every map of each key on the way to it, read or not (`store::held_anywhere`), as `store::by_seq` walks them. A swarm with nothing there is screened as before.
* store: the policy's reading unmarked however it endstv45 hours1-3/+9
| | | | | | | `signs_values` marks, for its thread, that the policy is being read, so that the reading doesn't ask itself again; a panic within it left the mark, and that thread read every strict place by Automerge's order from then on. The mark is now taken off when the reading returns or unwinds.
* policy: read only as continuum writes ittv45 hours1-1/+10
| | | | | | | | | | | | | | | | | | | A swarm turns strict only at its start or through a strict remake, and a change writing a strict policy where the policy isn't strict is refused, found by its operations: `"signed"` put at the policy's `values`, or an envelope asking for it put at its place. But the policy was read in plain JSON, where an Automerge text reads as a string, and writing a text is no such operation: `{"$text": "signed"}` at `values`, through the typed API, turned a swarm strict that nothing refused, with a time before it nothing closes. The policy is read in typed JSON now (`store::read_plain_as`): what continuum writes there reads as it is, plain JSON or an envelope, and a text, a counter or bytes as itself, tagged; a setting that isn't a string makes a policy no node knows (`policy::read`), as a version it doesn't know does. So no text turns a swarm strict, and the operations `rules::turns_strict` asks of are the only ways to. A policy holding none of these reads as before.
* rules: a swarm turns strict only at its start or through a strict remaketv47 hours2-90/+0
| | | | | | | | | | | | | | | | | | | | | | A strict policy written into a running swarm left a time before it: changes written there, beside the turn, were refused by the nodes that took the turn first and taken by the others where they came first (a signed policy that isn't strict, among them, unseated the turn there); and a remake whose base preceded the turn had every switching node replay the turn as one of its own, each refusing the others'. A change writing a strict policy where the policy at its history isn't strict (`"signed"` at its `values`, or an envelope there asking for signed values) is now refused, in every swarm. A swarm turns strict at its start (`--bootstrap-policy`) or through a strict remake, each its epoch's first change: no change of a strict epoch is from before its policy, and the rule for the time before goes, with the walk that found the changes that turned a swarm strict and what kept them (`before_strict`, `turned_strict`, `Reads::strict_now`, `Reads::turned_now`, `store::writers`, `store::made`, `changes::in_history`). The strict swarm's simulation starts strict. access.md says so, and that a strict swarm can't move to a policy its nodes don't know by writing it.
* store: one reading of the policy's placetv2 days1-48/+75
| | | | | | | | | | | | | | | | Whether values are ordered by `seq` (`signs_values`) read the policy's place itself, the first value alone and a map by Automerge's choice of each field, while the policy as judged (`policy::of`) read it through the store, which orders by `seq` only where `signs_values` says so, and merges every map there. They parted: a signed policy that isn't strict beside a newer plain one that is read as not strict for the one and strict for the other, and two maps, the newer without the field asking for signed values, the other way round. `signs_values` now asks `policy::of`, and the store orders the policy's own place by `seq` wherever any value there asks for signed values, and what is within the policy as written, so the two are one reading. Asked from within that reading, it answers false rather than ask again.
* rules: the changes that turned a swarm strict found once for its headstv2 days1-14/+38
| | | | | | | | | | | | Every change judged under a policy that isn't strict, in a strict document, walked back to the changes that turned it strict, each step reading every change the document holds. Only changes from the time before reach it in an honest swarm, but a member can send crafted ones at an old history, each costing every node a walk. The changes are now read once per walk (`store::made`), and what the walk finds is kept for the document's heads (`Reads::turned_now`), as whether its policy is strict is.
* store: values ordered by seq as the policy a read shows saystv2 days1-20/+77
| | | | | | | | | | | | | | | Whether values are read by `seq` went by whether any value at the policy's place asks for signed values, not by what the policy reads as. Where the place holds two, they part: a signed policy that isn't strict read before a plain one that is, or two maps, the newer not strict. Such a swarm judged as not strict and read by `seq`. Now the policy's own place is read by `seq` where any value there asks for signed values, so an older policy put back beside a strict one can't undo it; every other place is read by `seq` only where the policy that read shows is strict (`policy::read`, which `policy::of` reads with). A swarm whose policy doesn't read as strict reads every place as Automerge has it.
* rules: the time before strict is the change that turned it, written again or nottv2 days2-18/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | A change written under a policy that isn't strict was refused, in a strict document, unless it was in the history of the change that wrote the policy value the document read now. So the policy written again by a node that held a change from before, taken beside the strict policy, put that change in the new writer's history: that node kept it, every other node refused it, and the new policy with it, and the node was cut off. Now the reference is the change that turned the swarm strict: one that wrote a strict policy where the policy at its history wasn't, found by following back the writes of what the policy holds (`store::writers`). A change written under a policy that isn't strict is refused where such a change is beside it, neither in its history nor built on it. A policy written again, strict over strict, names the same change. One turning the swarm strict beside it is refused like any other. Of two at once neither is preferred: any rule choosing one, the lower hash say, would let a change made later to look as old take the place of the one every node took, and every node would drop it with all that was built on it. So two members turning a swarm strict at once split the nodes that took one from those that took the other; access.md says to turn it from one.
* store: a signed value chosen by seq is named sotv2 days1-5/+13
| | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but conflict reports still called the choice `newestWins`, and the code and the architecture still said "newest" of what a read shows. A report names it `highestSeq`; the rest says "the one a read shows".
* rules: nothing added to the time before a swarm turned stricttv2 days1-0/+21
| | | | | | | | | | | | | | | | | | | A swarm turned strict by writing the policy into it kept the time before open: a change whose history lacks the policy's change is judged by the policy then, none or one that isn't strict, needs no signature there, and is taken whenever it comes, from any member. With values read by `seq`, an envelope planted at that time with the highest `seq` there is can never be followed: a ban, a user, a declaration, for good. Once a document's policy is strict, a change written under one that isn't is refused, received or held, unless it is in the history of the change that wrote the policy the document reads (`store::written_by`). A node that holds one beside that change, taken before it came, is told so by any peer that refused it (REFUSALS), judges it again, now refuses it too, and drops it with what builds on it, as for any change it took unjudged. A swarm strict from its genesis change has no such time; one whose policy isn't strict judges as before.
* store: counters and the API's placement go by what a read showstv2 days2-6/+52
| | | | | | | | | | Where the policy asks for signed values, a place's value is chosen by `seq`, but two readers still took Automerge's own choice: an increment found the counter beside an envelope a read showed (answering the counter), and `inspect::placed`, which the API's checks go by, walked through whatever Automerge chose. Both now take the value a read shows (`store::shown`). A list's items keep Automerge's choice, as before: no signed value is one, and reading a list whole goes by it.
* store: values ordered by seq only where the policy asks for signed valuestv2 days1-13/+92
| | | | | | | | | | | | | | 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.
* signed values: one reading of an envelope, everywheretv2 days3-25/+189
| | | | | | | | | | | | | | | | Three parts read an envelope three ways: the store's order took any string with the prefix whose meta held a `seq`, its reads any whose value decoded, the checks only one with four parts and a meta of exactly its fields. A string that the first two took and the checks refused was read first, read as the registry's or the policy's value, and treated as nothing by the check of the next write there. `document::signed` reads an envelope the one way: four parts, the value JSON, the meta exactly its six fields (one more, or one twice, and it isn't one), no newline in either, the signature decoding. The store's order, its plain reads, the checks, the API and the users API all go by it. What isn't one in every respect is a plain string, wherever it is read.
* signed values: value and meta apart, numbered; the highest seq is readtv2 days1-15/+94
| | | | | | | | | | | | | | | | | | | | | | | | | A member could put a user's older signed value back beside a newer one: a change made with dependencies from before both is judged where the place was empty, so the older envelope (`prev` empty) is taken; and of values written at once, the one read was the one with the highest operation, which whoever writes the change steers. A revoked capability, a lifted ban or an earlier policy came back that way, signed by whoever signed it then. An envelope is now `cv2.<value>.<meta>.<signature>`: the value as its user wrote it, and apart from it what continuum adds (swarm, path, user, at, seq, prev), the signature over the value's line and the meta's. `seq` is one more than that of the envelope it replaces, 0 where it replaces none; every node checks it with `prev`. Of the values a place holds, written at once, signed ones are read before any other, the highest `seq` first, of equal ones the lower digest (`store::candidates`): reads, snapshots and writes all go by it. An older envelope beside a newer one changes nothing. `application/continuum-signed` is the value's line, the meta's, then the signature; `scripts/continuum-signed` writes and checks it so. The wire version goes up: nodes must agree on what a place's value is.
* 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 writetv5 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 ittv5 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 writetv5 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 nothingtv5 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: a twin of this node's actor switches it only signed with its keytv5 days1-0/+11
| | | | | | | | | | | | | A node switched to a fresh actor whenever a peer showed it a change of its own actor that it didn't hold, signed or not. So any peer made a node start a writer at will, by sending a copy of its last change with another value: and every writer costs every node memory in proportion to the document's history. Copies of a node's data directory hold its key, and sign their changes with it; a stranger can't. A twin switches the node only where a signature by the node's own key of it is kept or waiting. Unsigned, it is refused as forged as before, and nothing switches.
* screen: what is asked of a change, asked of its own historytv5 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 days2-1/+317
| | | | | | | | | | | | | | | | | | | | | 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.
* document file: format version 3tv6 days1-5/+15
| | | | | | | | | | The document file's first line names its format; each record's first byte its kind. A version that doesn't know a kind refuses the file, as it does a format it doesn't know. With the Closed and Opened records, the format is continuum-document/3, so a version knowing only 2 refuses a file it can't read by its first line. Files of 2 are read as of 3: the same records, Closed and Opened where a version knowing them wrote them.
* document file: say which versions read a file, and the Opened recordtv6 days1-4/+5
| | | | | | | | | | | The document file's format names itself in its first line (continuum-document/2) and each record's kind in its first byte. A record of a kind the reading version doesn't know makes the file unusable: the node doesn't start on it unless told to move it aside (--force badDocumentFile). lifecycle.md says so: a file one version wrote is read only by versions knowing every kind of record in it. The format's comment names the Opened record a node appends as it starts on the file, which undoes the clean stop's mark.
* screen: refuse a change at a seq this node made under its own actortv6 days1-2/+6
| | | | | | | | | | | | | | | | | A node receiving a change of the actor it writes as, one it doesn't hold, writes on as a fresh actor (another node writes as it, from a copy of its files). Where the other node made it at a seq this node made a change at too, the change was taken to Automerge, which refuses the whole batch (duplicate seq): the message failed, and with it everything else it carried. Signatures::forks found it forged only where a signature verified a change of the actor at that seq, and this node signs its own latest change only as it sends it. forks now also finds a change forged where its actor is the one the document writes as and the document's latest change of it (get_last_local_change) is at its seq or later. apply_bytes switches to the fresh actor after judging the batch, not before, so the check still sees the actor; also where judging fails.
* signatures: keep a few different signatures of a change waiting for ittv6 days1-34/+101
| | | | | | | | | | | | | | | | | | | A received signature of a change the document doesn't hold yet waits for it (Pending), checked once the change comes. A delta's signatures come before its changes, so they wait for the whole download. Kept one per change, the last that came, a member could send a signature that doesn't verify for a change it knows is on its way and put the honest one aside: the writer then went unvouched for until its changes came again with their signatures. Pending now keeps up to three different signatures of a change (CANDIDATES): the first that came, and the latest others. Ed25519 signatures are deterministic, so every honest copy is the same bytes and counts once: one sent first stays, one sent after stays unless more others follow it. Once the change comes, offer and vouch_batch check them in turn, the first that came first, up to the first valid one, within the bound on invalid signatures (MAX_INVALID). MAX_PENDING counts signatures, not changes.
* signatures: look for arrived changes only where the document grewtv6 days1-9/+18
| | | | | | | | | | | Received signatures of changes the document doesn't hold yet wait for them, up to 65536 (MAX_PENDING). Each Signatures::offer, one per received sync message, looked up every waiting one's change to find those that came meanwhile. The pending signatures now remember the document's heads at the last look (Pending::scanned, Pending::arrived): while they stand, the document holds nothing more, as it only grows, and offer looks up none.
* signatures: check a bounded number of invalid received signaturestv6 days1-17/+90
| | | | | | | | | | | | | | | A sync message carries up to 65536 signatures (MAX_PER_MESSAGE), and the receiver checks, under the document's write lock, each one of a held change that would vouch for more of its actor's changes than the one before: about 30 µs each. A member sending that many signatures that don't verify cost the receiver about two seconds of writes per message. Signatures::offer and vouch_batch now stop checking after 64 found invalid (MAX_INVALID) and drop the rest unchecked, with a warning. A node forwards only signatures it verified, so an honest peer sends none. offer counts those a message brings apart from those that waited for their changes, which came from any peer. Signatures::vouch says which it found (Vouched): more vouched for, nothing more, or invalid.
* document file: undo the clean stop's mark before deciding the actortv6 days1-7/+13
| | | | | | | | | | | | | | At start, a node on a document file appends an Opened record before it writes anything, so that a Closed record before it no longer says the file holds every change of the actor it names. It does so now before deciding which actor to write as, and DocumentFile::open says whether it could: where the append fails (the disk full, permissions), the file still ends with Closed, and later appends likely fail too. A crash, or a clean stop whose last append failed (close then sees the file behind and writes no mark), would leave that Closed standing for a run the file never got. So with --keep-actor, the node writes on as the actor of before only where the file was marked as opened; else it writes as a fresh actor and warns.
* stats: the writers of the documenttv8 days1-0/+10
| | | | | | | | | | | How many writers (Automerge actors) the document's changes have matters: a writer is a node's run (each start, rejoin or drop makes one, a start keeping the one of before with `--keep-actor` after a clean stop), and every transfer of the whole history carries a signature for each. `/admin/stats` now says it (`document.writers`, and `document_writers` for Prometheus), counted from the changes' metadata alongside the saved size's measurement in the background (at least a minute apart), as that takes time proportional to the document too; an export, which measures the size alone, keeps the count of before. The dashboard's figures show it with the rest.
* document file: a clean stop marked, and `--keep-actor` writes on as the same ↵tv8 days1-8/+86
| | | | | | | | | | | | | | | | | | | | | | actor A node writes as a fresh Automerge actor at each start, so no change number of an actor comes twice: one sent before a crash but not yet appended to the document file would otherwise be made again, differently. An epoch thus gathers a writer per start, and every transfer of its history carries a signature per writer. The document file now says when it holds everything the node wrote: * at a clean stop, after the last append, an empty `Closed` record, only where the file is up to the document's heads (ready, not rejoining); * as a node starts on the file, before anything is written, an empty `Opened` record, so a crash from then on leaves a file without the mark; * the header names the actor the node writes with (`current`). With `--keep-actor` (off by default; needs `--document-file`), a node starting on a file that ends with `Closed` writes on as that actor. A crash, a drop, a switch or a rejoin still starts a fresh one, so an epoch's writers come to one per node plus one per such event. lifecycle.md says so.
* docs: what is postponed or rejected stays in its own two filestv8 days1-2/+2
| | | | | | | | | Docs and comments outside future-work.md and review-rejections.md say what the code does, and point nowhere else for what it doesn't: the architecture page's map, the transports' forwarders, keys with `/`, a strict swarm's registry, trust.md's "Not yet" (now saying what isn't protected, in a sentence), the topology bench, and the comments of the change benchmarks, capabilities' grantor, tokens, dissemination, refusals and topology.
* signatures: a transfer carries one signature per writer in ittv8 days1-40/+97
| | | | | | | | | | | | | | | | | | | | | | Under a policy requiring signatures, a node takes a change only once a signature vouches for it: one of the change itself, or of a later change of the same writer. A writer is a node's run, each start, rejoin or drop making a fresh actor, so an epoch gathers writers for as long as it lasts, and a transfer of its whole history (a joiner pulling the document, a delta) must carry a signature for each of them, or the joiner waits for the rest for good. A message's signatures are now chosen by what it carries: * changes, up to 256 signed among them: each one's signature; * more (a whole document pulled): each writer's latest signed change among them, found by the document's change metadata (`Signatures::for_changes`), vouching for the rest; * a delta: each writer with changes in it (`get_changes_meta(from)`), its latest verified signature (`for_delta`). A message carries up to 65536 (6 MiB), and as many wait at the receiver for their changes (a delta's come after it). So a transfer leaves writers unvouched only in an epoch with more than 65536 runs writing since it began; a remake starts the count again. Wire version 48.
* signatures: a listed signed path takes `*`, as everything else doestv8 days1-3/+16
| | | | | | | | | | Review 4, appendix: whether a write is signed because `_continuum/access/signed` lists its path compared the listed paths by prefix (`signatures::related`), so a `*` there was a literal key, while api.md says the list holds paths as capabilities name them, which take `*` since 1259, and signed values already read the same list as patterns (`envelope::reaches_signed`). A listed `metrics/*/alerts` signed nothing. It compares by `access::agree` now: within or above the pattern, `*` for any one key.
* signatures: up to 4096 in a message, each actor's latest past themtv8 days1-2/+5
| | | | | | | | | | | | | | | | Review 4, F5: a delta, and a message whose changes held more than 256 signatures (a whole document pulled, of any real history), carried each actor's latest signature, the 256 that became latest last. An actor is a node's run, so past 256 runs writing in an epoch, some actors' changes arrived unvouched at the puller under a policy requiring signatures, waited, and every resend carried the same 256: a joiner never finished. A message now carries up to 4096 signatures (`MAX_PER_MESSAGE`, as many as wait for their changes, `MAX_PENDING`: 384 KiB at most), all of its changes' up to there, each actor's latest past it and for a delta, and a receiver takes as many (wire version 47). An epoch with more than 4096 runs writing would still leave some unvouched in such a transfer, which the constant says; sending each actor of the transfer its own latest would need the actors of a delta's changes, which only rebuilding their metadata gives.
* signatures: the latest unsigned change of each own actor signed, at start ↵tv8 days1-36/+46
| | | | | | | | | | | | | | | | | | | | | and after a swap Review 4, F2 (the honest case) and claim 2: a node signed at start its own changes at the heads that nothing vouched for (1216), and after a swap only its current actor's latest. An own change left unsigned can sit below the heads: a drop (`drop_taken`) takes away a signed change and keeps an earlier unsigned one, and the node writes on under a fresh actor, building on it; or a node's change is built on by another's concurrently with the signed one the drop took. Nothing signed it again, and under a policy requiring signatures every node pulling it (a joiner) waited for good, and for everything built on it. Now the latest change of each of the node's actors (`RemakeState::own_actors`, the current one among them) that no signature vouches for is signed (`Signatures::sign_own_actors`), at start and whenever the document is swapped (a drop, a switch, a rejoin), the old `sign_own_heads` and `sign_own_latest` going. One signature per actor vouches for all its changes before it. The case of a member whose signed change the rules refuse, vouching once for its earlier ones, is postponed (future-work.md, next).
* access: ending a single sessiontv8 days1-0/+3
| | | | | | | | | | | | | | | | | | | | Logging out of the dashboard (`DELETE /auth/session`) only cleared the cookie: the session's tokens stayed taken until they expired, by every node. Ending them took `POST /auth/logout`, which ends all of a user's sessions. Now `DELETE /auth/session` ends the session of the token it comes with (the cookie, or a bearer token): where the swarm has a registry, it is recorded as `_continuum/sessions/<user>/<session>` (`registry::session_path`), its value until when the session would have lasted, and every node refuses the session's tokens once the change reaches it (`token::Refused::Ended`): the page's own, its narrow tokens, and one handed to another member's dashboard, all refreshed from it and keeping its ID. The rules take the entry from the user itself or one who manages users, as a logout. A remake's snapshot leaves out entries past that time, a user's map where none is left: their tokens are expired anyway. Without a registry the document can't record it: the node ending it refuses the session's tokens itself (`AppState::ended_sessions`, until it restarts), others take them until they expire, as a logout there is refused.
* access: what a node holds alone by `_continuum/local/<node ID>/<name>`tv9 days1-0/+4
| | | | | | | | | | | | | | | | Setting a node's log filter took `write` on `_continuum`, all of the protocol data: whoever could change one node's logging could change the swarm's members, remakes and users too. Now what a node holds alone has paths of its own for capabilities, under `_continuum/local/<node ID>/`: `log` (`/admin/log`), `config` (`/admin/config`) and `debug` (`/debug`, always `write`), `read` to look and `write` to act (`api::access::needed`, which takes the node's ID). So `_continuum/local/<node ID>` is everything on one node, `_continuum/local/*/log` the log filter on every node, and holders of `_continuum` keep it all. Nothing is stored there: the store refuses writes under `_continuum/local`, and the rules refuse a change touching it, as for epoch metadata. The quarantine stays with `_continuum`: its entries are everyone's writes, which a node-local capability mustn't show.
* 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.
* sync: a message carries the signatures of its changestv9 days2-25/+42
| | | | | | | | | | | | | | | A sync message carried the signatures its peer wasn't sent yet, by a cursor per peer. Changes sent again, as after a message taken as delivered and lost on the way, went without them: the peer was past them. Under a policy requiring signatures they waited until the writer's next signed change, or the next session. A message now carries the signatures of the changes it carries (Signatures::for_changes), whatever the peer was sent before: changes sent again arrive vouched for as the first time. Past 256 (a message carrying the batches of many writers), each writer's latest instead, as a delta carries. The cursor goes, and with it resetting it after a failed send or a new session.
* sync: a test exchanging until level, not one answertv9 days1-0/+17
| | | | | | | | | delivered_messages_are_answered_with_changes_we_lack failed now and then: after the answer, the node still lacked the peer's change. Automerge's sync tells what each side has by a Bloom filter, whose false positives take more rounds. The test now exchanges up to four rounds more, each asking for what is still missing, until both are level.
* sync: signatures go with changes onlytv9 days1-0/+7
| | | | | | | | | | | A sync message took the signatures its peer wasn't sent yet whenever it had a body, an Automerge message saying only what we have included. A signature belongs with the changes it vouches for: they go along the trees, and a peer that got them elsewhere got the signatures with them. Signatures now go in a message that carries changes (pushed, offered as a delta, or in an Automerge message carrying some: SyncSession:: carrying), and in no other.
* signatures: sign what is senttv9 days1-40/+24
| | | | | | | | | | | | | | | | | | | A node signed its changes no rule signs a while after them (--sign-every 1s): the change left at once, unsigned, and its signature followed on its own a second later, to every neighbour, over every link. A few writes made a cascade of SIGNATURES. Under a policy requiring signatures it signed every change as it was made instead. A node now signs its latest change, if no signature vouches for it, as a sync message takes it (--sign-every sent, the default): the signature leaves in the same message, and goes where the change goes. One signature per message, however many changes it carries, each vouching for those before it: a slow writer's every change is signed, a fast writer's batches are, at no threshold to pick. A policy requiring signatures signs what is sent too, even with `none`. `all` still signs every change as it is made; changes to protocol data, listed paths and ?signed=true writes are signed as they are made, as before. The interval, and the task signing on it, go.
* signatures: a node signs at start what it kept unsigned when it stoppedtv9 days1-0/+49
| | | | | | | | | | | | | | A node commits a change, keeps it in its document file, and may stop before any signature vouches for it. It starts again under a new actor and only ever signed its current actor's latest change: the old one stays unsigned for good. Peers pulling it then wait for a signature under a policy requiring them, and so does everything the node writes after, building on it. Signing every change at commit hid this under such a policy; signing what is sent, next, won't. At start, before anything leaves, a node signs each of its own changes at the document's heads that no signature vouches for: nothing it made since builds on them, so they are heads.
* screen: judged after the policy is gone, tootv9 days1-0/+1
| | | | | | | | | | | | | | Review 3, R4: whether a batch was judged followed the receiving document's policy now (and whether the batch writes one). After the policy was removed, or replaced by a version the node doesn't know, changes written under it and received late went in unjudged, while nodes that had them earlier judged them; REFUSALS gave up likewise. Screening now remembers that the document held a policy, known or not (Screening::policed), and judges what it receives while it does, each change by the policy at its dependencies; REFUSALS judges then too (not under a policy the node doesn't know, as before). Not across a restart, which access.md says.