From b79ac0fb88ad6604a87d2e72010b6a9a1a4d6fd8 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Nov 2026 00:32:53 +0000 Subject: federation: the changes founding a swarm printed, to be fixed as vectors An ignored test prints, each by its hash and its bytes, the changes founding the swarm of the vectors' first version's root, and those founding the fork whose root is the fork vector's, keeping tv's write: Automerge encodes them, so no script apart computes them, and they are fixed once printed by a run of this code. --- src/federation/vectors.rs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/federation/vectors.rs') diff --git a/src/federation/vectors.rs b/src/federation/vectors.rs index a474677..10ce679 100644 --- a/src/federation/vectors.rs +++ b/src/federation/vectors.rs @@ -144,3 +144,44 @@ fn events_at_federation_1s_sizes_and_just_past_them() { let largest = Json::Int(super::jcs::LARGEST_INTEGER); assert!(Event::read(&tv.write(&[dep()], "home/tv/n", largest)).is_some()); } + +/// The changes founding the swarm of `first`'s root, and those founding the fork whose +/// root is `FORK_ROOT`, keeping tv's write: printed, each by its hash and its bytes, to be +/// fixed as vectors (`cargo test --features federation changes_to_fix -- --ignored +/// --nocapture`). Automerge encodes them, so no script apart computes them. +#[test] +#[ignore] +fn changes_to_fix() { + use super::fold::Federation; + use super::store::Fold; + let root = Checkpoint { + at: Vec::new(), + keeps: Vec::new(), + version: Version::read(&first().json()).expect("a version"), + } + .bytes(); + let founding = [ + ( + "root", + crate::document::events::founding(Federation::NAME, &root, &[]), + ), + ( + "fork", + crate::document::events::founding( + Federation::NAME, + FORK_ROOT.as_bytes(), + &[WRITE.as_bytes().to_vec()], + ), + ), + ]; + for (name, changes) in founding { + for change in changes { + let bytes: String = change + .raw_bytes() + .iter() + .map(|byte| format!("{byte:02x}")) + .collect(); + println!("{name} {} {bytes}", change.hash()); + } + } +} -- cgit v1.3.1