From f37d2941415e12bc435265862e3fbdeec3206bd7 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 02:15:23 +0000 Subject: state: a strict policy written where none judges, refused before it leaves Every node refuses a change writing a strict policy where the policy isn't strict (`rules::turns_strict`), whatever the policy before. But a node judges its own changes before they leave (`judged_here`) only under a policy judging every change: in a swarm without one, a strict policy written through its API was taken there and refused by every other node, with everything the node built on it. A change that leaves a policy where there was none to judge it is judged as every node will judge it, too. A change in a swarm that has no policy after it is judged by none, as before. --- src/state/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/state') diff --git a/src/state/mod.rs b/src/state/mod.rs index f7c5266..822f214 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -263,8 +263,9 @@ pub(crate) struct CatchUpSource { /// The change just made in `replica` (the one head after `before`), judged by the /// swarm's rules as every node will judge it on receipt (`access::rules`), under a policy -/// judging every change: a write the API let through and the rules refuse would be -/// refused everywhere, with everything built on it. +/// judging every change, or one written where none did (which every node refuses where it +/// turns the swarm strict, `rules::turns_strict`): a write the API let through and the +/// rules refuse would be refused everywhere, with everything built on it. fn judged_here( replica: &crate::document::replica::Replica, before: &[crate::document::ChangeHash], @@ -273,7 +274,7 @@ fn judged_here( // changing the policy is judged too. let enforced = crate::document::at::At::new(&replica.doc, before) .is_some_and(|at| crate::access::policy::of(&at).enforced()); - if !enforced { + if !enforced && crate::access::policy::of(&replica.doc) == crate::access::policy::Policy::Open { return Ok(()); } let after = replica.doc.get_heads(); -- cgit v1.3.1