ποΈ Architect: Enforce Explicit Strategy over Implicit Config for Endpoints#771
ποΈ Architect: Enforce Explicit Strategy over Implicit Config for Endpoints#771
Conversation
Design Change: Replaced implicit boolean flags (`_pop_study_filter`) and exception class overrides (`_missing_study_exception`) with an explicit Strategy pattern (`STUDY_KEY_STRATEGY`). DRY Gains: Removed conditional branching in `ParamMixin.study_key_strategy` property, leaning completely on the explicit presence of `self.STUDY_KEY_STRATEGY`. Solidity: Enforces "Explicit > Implicit". The logic for handling study keys is now immediately visible at the endpoint definition level via instances like `PopStudyKeyStrategy`. Breaking Changes: None. The default fallback in `ParamMixin` when `requires_study_key` is True and no strategy is set maps exactly to the previous default behavior. Existing endpoints maintain their exact exception classes (`KeyError` or `ValueError`). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Design Change: Replaced implicit boolean flags (`_pop_study_filter`) and exception class overrides (`_missing_study_exception`) with an explicit Strategy pattern (`STUDY_KEY_STRATEGY`). DRY Gains: Removed conditional branching in `ParamMixin.study_key_strategy` property, leaning completely on the explicit presence of `self.STUDY_KEY_STRATEGY`. Solidity: Enforces "Explicit > Implicit". The logic for handling study keys is now immediately visible at the endpoint definition level via instances like `PopStudyKeyStrategy`. Breaking Changes: None. The default fallback in `ParamMixin` when `requires_study_key` is True and no strategy is set maps exactly to the previous default behavior. Existing endpoints maintain their exact exception classes (`KeyError` or `ValueError`). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This PR refactors how API Endpoints define their study key filtering strategies. It adheres to the Architect persona's "Explicit > Implicit" rule by eliminating magic
_pop_study_filterflags and_missing_study_exceptionproperties in favor of explicit strategy instantiation.ParamMixinandEndpointProtocolto drop the deprecated properties.users,variables,forms,records,intervals,codings,sites) to useSTUDY_KEY_STRATEGYexplicitly.mypy) passing and no test failures..jules/architect.md.PR created automatically by Jules for task 11714234966353973980 started by @fderuiter