diff options
| author | tv <tv@krebsco.de> | 2026-11-17 00:32:53 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 01:47:53 +0100 |
| commit | b79ac0fb88ad6604a87d2e72010b6a9a1a4d6fd8 (patch) | |
| tree | e0802102d213fe6e4b70f055abc5440f02ddb782 /src | |
| parent | 3727222b4ec92134a3597aab65619c3898316ea2 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/federation/vectors.rs | 41 |
1 files changed, 41 insertions, 0 deletions
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()); + } + } +} |
