Repository navigation
Conversation
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
soujasK
force-pushed
the
fix/batch-model-conversion-error
branch
from
October 26, 2026 10:41
c3afb78 to
e316530
Compare
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Issue number: closes #8660
Summary
Changes
When converting a record to the customer's model raised something other than the model's
ValidationError(Pydantic v2 only wrapsValueError/AssertionErrorfrom validators, so e.g. aKeyErrorescapes as-is),BatchProcessor._process_recordandAsyncBatchProcessor._async_process_recordcalledfailure_handler(record=data)withdatastillNone.Noneended up infail_messages, and_clean()then crashed in_collect_*_failureswithAttributeError: 'NoneType' object has no attribute 'message_id'.data is Nonein theexceptblock means the conversion itself failed, so those records now go through the existing_register_model_validation_error_recordpath from #2091, which converts the raw record to the event source data class and registers it with the original exception.Tests: a model whose
field_validatorraisesKeyErrorfor one record of three, for the sync and async processors. Both failed with theAttributeErrorbefore the change and pass after it;batch.exceptionskeeps the originalKeyError.tests/functional/batchpasses on Linux (Python 3.12), along with ruff, mypy, ty, bandit and xenon.User experience
Before: one malformed record fails the whole invocation with an
AttributeErrorthat hides the real error, and every record in the batch is retried, including the ones that already succeeded.After: the malformed record is reported in
batchItemFailures(as an event source data class, as documented for early model failures) and the rest of the batch is processed normally.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.