diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 11:17:10 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-23 12:05:29 +0000 |
| commit | 70749ea9df1f6061c332112c617b615f91d79d48 (patch) | |
| tree | 6f4ace061681d8356ea79eb782fddb36c1f31d23 /src/git/handlers.rs | |
| parent | 9f15929b10825c2f55434a98794fc551794cad2b (diff) | |
fix: re-process hot-cache maintainer announcements after git push promotion
When an owner announcement is promoted from purgatory via a git push,
any maintainer announcements sitting in the rejected_events_index hot
cache were never re-processed. The invalidate_and_get call only existed
in SyncManager::process_event_static (the nostr sync path); the git push
promotion path (http -> handlers -> git::sync) had no access to the
rejected_events_index at all.
Thread rejected_events_index and write_policy through the git push path:
- process_purgatory_announcements: after saving the promoted announcement,
parse its maintainers tag and call invalidate_and_get() for each, then
re-process any returned hot-cache events via admit_event + save
- process_newly_available_git_data: accept optional write_policy and
rejected_events_index, pass them through to process_purgatory_announcements
- handle_receive_pack: accept Arc<Nip34WritePolicy> and
Arc<RejectedEventsIndex>, pass them to process_newly_available_git_data
- HttpService / run_server: carry the two new fields, clone into each
handle_receive_pack call
- main.rs: obtain rejected_events_index from sync_manager before moving
it into its task; wrap write_policy in Arc for the HTTP server
- RealSyncContext::process_newly_available_git_data: pass None for both
new params (purgatory sync path already handles this via
SyncManager::process_event_static)
Also rewrite the maintainer_reprocessing integration tests to correctly
exercise the hot-cache path now that announcements require git data
before being released from purgatory:
- Start relay_b with relay_a as bootstrap so its SyncManager syncs
maintainer announcements via negentropy before the owner git push
- Use push_unique_git_data_to_relay (new helper) to give each maintainer
a distinct commit hash, preventing git from skipping pack transfer
- Make wait_for_event_on_relay poll in a retry loop so transient timing
gaps between DB write and query do not cause false negatives
Diffstat (limited to 'src/git/handlers.rs')
| -rw-r--r-- | src/git/handlers.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/git/handlers.rs b/src/git/handlers.rs index 017eee4..13d6ba0 100644 --- a/src/git/handlers.rs +++ b/src/git/handlers.rs | |||
| @@ -17,8 +17,9 @@ use super::subprocess::GitSubprocess; | |||
| 17 | 17 | ||
| 18 | use crate::git::authorization::{authorize_push, parse_pushed_refs}; | 18 | use crate::git::authorization::{authorize_push, parse_pushed_refs}; |
| 19 | use crate::git::sync::process_newly_available_git_data; | 19 | use crate::git::sync::process_newly_available_git_data; |
| 20 | use crate::nostr::builder::SharedDatabase; | 20 | use crate::nostr::builder::{Nip34WritePolicy, SharedDatabase}; |
| 21 | use crate::purgatory::Purgatory; | 21 | use crate::purgatory::Purgatory; |
| 22 | use crate::sync::rejected_index::RejectedEventsIndex; | ||
| 22 | 23 | ||
| 23 | /// Handle GET /info/refs?service=git-{upload,receive}-pack | 24 | /// Handle GET /info/refs?service=git-{upload,receive}-pack |
| 24 | /// | 25 | /// |
| @@ -195,6 +196,8 @@ pub async fn handle_receive_pack( | |||
| 195 | purgatory: Arc<Purgatory>, | 196 | purgatory: Arc<Purgatory>, |
| 196 | git_data_path: &str, | 197 | git_data_path: &str, |
| 197 | git_protocol: Option<&str>, | 198 | git_protocol: Option<&str>, |
| 199 | write_policy: Arc<Nip34WritePolicy>, | ||
| 200 | rejected_events_index: Arc<RejectedEventsIndex>, | ||
| 198 | ) -> Result<Response<Full<Bytes>>, GitError> { | 201 | ) -> Result<Response<Full<Bytes>>, GitError> { |
| 199 | debug!("Handling receive-pack for {:?}", repo_path); | 202 | debug!("Handling receive-pack for {:?}", repo_path); |
| 200 | 203 | ||
| @@ -307,6 +310,8 @@ pub async fn handle_receive_pack( | |||
| 307 | Some(&relay), | 310 | Some(&relay), |
| 308 | &purgatory, | 311 | &purgatory, |
| 309 | git_data_path_buf, | 312 | git_data_path_buf, |
| 313 | Some(&write_policy), | ||
| 314 | Some(&rejected_events_index), | ||
| 310 | ) | 315 | ) |
| 311 | .await | 316 | .await |
| 312 | { | 317 | { |