From 1293142cc6d1dd97e0aaf4c558254406e68d4219 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Nov 2026 03:47:18 +0000 Subject: holding: the tests' other nodes write under writers of their own A writer's changes are its first change's author's, so a node writing in a test after another under the same writer wrote as that one: a decision by another than the coordinator was taken as the coordinator's. Another node now writes under a fresh writer. The proposal written again differs, as one written the same makes no change. --- src/access/holding.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/access/holding.rs b/src/access/holding.rs index 4bef52a..798ba46 100644 --- a/src/access/holding.rs +++ b/src/access/holding.rs @@ -265,6 +265,14 @@ mod tests { node: &str, f: impl FnOnce(&mut Transaction<'_>) -> Result<(), StoreError>, ) -> Result<(), String> { + // Another node writes under a writer of its own: a writer's changes are its + // first's author's. + if doc + .get_author() + .is_some_and(|author| author.as_bytes() != node.as_bytes()) + { + doc.set_actor(crate::document::ActorId::random()); + } let before = doc.get_heads(); transact(doc, UnixMillis(1), &Writer { node, user: None }, f).unwrap(); let after = doc.get_heads(); @@ -501,7 +509,16 @@ mod tests { propose(&mut doc, "node-a", "r", "compact", "node-a"), Ok(()) ); - assert!(propose(&mut doc, "node-a", "r", "compact", "node-a").is_err()); + assert!( + judged(&mut doc, "node-a", |doc| { + store::write_path( + doc, + &meta::path(&[meta::REMAKES, "r", "proposal"]), + &json!({"coordinator": "node-a", "kind": "compact", "quorum": 2}), + ) + }) + .is_err() + ); assert!(propose(&mut doc, "node-a", "s", "replace", "node-a").is_err()); assert!(propose(&mut doc, "node-a", "s", "compact", "node-b").is_err()); assert_eq!(decide(&mut doc, "node-a", "r"), Ok(())); -- cgit v1.3.1