Skip to content

Conversation

skipkayhil
Copy link
Member

Motivation / Background

Ref #55161

In Rails 7, a new render tracking implementation was added to Rails: the RipperTracker. From that commit message:

Using a parser finds dependencies that would otherwise be difficult to
find with the regular expressions. It should also theoretically work
with other template systems since it operates on the compiled template
instead of the contents of the file.

It was initially made the default render tracker, but that change was later backed out.

Since then, the Prism parser was released and made the default Ruby parser. A Prism render tracker implementation was also added to Rails in 7.2.

Detail

Until now, there hasn't been a "blessed" way for applications to try out the new tracker implementations (you would have to go through private API). This commit adds configuration to not only make it easy for applications to use the new Ruby-parser-based trackers, but it also makes these new trackers the default for new applications on 8.1.

The new trackers are not only better at finding render calls, they are also much easier to maintain. When I added trailing interpolation tracking to the three trackers, the Prism tracker was by far the easiest to work with.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

@tenderlove
Copy link
Member

This makes sense to me. Is the plan that we would make the Ruby parser implementation default? I think that we should.

Also what about #55165? It seems like we should merge it as well.

@tenderlove
Copy link
Member

Is the plan that we would make the Ruby parser implementation default?

🤦 I misread the PR. I see that indeed this makes the Ruby parser implementation default. I think that's good, lets ship it.

In Rails 7, a new render tracking implementation was [added][1] to
Rails: the RipperTracker. From that commit message:

> Using a parser finds dependencies that would otherwise be difficult to
> find with the regular expressions. It should also theoretically work
> with other template systems since it operates on the compiled template
> instead of the contents of the file.

It was initially made the default render tracker, but that change was
later [backed out][2].

Since then, the Prism parser was released and made the default Ruby
parser. A Prism render tracker implementation was also [added][3] to
Rails in 7.2.

Until now, there hasn't been a "blessed" way for applications to try out
the new tracker implementations (you would have to go through private
API). This commit adds configuration to not only make it easy for
applications to use the new Ruby-parser-based trackers, but it also
makes these new trackers the default for new applications on 8.1.

The new trackers are not only better at finding `render` calls, they are
also much easier to maintain. When I [added][4] trailing interpolation
tracking to the three trackers, the Prism tracker was by far the easiest
to work with.

[1]: 897b9bf
[2]: 41c0681
[3]: d743a2b
[4]: 13df150
@skipkayhil skipkayhil force-pushed the hm-configurable-render-tracker branch from f520bc7 to 89fddd3 Compare August 6, 2025 16:18
@tenderlove tenderlove enabled auto-merge August 6, 2025 16:22
@tenderlove tenderlove merged commit ab756d9 into rails:main Aug 6, 2025
3 checks passed
@skipkayhil skipkayhil deleted the hm-configurable-render-tracker branch August 6, 2025 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants