upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/sync/self_subscriber.rs
AgeCommit message (Collapse)Author
2026-01-13fix: Enable sync relay discovery in archive_all modeDanConwayDev
The bug: SelfSubscriber filtered announcements with lists_our_relay() check, preventing archive_all mode from discovering relays in announcements that don't list our relay domain. The insight: SelfSubscriber only receives events that ALREADY passed write policy validation (archive_all, archive_whitelist, blacklist, etc.) via admit_event() before being saved to the database. The event flow: External relay → process_event_static() → write_policy.admit_event() → (validation happens here) → save to DB → notify_event() → SelfSubscriber receives via WebSocket So the lists_our_relay() check was redundant double-validation that broke archive_all mode by filtering events that had already been accepted by the write policy. The fix: Simply remove the lists_our_relay() filtering. Events reaching SelfSubscriber are pre-validated and should all be processed for relay discovery according to the configured archive policy. Changes: - Removed lists_our_relay() check from process_notification() (4 lines) - Removed unused lists_our_relay() helper function (9 lines) - Added comment explaining events are pre-validated (3 lines) - Total: 13 lines removed, 3 lines added Fixes #194d
2026-01-08refactor: replace hardcoded Kind constants with rust-nostr variantsDanConwayDev
- Replace KIND_REPOSITORY_ANNOUNCEMENT with Kind::GitRepoAnnouncement - Replace KIND_REPOSITORY_STATE with Kind::RepoState - Replace KIND_PR with Kind::GitPullRequest - Replace KIND_PR_UPDATE with Kind::GitPullRequestUpdate - Replace KIND_USER_GRASP_LIST with Kind::GitUserGraspList - Replace KIND_PATCH with Kind::GitPatch - Replace KIND_ISSUE with Kind::GitIssue - Replace KIND_COMMENT with Kind::Comment - Replace all Kind::Custom(30617|30618|1617|1618|1619|1621|1111|10317) patterns - Remove all hardcoded KIND_* constants from events.rs - Update all match statements to use Kind enum directly - Update all filter builders to use Kind variants - Update all test helpers and assertions Benefits: - Type safety: compiler prevents wrong kind numbers - Readability: Kind::GitRepoAnnouncement is self-documenting - Maintainability: single source of truth (rust-nostr) - IDE support: full autocompletion and refactoring - Standards: aligns with rust-nostr best practices Files modified: 21 Constants removed: 9 Patterns replaced: 100+ Tests passing: 222/222
2025-12-22accept all UserGraspList for better discoveryDanConwayDev
2025-12-16proactive sync prep - some helper functions written but not enabledDanConwayDev
2025-12-11sync: remove reply kind from sync filters for root eventsDanConwayDev
they are legacy and not root events
2025-12-11fix: resolve all fmt and clippy warningsDanConwayDev
Main lib (src/): - Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration) - Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting) - Replace .or_insert_with(RelaySyncNeeds::default) with .or_default() - Replace manual div_ceil implementations with .div_ceil(100) Test code (tests/): - Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...)) - Remove needless borrows in fetch_metrics() calls - Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module grasp-audit: - Apply cargo fmt to fix formatting
2025-12-10fix: enable Layer 3 sync by adding root events to pending queueDanConwayDev
When root events (issues/patches) are received via self-subscription, handle_root_event() was only updating the repo_sync_index directly. This caused process_batch() to early-return when pending.is_empty(), so Layer 3 filters for comments/replies were never created. The fix adds root events to both: 1. repo_sync_index (for immediate availability) 2. pending queue (to trigger Layer 3 filter creation in next batch) Critical: The pending entry must include relays from repo_sync_index so derive_relay_targets() knows where to send Layer 3 subscriptions. The Layer 3 test now verifies that events sent BEFORE the subscription is established are still synced - proving subscriptions without 'since' correctly fetch historical events. Enabled 4 previously ignored Layer 3 tests: - test_live_sync_layer3_events - test_layer3_sync_with_lowercase_e_tag - test_layer3_sync_with_uppercase_e_tag - test_layer3_sync_with_q_tag
2025-12-10sync: fix connection registration issueDanConwayDev
2025-12-10refactor: deduplicate SelfSubscriber select branches (SIMPLIFY-2)DanConwayDev
2025-12-10refactor: remove redundant RelayAction enum (SIMPLIFY-1)DanConwayDev
2025-12-10fix: don't add 30617 announcement IDs to root_events (BUG-2)DanConwayDev
2025-12-10sync: implement graceful shutdown for all tasks and connectionsDanConwayDev
2025-12-10sync: enhance SelfSubscriber with reconnect and root event trackingDanConwayDev
2025-12-10sync v4 mvpDanConwayDev
2025-12-10stub of sync v4DanConwayDev
2025-12-10improve sync designDanConwayDev