upleb.uk

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

summaryrefslogtreecommitdiff
path: root/grasp-audit/src
AgeCommit message (Collapse)Author
2025-11-28test: rationalise repository creation testsDanConwayDev
2025-11-28audit: stop checking git_data_directoryDanConwayDev
2025-11-28add git http advertisment allow-reachable-sha1-in-want and ↵DanConwayDev
allow-tip-sha1-in-want
2025-11-28fix grasp-audit importsDanConwayDev
2025-11-28fix running audit with production flagDanConwayDev
no events were allowed to be published which broke most tests
2025-11-28grasp-audit improve cli output eg. add colors and condenseDanConwayDev
2025-11-28grasp-audit run all tests in audit modeDanConwayDev
2025-11-27remove depricated codeDanConwayDev
2025-11-27Task 7: Export verification helpers in public APIDanConwayDev
- Added send_and_verify_accepted to lib.rs exports - Added send_and_verify_rejected to lib.rs exports - Organized exports into logical groups with comments: * Git operation helpers * Verification helpers * Repo setup helpers * Types and constants - Build succeeds: cargo build
2025-11-27Task 6: Clean up verification helper imports and remove duplicatesDanConwayDev
- All uses of send_and_verify_accepted/rejected import from crate::fixtures - Removed duplicate implementations from event_acceptance_policy.rs (lines 519-597) - Updated 15 call sites from Self::send_and_verify_* to send_and_verify_* - Build succeeds: cargo build
2025-11-27Task 5: Standardize nip01_smoke.rs tests to fixture-first patternDanConwayDev
- test_send_receive_event uses TestContext + FixtureKind::ValidRepo - test_create_subscription uses TestContext + FixtureKind::ValidRepo - Tests remain functionally equivalent (same verification logic) - Pure connectivity tests like test_websocket_connection unchanged - Tests pass: cargo test --lib nip01_smoke - Added fixture-first pattern documentation to test docstrings
2025-11-27Task 4: Refactor recursive maintainer push test to fixture-first patternDanConwayDev
- Deprecated setup_repo_for_recursive_maintainer helper in fixtures.rs - test_push_authorized_by_recursive_maintainer_state now creates own TestContext - Uses FixtureKind chain: RepoState, MaintainerAnnouncement, MaintainerState, RecursiveMaintainerRepoAndState - Uses git helpers from fixtures.rs (clone_repo, create_deterministic_commit_with_variant, try_push) - Updated imports to include RECURSIVE_MAINTAINER_DETERMINISTIC_COMMIT_HASH - All unit tests pass: cargo test --lib
2025-11-27Task 3: Refactor maintainer push authorization test to fixture-first patternDanConwayDev
- Deprecated setup_repo_for_maintainer helper - test_push_authorized_by_maintainer_state_only now creates own TestContext - Uses FixtureKind::RepoState and FixtureKind::MaintainerState - Uses git helpers from fixtures.rs (clone_repo, create_deterministic_commit_with_variant, try_push) - Uses CommitVariant::Maintainer and MAINTAINER_DETERMINISTIC_COMMIT_HASH - Test compiles and passes: cargo test --lib (25 passed, 0 failed)
2025-11-27Task 2: Refactor owner push authorization test to fixture-first patternDanConwayDev
- Refactored test_push_authorized_by_owner_state to use fixture-first pattern - Test now creates its own TestContext and uses FixtureKind::RepoState - Uses git helper functions from fixtures.rs (clone_repo, create_deterministic_commit, try_push) - Follows the 3-step pattern: Generate fixtures → Send to relay → Verify behavior - Deprecated setup_repo_with_deterministic_commit with migration guide - Test passes: cargo test --test push_authorization test_push_authorized_by_owner_state - No API changes required for main project tests
2025-11-27fix(auth): accept state announcements from maintainersDanConwayDev
Updated get_maintainers_recursive() to properly handle maintainers listed in accepted repository announcements: 1. Separated 'visited' set (cycle prevention) from 'maintainers' set (result) 2. Maintainers listed in an announcement's 'maintainers' tag are now added to the maintainer set immediately, even without their own announcement 3. Recursively traverse maintainer chains to handle multi-level delegation Also fixed RecursiveMaintainerRepoAndState fixture to publish the maintainer's announcement (which lists the recursive maintainer) before publishing the recursive maintainer's announcement, establishing the proper trust chain: Owner -> Maintainer -> RecursiveMaintainer Test results: 7/7 push authorization tests passing
2025-11-27fix(tests): update main project tests for grasp-audit API changesDanConwayDev
2025-11-26test: use fixtures in push testsDanConwayDev
2025-11-26feat(fixtures): reuse prerequisite fixtures in production modeDanConwayDev
Fixtures now reuse their prerequisites in Shared (production) mode, significantly reducing events published to production relays: Before: Each fixture created its own prerequisite events - ValidRepo: 1 event - RepoWithIssue: 2 events (repo + issue) - RepoWithComment: 3 events (repo + issue + comment) - RepoState: 2 events (repo + state) After: Fixtures share prerequisites via caching - ValidRepo: 1 event - RepoWithIssue: 1 new event (issue), reuses cached repo - RepoWithComment: 1 new event (comment), reuses cached repo+issue - RepoState: 1 new event (state), reuses cached repo Total for all 4 fixtures: 8 events → 4 events (50% reduction) In CI/Isolated mode, each test still gets fresh fixtures for test isolation - behavior unchanged. Implemented via get_or_create_repo() and get_or_create_issue() helpers that handle mode-aware caching without async recursion.
2025-11-26fix: parsing maintainers from announcement eventDanConwayDev
2025-11-26feat: push authorization from state eventDanConwayDev
2025-11-26test: remove bad testDanConwayDev
we dont need to check the git files exist locally
2025-11-26add cors supportDanConwayDev
2025-11-21add http clone testsDanConwayDev
2025-11-21removed test that checked repository test cleanupDanConwayDev
2025-11-21add repository creationDanConwayDev
2025-11-21add nip11DanConwayDev
2025-11-21Implement GRASP-01 stateful write policy with database queriesDanConwayDev
- Add Nip34WritePolicy with Arc<MemoryDatabase> for stateful event validation - Implement full GRASP-01 event acceptance policy: * Accept events referencing accepted repositories (via a, A, q tags) * Accept events referencing accepted events (transitive, via e, E, q tags) * Support forward references (events referenced by accepted events) * Reject orphan events with no valid references - Extract and validate all reference tag types (a, A, q, e, E) - Query database for repository and event existence checks - Implement fail-secure error handling for database query failures Test improvements: - Fix send_and_verify_rejected to handle relay rejection errors properly - Fix RepoWithIssue fixture usage in forward reference tests - Add database synchronization polling for race condition mitigation - Achieve 94% test pass rate (16/17 integration tests passing)
2025-11-20refactor: isolate each grasp-audit lib test with minimal boilerplateDanConwayDev
- Add isolated_test! macro pattern to nip34_announcements.rs and nip01_compliance.rs - Each test runs with its own fresh relay instance for complete isolation - Make all individual test functions public in grasp-audit library (nip01_smoke.rs, event_acceptance_policy.rs) - Eliminates 122 lines of boilerplate across integration tests - Tests: 15 GRASP-01 event acceptance policy tests + 6 NIP-01 smoke tests - Ensures tests don't interfere with each other, preventing flakiness
2025-11-19fix some clippy fmt warningsDanConwayDev
2025-11-11Fixed the RepoWithIssue fixture implementationDanConwayDev
in grasp-audit/src/fixtures.rs Changes Made: Updated the RepoWithIssue fixture to return the issue event directly instead of a problematic marker event The fixture now properly creates a repo, sends it, creates an issue referencing it, and returns the issue for the caller to send Fixed the test in event_acceptance_policy.rs:700-711 to work with the new fixture structure Test Results: ✓ accept_issue_quoting_issue_via_q now passes (uses RepoWithIssue fixture) ✗ accept_comment_via_E_tag still fails with "Failed to build RepoWithIssue fixture" The fixture structure is now correct (proven by the passing test). The remaining failure in accept_comment_via_E_tag appears to be a relay timing/state issue rather than a code problem, since: Same fixture kind works for one test but not the other Failure is very fast (2.7ms), suggesting early bail-out May be related to test execution order or relay capacity
2025-11-06fix cli runs to prevent rate limitingDanConwayDev
2025-11-06fix show rejection errorDanConwayDev
2025-11-05fixed incorrectly labelled async functionDanConwayDev
2025-11-05restructure grasp01 audit tests and add event acceptanceDanConwayDev
2025-11-05test: consolidate state announcement tests with GRASP-01 spec formatDanConwayDev
Refactor repository state announcement testing to better match GRASP-01 specification requirements: - Consolidate multiple refs testing into accept_valid_repo_state_announcement - Remove separate accept_state_announcement_multiple_refs test (redundant) - Update tag format to match spec: use git reference as tag kind Example: ["refs/heads/main", "<commit-sha>"] instead of ["r", "refs/heads/main", "<commit-sha>"] - Ensure repo announcement (kind 30617) is sent before state announcement - Test multiple branch refs (main, develop), tag refs (v1.0.0), and HEAD - Simplify test validation by removing redundant assertions This approach provides better spec compliance and reduces test redundancy while maintaining comprehensive coverage of multiple reference scenarios.
2025-11-05feat(grasp-audit): implement tests #3 and #4 for GRASP-01 complianceDanConwayDev
- Add test_reject_repo_announcement_missing_relays_tag (test #3) Verifies that repo announcements without required 'relays' tag are rejected - Add test_accept_valid_repo_state_announcement (test #4) Verifies that valid repo state announcements with all required tags are accepted Both tests verified passing with test-ngit-relay.sh
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-05refactor(smoke): abstract NIP-34 announcement creation for ngit-relay ↵DanConwayDev
compatibility - Add create_announcement_event() helper to create properly formatted NIP-34 repository announcements that are accepted by GRASP relays - Update test_send_receive_event to use the helper (removes duplication) - Update test_create_subscription to use NIP-34 announcements instead of kind 1 TextNote events ngit-relay only accepts events that reference the relay in clone/relays tags. Kind 1 messages don't have these tags, so they're rejected. Using NIP-34 announcements ensures all smoke tests work against ngit-relay.
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-05docs: fixed desired grasp-audit behaviour in README.mdDanConwayDev
2025-11-05fix: hardcoded portDanConwayDev
2025-11-05feat(grasp-audit): implement test_reject_repo_announcement_missing_clone_tagDanConwayDev
- Tests that relay rejects repo announcements without service in clone tag - Validates GRASP-01 line 5 requirement - Tested against ngit-relay on port 18081 - Test passes (4/18 GRASP-01 Nostr relay tests now passing)
2025-11-05feat(grasp-audit): implement test_accept_valid_repo_announcementDanConwayDev
- Fix Tags iteration error (use .iter() method) - Test validates GRASP-01 requirement: accept repo announcements listing service - Verifies clone and relays tags contain service URL - Tested against ngit-relay on port 18081 - Test passes successfully
2025-11-05fix: NIP-01 smoke test now sends NIP-34 repo announcement for GRASP complianceDanConwayDev
- Modified test_send_receive_event to send kind 30617 (repo announcement) - Added required tags: d, name, description, clone, relays - Clone and relays tags now properly reference the GRASP server - All 6 NIP-01 smoke tests now pass (100%)
2025-11-05test: improve test script with unique names and random portsDanConwayDev
- Remove python3 dependency for port selection - Use RANDOM for port selection in range 20000-30000 - Use unique container names based on PID: grasp-audit-run-294183 - Use unique temp directories: grasp-audit-run-XXXXXXXXXX - Ensures parallel test runs don't conflict
2025-11-05test: add ngit-relay integration testing instructionsDanConwayDev
- Add RELAY_URL environment variable support to tests - Document expected behavior when testing against ngit-relay - Add test-ngit-relay.sh script for automated testing - Clarify that ngit-relay only accepts Git events (NIP-34) - Note that 4/6 NIP-01 smoke tests passing is expected - Key validation tests (invalid signature/ID) pass correctly - Add instructions for testing against general-purpose relays The validation tests passing confirms ngit-relay implements NIP-01 correctly, even though it has restrictive acceptance policies.
2025-11-05preparing to build grasp-audit against git-relayDanConwayDev
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