From 76a5e7b46dbe90ebf5e31904cb510e6cab242cf4 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 26 Feb 2026 21:13:29 +0000 Subject: feat: track and display kind-5 deletion count in FetchReport Add a deletions counter to FetchReport, incremented in process_fetched_events for each kind-5 event received and accumulated across relays in consolidate_fetch_reports. The count is included in the fetch summary display (e.g. "1 deletion", "2 deletions"). --- CHANGELOG.md | 1 + src/lib/client.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5b583..5f88b1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - git server push option passthrough, enabling `-o secret-scanning.skip` for grasp servers - `ngit sync` now publishes the current state event to grasp server relays that are missing it or have a stale version before attempting git pushes, preventing rejections; per-relay state visibility is captured during the nostr fetch and surfaced via `FetchReport::state_per_relay` - Fetch filters now request kind-5 deletion events for cached state and repo announcement events by `#e` tag (NIP-09), in addition to the existing `#a`-tagged filter; ensures deletions of these events are received even from clients that do not embed a repo coordinate in their deletion event +- `FetchReport` now tracks and displays a count of kind-5 deletion events received (e.g. `"1 deletion"` in the fetch summary) ### Fixed diff --git a/src/lib/client.rs b/src/lib/client.rs index 95dd78d..634dce2 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -1962,6 +1962,8 @@ async fn process_fetched_events( report.updated_state = Some((event.created_at, event.id)); } } + } else if event.kind.eq(&Kind::EventDeletion) { + report.deletions += 1; } else if event_is_patch_set_root(event) || event.kind.eq(&KIND_PULL_REQUEST) { fresh_proposal_roots.insert(event.id); report.proposals.insert(event.id); @@ -2064,6 +2066,7 @@ pub fn consolidate_fetch_reports(reports: Vec>) -> FetchRepo for c in relay_report.statuses { report.statuses.insert(c); } + report.deletions += relay_report.deletions; for c in relay_report.contributor_profiles { report.contributor_profiles.insert(c); } @@ -2234,6 +2237,8 @@ pub struct FetchReport { /// commits against existing propoals commits: HashSet, statuses: HashSet, + /// Count of kind-5 deletion events received (for display purposes). + deletions: u32, contributor_profiles: HashSet, profile_updates: HashSet, /// The best (newest) state event seen on each relay during the fetch. @@ -2295,6 +2300,13 @@ impl Display for FetchReport { if self.statuses.len() > 1 { "es" } else { "" }, )); } + if self.deletions > 0 { + display_items.push(format!( + "{} deletion{}", + self.deletions, + if self.deletions > 1 { "s" } else { "" }, + )); + } if !self.contributor_profiles.is_empty() { display_items.push(format!( "{} user profile{}", -- cgit v1.2.3