From 6dd9fcd5392891b0ddb7894e2c5cb40450eae00e Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 9 Jan 2026 19:28:18 +0000 Subject: refactor(sync): remove PR references from comments Replace PR-specific references (PR3, PR4.1, PR4.2) with problem-focused documentation that explains what the code does and why. Changes: - Maintainer re-processing: Explain race condition handling - State event re-processing (announcement): Clarify timing issue - State event re-processing (state): Describe multi-event scenario Why: PR numbers are ephemeral and meaningless to future readers. Comments should explain the problem being solved, not when code was added. All tests pass: 248 library tests passing --- src/sync/mod.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/sync/mod.rs') diff --git a/src/sync/mod.rs b/src/sync/mod.rs index d5c4856..ed3b78c 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -2165,11 +2165,11 @@ impl SyncManager { "Synced event saved and broadcast" ); - // GRASP-02 PR3: Invalidate and re-process maintainer announcements - // If this is a repository announcement that lists maintainers, check if any - // of those maintainer announcements were previously rejected and are still - // in the hot cache. If so, re-process them immediately (they should now pass - // validation since the owner announcement has been accepted). + // When an owner announcement is accepted, re-process any maintainer announcements + // that were previously rejected because the owner announcement didn't exist yet. + // This handles the race condition where maintainer events arrive before owner events + // during relay synchronization. Maintainer events in the hot cache are re-processed + // immediately and should now pass validation. if event.kind == Kind::GitRepoAnnouncement { use crate::nostr::events::RepositoryAnnouncement; @@ -2276,9 +2276,10 @@ impl SyncManager { } } - // GRASP-02 PR4.1: Re-process state events that were rejected because no announcement existed - // When an announcement is accepted, check for state events that were rejected - // because "no announcement exists for this repository". These should now pass. + // When a repository announcement is accepted, re-process any state events + // that were previously rejected because no announcement existed. + // This handles the race condition where state events arrive before their + // announcements during relay synchronization. match RepositoryAnnouncement::from_event(event.clone()) { Ok(announcement) => { // Get the announcement author's state events that were rejected @@ -2357,10 +2358,10 @@ impl SyncManager { } } - // GRASP-02 PR4.2: Invalidate and re-process state events - // When a state event is accepted (git data arrived), check if there are any - // other rejected state events for the same repository in the hot cache. - // Re-process them immediately since git data is now available. + // When a state event is accepted (git data arrived), re-process any other + // rejected state events for the same repository. This handles the case where + // multiple state events arrive but only one has git data initially. + // Events in the hot cache are re-processed immediately now that git data is available. if event.kind == Kind::RepoState { // Extract identifier from 'd' tag if let Some(identifier) = event -- cgit v1.2.3