Fix: pydantic migrations error handling #786
Merged
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.
When re syncing a node some message is not valid anymore,
Those message just getting re try and failing, the goal of this PR is to catch those error and reject
Related Clickup or Jira tickets : ALEPH-XXX
Self proofreading checklist
Changes
This pull request addresses error handling improvements and dependency updates in the message processing pipeline. The changes ensure better handling of serialization issues and expand exception handling for validation errors.
Error Handling Improvements:
src/aleph/db/accessors/messages.py
: Added a fix to ensure all values in thedetails
dictionary are JSON serializable, converting exceptions (e.g.,ValueError
) to strings when necessary. This prevents potential errors during logging or serialization.Dependency Updates:
src/aleph/schemas/pending_messages.py
: Added an import forpydantic_core
to handle validation exceptions from Pydantic's core library.Validation Error Handling:
src/aleph/schemas/pending_messages.py
: Updated theparse_message
function to catch bothpydantic.ValidationError
andpydantic_core.ValidationError
, ensuring broader coverage for validation-related exceptions.How to test
Explain how to test your PR.
Re sync a node
Print screen / video
Some message who got now rejected:
Errors:
Notes
We might need to fully re sync a node and ensure no important message go rejected and shouldn't.