Repository navigation
fix: preserve ByteStream subclasses during deserialization - #13180
JimmyWang0417 wants to merge 1 commit into
Conversation
|
@JimmyWang0417 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
Confirmed the bug on current main: |
Thanks for independently reproducing this and running the broader checks! I appreciate the extra validation of the subclass round-trip. |
|
You're welcome — the subclass round-trip was the case worth pinning down, and the cls(...) fix is the right shape. Nice work. |
Related Issues
No existing issue. Reproduced through a subclass serialization round trip.
Proposed Changes
CustomByteStream.from_dict(original.to_dict())currently returns aByteStream, even whenoriginalis aCustomByteStream. Useclsto construct the result, matchingfrom_string()andfrom_file_path().Add a subclass round-trip regression test, clarify the return-value docstring, and include a release note.
How did you test it?
Checks ran through Hatch with Python 3.12. The default environment had the temporary test/type-check dependencies installed; the full optional integration dependency set was not installed.
hatch -e default run python -m pytest test/dataclasses/test_byte_stream.py -q: 37 passed.hatch -e default run fmt-check haystack/dataclasses/byte_stream.py test/dataclasses/test_byte_stream.py: passed.hatch -e default run mypy --follow-imports=silent haystack/dataclasses/byte_stream.py test/dataclasses/test_byte_stream.py: passed.git diff --check: passed.Notes for the reviewer
The serialized fields and defaults are unchanged. This PR was fully generated with an AI assistant. The assistant reviewed the complete diff and ran the checks listed above.
Checklist