Feedback from validate_lola_access() review PR - #272
Merged
aaronjae22 merged 6 commits intoAug 4, 2026
Conversation
…se | None) and add new decorators plus drop _get_url_pk
…r-scoped views. Dropping inline lookups and validation boilerplate
…mpliflying _make_lola_request
aaronjae22
force-pushed
the
stacked-1/feedback-from-validate_lola_access_review-pr
branch
from
August 4, 2026 02:50
2ff3395 to
13fd5b8
Compare
aaronjae22
deleted the
stacked-1/feedback-from-validate_lola_access_review-pr
branch
August 4, 2026 02:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently
validate_lola_accessreturns a two-key dict.There is no row where valid is True and an error_response exists, and none where valid is False without one.
We repeat this during the 7 call sites:
With these changes the function just return that Response on failure, and None on success, which will indicates something like "nothing to send, move on".
validate_lola_accessbecomeslola_access_errorlater on during a new refactor.Before
After
Following the suggestions on PR #267 we would now add
@actor_requiredand@validate_lola_accessas decorators but keeping in mind that 404 should execute before 403 (a nonexisting actor gets 404 regardless of token because the existence check runs beforevalidate_lola_access)The sxecution order at request time would be like this:
Following refactor I changed
validate_lola_access()tolola_access_error(). I decided to do this because I didn't want to add the parameter to@validate_lola_accesssuch as@validate_lola_access(required_scope=True/False)and instead use two named decorators (@lola_scope_required/@lola_scope_optional).I thought of naming it
@lola_dual_modesince its established vocabulary in the Testbed but I thought that_required/_optionalmakes more sense.This new
def lola_access_error(request, required_scope, url_pk):already haspkin its kwargs so we passurl_pkin directly and drop therequest.resolver_match(_get_url_pkgoes away).So pretty much our api views will look from this:
To:
This is a massive improvement.
One thing to mention is that
portability_outbox_detaildoes not look up anActor, it looks upPortabilityOutbox.objects.get(actor_id=pk). With@actor_requiredinjecting the actor, it becomes