Skip to content

Conversation

@alexrford
Copy link
Contributor

The modelling for request accesses in ActionController.qll seemed more related to ActionDispatch, so I wanted to move this into ActionDispatch.qll. ActionDispatch.qll itself was kind of large, so I ended up splitting this into multiple files - Mime.qll and Routing.qll for what was already present in ActionDispatch.qll, and Request.qll for the parts moved from ActionController.qll.

I expanded request modelling a tiny bit by considering direct instantiations of ActionDispatch::Request as being request instances. This is mostly driven by cases like https://github.com/rails/rails/blob/070d4afacd3e9721b7e3a4634e4d026b5fa2c32c/actionpack/lib/action_dispatch/middleware/actionable_exceptions.rb#L16-L21 - I expect it's an uncommon pattern.

I've aimed to avoid changing the API in any substantial way, e.g. ActionDispatch::Routing was public before, but the Request module was not. The component files of ActionDispatch are in an internal directory to try to avoid these being used directly.

@alexrford alexrford added no-change-note-required This PR does not need a change note Ruby labels May 23, 2023
@alexrford alexrford marked this pull request as ready for review May 31, 2023 15:18
@alexrford alexrford requested a review from a team as a code owner May 31, 2023 15:18
@alexrford
Copy link
Contributor Author

Apologies for the size of the diff - this one is probably easier to review commit-by-commit as a lot of it is just moving code around.

@calumgrant calumgrant requested a review from aibaars June 6, 2023 08:20
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, a minor suggestion.

Comment on lines +15 to +16
any(ActionControllerClass cls)
.getSelf()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use actionControllerInstance()

Suggested change
any(ActionControllerClass cls)
.getSelf()
actionControllerInstance()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd slightly prefer to keep actionControllerInstance() private to the ActionController module, though this is a little messy.

@alexrford alexrford merged commit 22b9ab4 into github:main Jun 8, 2023
@alexrford alexrford deleted the rb/actiondispatch-refactor branch June 8, 2023 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Ruby

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants