fix(toolkit-lib): guard against a stack with no metadata in countAssemblyResults - #1952
Merged
mrgrain merged 1 commit intoSep 9, 2026
Conversation
sharonyajain
had a problem deploying
to
integ-approval
September 8, 2026 11:40 — with
GitHub Actions
Failure
aws-cdk-automation
enabled auto-merge
September 8, 2026 11:40
mrgrain
approved these changes
Sep 8, 2026
4 tasks
mrgrain
reviewed
Sep 9, 2026
mrgrain
requested changes
Sep 9, 2026
auto-merge was automatically disabled
September 9, 2026 09:37
Head branch was pushed to by a user without write access
sharonyajain
had a problem deploying
to
integ-approval
September 9, 2026 09:38 — with
GitHub Actions
Failure
mrgrain
approved these changes
Sep 9, 2026
…mblyResults
countAssemblyResults calls Object.values(stack.metadata) with no null guard while counting annotation error codes after synth. When a synthesized stack has no metadata (stack.metadata is undefined), Object.values(undefined) throws 'Cannot convert undefined or null to object', crashing Toolkit.synth() for otherwise-valid apps.
Guard with 'stack.metadata ?? {}' and add a regression test covering both the undefined-metadata case and the normal annotation-counting path.
sharonyajain
force-pushed
the
fix/count-assembly-results-metadata-null-guard
branch
from
September 9, 2026 09:56
03452ff to
8f1e39e
Compare
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
sharonyajain
temporarily deployed
to
run-tests
September 9, 2026 10:04 — with
GitHub Actions
Inactive
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1952 +/- ##
==========================================
- Coverage 91.33% 91.32% -0.02%
==========================================
Files 79 79
Lines 12164 12216 +52
Branches 1721 1724 +3
==========================================
+ Hits 11110 11156 +46
- Misses 1019 1025 +6
Partials 35 35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Sep 9, 2026
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.
countAssemblyResultscounts annotation error codes after synth by callingObject.values(stack.metadata)for every stack inassembly.stacksRecursively, with no null guard. When a synthesized stack has no metadata (stack.metadataisundefined),Object.values(undefined)throws:This crashes
Toolkit.synth()for otherwise-valid apps. It was reported downstream in AWS Amplify Gen 2, where a backend defining auth + a multi-model data schema + storage produces at least one nested stack whosemetadatais undefined: aws-amplify/amplify-backend#3316.This change guards the access with
stack.metadata ?? {}(one line) and adds a regression test covering both the undefined-metadata case and the normal annotation-counting path.Fixes #
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license