From 9372ad649b6c438b1e4645f1dbe95c0f648bb80d Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 19 Jan 2026 14:25:27 +0000 Subject: 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 --- src/nostr/builder.rs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'src/nostr/builder.rs') 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 { let event_id_str = event.id.to_bech32().unwrap_or_else(|_| event.id.to_hex()); match self.announcement_policy.validate(event).await { - AnnouncementResult::Accept => { + AnnouncementResult::Accept | AnnouncementResult::AcceptArchive => { // Parse announcement to get repository details match RepositoryAnnouncement::from_event(event.clone()) { Ok(announcement) => { @@ -166,34 +166,6 @@ impl Nip34WritePolicy { } } } - AnnouncementResult::AcceptArchive => { - // GRASP-05: Archive mode - accept announcement but don't create bare repository - match RepositoryAnnouncement::from_event(event.clone()) { - Ok(announcement) => { - tracing::info!( - "Accepted archive announcement {} for {}/{} (GRASP-05 read-only mirror)", - event_id_str, - announcement.owner_npub(), - announcement.identifier - ); - // Don't create bare repository for archived announcements - - // Check purgatory for state events that might now be authorized - self.check_purgatory_state_events_for_identifier(&announcement.identifier) - .await; - - WritePolicyResult::Accept - } - Err(e) => { - tracing::warn!( - "Failed to parse archive announcement {}: {}", - event_id_str, - e - ); - WritePolicyResult::reject(format!("Failed to parse announcement: {}", e)) - } - } - } AnnouncementResult::Reject(reason) => { tracing::warn!( "Rejected repository announcement {}: {}", -- cgit v1.2.3