upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/nostr/policy/pr_event.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 15:41:32 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-02-23 15:41:32 +0000
commitc54ce061d6d278cce8362d5af085808ca60c239b (patch)
treeec967d6195d9f7ec4f061449596611afe3a0950f /src/nostr/policy/pr_event.rs
parente0ad39a489b3398f8208713bf728db0cb11475b0 (diff)
parent113928aa84894ea8f65c247d9987527e792b32a9 (diff)
feat: announcement purgatory
Extends purgatory to hold repository announcements until git data arrives, preventing empty repositories from being served to clients. When an announcement is received, a bare repo is created immediately and the announcement is held in purgatory. It is only promoted and served once a git push confirms real content exists. If no push arrives before expiry, the bare repo is deleted and the announcement is silently discarded. Key behaviours: - Soft expiry: announcements are hidden from clients but kept alive while git pushes are in progress, reviving on successful push - Expiry is extended when a matching state event or git push is observed - NIP-09 deletion events remove announcements from purgatory - Purgatory state (announcements, state events, PR events, expired set) is persisted to disk on graceful shutdown and restored on startup, with elapsed downtime subtracted from expiry deadlines - Purgatory announcements drive StateOnly sync in the sync system so state events are fetched from listed relays before promotion - SyncLevel added to RepoSyncIndex to distinguish purgatory repos (StateOnly) from promoted repos (Full L2+L3 sync)
Diffstat (limited to 'src/nostr/policy/pr_event.rs')
-rw-r--r--src/nostr/policy/pr_event.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nostr/policy/pr_event.rs b/src/nostr/policy/pr_event.rs
index 00e09c3..072e445 100644
--- a/src/nostr/policy/pr_event.rs
+++ b/src/nostr/policy/pr_event.rs
@@ -127,6 +127,10 @@ impl PrEventPolicy {
127 .ok_or_else(|| anyhow::anyhow!("No identifier in PR event"))?; 127 .ok_or_else(|| anyhow::anyhow!("No identifier in PR event"))?;
128 128
129 // Fetch repository data 129 // Fetch repository data
130 // NOTE: Only fetch from database, NOT purgatory. Incoming PR events should
131 // only be accepted for announcements that have been promoted (validated).
132 // If the announcement is still in purgatory, the PR event should also go
133 // to purgatory and wait for the announcement to be promoted.
130 let db_repo_data = fetch_repository_data(&self.ctx.database, &identifier).await?; 134 let db_repo_data = fetch_repository_data(&self.ctx.database, &identifier).await?;
131 135
132 // Extract owner pubkey from source repo path 136 // Extract owner pubkey from source repo path
@@ -203,6 +207,10 @@ impl PrEventPolicy {
203 let identifier = parts[2]; 207 let identifier = parts[2];
204 208
205 // 2. Fetch repo data 209 // 2. Fetch repo data
210 // NOTE: Only fetch from database, NOT purgatory. Incoming PR events should
211 // only be accepted for announcements that have been promoted (validated).
212 // If the announcement is still in purgatory, the PR event should also go
213 // to purgatory and wait for the announcement to be promoted.
206 let db_repo_data = fetch_repository_data(&self.ctx.database, identifier).await?; 214 let db_repo_data = fetch_repository_data(&self.ctx.database, identifier).await?;
207 215
208 // 3. Extract list of maintainers from "a 30617:<maintainer>:<identifier>" tags 216 // 3. Extract list of maintainers from "a 30617:<maintainer>:<identifier>" tags