Bug: S3RecordModel drops lifecycleEventData and replicationEventData
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
Empieza leyendo S3RecordModel y los campos de datos de eventos adyacentes; después, inspecciona tests/events/s3EventLifecycleTransition.json y las pruebas del parser para registros de S3. Añade cobertura para conservar ambos campos de datos del evento, incluido un ejemplo de replicación adecuado. El trabajo estará terminado cuando el análisis de eventos S3 y S3-to-SQS conserve los datos y pasen las pruebas relevantes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected Behaviour
S3RecordModel keeps lifecycleEventData and replicationEventData when S3 sends them, the same way it keeps glacierEventData and intelligentTieringEventData. They hold the main detail of those events, like the storage class an object moved to or why a replication failed. The event message structure docs list both, and there are samples for Lifecycle transition and replication events.
Current Behaviour
The model doesn't declare either key, and Pydantic ignores keys it doesn't know, so these events parse without an error but the data isn't on the parsed record. The repo's own tests/events/s3EventLifecycleTransition.json has lifecycleEventData, and it's gone after parsing. S3SqsEventNotificationModel reuses S3Model, so S3 to SQS events lose it too.
The TypeScript parser added both in aws-powertools/powertools-lambda-typescript#5924.
Code snippet
import json
from aws_lambda_powertools.utilities.parser import parse
from aws_lambda_powertools.utilities.parser.models import S3Model
with open("tests/events/s3EventLifecycleTransition.json") as f:
event = json.load(f)
print("in event:", "lifecycleEventData" in event["Records"][0])
record = parse(event=event, model=S3Model).Records[0]
print("on parsed record:", "lifecycleEventData" in record.model_dump())
in event: True
on parsed record: False
Possible Solution
Add both as optional fields next to intelligentTieringEventData, with Field(description=...) like the rest of the model:
class S3EventRecordLifecycleTransitionEventData(BaseModel):
destinationStorageClass: str
class S3EventRecordLifecycleEventData(BaseModel):
transitionEventData: S3EventRecordLifecycleTransitionEventData
class S3EventRecordReplicationEventData(BaseModel):
replicationRuleId: str | None = None
destinationBucket: str | None = None
s3Operation: str | None = None
requestTime: str | None = None
failureReason: str | None = None
# In S3RecordModel
lifecycleEventData: S3EventRecordLifecycleEventData | None = None
replicationEventData: S3EventRecordReplicationEventData | None = None
Every replication field is optional because the docs only show the failed replication event, the same call the TypeScript fix made. This only adds fields, so nothing that parses today changes.
I'm happy to send a PR with tests and a replication fixture if that sounds good.
Steps to Reproduce
Run the snippet above from the repo root. The replication sample from the docs page loses replicationEventData the same way.
Powertools for AWS Lambda (Python) version
3.40.0
AWS Lambda function runtime
3.13
Packaging format used
PyPi
- Lenguaje dominante
- Python
- Estrellas
- 3.3k
- Forks
- 511
- Merge medio
- 3 d 8 h
- PR fusionados (30 d)
- 103
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws-powertools/powertools-lambda-python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
aws-powertools/powertools-lambda-python#8801 ·
Los mantenedores suelen responder en 1 día
-
Bug: child Logger without a level ignores its parent's log level since 3.6.0Posiblemente ocupada @saimcyber la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
aws-powertools/powertools-lambda-python#8778 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocationPosiblemente ocupada @lechakrawarthy la tomó hace 11 días. Abiertobug good first issue help wanted idempotency
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
aws-powertools/powertools-lambda-python#8728 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Bug: Redis layer fails the invocation instead of retrying when a record expires between SET NX and GETPosiblemente ocupada @coughlmao la tomó hace 11 días. Abiertobug good first issue help wanted idempotency
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
aws-powertools/powertools-lambda-python#8727 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Bug: Redis orphan lock timeout ignores expires_after_seconds and is always 10 secondsPosiblemente ocupada @CJstate la tomó hace 11 días. Abiertobug good first issue help wanted idempotency
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
aws-powertools/powertools-lambda-python#8726 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de aws-powertools/powertools-lambda-python
Issues similares
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Huerte/algo-solutions-python#254 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
MichaelYcJo/SpecSeal#1543 ·
-
size/s
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
sipyourdrink-ltd/bernstein#7179 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted python up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
andrewsiah/agentswarm-data-tasks#309 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día