Skip to content

test(event): cover notification rule replacement#73

Merged
overtrue merged 3 commits intomainfrom
codex/event-add-replace-test-gap
Apr 2, 2026
Merged

test(event): cover notification rule replacement#73
overtrue merged 3 commits intomainfrom
codex/event-add-replace-test-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

This change adds focused regression coverage for the bucket notification update path in event add.

The recent event shorthand normalization fix ensures shorthand values like put are converted before notification rules are persisted. Existing unit coverage verified the normalization helper itself, but it did not verify the replace-by-ARN behavior that event add uses when updating an existing notification target. That left a gap where normalization could pass in isolation while replacement logic still regressed in the path that actually writes the updated rule.

This patch adds a unit test that starts with an existing notification rule, parses a mixed shorthand and canonical event list, and then upserts a rule with the same ARN. The test asserts that the old rule is replaced rather than duplicated and that the persisted event list is normalized and deduplicated to a single canonical value.

User Impact

Without this coverage, a future change could reintroduce duplicated rules or persist stale event values when users update an existing notification target with shorthand events.

Validation

I ran the required repository checks:

  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

@overtrue overtrue marked this pull request as ready for review April 2, 2026 01:42
Copilot AI review requested due to automatic review settings April 2, 2026 01:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a regression test to ensure event add’s notification upsert path replaces an existing rule with the same ARN (instead of duplicating it) and that shorthand events are normalized/deduplicated before persisting.

Changes:

  • Add a unit test covering upsert_notification() replacement-by-ARN behavior.
  • Exercise parse_event_list() with mixed shorthand + canonical + mixed-case inputs and assert the stored events are normalized/deduped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overtrue overtrue merged commit 53894db into main Apr 2, 2026
15 checks passed
@overtrue overtrue deleted the codex/event-add-replace-test-gap branch April 2, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants