-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(assertions): incorrect assertions when >1 messages on a resource (#…
…18948) Previously we relied on the message id as a key to the internal `messages` object we maintain. However, the id is the construct path, and this is not unique if there are multiple messages attached to a particular construct. This would result in erroneous behavior from `Annotations`, as the newer message would overwrite the old one. The fix here is to not depend on the id as the key at all. We don't need it, and it's there just to mold the messages into an object that `matchSection` can handle. Instead, we can index on `index`, and suddenly all our problems are solved. I also redacted the stack trace from the `findXxx APIs; I don't see this as a breaking change because it is unfathomable that anyone is depending on the stack trace output, which is a long list of gibberish. Fixes #18840. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
4 changed files
with
106 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { SynthesisMessage } from '@aws-cdk/cx-api'; | ||
|
||
export type Messages = { | ||
[logicalId: string]: SynthesisMessage; | ||
[key: string]: SynthesisMessage; | ||
} |
This file contains 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
This file contains 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