From 5d02ad6b893f9059044914c115d77cf9d8e589c3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 8 Jan 2026 11:20:35 +0000 Subject: refactor: replace hardcoded Kind constants with rust-nostr variants - 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 --- grasp-audit/src/specs/grasp01/nip01_smoke.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'grasp-audit/src/specs/grasp01/nip01_smoke.rs') diff --git a/grasp-audit/src/specs/grasp01/nip01_smoke.rs b/grasp-audit/src/specs/grasp01/nip01_smoke.rs index bd45ea4..4d0b8a4 100644 --- a/grasp-audit/src/specs/grasp01/nip01_smoke.rs +++ b/grasp-audit/src/specs/grasp01/nip01_smoke.rs @@ -78,7 +78,7 @@ impl Nip01SmokeTests { tokio::time::sleep(std::time::Duration::from_millis(100)).await; // Step 2: VERIFY - Query event back - let filter = Filter::new().kind(Kind::Custom(30617)).id(event_id); + let filter = Filter::new().kind(Kind::GitRepoAnnouncement).id(event_id); let events = client .query(filter) @@ -88,7 +88,7 @@ impl Nip01SmokeTests { if events.is_empty() { // Debug: try querying without audit client filtering eprintln!("Event not found with audit client query, trying direct client query..."); - let direct_filter = Filter::new().kind(Kind::Custom(30617)).id(event_id); + let direct_filter = Filter::new().kind(Kind::GitRepoAnnouncement).id(event_id); let direct_events = client .client() .fetch_events(direct_filter, std::time::Duration::from_secs(5)) @@ -140,7 +140,7 @@ impl Nip01SmokeTests { // Step 2: VERIFY - Subscribe to NIP-34 announcements from this author let filter = Filter::new() - .kind(Kind::Custom(30617)) + .kind(Kind::GitRepoAnnouncement) .author(client.public_key()); let events = client -- cgit v1.2.3