Skip to content

test(event): cover mixed-case canonical event names#117

Merged
overtrue merged 1 commit intomainfrom
codex/event-canonical-shorthand-gap
Apr 19, 2026
Merged

test(event): cover mixed-case canonical event names#117
overtrue merged 1 commit intomainfrom
codex/event-canonical-shorthand-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented Apr 13, 2026

Summary

This change closes a small regression gap in the recent event shorthand normalization work.

The event add path already normalizes shorthand values like put and delete before persisting notifications, and there are tests covering shorthand inputs plus exact canonical values. What was still untested was the mixed-case canonical wildcard path, where users pass values like S3:objectcreated:* alongside shorthand aliases.

Problem

Without canonicalizing those wildcard names before deduplication, the parser treated PUT and S3:objectcreated:* as different events. That allowed duplicate logical event entries to survive normalization and be written back to notification configuration.

Root Cause

normalize_event_name() only mapped shorthand aliases onto canonical wildcard names. It did not also collapse the equivalent canonical wildcard strings when they arrived in a different case.

Fix

The parser now normalizes the canonical wildcard forms for the same five shorthand-backed event families:

  • s3:ObjectCreated:*
  • s3:ObjectAccessed:*
  • s3:ObjectRemoved:*
  • s3:Replication:*
  • s3:ObjectTransition:*

I also added a focused unit test that fails on the old behavior and proves mixed-case canonical values deduplicate correctly with shorthand aliases.

Validation

I ran:

  • cargo test -p rustfs-cli mixed_case_canonical
  • cargo test -p rustfs-cli parse_event_list
  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

I also attempted make pre-commit, per the automation requirement, but this checkout does not define a pre-commit target:

text
make: *** No rule to make target pre-commit'. Stop.

@overtrue overtrue force-pushed the codex/event-canonical-shorthand-gap branch from 44dad1b to 3fc1429 Compare April 19, 2026 15:10
@overtrue overtrue marked this pull request as ready for review April 19, 2026 15:12
@overtrue overtrue merged commit 85c9548 into main Apr 19, 2026
15 checks passed
@overtrue overtrue deleted the codex/event-canonical-shorthand-gap branch April 19, 2026 15:20
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.

1 participant