From 3fc73a0b8937cbc816aad2034a6a23fa5840ff52 Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Mon, 11 May 2026 14:06:19 +0200 Subject: [PATCH] Fix contributor filter in list_repos & repo_count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - the previous list_repos / repo_count predicates only matched SignedRefsInfo::Some, so a forked repo whose sigrefs predate the current FeatureLevel (NeedsMigration) was hidden from the contributor view and undercounted - add is_contributor helper so the two call sites can't drift again (they already had — list_repos was inverted from repo_count after the 0.22 sigrefs refactor) See discussion for more info https://radicle.zulipchat.com/#narrow/channel/369277-heartwood/topic/.60SignedRefsInfo.3A.3ANeedsMigration.60.20and.20local.20signed.20refs/with/594265582 --- crates/radicle-types/src/traits/repo.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/radicle-types/src/traits/repo.rs b/crates/radicle-types/src/traits/repo.rs index cbc4c7035..e91d6c66d 100644 --- a/crates/radicle-types/src/traits/repo.rs +++ b/crates/radicle-types/src/traits/repo.rs @@ -32,6 +32,16 @@ pub enum Show { Private, } +/// A repo counts as one the local node contributes to whenever it has +/// local signed refs, even if those refs are at an outdated feature +/// level pending node-side migration. +fn is_contributor(refs: &storage::SignedRefsInfo) -> bool { + matches!( + refs, + storage::SignedRefsInfo::Some(_) | storage::SignedRefsInfo::NeedsMigration, + ) +} + pub trait Repo: Profile { fn list_repos(&self, show: Show) -> Result, Error> { let profile = self.profile(); @@ -41,9 +51,7 @@ pub trait Repo: Profile { let mut entries = Vec::new(); for RepositoryInfo { rid, doc, refs, .. } in repos { - if matches!(refs, radicle::storage::SignedRefsInfo::Some(_)) - && show == Show::Contributor - { + if !is_contributor(&refs) && show == Show::Contributor { continue; } @@ -126,7 +134,7 @@ pub trait Repo: Profile { delegate += 1; } - if matches!(refs, radicle::storage::SignedRefsInfo::Some(_)) { + if is_contributor(&refs) { contributor += 1; } }