fix(pipeline): preserve dictionary subclasses when copying inputs - #13096
hahahahahayesyeseys wants to merge 1 commit into
Conversation
|
@hahahahahayesyeseys is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
|
|
Hi @hahahahahayesyeseys, thanks for your interest in contributing to Haystack! 🙏 This is an automated message to help us keep the review queue healthy. |
|
Heads-up so we don't land the same fix twice: I have #13094 open against the same problem (it touches Whichever of the two you merge, feel free to close the other — I'm happy for #13096 to supersede mine if you prefer it. Just leave a note and I'll close mine myself rather than leaving a duplicate open. |
Related Issues
Proposed Changes:
_deepcopy_with_exceptionsnow preserves dictionary subclasses when copying pipeline inputs. Plain dictionaries retain their current path; subclasses are copied while retaining their type and state, then recursively populated with copied values. This keeps behaviors such asdefaultdict.default_factory,OrderedDictordering, andCountersemantics.A regression test covers
OrderedDict,defaultdict, andCounter, including missing-key creation fordefaultdict. A release note documents the user-visible fix.How did you test it?
hatch run test:unit test/core/pipeline/test_utils.py -q --tb=short(28 passed)hatch run test:unit test/core/pipeline -q --tb=short(442 passed, 155 deselected)hatch run test:types haystack/core/pipeline/utils.py test/core/pipeline/test_utils.pyhatch run fmt-check haystack/core/pipeline/utils.py test/core/pipeline/test_utils.pyhatch run pre-commit run --files haystack/core/pipeline/utils.py test/core/pipeline/test_utils.py releasenotes/notes/preserve-dict-subclasses-67205ab6180303fa.yamlgit diff --checkNotes for the reviewer
The issue is open, unassigned, and has no linked branch or pull request at the review gate. The patch follows the issue's proposed copy/clear/repopulate approach and leaves the existing plain-dict fallback available for custom subclasses that reject copying. The full repository suite was not run.
This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist