Skip to content

Add Rails engine support to UrlHelpers compiler#2632

Open
bdewater-thatch wants to merge 1 commit into
Shopify:mainfrom
thatch-health:url-helpers-engine-support
Open

Add Rails engine support to UrlHelpers compiler#2632
bdewater-thatch wants to merge 1 commit into
Shopify:mainfrom
thatch-health:url-helpers-engine-support

Conversation

@bdewater-thatch

Copy link
Copy Markdown
Contributor

Motivation

Discover Rails engines during URL helper generation and register their engine-scoped path and URL helper modules. Fixes #474

Generate mounted helper RBIs for engine mount points, including typed routes proxy classes that include the engine helper modules. Add mounted helper mixins only for classes/modules that actually receive Rails' mounted helpers, and cover the new behavior with regression tests.

Implementation

AI assisted with manual refactoring + testing on our own app.

@bdewater-thatch bdewater-thatch requested a review from a team as a code owner May 25, 2026 15:14
@bdewater-thatch bdewater-thatch force-pushed the url-helpers-engine-support branch from 5dab70a to 33f1327 Compare May 25, 2026 15:39

@KaanOzkan KaanOzkan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implementation looks fine to me but as someone without much context on the compiler it was difficult to wrap my head around it. I have some suggestions on how to improve maintainability. Curious to hear if you have more ideas.

Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb
@KaanOzkan KaanOzkan added the enhancement New feature or request label Jun 4, 2026
@bdewater-thatch bdewater-thatch force-pushed the url-helpers-engine-support branch 2 times, most recently from 006de5e to e96f1f5 Compare June 4, 2026 19:25
@bdewater-thatch

Copy link
Copy Markdown
Contributor Author

@KaanOzkan addressed your feedback, PTAL

@KaanOzkan KaanOzkan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implementation looks good to me, @paracycle are you able to take a look as well? PR is adding significant complexity to add engine support and I want to make sure it's correct.

Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
@KaanOzkan KaanOzkan requested a review from paracycle June 8, 2026 14:31
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated

@amomchilov amomchilov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a great feature idea, but I'm finding the code kinda hard to follow/review, especially because so many of these concepts have such similar names.

Could you please take a human pass over this and try to see if anything could be simplified? Some documentation on the helper methods would also help

Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Comment thread lib/tapioca/dsl/compilers/url_helpers.rb Outdated
Discover Rails engines during URL helper generation and register their engine-scoped path and URL helper modules.

Generate mounted helper RBIs for engine mount points, including typed routes proxy classes that include the engine helper modules. Add mounted helper mixins only for classes/modules that actually receive Rails' mounted helpers, and cover the new behavior with regression tests.
@bdewater-thatch bdewater-thatch force-pushed the url-helpers-engine-support branch from e96f1f5 to d85f843 Compare June 26, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make UrlHelpers generator Rails Engine aware

3 participants