Repository navigation
Description
Expected Behaviour
DynamoDBStreamModel and KinesisDataStreamModel in aws_lambda_powertools.utilities.parser.models should parse and expose the optional AWS Lambda tumbling window fields sent on DynamoDB Streams and Kinesis Data Streams invocations when tumbling windows are enabled:
window(start,endtimestamps)stateshardIdeventSourceARNisFinalInvokeForWindowisWindowTerminatedEarly
aws_lambda_powertools.utilities.data_classes already supports these fields on DynamoDBStreamEvent and KinesisStreamEvent, and this repository already includes the tests/events/dynamoStreamTumblingWindowEvent.json and tests/events/kinesisStreamTumblingWindowEvent.json fixtures for them.
Current Behaviour
Both DynamoDBStreamModel (aws_lambda_powertools/utilities/parser/models/dynamodb.py) and KinesisDataStreamModel (aws_lambda_powertools/utilities/parser/models/kinesis.py) only define Records. Because Pydantic models ignore extra fields by default, parsing a DynamoDB or Kinesis tumbling window event silently drops window, state, shardId, eventSourceARN, isFinalInvokeForWindow, and isWindowTerminatedEarly.
Code snippet
from aws_lambda_powertools.utilities.parser.models import (
DynamoDBStreamModel,
KinesisDataStreamModel,
)
from tests.functional.utils import load_event
ddb_event = DynamoDBStreamModel(**load_event("dynamoStreamTumblingWindowEvent.json"))
print("ddb window:", hasattr(ddb_event, "window"), "state:", hasattr(ddb_event, "state"))
kinesis_event = KinesisDataStreamModel(**load_event("kinesisStreamTumblingWindowEvent.json"))
print("kinesis window:", hasattr(kinesis_event, "window"), "state:", hasattr(kinesis_event, "state"))Possible Solution
Add a shared optional TumblingWindowModel (start: datetime, end: datetime) and optional base fields (window, state: dict[str, Any] | None, shardId, eventSourceARN, isFinalInvokeForWindow, isWindowTerminatedEarly, all defaulting to None) in a shared model module (for example aws_lambda_powertools/utilities/parser/models/tumbling_window.py) inherited by both DynamoDBStreamModel and KinesisDataStreamModel, and export TumblingWindowModel from aws_lambda_powertools.utilities.parser.models.
Because every new field is optional and defaults to None, non-tumbling stream payloads remain unaffected. I have a verified fix and unit tests ready and would be happy to submit a PR once triaged.
I verified this issue and prepared the reproduction locally with the help of an AI coding assistant, and reviewed all behavior myself.
Steps to Reproduce
- Check out
develop(0bbc252). - Run the code snippet above against the repository's existing
dynamoStreamTumblingWindowEvent.jsonandkinesisStreamTumblingWindowEvent.jsontest fixtures. - Observe
hasattr(..., "window")andhasattr(..., "state")returnFalsefor both parsed models.
Did you run the reproduction yourself?
Yes, I ran it and saw the failure
Powertools for AWS Lambda (Python) version
develop @ 0bbc252 (3.41.0)
AWS Lambda function runtime
3.14
Packaging format used
PyPi
Debugging logs
DynamoDBStreamModel(**load_event("dynamoStreamTumblingWindowEvent.json")) -> has window: False, has state: False
KinesisDataStreamModel(**load_event("kinesisStreamTumblingWindowEvent.json")) -> has window: False, has state: False
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTriage
Activity
boring-cyborg commentedon Dec 2, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
powertools-for-aws-oss-automation commentedon Dec 2, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation