You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False positive suppressions should be disallowed / emit a warning #2623
If you suppress a validation event that isn't emitted for a given shape/namespace, Smithy should let you know that the suppression doesn't silence anything.
Currently, such no-op suppressions are just ignored.
I actually looked into implementing this a while ago (sorry for not updating here). The way we implement suppressions doesn't leave room to pass along this sort of metadata, so it would require quite a bit of doing to get working. That said, I do still think it's a good idea that we should do.
I'd like to pick this up. Plan: track which suppressions actually matched a validation event through the validator pipeline and emit a WARNING for the ones that silenced nothing. I'll keep the refactor contained and open a PR shortly.
PR up: #3293, implementing this. Quick summary of the approach:
ModelBasedEventDecorator now tracks which suppressions matched while it decorates events — trait suppressions tracked per trait value (so @suppress(["A", "B"]) only warns about the value that matched nothing), metadata ones via a matched flag (thread-safe, since validators run in parallel).
After all validators complete (and only when the run didn't early-return on ERRORs), each suppression that matched zero events emits an UnusedSuppression WARNING naming it and carrying its source location.
The new warning deliberately bypasses the suppression pipeline, so a stale suppression can never silence the warning about itself — a self-referential {id: "UnusedSuppression"} entry itself becomes a warned no-op (pinned by a test).
smithy validate prints WARNING-level events by default, so these surface out of the box without flag changes.
Happy to adjust any of these choices if maintainers would prefer different semantics.
Activity
JordonPhillips commentedon Nov 14, 2025
I actually looked into implementing this a while ago (sorry for not updating here). The way we implement suppressions doesn't leave room to pass along this sort of metadata, so it would require quite a bit of doing to get working. That said, I do still think it's a good idea that we should do.
Mihir-Rabari commentedon Sep 18, 2026
I'd like to pick this up. Plan: track which suppressions actually matched a validation event through the validator pipeline and emit a WARNING for the ones that silenced nothing. I'll keep the refactor contained and open a PR shortly.
Mihir-Rabari commentedon Sep 18, 2026
PR up: #3293, implementing this. Quick summary of the approach:
ModelBasedEventDecoratornow tracks which suppressions matched while it decorates events — trait suppressions tracked per trait value (so@suppress(["A", "B"])only warns about the value that matched nothing), metadata ones via a matched flag (thread-safe, since validators run in parallel).UnusedSuppressionWARNING naming it and carrying its source location.{id: "UnusedSuppression"}entry itself becomes a warned no-op (pinned by a test).smithy validateprints WARNING-level events by default, so these surface out of the box without flag changes.Happy to adjust any of these choices if maintainers would prefer different semantics.