Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :report behavior to ActiveSupport::Deprecation #48578

Merged

Conversation

etiennebarrie
Copy link
Contributor

This behavior uses the ErrorReporter to report a deprecation as a handled error with :warning severity.

Motivation / Background

The error reporter is a great way to report on errors happening in production, with a way to declare the "error" as handled. In the lifecycle of an application, after upgrading to a new minor, deprecations can be slowly resolved and even marked as disallowed to prevent reintroduction, then deprecations can be configured to raise in development/test to make sure they don't reappear or are not ignored. But typically deprecations are completely silenced in production, with the config.active_support.report_deprecations configuration option.

At the very last step before upgrading to the subsequent minor, if tests are not fully trusted to cover all code paths, it would be nice to be able to report deprecations happening in production to the bug tracker the application uses.

Detail

I debated whether to de-duplicate reports by somehow keeping track of backtraces or things like that. Ultimately I felt like this wasn't super useful since multiple worker processes will still report the same deprecation multiple times, and it would add complexity to the implementation.

By default, reported errors are marked as handled and have a severity of :warning. I wondered about using :info to denote that it's very low cause for concern, but since the terminology is "deprecation warning" I went with what's the default for handled errors.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated 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.

This behavior uses the ErrorReporter to report a deprecation as a
handled error with :warning severity.
@rafaelfranca rafaelfranca merged commit fe52de6 into rails:main Jun 26, 2023
8 of 9 checks passed
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.

None yet

2 participants