feat(event): add shorthand dedupe regression test#72
Draft
Conversation
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.
Summary
This change adds a focused regression test for the
event addshorthand-normalization path.Users can pass shorthand event names such as
put,get, ordelete, and the CLI now has explicit coverage for the case where those shorthands are mixed with their canonical S3 event names in the same input. The expected behavior is to normalize both forms to the same persisted event name and deduplicate the final notification event list.Problem
The recent event normalization fix added support for shorthand event names before persisting notification rules, but the tests only proved that shorthand values normalize correctly on their own. They did not cover the user-facing case where shorthand and canonical values are combined in one command.
Without that regression coverage, a future refactor could reintroduce duplicate persisted events such as both
putands3:ObjectCreated:*surviving as separate entries after parsing.Root Cause
The missing test path was the overlap between normalization and deduplication. Existing tests covered:
They did not cover normalization producing values that should then collapse against already-canonical inputs.
Fix
Add a unit test in
crates/cli/src/commands/event.rsthat mixes shorthand and canonical event names for created, accessed, and removed events, then asserts that the parsed list contains only the canonical deduplicated values.Validation
The following checks passed:
cargo fmt --all --checkcargo clippy --workspace -- -D warningscargo test --workspace