upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-09 19:28:18 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-09 19:28:18 +0000
commit6dd9fcd5392891b0ddb7894e2c5cb40450eae00e (patch)
treefd70a0c90ecabcccb9ee952139f813349168e0ee /src/sync
parent9157b170226d3f19011deb458a73071491444928 (diff)
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
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/mod.rs25
1 files changed, 13 insertions, 12 deletions
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 {
2165 "Synced event saved and broadcast" 2165 "Synced event saved and broadcast"
2166 ); 2166 );
2167 2167
2168 // GRASP-02 PR3: Invalidate and re-process maintainer announcements 2168 // When an owner announcement is accepted, re-process any maintainer announcements
2169 // If this is a repository announcement that lists maintainers, check if any 2169 // that were previously rejected because the owner announcement didn't exist yet.
2170 // of those maintainer announcements were previously rejected and are still 2170 // This handles the race condition where maintainer events arrive before owner events
2171 // in the hot cache. If so, re-process them immediately (they should now pass 2171 // during relay synchronization. Maintainer events in the hot cache are re-processed
2172 // validation since the owner announcement has been accepted). 2172 // immediately and should now pass validation.
2173 if event.kind == Kind::GitRepoAnnouncement { 2173 if event.kind == Kind::GitRepoAnnouncement {
2174 use crate::nostr::events::RepositoryAnnouncement; 2174 use crate::nostr::events::RepositoryAnnouncement;
2175 2175
@@ -2276,9 +2276,10 @@ impl SyncManager {
2276 } 2276 }
2277 } 2277 }
2278 2278
2279 // GRASP-02 PR4.1: Re-process state events that were rejected because no announcement existed 2279 // When a repository announcement is accepted, re-process any state events
2280 // When an announcement is accepted, check for state events that were rejected 2280 // that were previously rejected because no announcement existed.
2281 // because "no announcement exists for this repository". These should now pass. 2281 // This handles the race condition where state events arrive before their
2282 // announcements during relay synchronization.
2282 match RepositoryAnnouncement::from_event(event.clone()) { 2283 match RepositoryAnnouncement::from_event(event.clone()) {
2283 Ok(announcement) => { 2284 Ok(announcement) => {
2284 // Get the announcement author's state events that were rejected 2285 // Get the announcement author's state events that were rejected
@@ -2357,10 +2358,10 @@ impl SyncManager {
2357 } 2358 }
2358 } 2359 }
2359 2360
2360 // GRASP-02 PR4.2: Invalidate and re-process state events 2361 // When a state event is accepted (git data arrived), re-process any other
2361 // When a state event is accepted (git data arrived), check if there are any 2362 // rejected state events for the same repository. This handles the case where
2362 // other rejected state events for the same repository in the hot cache. 2363 // multiple state events arrive but only one has git data initially.
2363 // Re-process them immediately since git data is now available. 2364 // Events in the hot cache are re-processed immediately now that git data is available.
2364 if event.kind == Kind::RepoState { 2365 if event.kind == Kind::RepoState {
2365 // Extract identifier from 'd' tag 2366 // Extract identifier from 'd' tag
2366 if let Some(identifier) = event 2367 if let Some(identifier) = event