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/push_authorization.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/push_authorization.rs')
| -rw-r--r-- | grasp-audit/src/specs/grasp01/push_authorization.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/grasp-audit/src/specs/grasp01/push_authorization.rs b/grasp-audit/src/specs/grasp01/push_authorization.rs index 23eb735..4c7720b 100644 --- a/grasp-audit/src/specs/grasp01/push_authorization.rs +++ b/grasp-audit/src/specs/grasp01/push_authorization.rs | |||
| @@ -877,7 +877,7 @@ impl PushAuthorizationTests { | |||
| 877 | // Create a rogue state event announcing the new commit | 877 | // Create a rogue state event announcing the new commit |
| 878 | // This event has the correct repo_id but is signed by a non-maintainer | 878 | // This event has the correct repo_id but is signed by a non-maintainer |
| 879 | let rogue_state = match client | 879 | let rogue_state = match client |
| 880 | .event_builder(Kind::Custom(30618), "") | 880 | .event_builder(Kind::RepoState, "") |
| 881 | .tag(Tag::identifier(&repo_id)) | 881 | .tag(Tag::identifier(&repo_id)) |
| 882 | .tag(Tag::custom( | 882 | .tag(Tag::custom( |
| 883 | TagKind::custom("refs/heads/main"), | 883 | TagKind::custom("refs/heads/main"), |
| @@ -1591,7 +1591,7 @@ impl PushAuthorizationTests { | |||
| 1591 | // This references a commit that doesn't yet exist on the relay | 1591 | // This references a commit that doesn't yet exist on the relay |
| 1592 | // ============================================================ | 1592 | // ============================================================ |
| 1593 | let state_event = match client | 1593 | let state_event = match client |
| 1594 | .event_builder(Kind::Custom(30618), "") | 1594 | .event_builder(Kind::RepoState, "") |
| 1595 | .tag(Tag::identifier(&repo_id)) | 1595 | .tag(Tag::identifier(&repo_id)) |
| 1596 | .tag(Tag::custom( | 1596 | .tag(Tag::custom( |
| 1597 | TagKind::custom("HEAD"), | 1597 | TagKind::custom("HEAD"), |