mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
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
This commit is contained in:
+13
-12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user