Skip to content

fix(pipeline): preserve dictionary subclasses when copying inputs - #13096

Closed
hahahahahayesyeseys wants to merge 1 commit into
deepset-ai:mainfrom
hahahahahayesyeseys:fix/issue-13092-dict-subclass
Closed

hahahahahayesyeseys wants to merge 1 commit into
deepset-ai:mainfrom
hahahahahayesyeseys:fix/issue-13092-dict-subclass

Conversation

@hahahahahayesyeseys

Copy link
Copy Markdown

Related Issues

Proposed Changes:

_deepcopy_with_exceptions now 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 as defaultdict.default_factory, OrderedDict ordering, and Counter semantics.

A regression test covers OrderedDict, defaultdict, and Counter, including missing-key creation for defaultdict. 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.py
  • hatch run fmt-check haystack/core/pipeline/utils.py test/core/pipeline/test_utils.py
  • hatch run pre-commit run --files haystack/core/pipeline/utils.py test/core/pipeline/test_utils.py releasenotes/notes/preserve-dict-subclasses-67205ab6180303fa.yaml
  • git diff --check

Notes 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

  • I have read contributors guidelines/code of conduct.
  • I have updated the related issue with the proposed changes.
  • I have added unit tests and updated the release note.
  • The PR title uses the conventional commit format.
  • The changed code is documented by the release note and existing API documentation remains accurate.
  • Pre-commit hooks pass.

@hahahahahayesyeseys
hahahahahayesyeseys requested a review from a team as a code owner October 3, 2026 13:25
@hahahahahayesyeseys
hahahahahayesyeseys requested review from julian-risch and removed request for a team October 3, 2026 13:25
@vercel

vercel Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

@hahahahahayesyeseys is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Hi @hahahahahayesyeseys, thanks for your interest in contributing to Haystack! 🙏

⚠️ Issue #13092 is already being addressed by open pull request(s) #13094. Before opening a PR for an issue, please check whether a PR is already linked to it, and consider contributing to the existing PR instead. We may close duplicate PRs to keep the review queue manageable.

This is an automated message to help us keep the review queue healthy.

@inchang-ing

Copy link
Copy Markdown

Heads-up so we don't land the same fix twice: I have #13094 open against the same problem (it touches haystack/core/pipeline/utils.py with the same +11/-2 change: copy(obj) + refill to keep the concrete dict subclass, plain dict keeps the current comprehension path). Mine predates this one, is CLA-signed and CI-green.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_deepcopy_with_exceptions turns dict subclasses (defaultdict, OrderedDict, Counter) into plain dict, so pipeline inputs lose their type

3 participants