feat(alert-registry): add update_label and get_active_alerts_for_contract#158
Merged
habiba-d-coder merged 2 commits intoMay 30, 2026
Merged
Conversation
…ract - Add update_label entrypoint so owners can rename an alert without touching rules or webhook_hash. Validates label <= 128 bytes, requires owner auth, returns AlertNotFound / Unauthorized on error, and refreshes TTL on all three persistent keys. - Add get_active_alerts_for_contract query that filters the contract index to only entries where active == true, backed by a new private helper active_configs_for_ids. The existing get_alerts_for_contract is unchanged and still returns all entries. - Fix pre-existing bug in update_webhook and remove_alert where the caller parameter was referenced as the undefined variable 'owner'. - Remove duplicate assert_owner definition. - Add 9 tests covering both features (happy path, unauthorized, not found, boundary lengths, active/inactive filtering). - Update docs/alert-registry.md with entries for both new functions.
|
@pugsley76 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! 🚀 |
Collaborator
|
resolve conflict |
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.
closes #32
closes #34
Summary
Two new features for the alert registry contract.
Feature A —
update_labelAdds a dedicated entrypoint for owners to rename an alert without touching its rules or webhook hash. Previously the only option was
update_alert, which requires passing rules too.AlertNotFound/Unauthorizedon errorAlert,OwnerIndex, andContractIndexFeature B —
get_active_alerts_for_contractAdds a filtered variant of
get_alerts_for_contractthat returns only entries whereactive == true. The existing function is unchanged.active_configs_for_idsBug Fixes
update_webhookandremove_alertreferenced undefined variableownerinstead ofcaller— fixedassert_ownerdefinitionTests
9 new tests covering both features: happy path, unauthorized, not found, label boundary lengths, and active/inactive filtering.
Docs
Updated
docs/alert-registry.mdwith entries for both new functions.