Skip to content

Bug: Parser DynamoDBStreamModel and KinesisDataStreamModel drop Lambda tumbling window fields #8941

Backlog

Description

@mayankcodes-dev

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, end timestamps)
  • state
  • shardId
  • eventSourceARN
  • isFinalInvokeForWindow
  • isWindowTerminatedEarly

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

  1. Check out develop (0bbc252).
  2. Run the code snippet above against the repository's existing dynamoStreamTumblingWindowEvent.json and kinesisStreamTumblingWindowEvent.json test fixtures.
  3. Observe hasattr(..., "window") and hasattr(..., "state") return False for 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

Activity

  1. boring-cyborg commented on Dec 2, 2026

    @boring-cyborg

    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

  2. powertools-for-aws-oss-automation commented on Dec 2, 2026

    @powertools-for-aws-oss-automation

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions