-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(kernel): cannot pass decorated structs to kernel as "any" #997
Conversation
The title of this Pull Request does not conform with [Conventional Commits] guidelines. It will need to be adjusted before the PR can be merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
When a struct is serialized with a $jsii.struct decoration from a jsii host language and passed into a value typed `any`, the kernel ignored the decoration. This resulted in a malformed object passed to the javascript code. This fix undecorates the object and continues to deserialize it as `any`. Fixes aws/aws-cdk#5066
cee5b0b
to
684a368
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't approve as I'm tagged as the author here... But ✅
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
When moving out of callbacks, the result was not turned into a reference before being passed out to the jsii kernel, causing TypeErrors when attempting to turn structs (and probably other non-primitive types) to JSON. Discovered while attempting to reproduce #1003, which can no longer trigger as it depended on returning a Struct through and `any` and being hit with the bug fixed in #997... the fix also removed the conditions that make leveraging the cause possible (or at the very least I could not come up with a reproduction, and have verified that the original bug report no longer reproduces once #997 is in). That being said, still introduced the necessary changes to address the cause by properly discovering interfaces and adding the relevant overrides filtering, as this may improve the performance and reliability of the jsii runtime for Java. Fixes #1003
When moving out of callbacks, the result was not turned into a reference before being passed out to the jsii kernel, causing TypeErrors when attempting to turn structs (and probably other non-primitive types) to JSON. Discovered while attempting to reproduce #1003, which can no longer trigger as it depended on returning a Struct through and `any` and being hit with the bug fixed in #997... the fix also removed the conditions that make leveraging the cause possible (or at the very least I could not come up with a reproduction, and have verified that the original bug report no longer reproduces once #997 is in). That being said, still introduced the necessary changes to address the cause by properly discovering interfaces and adding the relevant overrides filtering, as this may improve the performance and reliability of the jsii runtime for Java. Fixes #1003
* fix(python): correctly handle structs out of callbacks When moving out of callbacks, the result was not turned into a reference before being passed out to the jsii kernel, causing TypeErrors when attempting to turn structs (and probably other non-primitive types) to JSON. Discovered while attempting to reproduce #1003, which can no longer trigger as it depended on returning a Struct through and `any` and being hit with the bug fixed in #997... the fix also removed the conditions that make leveraging the cause possible (or at the very least I could not come up with a reproduction, and have verified that the original bug report no longer reproduces once #997 is in). That being said, still introduced the necessary changes to address the cause by properly discovering interfaces and adding the relevant overrides filtering, as this may improve the performance and reliability of the jsii runtime for Java. Fixes #1003 * improve documentation & test coverage * fixup * inline-fy doc * remove spurious 'final' * Add missing fget * add type annotation to make MyPy happy
When a struct is serialized with a $jsii.struct decoration from a jsii host language and passed into a value typed
any
, the kernel ignored the decoration. This resulted in a malformed object passed to the javascript code.This fix undecorates the object and continues to deserialize it as
any
.Fixes aws/aws-cdk#5066
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.