Repository navigation
Conversation
…inesis stream models
|
This branch has not been deployed
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.



Issue number: closes #8941
Summary
Changes
DynamoDBStreamModelandKinesisDataStreamModelonly definedRecords, so Pydantic silently dropped the optional Lambda tumbling window fields (window,state,shardId,eventSourceARN,isFinalInvokeForWindow,isWindowTerminatedEarly) present on DynamoDB Streams and Kinesis Data Streams invocations when tumbling windows are enabled.aws_lambda_powertools/utilities/parser/models/tumbling_window.pywith:TumblingWindowModel(start/enddatetimes)TumblingWindowEventModelbase model holding the six optional tumbling window fields, all defaulting toNoneDynamoDBStreamModelandKinesisDataStreamModelnow inheritTumblingWindowEventModelTumblingWindowModel(andTumblingWindowEventModel) fromaws_lambda_powertools.utilities.parser.modelsFixes #8941
User experience
Before: parsing a tumbling window event with either model dropped the window fields (
hasattr(event, "window")wasFalse).After: the fields are parsed and exposed, e.g.
event.window.start,event.state,event.shardId,event.isFinalInvokeForWindow. Non-tumbling events are unaffected — all new fields default toNone.Verification
developwithAttributeError: ... object has no attribute 'window', and pass with the fix (red-proof).tests/unit/parser/_pydantic/test_dynamodb.pyandtests/unit/parser/_pydantic/test_kinesis.pyparse the existingtests/events/dynamoStreamTumblingWindowEvent.jsonandtests/events/kinesisStreamTumblingWindowEvent.jsonfixtures and assert every tumbling window field, plus assert all fields areNonefor regular (non-tumbling) stream events.tests/unit/parser/_pydantic/test_dynamodb.py,test_kinesis.py,tests/functional/parser/test_model_imports.py,tests/functional/parser/test_parser.py— 92 passed;tests/unit/data_classes/required_dependencies/test_dynamo_db_stream_event.pyandtest_kinesis_stream_event.py— 14 passed.ruff format --checkandruff checkclean on all changed files.mypyreports no errors in the changed files (the only errors are pre-existing missingboto3/botocorestubs in unrelated files, also present on unmodifieddevelop).docs/utilities/parser.mdlists these models by name only, with no field-level detail to update, and no example covers these fields.I used an AI coding assistant to help write this fix and the tests, and I reviewed the behaviour and ran all verification myself.
Signed-off-by: Azmi Muwahid azmimuwahid@gmail.com
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.