diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 07:45:56 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-04 07:45:56 +0000 |
| commit | 8190a3a1b4541e86692d5e1210f955fc8c8351a8 (patch) | |
| tree | c6353e2d4756b96f08bf64de7bc66a903cbf392f /grasp-audit/src/specs | |
| parent | c92faa11d669832e9339d8f7707220ff44553008 (diff) | |
Fix audit system tag filtering and event validation
- 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.
Diffstat (limited to 'grasp-audit/src/specs')
| -rw-r--r-- | grasp-audit/src/specs/nip01_smoke.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/grasp-audit/src/specs/nip01_smoke.rs b/grasp-audit/src/specs/nip01_smoke.rs index cd4ae2b..569997b 100644 --- a/grasp-audit/src/specs/nip01_smoke.rs +++ b/grasp-audit/src/specs/nip01_smoke.rs | |||
| @@ -76,6 +76,9 @@ impl Nip01SmokeTests { | |||
| 76 | )); | 76 | )); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | // Wait a bit for event to be indexed | ||
| 80 | tokio::time::sleep(std::time::Duration::from_millis(100)).await; | ||
| 81 | |||
| 79 | // Try to query it back | 82 | // Try to query it back |
| 80 | let filter = Filter::new() | 83 | let filter = Filter::new() |
| 81 | .kind(Kind::TextNote) | 84 | .kind(Kind::TextNote) |
| @@ -87,7 +90,17 @@ impl Nip01SmokeTests { | |||
| 87 | .map_err(|e| format!("Failed to query event: {}", e))?; | 90 | .map_err(|e| format!("Failed to query event: {}", e))?; |
| 88 | 91 | ||
| 89 | if events.is_empty() { | 92 | if events.is_empty() { |
| 90 | return Err("Event not found after sending".to_string()); | 93 | // Debug: try querying without audit client filtering |
| 94 | eprintln!("Event not found with audit client query, trying direct client query..."); | ||
| 95 | let direct_filter = Filter::new().kind(Kind::TextNote).id(event_id); | ||
| 96 | let direct_events = client.client().fetch_events(direct_filter, std::time::Duration::from_secs(5)).await | ||
| 97 | .map_err(|e| format!("Direct query failed: {}", e))?; | ||
| 98 | let direct_vec: Vec<Event> = direct_events.into_iter().collect(); | ||
| 99 | eprintln!("Direct query found {} events", direct_vec.len()); | ||
| 100 | if !direct_vec.is_empty() { | ||
| 101 | eprintln!("Event tags: {:?}", direct_vec[0].tags); | ||
| 102 | } | ||
| 103 | return Err(format!("Event not found after sending (direct query found {})", direct_vec.len())); | ||
| 91 | } | 104 | } |
| 92 | 105 | ||
| 93 | if events[0].id != event_id { | 106 | if events[0].id != event_id { |