Repository navigation
fix: let Pipeline.connect match Union and Literal members in any order - #13510
Merged
sjrl merged 1 commit intoNov 6, 2026
Merged
Conversation
Contributor
|
@Revinand is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Closed
1 task done
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
Proposed Changes:
_strict_types_are_compatiblecompared the members of twoUniontypes, and the values of twoLiteraltypes, by position. A connection passed only when each sender member matched the receiver member at the same position:str | Noneconnected tostr | None | int, but not tostr | int | None.A
Unionsender is now compatible when each of its members is compatible with the receivingUnion, which reuses the existing branch for a non-union sender. ALiteralsender is compatible when all of its values are in the receivingLiteral. A release note describes the change.How did you test it?
New cases in
test/core/test_type_utils.py:Literal["b", "c"]toLiteral["a", "b", "c"],Optional[str]toUnion[int, str, None],str | Nonetostr | int | None, andlist[Path | ByteStream]tolist[str | Path | ByteStream]. All four fail on main. The existing reverse-direction test checks each of them the other way round, where they stay incompatible.Literal["a", "x"]toLiteral["a", "b", "c"]. It fails if theLiteralcheck accepts a sender with only some of its values in the receiver; the existing partially overlapping union cases do the same for theUnioncheck.test/corepasses (1893 passed), excepttest_show_in_notebook, which needs IPython, not installed in my environment. It fails the same way on main. mypy ontype_utils.pyand the pre-commit hooks pass.Notes for the reviewer
One existing case changes.
test_partially_overlapping_unions_are_not_compatible_strictusedint | booltoint | str.boolis a subclass ofint, and the same file treatsbooltointas compatible (different-primitives), which makes every member ofint | boolfitint | stronce members are checked one by one. I replacedboolwithfloatin both spellings to keep the partial overlap.FileTypeRouterdeclareslist[str | Path | ByteStream]outputs to work around this bug. With this fix it could declarelist[Path | ByteStream]; I left that out to keep this PR to the type check.This PR was fully generated with an AI assistant. I have reviewed the changes and run the relevant tests.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.