Skip to content

πŸ›οΈ Architect: Enforce Explicit Strategy over Implicit Config for Endpoints#771

Draft
fderuiter wants to merge 2 commits intomainfrom
architect-explicit-study-key-strategy-11714234966353973980
Draft

πŸ›οΈ Architect: Enforce Explicit Strategy over Implicit Config for Endpoints#771
fderuiter wants to merge 2 commits intomainfrom
architect-explicit-study-key-strategy-11714234966353973980

Conversation

@fderuiter
Copy link
Copy Markdown
Owner

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_filter flags and _missing_study_exception properties in favor of explicit strategy instantiation.

  • Modifies ParamMixin and EndpointProtocol to drop the deprecated properties.
  • Updates all relevant endpoints (users, variables, forms, records, intervals, codings, sites) to use STUDY_KEY_STRATEGY explicitly.
  • Fully backwards compatible, with strict typing (mypy) passing and no test failures.
  • Recorded architecture changes in .jules/architect.md.

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

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>
@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.

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>
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