Checking of agreement conditions occurs prior to constraint checks for a remote operation marked as an agreement.
⚠ Contents of the
state
provided may not always be suitable as an input for condition checking. See the AgreementCondition documentation.
a read-only view of data from the clone at the moment the agreement has been received
the agreement update, prior to application to the data
a rejection if the condition is violated (or fails)
Generated using TypeDoc. Delivered by Vercel. @m-ld/m-ld - v0.10.1-edge.4 Source code licensed MIT. Privacy policy
An agreement condition asserts a necessary precondition for an agreement.
Violation of an agreement condition indicates that the source of the operation is not behaving correctly according to the specification of the app; for example, it has been replaced by malware (with or without the user's knowledge). The condition check is therefore made for incoming remote agreement operations, not for a local write marked as an agreement – it is the responsibility of the app (and its constraints) to ensure that preconditions are met for a local write.
The consequence of a violation is that the operation is ignored, and also any further operations from the same remote clone. This causes a permanent divergence which can only be recovered by creating a new clone for the violating remote user/device.
It is therefore imperative that agreement conditions only consider inputs that are known to be consistent for all clones. Generally this does not include the local clone state, because clone state on receipt of an agreement operation may not be the same as the prior state at the originating clone, per normal m-ld behaviour. Examples of valid inputs include:
Clone state which is known not to have changed since the last agreement, for example if access controlled so that it cannot change without agreement.
External state known to have strong consistency, such as the content of a ledger or database. In this case it may be necessary for the operation to reference some immutable data such as specific block in a blockchain, or an append-only table row.
Update
clone status notification on receipt of a violating remote operation