Files
ngit-grasp/tests/sync.rs
T
DanConwayDev ced9706a09 feat(sync): recover accepted conversations from NIP-65 inboxes
Repository-declared relays do not necessarily contain replies addressed through the Nostr outbox model. The previous GRASP-03 branch solved that with a second recursive scope engine, duplicating the now-mature sync scheduler and its safety work.

Inventory accepted root IDs and authors once per minute, query kind 10002 in batches of at most 100 through the configured bootstrap and existing repository relays, and map read/unmarked inboxes onto those roots. Start at most one discovery batch per maintenance tick, use an existing connection, and let RelayConnection own the SDK REQ under the shared pacer and subscription ledger. This initial path may wait behind existing transient work; the following lifecycle commit bounds admission. Successful author/source pairs refresh daily; failures retry after five minutes.

Serialize discovery results back through the sync actor, retain the newest NIP-01 replacement across sources, prune authors and source attempts when accepted roots disappear, and overlay inbox roots at every ordinary target derivation boundary. Existing root tiers, historic/live rotation, pagination, grouping, rate recovery and the per-relay connection lifecycle remain the only event data-plane.

Correctness assumes a current relay-list is present on the bootstrap or a repository relay. General identity storage, profiles, outbox-only relays, maintainer-wide expansion, response-author recursion, fallback configuration and a separate scope scheduler remain excluded.

Validation: nix develop -c cargo check --lib; nix develop -c cargo test --lib (719 passed); nix develop -c cargo test --test sync root_author_inbox_reuses_existing_root_sync_pipeline -- --nocapture (passed).
2026-08-12 10:34:07 +00:00

52 lines
1.5 KiB
Rust

//! Proactive Sync Integration Tests
//!
//! This test file organizes tests for ngit-grasp's proactive sync functionality.
//! Tests are grouped into submodules by sync scenario:
//!
//! - `historic_sync` - Tests for sync from pre-configured bootstrap relay (historic events)
//! - `discovery` - Tests for relay discovery from announcement events
//! - `live_sync` - Tests for real-time sync after connection established
//! - `tag_variations` - Tests for different Layer 2/3 tag types
//! - `catchup` - Tests for catchup sync after disconnect (not yet implemented)
//! - `metrics` - Tests for Prometheus metrics integration
//!
//! # Running Tests
//!
//! ```bash
//! # Run all sync tests
//! cargo test --test sync
//!
//! # Run with output
//! cargo test --test sync -- --nocapture
//!
//! # Run specific test
//! cargo test --test sync test_bootstrap_syncs -- --nocapture
//!
//! # Run ignored tests (like catchup)
//! cargo test --test sync -- --ignored
//! ```
// Include the common test utilities
mod common;
// Include sync test submodules (located in tests/sync/)
mod sync {
pub mod adaptive_pagination;
pub mod catchup;
pub mod descendant_sync;
pub mod discovery;
pub mod historic_recovery;
pub mod historic_sync;
pub mod live_sync;
pub mod maintainer_reprocessing;
pub mod metrics;
pub mod naughty_list_scheduling;
pub mod neg_concurrency;
pub mod purgatory_fetch;
pub mod proactive_sync_plus;
pub mod reconnect_backoff;
pub mod req_concurrency;
pub mod stale_connect_result;
pub mod tag_variations;
}