diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 11:20:35 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 11:23:28 +0000 |
| commit | 5d02ad6b893f9059044914c115d77cf9d8e589c3 (patch) | |
| tree | b727f9c44d2f2d4e203dc2344e4c9bd5144a77dd /grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | |
| parent | 075307804bf66bba10f5bc55cb40e2e6a98a65ee (diff) | |
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
Diffstat (limited to 'grasp-audit/src/specs/grasp01/event_acceptance_policy.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs index 3db1446..5b697d8 100644 --- a/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs +++ b/grasp-audit/src/specs/grasp01/event_acceptance_policy.rs | |||
| @@ -659,7 +659,7 @@ impl EventAcceptancePolicyTests { | |||
| 659 | ]; | 659 | ]; |
| 660 | 660 | ||
| 661 | let comment = client | 661 | let comment = client |
| 662 | .event_builder(Kind::Custom(1111), "Comment on repo") | 662 | .event_builder(Kind::Comment, "Comment on repo") |
| 663 | .tags(tags) | 663 | .tags(tags) |
| 664 | .build(client.keys()) | 664 | .build(client.keys()) |
| 665 | .map_err(|e| format!("Failed to build comment: {}", e))?; | 665 | .map_err(|e| format!("Failed to build comment: {}", e))?; |
| @@ -935,7 +935,7 @@ impl EventAcceptancePolicyTests { | |||
| 935 | ]; | 935 | ]; |
| 936 | 936 | ||
| 937 | let issue = client | 937 | let issue = client |
| 938 | .event_builder(Kind::Custom(1621), "issue content") | 938 | .event_builder(Kind::GitIssue, "issue content") |
| 939 | .tags(issue_tags) | 939 | .tags(issue_tags) |
| 940 | .build(client.keys()) | 940 | .build(client.keys()) |
| 941 | .map_err(|e| format!("Failed to build issue: {}", e))?; | 941 | .map_err(|e| format!("Failed to build issue: {}", e))?; |
| @@ -995,7 +995,7 @@ impl EventAcceptancePolicyTests { | |||
| 995 | ]; | 995 | ]; |
| 996 | 996 | ||
| 997 | let comment_b = client | 997 | let comment_b = client |
| 998 | .event_builder(Kind::Custom(1111), "Comment B quoting Comment A") | 998 | .event_builder(Kind::Comment, "Comment B quoting Comment A") |
| 999 | .tags(comment_b_tags) | 999 | .tags(comment_b_tags) |
| 1000 | .build(client.keys()) | 1000 | .build(client.keys()) |
| 1001 | .map_err(|e| format!("Failed to build comment B: {}", e))?; | 1001 | .map_err(|e| format!("Failed to build comment B: {}", e))?; |
| @@ -1172,7 +1172,7 @@ impl EventAcceptancePolicyTests { | |||
| 1172 | ]; | 1172 | ]; |
| 1173 | 1173 | ||
| 1174 | let comment = client | 1174 | let comment = client |
| 1175 | .event_builder(Kind::Custom(1111), "Comment on unaccepted repo") | 1175 | .event_builder(Kind::Comment, "Comment on unaccepted repo") |
| 1176 | .tags(tags) | 1176 | .tags(tags) |
| 1177 | .build(client.keys()) | 1177 | .build(client.keys()) |
| 1178 | .map_err(|e| format!("Failed to build comment: {}", e))?; | 1178 | .map_err(|e| format!("Failed to build comment: {}", e))?; |