feat(contract): enforce notification category validation - #543
Open
iamtjbest wants to merge 6 commits into
Open
Conversation
|
@iamtjbest Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces the Notification Category Registry, allowing administrators to define and manage supported notification categories before they can be used in the system. It enforces these category rules across the notification scheduling ecosystem, ensuring only valid, pre-registered categories are utilized.
Changes Made
Category Validation Enforced: Integrated strict category registry checks into the core scheduling logic, specifically within create_autoshare, schedule_notification, and batch_schedule_notifications (autoshare_logic.rs).
Error Handling & Compilation Fix: Resolved severe compilation errors in errors.rs that were caused by overlapping enum values.
Event Emission: Updated events.rs to ensure the registry properly emits update events when categories are registered or modified.
Backward Compatibility: Implemented a mechanism to pre-seed default categories, ensuring that existing operations and legacy schedules do not break upon deployment.
Testing & Verification
Refactored and expanded category_registry_test.rs to cover the new registration logic fully.
Introduced a new System category variant specifically to facilitate robust testing.
Verified that duplicate category registrations are successfully rejected and that all associated events are properly emitted.
Confirmed that the test suite compiles and passes with the newly added validations.
To Test
Run the test suite locally to verify the registry logic and backward compatibility:
Bash
cargo test
Closes #470
CLoses #485