test(event): cover shorthand normalization deduplication#70
Closed
test(event): cover shorthand normalization deduplication#70
Conversation
Contributor
Author
|
Superseded by #69, which now carries the broadened mixed shorthand/canonical event dedup coverage from this run. |
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 closes a regression-test gap in the event notification parser.
The recent event shorthand normalization fix correctly maps aliases such as
put,get, anddeleteto their canonical S3 event names before notification rules are persisted. That behavior was already covered for plain shorthand inputs, but there was still no test proving that shorthand aliases collapse with already-canonical event names into a single persisted value.Without this regression test, a future refactor could accidentally reintroduce duplicate notification events whenever users mix shorthand flags and canonical event names in the same command invocation.
Root cause
The changed code path normalizes event names first and only then sorts and deduplicates them. The existing tests did not exercise the specific case where shorthand inputs and canonical S3 event names should normalize to the same final string before deduplication.
Fix
Add a focused unit test in
crates/cli/src/commands/event.rsthat covers mixed shorthand and canonical event inputs and asserts that the parser returns a deduplicated canonical event list.Validation
cargo fmt --all --checkcargo clippy --workspace -- -D warningscargo test --workspace