aws / aws/bedrock-agentcore-sdk-python
Type inconsistency in EventMetadataFilter TypedDict
- Lenguaje dominante
- Python
- Estrellas
- 761
- Forks
- 147
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 7
Descripción
## 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
Guía de contribución
Línea de trabajo
Comienza en src/bedrock_agentcore/memory/models/filters.py leyendo EventMetadataFilter junto con build_expression, que convierte el operador antes de almacenarlo. Verifica que la anotación coincida con el valor serializado y, después, ejecuta las pruebas de Python y las comprobaciones de tipos pertinentes; se considera terminado cuando TypedDict y la representación en tiempo de ejecución coinciden sin inducir a error a quienes realizan las llamadas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend-api-design
- Tipo de issue
- Error
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 55/100