upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit/src/client.rs
AgeCommit message (Collapse)Author
2026-02-25add probe subcommand for end-to-end relay health checksDanConwayDev
Implements grasp-audit probe with full write path (publish events, poll for repo init, push, verify refs match state) and read-only fallback (find existing announcement, fetch refs). Supports --nsec for whitelisted relays, --json output, and --watch for continuous monitoring.
2026-02-12refactor(grasp-audit): split ValidRepo into Sent/Served, add tolerant purgatoryDanConwayDev
- Rename ValidRepo to ValidRepoSent (announcement sent, may be in purgatory) - Add ValidRepoServed (announcement queryable after git data pushed) - Add send_event_and_note_purgatory() for tolerant purgatory detection - Update fixtures to use tolerant method instead of strict assertion - Update event_acceptance_policy tests to use ValidRepoServed This enables tests to pass regardless of purgatory implementation status while still having explicit purgatory tests that verify the behavior.
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-31test: fix purgatory not-served check outcomeDanConwayDev
2025-12-24feat(purgatory): add broken purgatory implementationDanConwayDev
2025-12-23test: prepare OwnerStateDataPushed fixture for purgatoryDanConwayDev
This is the model for how to prepare all push tests for purgatory
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-02refactor: rename AuditMode variants and change CLI default to sharedDanConwayDev
Breaking change: Renamed AuditMode enum variants for clarity: - AuditMode::CI -> AuditMode::Isolated (fresh fixtures per test) - AuditMode::Production -> AuditMode::Shared (reuse fixtures across tests) Config constructors renamed (with deprecated aliases): - AuditConfig::ci() -> AuditConfig::isolated() - AuditConfig::production() -> AuditConfig::shared() CLI default changed from 'ci' to 'shared' mode, which enables fixture caching across tests. This fixes the issue where fixtures were being re-created for every test in CLI mode. Fixture caching behavior: - Shared mode (CLI default): Uses client's cache, fixtures reused - Isolated mode (for cargo test): Local cache per TestContext
2025-12-01reject push when refs/nostr/<event-id> doesnt match known event and delete ↵DanConwayDev
incorrect ref on event receive
2025-11-28test: added checks that refs/nostr/<event-id> match commit in PR / updateDanConwayDev
2025-11-28audit: fix shared test context to minimise events sent to production relaysDanConwayDev
2025-11-26test: use fixtures in push testsDanConwayDev
2025-11-26fix: parsing maintainers from announcement eventDanConwayDev
2025-11-21add nip11DanConwayDev
2025-11-19fix some clippy fmt warningsDanConwayDev
2025-11-06fix cli runs to prevent rate limitingDanConwayDev
2025-11-06fix show rejection errorDanConwayDev
2025-11-05restructure grasp01 audit tests and add event acceptanceDanConwayDev
2025-11-05tag test events with audit-grasp-test-eventDanConwayDev
2025-11-05Refactor: abstract announcement event creation into AuditClient helperDanConwayDev
- Add create_repo_announcement() method to AuditClient - Remove duplicate code from nip01_smoke.rs - Update grasp01_nostr_relay.rs to use centralized helper - All tests passing (GRASP-01: 4/18, NIP-01: 6/6)
2025-11-05feat(grasp-audit): improve test infrastructure and error handlingDanConwayDev
- Fix compilation error in test setup (use .expect() instead of ?) - Add comprehensive error messages with troubleshooting guidance - Implement connection verification in AuditClient with retry logic - Update AGENTS.md with testing troubleshooting section - Verify all changes: 4/18 tests passing as expected Error messages now include: - Specific context about failures (event IDs, repo IDs, URLs) - Example commands for resolution (docker, nak verification) - References to helper scripts (test-ngit-relay.sh) Tests compile cleanly and run successfully against ngit-relay.
2025-11-04Migrate to standard NIP-01 't' tags for audit eventsDanConwayDev
- Changed from custom single-letter tags (g, r, c) to standard 't' tags - Tag values now use descriptive prefixes: - 'grasp-audit-test-event' (marker tag) - 'audit-{run-id}' (run identification) - 'audit-cleanup-after-{timestamp}' (cleanup time) - Updated audit_tags() in src/audit.rs - Updated query filtering in src/client.rs - Updated all tests to verify 't' tag usage - All tests passing: 12/12 unit tests, 1/1 integration test - CLI verified working with new tag scheme This follows standard Nostr conventions and avoids potential conflicts with other uses of single-letter tags. The 't' tag is specifically designed for categorization/topics per NIP-01.
2025-11-04Fix audit system tag filtering and event validationDanConwayDev
- Changed from multi-letter custom tags to single-letter tags (g, r, c) for compatibility with Nostr Filter API - Added validation check in send_event() to detect relay rejections by checking output.success and output.failed - Improved connection stability with retry loop - Added debug output for troubleshooting query issues - All tests now pass: 12/12 unit tests, 6/6 integration tests - CLI verified working with Docker relay Fixes issues discovered during Path 1 integration testing.
2025-11-04Upgrade to nostr-sdk 0.43 (from 0.35)DanConwayDev
Major upgrade of nostr-sdk dependency from 0.35 to 0.43 (8 minor versions). All breaking API changes fixed, all tests passing. Breaking Changes Fixed: - EventBuilder::new() - Removed tags parameter, use .tags() method - EventBuilder::to_event() → sign_with_keys() - Renamed signing method - Client::new() - Takes ownership of keys (clone instead of reference) - Relay::is_connected() - No longer async - Client::get_events_of() → fetch_events() - Complete API redesign - EventSource - Removed entirely - Filter::custom_tag() - Takes single value instead of array - Client::send_event() - Takes reference instead of ownership - Multiple filters - Loop and combine instead of vec parameter - Events type - New return type, convert with .into_iter().collect() Files Modified: - Cargo.toml: nostr-sdk = "0.43" - src/audit.rs: EventBuilder API changes - src/client.rs: Client, query, and filter API changes - src/specs/nip01_smoke.rs: Event building changes Documentation: - NOSTR_SDK_0.43_UPGRADE.md: Comprehensive upgrade guide - COMPILATION_FIXES.md: Marked as obsolete (0.35 fixes) - SESSION_2025_11_04_SUMMARY.md: Session summary - NEXT_SESSION_QUICKSTART.md: Updated status Test Results: ✅ All 12 unit tests passing ✅ CLI builds successfully ✅ Examples build successfully ✅ Clean build with no warnings Benefits: - Latest stable nostr-sdk version - Cleaner, more intuitive APIs - Better performance (reference passing, sync operations) - 8 versions of bug fixes and improvements - Future compatibility
2025-11-04created POC grasp-auditorDanConwayDev