FIX Metadata routing: register remainder when remainder="passthrough"#33665
Merged
jeremiedbb merged 11 commits intoscikit-learn:mainfrom Apr 15, 2026
Merged
Conversation
jeremiedbb
reviewed
Apr 1, 2026
Member
jeremiedbb
left a comment
There was a problem hiding this comment.
Thanks for the PR @AnneBeyer
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
…om/AnneBeyer/scikit-learn into fix_metadata_remainder_passthrough
adrinjalali
reviewed
Apr 14, 2026
Comment on lines
+2928
to
+2932
| router = ct.get_metadata_routing() | ||
| if remainder == "drop": | ||
| assert "remainder" not in router._route_mappings | ||
| else: | ||
| assert "remainder" in router._route_mappings |
Member
There was a problem hiding this comment.
I don't think you need this, the regression test is that fit_transform shouldn't raise a KeyError. Using this private attribute here in the test makes it fragile.
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.
Reference Issues/PRs
Closes #33614
What does this implement/fix? Explain your changes.
When
remainder="passthrough", it is now still registered in theMetadataRouter, even though it does not consume any meta data. (See the issue for details.)I added a test for all types of remainder values I could think of, which goes a bit beyond the "passthrough" issue here, but it helped me understand some of the ideas behind metadata routing. I'm happy to simplify it, though, if it is too much here.
@StefanieSenger @jinlow
AI usage disclosure
I used AI assistance for:
Any other comments?