From 0684d1ccdfa2f89a570f5599a411fbfa82b1830a Mon Sep 17 00:00:00 2001 From: Adrian Duke Date: Tue, 27 Jan 2026 16:27:34 +0000 Subject: [PATCH] cli: Changed the default scope from all to followed for clone and seed The previous implementation used 'all' as the default for scope, this could lead to surprising behaviour where a user would fetch all references for cloned and seeded repositories. Instead have a progressive, safe by default value - where it fetches only 'followed' references. Later a user can decide to set the scope to 'all'. NOTE: the default policy scope was not changed from 'all' and is intended to be changed at a later date. --- crates/radicle-cli/examples/rad-clone-connect.md | 2 +- crates/radicle-cli/examples/rad-clone-partial-fail.md | 3 ++- crates/radicle-cli/examples/rad-clone.md | 2 +- crates/radicle-cli/examples/rad-fetch.md | 2 +- crates/radicle-cli/examples/rad-id-threshold.md | 2 +- crates/radicle-cli/examples/rad-init-no-seed.md | 2 +- .../radicle-cli/examples/rad-init-private-clone-seed.md | 4 ++-- crates/radicle-cli/examples/rad-init-private-clone.md | 2 +- crates/radicle-cli/examples/rad-init-private-no-seed.md | 2 +- crates/radicle-cli/examples/rad-node.md | 2 +- crates/radicle-cli/examples/rad-patch-pull-update.md | 2 +- crates/radicle-cli/examples/rad-seed-many.md | 4 ++-- crates/radicle-cli/examples/rad-sync-without-node.md | 2 +- crates/radicle-cli/examples/rad-sync.md | 2 +- crates/radicle-cli/src/commands/clone/args.rs | 2 +- crates/radicle-cli/src/commands/seed/args.rs | 2 +- crates/radicle-cli/tests/commands.rs | 9 ++++++--- 17 files changed, 25 insertions(+), 21 deletions(-) diff --git a/crates/radicle-cli/examples/rad-clone-connect.md b/crates/radicle-cli/examples/rad-clone-connect.md index 169ede97..f6566a1b 100644 --- a/crates/radicle-cli/examples/rad-clone-connect.md +++ b/crates/radicle-cli/examples/rad-clone-connect.md @@ -3,7 +3,7 @@ automatically connect to the necessary seeds. ``` $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all' +✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. diff --git a/crates/radicle-cli/examples/rad-clone-partial-fail.md b/crates/radicle-cli/examples/rad-clone-partial-fail.md index d16cc040..56f6bed4 100644 --- a/crates/radicle-cli/examples/rad-clone-partial-fail.md +++ b/crates/radicle-cli/examples/rad-clone-partial-fail.md @@ -10,12 +10,13 @@ $ rad node routing │ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ``` + When she tries to clone, one of those will fail to fetch. But the clone command still returns successfully. ``` $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --timeout 3 -✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all' +✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 3 potential seed(s). ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. diff --git a/crates/radicle-cli/examples/rad-clone.md b/crates/radicle-cli/examples/rad-clone.md index 7eab6124..543d49ab 100644 --- a/crates/radicle-cli/examples/rad-clone.md +++ b/crates/radicle-cli/examples/rad-clone.md @@ -2,7 +2,7 @@ To create a local copy of a repository on the radicle network, we use the `clone` command, followed by the identifier or *RID* of the repository: ``` -$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --scope followed +$ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found [..] potential seed(s). ✓ Target met: [..] seed(s) diff --git a/crates/radicle-cli/examples/rad-fetch.md b/crates/radicle-cli/examples/rad-fetch.md index 43a35986..89a4dd78 100644 --- a/crates/radicle-cli/examples/rad-fetch.md +++ b/crates/radicle-cli/examples/rad-fetch.md @@ -10,7 +10,7 @@ have to update our seeding policy for the project. ``` $ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji --no-fetch -✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all' +✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' ``` Now that the project is seeding we can fetch it and we will have it in diff --git a/crates/radicle-cli/examples/rad-id-threshold.md b/crates/radicle-cli/examples/rad-id-threshold.md index 924a9005..06a6c85b 100644 --- a/crates/radicle-cli/examples/rad-id-threshold.md +++ b/crates/radicle-cli/examples/rad-id-threshold.md @@ -170,7 +170,7 @@ sync` and fetch his references: ``` ~bob $ rad clone rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all' +✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' Fetching rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji from the network, found 2 potential seed(s). ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. diff --git a/crates/radicle-cli/examples/rad-init-no-seed.md b/crates/radicle-cli/examples/rad-init-no-seed.md index 03176c77..8163f07d 100644 --- a/crates/radicle-cli/examples/rad-init-no-seed.md +++ b/crates/radicle-cli/examples/rad-init-no-seed.md @@ -21,7 +21,7 @@ If we then seed it, it becomes advertised in our inventory: ``` $ rad seed rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK ✓ Inventory updated with rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK -✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'all' +✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'followed' ``` ``` $ rad node inventory diff --git a/crates/radicle-cli/examples/rad-init-private-clone-seed.md b/crates/radicle-cli/examples/rad-init-private-clone-seed.md index 5c5685f9..7d92732e 100644 --- a/crates/radicle-cli/examples/rad-init-private-clone-seed.md +++ b/crates/radicle-cli/examples/rad-init-private-clone-seed.md @@ -30,7 +30,7 @@ $ rad inspect --identity ``` ~bob $ rad ls --all --private $ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1 -✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all' +✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed' Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✓ Target met: 1 preferred seed(s). ✓ Creating checkout in ./heartwood.. @@ -49,7 +49,7 @@ We can also use `rad seed` to seed and fetch without creating a checkout. ``` ~bob $ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --from z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1 -✓ Seeding policy exists for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all' +✓ Seeding policy exists for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed' Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ``` diff --git a/crates/radicle-cli/examples/rad-init-private-clone.md b/crates/radicle-cli/examples/rad-init-private-clone.md index 852538d9..bb0c0d77 100644 --- a/crates/radicle-cli/examples/rad-init-private-clone.md +++ b/crates/radicle-cli/examples/rad-init-private-clone.md @@ -6,7 +6,7 @@ $ rad ls ``` ``` ~bob (fail) $ rad clone rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu --seed z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi --timeout 1 -✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all' +✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed' Fetching rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu from the network, found 1 potential seed(s). ✗ Target not met: could not fetch from [z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi], and required 1 more seed(s) ! Warning: Failed to fetch from 1 seed(s). diff --git a/crates/radicle-cli/examples/rad-init-private-no-seed.md b/crates/radicle-cli/examples/rad-init-private-no-seed.md index 9b3bd246..2250e844 100644 --- a/crates/radicle-cli/examples/rad-init-private-no-seed.md +++ b/crates/radicle-cli/examples/rad-init-private-no-seed.md @@ -28,7 +28,7 @@ We can decide to seed it later, so that others can fetch it from us, given that they are part of the allow list: ``` $ rad seed rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu -✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'all' +✓ Seeding policy updated for rad:z2ug5mwNKZB8KGpBDRTrWHAMbvHCu with scope 'followed' ``` But it still won't show up in our inventory, since it's private: diff --git a/crates/radicle-cli/examples/rad-node.md b/crates/radicle-cli/examples/rad-node.md index 3be1ef59..c6d44d23 100644 --- a/crates/radicle-cli/examples/rad-node.md +++ b/crates/radicle-cli/examples/rad-node.md @@ -108,7 +108,7 @@ up in our inventory: ``` $ rad seed rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ✓ Inventory updated with rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'all' +✓ Seeding policy updated for rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji with scope 'followed' $ rad node inventory rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji ``` diff --git a/crates/radicle-cli/examples/rad-patch-pull-update.md b/crates/radicle-cli/examples/rad-patch-pull-update.md index fefcee86..e5f37ec2 100644 --- a/crates/radicle-cli/examples/rad-patch-pull-update.md +++ b/crates/radicle-cli/examples/rad-patch-pull-update.md @@ -22,7 +22,7 @@ To push changes, run `git push`. ``` ~bob $ rad clone rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK -✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'all' +✓ Seeding policy updated for rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK with scope 'followed' Fetching rad:zhbMU4DUXrzB8xT6qAJh6yZ7bFMK from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ✓ Creating checkout in ./heartwood.. diff --git a/crates/radicle-cli/examples/rad-seed-many.md b/crates/radicle-cli/examples/rad-seed-many.md index 4880b059..96e946e0 100644 --- a/crates/radicle-cli/examples/rad-seed-many.md +++ b/crates/radicle-cli/examples/rad-seed-many.md @@ -4,10 +4,10 @@ is used): ``` $ rad seed rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm -✓ Seeding policy updated for rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW with scope 'all' +✓ Seeding policy updated for rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW with scope 'followed' Fetching rad:z3Rry7rpdWuGpfjPYGzdJKQADsoNW from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) -✓ Seeding policy updated for rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm with scope 'all' +✓ Seeding policy updated for rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm with scope 'followed' Fetching rad:z3zTnCfi6cVSZG8eCGn6AMDypgAPm from the network, found 1 potential seed(s). ✓ Target met: 1 seed(s) ``` diff --git a/crates/radicle-cli/examples/rad-sync-without-node.md b/crates/radicle-cli/examples/rad-sync-without-node.md index e7ed8180..cb80789c 100644 --- a/crates/radicle-cli/examples/rad-sync-without-node.md +++ b/crates/radicle-cli/examples/rad-sync-without-node.md @@ -14,5 +14,5 @@ Note that seeding works fine without a running node: ``` ~alice $ rad seed rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 -✓ Seeding policy updated for rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 with scope 'all' +✓ Seeding policy updated for rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5 with scope 'followed' ``` diff --git a/crates/radicle-cli/examples/rad-sync.md b/crates/radicle-cli/examples/rad-sync.md index 43d86183..f90cd35d 100644 --- a/crates/radicle-cli/examples/rad-sync.md +++ b/crates/radicle-cli/examples/rad-sync.md @@ -107,7 +107,7 @@ It's also possible to receive an error if a repository is not found anywhere. ``` $ rad seed rad:z39mP9rQAaGmERfUMPULfPUi473tY --no-fetch -✓ Seeding policy updated for rad:z39mP9rQAaGmERfUMPULfPUi473tY with scope 'all' +✓ Seeding policy updated for rad:z39mP9rQAaGmERfUMPULfPUi473tY with scope 'followed' ``` ``` (fail) $ rad sync rad:z39mP9rQAaGmERfUMPULfPUi473tY diff --git a/crates/radicle-cli/src/commands/clone/args.rs b/crates/radicle-cli/src/commands/clone/args.rs index 0c763bfe..d45c8e2c 100644 --- a/crates/radicle-cli/src/commands/clone/args.rs +++ b/crates/radicle-cli/src/commands/clone/args.rs @@ -62,7 +62,7 @@ pub struct Args { /// Follow scope #[arg( long, - default_value_t = Scope::All, + default_value_t = Scope::Followed, value_parser = terminal::args::ScopeParser )] pub(super) scope: Scope, diff --git a/crates/radicle-cli/src/commands/seed/args.rs b/crates/radicle-cli/src/commands/seed/args.rs index e654d1c2..d5b331c7 100644 --- a/crates/radicle-cli/src/commands/seed/args.rs +++ b/crates/radicle-cli/src/commands/seed/args.rs @@ -49,7 +49,7 @@ pub struct Args { /// Peer follow scope for this repository #[arg( long, - default_value_t = Scope::All, + default_value_t = Scope::Followed, value_parser = terminal::args::ScopeParser )] pub(super) scope: Scope, diff --git a/crates/radicle-cli/tests/commands.rs b/crates/radicle-cli/tests/commands.rs index 0551fe9c..9af201ca 100644 --- a/crates/radicle-cli/tests/commands.rs +++ b/crates/radicle-cli/tests/commands.rs @@ -572,6 +572,7 @@ fn rad_id_multi_delegate() { alice.handle.seed(acme, Scope::All).unwrap(); bob.handle.follow(eve.id, None).unwrap(); + eve.handle.follow(bob.id, None).unwrap(); alice.connect(&bob).converge([&bob]); eve.connect(&alice).converge([&alice]); @@ -2060,17 +2061,19 @@ fn rad_remote() { .handle .follow(bob.id, Some(Alias::new("bob"))) .unwrap(); + alice + .handle + .follow(eve.id, Some(Alias::new("eve"))) + .unwrap(); bob.connect(&alice); bob.routes_to(&[(rid, alice.id)]); bob.fork(rid, bob.home.path()).unwrap(); - bob.announce(rid, 2, bob.home.path()).unwrap(); alice.has_remote_of(&rid, &bob.id); - eve.connect(&bob); + eve.connect(&alice); eve.routes_to(&[(rid, alice.id)]); eve.fork(rid, eve.home.path()).unwrap(); - eve.announce(rid, 2, eve.home.path()).unwrap(); alice.has_remote_of(&rid, &eve.id); test(