aws / aws/bedrock-agentcore-sdk-python
Type inconsistency in EventMetadataFilter TypedDict
- 主要言語
- Python
- スター
- 761
- フォーク
- 147
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 7
説明
## Description
In `src/bedrock_agentcore/memory/models/filters.py`, the `EventMetadataFilter` TypedDict defines `operator: OperatorType` (an enum), but the actual value stored is a string.
```python
class EventMetadataFilter(TypedDict):
left: LeftExpression
operator: OperatorType # Type says enum
right: Optional[RightExpression]
```
The `build_expression` method correctly converts the enum to a string:
```python
filter = {"operator": operator.value} # Stores string, not enum
```
## Ramifications
1. **Type hint is misleading** - The TypedDict suggests `operator` holds an `OperatorType` enum, but it actually holds a string like `"EQUALS_TO"`
2. **Potential runtime error** - If a user follows the type hint and passes an enum directly (without using `build_expression`), boto3 will fail to serialize it since enums are not JSON serializable
3. **Type checker inconsistency** - Static type checkers like mypy may produce warnings or miss actual type errors due to this mismatch
コントリビューションガイド
調査の方向性
src/bedrock_agentcore/memory/models/filters.py で、保存前に演算子を変換する build_expression と併せて EventMetadataFilter を読み始めます。アノテーションがシリアライズされた値と一致していることを確認し、その後、関連する Python テストと型チェックを実行します。TypedDict とランタイム表現が一致し、呼び出し元を誤解させなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend-api-design
- issue の種類
- バグ
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100