Repository navigation
fix: keep init parameters when serializing RecursiveDocumentSplitter and TextCleaner - #12738
Merged
sjrl merged 2 commits intoSep 14, 2026
Merged
Conversation
…and TextCleaner Neither class had to_dict, so serialization fell back to reading attributes named after the init parameters and used the defaults when they were missing. RecursiveDocumentSplitter stores split_unit as split_units and TextCleaner stores its options in underscored attributes, so a pipeline saved and loaded again got a word splitter and a cleaner that does nothing. Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
|
@alanhuangyoo is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
Hi @alanhuangyoo, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
sjrl
reviewed
Sep 14, 2026
Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
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.
Related Issues
component_to_dictfallback.Proposed Changes:
RecursiveDocumentSplitterandTextCleanerhave noto_dict, socomponent_to_dictreads an attribute named after each init parameter. When that attribute doesn't exist, it quietly uses the signature default.RecursiveDocumentSplitterstoressplit_unitasself.split_units, so it always serializessplit_unit: word. AfterPipeline.dumps()/loads(), a splitter created withsplit_unit="char"or"token"counts words instead.TextCleanerkeeps all four options in underscored attributes, so every option serializes as its default and a reloaded cleaner returns the texts unchanged.The existing
test_run_serialization_in_pipelinecompares two dumps, which are both wrong in the same way, so it passes.Both classes now get a
to_dictthat writes the stored values under the init parameter names. Deserialization still goes throughdefault_from_dict, and the attribute names stay as they are.How did you test it?
test_serialization_keeps_split_unitandtest_serialization_keeps_init_parameterscheck the serialized init parameters and that a pipeline loaded from YAML gives the same output as the original. Both fail on main.pytest -m "not integration" test/components/preprocessors test/core/pipeline test/core/test_serialization.py: 834 passed, 22 failed. The failures are the same on main: 21 need the NLTKpunkt_tabdata, which isn't downloaded here, andtest_show_in_notebookneeds IPython.ruff check,ruff format --check, andmypyon the four changed Python files pass.Notes for the reviewer
I checked every
@componentclass inhaystack/without ato_dictfor the same mismatch between init parameter and attribute names. Apart from theRepeatsample component inhaystack/testing, these two are the only ones.Checklist
This PR was fully generated with an AI assistant (Claude Code), including the fix, the tests and this description. The checks above are the ones that were actually run.
🤖 Generated with Claude Code