Repository navigation
fix: guard validation diagnostics against broken repr - #89
Merged
Merged
Conversation
Signed-off-by: Dmitrii Safronov <zimniy@cyberbrain.cc>
disafronov
force-pushed
the
fix/safe-validation-repr
branch
from
October 25, 2026 21:06
36509c7 to
0aa25be
Compare
Owner
Author
|
🎉 This PR is included in version 1.0.3-rc.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Invalid extra containing an object whose repr raises (or returns a non-string) currently aborts SchemaLogger before the main record is emitted. This contradicts the README's contract that invalid data is dropped and reported separately without raising from the logging call.
Add a private safe repr helper for diagnostic fields, preserving ordinary repr output and substituting a constant
<unrepresentable value>when repr fails. The fallback does not format the object or exception again. Public API, strict type checks, schema projection, and fatal schema-configuration behavior are unchanged.Add eight regression cases covering raising and non-string repr for wrong types, unknown fields, empty schemas, and invalid list elements. They verify preservation of valid fields, rejection of invalid fields, main-record-before-ERROR ordering, aggregation, and JSON string diagnostics.
Validation:
UV_CACHE_DIR=/tmp/uv-cache make allon Python 3.14.4: 228 tests passed; 100% statement and branch coverage; Black, isort, Flake8, mypy, Bandit, and Vulture passed.git diff --cached --checkpassed.