Skip to content

🏗️ Architect: Refactor ParamMixin to use Strategy Pattern#683

Merged
fderuiter merged 3 commits intomainfrom
refactor/param-processor-strategy-5030683434347259592
Feb 20, 2026
Merged

🏗️ Architect: Refactor ParamMixin to use Strategy Pattern#683
fderuiter merged 3 commits intomainfrom
refactor/param-processor-strategy-5030683434347259592

Conversation

@fderuiter
Copy link
Copy Markdown
Owner

This PR refactors the parameter processing logic in ParamMixin to use the Strategy Pattern.

Previously, endpoints like UsersEndpoint and RecordsEndpoint overrode a protected method _extract_special_params to handle endpoint-specific filtering logic (e.g., include_inactive). This approach relied on inheritance and side effects (mutating the input dictionary).

The new approach:

  1. Defines a ParamProcessor protocol.
  2. Delegates parameter processing to a strategy class (PARAM_PROCESSOR_CLS).
  3. Implementations (UsersParamProcessor, RecordsParamProcessor) return a tuple of (cleaned_filters, special_params) without side effects on the input.

This change enhances testability and decoupling, following SOLID principles.


PR created automatically by Jules for task 5030683434347259592 started by @fderuiter

Replaced inheritance-based `_extract_special_params` hook with `ParamProcessor` strategy.
- Defined `ParamProcessor` protocol in `imednet/core/protocols.py`.
- Created `DefaultParamProcessor` in `imednet/core/endpoint/strategies.py`.
- Refactored `ParamMixin` to use `PARAM_PROCESSOR_CLS`.
- Implemented `UsersParamProcessor` and `RecordsParamProcessor` in respective endpoints.
- Updated `UsersEndpoint` and `RecordsEndpoint` to use the new strategies.

This improves modularity, type safety, and adheres to the Open/Closed Principle.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

fderuiter and others added 2 commits February 20, 2026 18:42
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Explicitly inherit DefaultParamProcessor from ParamProcessor protocol to resolve ruff F401 error.
This also clarifies that the class implements the protocol.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@fderuiter fderuiter marked this pull request as ready for review February 20, 2026 18:53
@fderuiter fderuiter merged commit 8b4146a into main Feb 20, 2026
13 checks passed
@fderuiter fderuiter deleted the refactor/param-processor-strategy-5030683434347259592 branch February 20, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant