Skip to content

Conversation

@ditikrushna
Copy link

Motivation

The DynamoDB Streams DescribeStream API accepts an optional ShardFilter parameter (e.g. Type: CHILD_SHARDS, ShardId) but LocalStack ignored it and always returned all shards. Callers (e.g. stream consumers that need to discover child shards after a parent shard closes) could not use the API as documented by AWS.

This PR implements support for the CHILD_SHARDS ShardFilter type so that when ShardFilter is provided with Type: CHILD_SHARDS and a ShardId, the response contains only shards whose ParentShardId matches the given shard ID.

Changes

  • localstack-core/localstack/services/dynamodbstreams/provider.py
    • In describe_stream, after applying ExclusiveStartShardId pagination, apply ShardFilter when present.
    • When ShardFilter.Type is CHILD_SHARDS and ShardFilter.ShardId is set, filter the returned shards to only those whose ParentShardId equals the given shard ID.

Tests

  • tests/aws/services/dynamodbstreams/test_dynamodb_streams.py
    • Added test_describe_stream_with_shard_filter (@markers.aws.only_localstack):
      • Creates a DynamoDB table with streams enabled.
      • Calls describe_stream without filter to get initial shards.
      • Calls describe_stream with ShardFilter={"Type": "CHILD_SHARDS", "ShardId": parent_shard_id}.
      • Asserts the response contains only shards whose ParentShardId equals the given ID (or an empty list when there are no children).
      • Cleans up the table.

Related


- Implement CHILD_SHARDS ShardFilter in DescribeStream (v1/Kinesis provider)
- Normalize ParentShardId to DynamoDB format for filter and response consistency
- Add test_describe_stream_with_shard_filter
- Implement CHILD_SHARDS ShardFilter in DescribeStream (v1/Kinesis provider)
- Add test_describe_stream_with_shard_filter
Copy link
Contributor

@localstack-bot localstack-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.

@localstack-bot
Copy link
Contributor

localstack-bot commented Jan 31, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ditikrushna
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

localstack-bot added a commit that referenced this pull request Jan 31, 2026
@ditikrushna
Copy link
Author

Hi @giograno , please take a look and let me know your thoughts. Thanks

@alexrashed alexrashed requested a review from giograno February 4, 2026 11:14
@alexrashed alexrashed added semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes labels Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DynamoDB Streams: DescribeStream does not support ShardFilter parameter

4 participants