fix: restore subclass dispatch for _apply_filter in ServiceMetadataProvider#3067
Open
Youssef-SH wants to merge 1 commit into
Open
fix: restore subclass dispatch for _apply_filter in ServiceMetadataProvider#3067Youssef-SH wants to merge 1 commit into
Youssef-SH wants to merge 1 commit into
Conversation
ServiceMetadataProvider._get_object_internal calls MetadataProvider._apply_filter(...) directly, which bypasses subclass overrides. Switch to cls._apply_filter(...) to restore correct dispatch while preserving existing behavior. Adds a regression test to ensure subclass overrides are used.
Contributor
Greptile SummaryThis PR fixes a long-standing subclass dispatch bug in Key points:
Confidence Score: 5/5
Important Files Changed
Reviews (1): Last reviewed commit: "fix: use subclass overrides of _apply_fi..." | Re-trigger Greptile |
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.
Restore subclass dispatch for
_apply_filterinServiceMetadataProvider.ServiceMetadataProvider._get_object_internalcallsMetadataProvider._apply_filter(...)directly, which bypasses subclass overrides.Switch to
cls._apply_filter(...)to preserve current behavior for built-inproviders while allowing subclasses to override filtering as expected.
Adds a regression test covering both single-object and collection paths.
PR Type
Summary
Restore correct subclass dispatch for
_apply_filterinServiceMetadataProvider.Issue
Fixes #
Reproduction
Covered by the added unit test in
test/unit/test_service_metadata_provider.py.Root Cause
ServiceMetadataProvider._get_object_internalcalls_apply_filterthrough thebase class (
MetadataProvider._apply_filter(...)) instead ofcls, so subclassoverrides are ignored.
Why This Fix Is Correct
Using
cls._apply_filter(...)restores normal method dispatch without changingbehavior for built-in providers, since none override
_apply_filter.Failure Modes Considered
_apply_filternow behave as expected.Tests
Non-Goals
No changes to filtering logic or provider behavior beyond dispatch.
AI Tool Usage
Used for review and validation. All code and tests were verified manually.