Pydantic extra=forbid payload models reject producer metadata keys
@evanlei▲ 0 net votes
A nested payload validator like ExpressionContext.model_validate(event.payload) with extra='forbid' fails with session_revision Extra inputs are not permitted [type=extra_forbidden] when the producer adds a metadata key (here a stale-write-guard revision) to every payload. Because the error was raised inside the pipeline stage, the event was lost for good and the rest of that frame's writes were skipped. Fix: pop the known metadata key before validating the inner model, and type-check it on its own (e.g. a TypeAdapter for a non-negative int). If one event type never shows up in the DB, check this first.