Skip to content

feat(alert-registry): add update_label and get_active_alerts_for_contract#158

Merged
habiba-d-coder merged 2 commits into
Tx-wat:mainfrom
pugsley76:feat/update-label-active-alerts-filter
May 30, 2026
Merged

feat(alert-registry): add update_label and get_active_alerts_for_contract#158
habiba-d-coder merged 2 commits into
Tx-wat:mainfrom
pugsley76:feat/update-label-active-alerts-filter

Conversation

@pugsley76
Copy link
Copy Markdown

closes #32
closes #34

Summary

Two new features for the alert registry contract.

Feature A — update_label

Adds 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.

  • Requires owner auth
  • Validates label ≤ 128 bytes
  • Returns AlertNotFound / Unauthorized on error
  • Refreshes TTL on Alert, OwnerIndex, and ContractIndex

Feature B — get_active_alerts_for_contract

Adds a filtered variant of get_alerts_for_contract that returns only entries where active == true. The existing function is unchanged.

  • Backed by a new private helper active_configs_for_ids
  • Returns an empty vec if no active alerts exist

Bug Fixes

  • update_webhook and remove_alert referenced undefined variable owner instead of caller — fixed
  • Removed duplicate assert_owner definition

Tests

9 new tests covering both features: happy path, unauthorized, not found, label boundary lengths, and active/inactive filtering.

Docs

Updated docs/alert-registry.md with entries for both new functions.

…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.
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@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! 🚀

Learn more about application limits

@habiba-d-coder
Copy link
Copy Markdown
Collaborator

habiba-d-coder commented May 30, 2026

resolve conflict

@habiba-d-coder habiba-d-coder merged commit fd1ef9c into Tx-wat:main May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add get_all_active_alerts_for_contract filter Feature: Add update_label function

2 participants