Skip to content

♻️(refacto) Unused scope attributes on DocumentThrottle and DocumentAccessThrottle #2865

Closed

Description

@AntoLC

DocumentThrottle.scope = "document" and DocumentAccessThrottle.scope = "document_access" are never used: DRF's ScopedRateThrottle.allow_request overwrites self.scope with view.throttle_scope before choosing the rate and the cache key.

class DocumentThrottle(YProviderThrottleMixin, MonitoredScopedRateThrottle):
"""Throttle for document-related endpoints, except collaboration-server requests."""
scope = "document"
class DocumentAccessThrottle(YProviderThrottleMixin, MonitoredScopedRateThrottle):
"""Throttle for document access endpoints, except collaboration-server requests."""
scope = "document_access"

They suggest the class carries its own scope, but a view or action using these classes without throttle_scope is not throttled at all (DRF lets every request through when the view has no scope). Today both viewsets set it (documents, accesses), so nothing is broken yet.
Suggested fix: remove the scope attributes and say in the docstrings that the scope and the rate come from the view's throttle_scope.

Activity

  1. added theissue type on Oct 20, 2026
  2. added a commit that references this issue on Oct 31, 2026
    8a7b43c
  3. added a commit that references this issue on Nov 2, 2026
    ad29f64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions