From 96a733e1ccbf6dab2d69f263d655e487ac54c20d Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 20 Nov 2026 01:28:41 +0000 Subject: federation: revision 2, the federation's name A version may give its federation a name (`name`, spelled as a party's), under a revision that has names: `federation-name`, revision 2. The first version's is in the root, so a rehearsal named otherwise is another federation, though its parties, keys, nodes and rules are the same; a later version changes the name as anything else, which changes what the federation is called, not which it is. A version giving a name under an earlier revision is none. What a version does says so, in words: it names the federation, renames it, or drops its name. Half the generated histories begin at the newest revision now, their versions naming the federation anew now and then; those of the revisions before are generated as they were. --- src/federation/client.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src/federation/client.rs') diff --git a/src/federation/client.rs b/src/federation/client.rs index ca2db86..74be7c8 100644 --- a/src/federation/client.rs +++ b/src/federation/client.rs @@ -433,8 +433,8 @@ pub(crate) fn backable(current: &Version, proposed: &Json) -> Result lines.push(format!("names the federation {name}")), + (Some(was), Some(name)) if was != name => { + lines.push(format!("renames the federation {was} -> {name}")); + } + (Some(was), None) => lines.push(format!("drops the federation's name, {was}")), + _ => {} + } lines } @@ -1411,6 +1419,27 @@ mod tests { "moves to revision 1 (merge-events)".to_owned(), ] ); + let mut named = Spec::first(&[&tv, &lass], &rules); + named.revision = Revision::newest(); + named.name = Some("krebs".to_owned()); + assert_eq!( + described(¤t, &read(&named)), + [ + format!("moves to {}", Revision::newest()), + "names the federation krebs".to_owned(), + ] + ); + let mut renamed = named.clone(); + renamed.name = Some("krebs-test".to_owned()); + assert_eq!( + described(&read(&named), &read(&renamed)), + ["renames the federation krebs -> krebs-test"] + ); + renamed.name = None; + assert_eq!( + described(&read(&named), &read(&renamed)), + ["drops the federation's name, krebs"] + ); } /// Each hash is named by its shortest prefix no other has, of four digits at least, and -- cgit v1.3.1