upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/nostr/builder.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-19 14:25:27 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-19 15:04:00 +0000
commit9372ad649b6c438b1e4645f1dbe95c0f648bb80d (patch)
treea2f95431711bde64713aeb72f3a7dcc65ffe58cc /src/nostr/builder.rs
parent16833501a1004a5a661a729e4fd2dbcbeaecd1d5 (diff)
fix: archive_read_only creates bare repos for archived announcements
Combined Accept and AcceptArchive match arms in builder.rs to ensure bare repositories are created for both cases. Previously AcceptArchive had duplicate code that didn't call ensure_bare_repository(). Also includes: - Config fix: effective_git_data_path() respects explicit paths with memory backend - TestRelay: Added git_data_path() and archive config support for testing - Integration tests for archive_read_only behavior
Diffstat (limited to 'src/nostr/builder.rs')
-rw-r--r--src/nostr/builder.rs30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/nostr/builder.rs b/src/nostr/builder.rs
index ef1b700..34014db 100644
--- a/src/nostr/builder.rs
+++ b/src/nostr/builder.rs
@@ -103,7 +103,7 @@ impl Nip34WritePolicy {
103 let event_id_str = event.id.to_bech32().unwrap_or_else(|_| event.id.to_hex()); 103 let event_id_str = event.id.to_bech32().unwrap_or_else(|_| event.id.to_hex());
104 104
105 match self.announcement_policy.validate(event).await { 105 match self.announcement_policy.validate(event).await {
106 AnnouncementResult::Accept => { 106 AnnouncementResult::Accept | AnnouncementResult::AcceptArchive => {
107 // Parse announcement to get repository details 107 // Parse announcement to get repository details
108 match RepositoryAnnouncement::from_event(event.clone()) { 108 match RepositoryAnnouncement::from_event(event.clone()) {
109 Ok(announcement) => { 109 Ok(announcement) => {
@@ -166,34 +166,6 @@ impl Nip34WritePolicy {
166 } 166 }
167 } 167 }
168 } 168 }
169 AnnouncementResult::AcceptArchive => {
170 // GRASP-05: Archive mode - accept announcement but don't create bare repository
171 match RepositoryAnnouncement::from_event(event.clone()) {
172 Ok(announcement) => {
173 tracing::info!(
174 "Accepted archive announcement {} for {}/{} (GRASP-05 read-only mirror)",
175 event_id_str,
176 announcement.owner_npub(),
177 announcement.identifier
178 );
179 // Don't create bare repository for archived announcements
180
181 // Check purgatory for state events that might now be authorized
182 self.check_purgatory_state_events_for_identifier(&announcement.identifier)
183 .await;
184
185 WritePolicyResult::Accept
186 }
187 Err(e) => {
188 tracing::warn!(
189 "Failed to parse archive announcement {}: {}",
190 event_id_str,
191 e
192 );
193 WritePolicyResult::reject(format!("Failed to parse announcement: {}", e))
194 }
195 }
196 }
197 AnnouncementResult::Reject(reason) => { 169 AnnouncementResult::Reject(reason) => {
198 tracing::warn!( 170 tracing::warn!(
199 "Rejected repository announcement {}: {}", 171 "Rejected repository announcement {}: {}",