Skip to content

πŸ›οΈ Architect: Endpoint Configuration Flags#840

Merged
fderuiter merged 1 commit intomainfrom
jules-architect-endpoint-config-flags-6692820588331616929
Apr 29, 2026
Merged

πŸ›οΈ Architect: Endpoint Configuration Flags#840
fderuiter merged 1 commit intomainfrom
jules-architect-endpoint-config-flags-6692820588331616929

Conversation

@fderuiter
Copy link
Copy Markdown
Owner

πŸ›οΈ Refactor Candidate: Endpoint Configuration Flags MRO Shadowing

The Smell:
EndpointABC defined _id_param and _enable_cache as @property methods merely to return constant default values. This causes Python Method Resolution Order (MRO) shadowing issues when mixin classes (e.g. CachedEndpointMixin) attempt to override these settings via simple class attributes, since descriptors (@property) on base classes take precedence over class attributes on mixins in the MRO. This forces developers to use clunky workarounds or redefine them as @property on subclasses.

The Fix:
Converted these configuration flags from @property methods to straightforward type-hinted class attributes (_id_param: str = "id", _enable_cache: bool = False) with proper docstrings.

The Code:

    _id_param: str = "id"
    """
    The query parameter name for the ID.
    Defaults to "id". Override in subclasses if needed.
    """

    _enable_cache: bool = False
    """
    Whether this endpoint supports caching.
    Defaults to False. Override in subclasses if needed.
    """

Verification:

  • Types are strict (No Any)
  • Sync/Async parity maintained
  • No logic changes, only structural

Architect's Advice:

  • "If you have to write a comment to explain what the code is doing, refactor the code so the comment isn't needed."
  • "Duplication is cheaper than the wrong abstraction."

πŸ›οΈ Design Change:
Replaced @property accessors for static endpoint configuration flags with class attributes to resolve MRO shadowing bugs and follow KISS.

♻️ DRY Gains:
Eliminated boilerplate function definitions for constants across endpoints.

πŸ›‘οΈ Solidity:
Fully backward compatible, but fundamentally safer against Python's MRO corner cases when combining multiple mixins on GenericEndpoints. Tests updated to reflect simplified access.

⚠️ Breaking Changes:
None. Read access to self._id_param or self._enable_cache still resolves to the correct values on an instance.


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

Converted _id_param and _enable_cache from @Property to type-hinted class attributes in EndpointABC to properly support mixin MRO overriding while keeping the code simpler.

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 fderuiter marked this pull request as ready for review April 29, 2026 20:38
@fderuiter fderuiter merged commit b5f34b2 into main Apr 29, 2026
13 checks passed
@fderuiter fderuiter deleted the jules-architect-endpoint-config-flags-6692820588331616929 branch April 29, 2026 20:39
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