Skip to content

Clean ActiveRecord backtraces as if they are in the source #1350

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

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

aidanharan
Copy link
Contributor

Treat ActiveRecord backtraces lines as if they are from the source code rather than from the Rails gem.

Fixes the following tests.

https://github.com/aidanharan/rails/pull/4/files#diff-895b194d1cd076295b52cf047d3452420d42f082f4208f4e97e1a9eb87caf0ee

1) Failure:
AssociationDeprecationTest::WarnModeTest#test_0001_report warns in :warn mode [/usr/local/bundle/bundler/gems/rails-4621f7131d2a/activerecord/test/cases/associations/deprecation_test.rb:127]:
Expected /The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked \(\/usr\/local\/bundle\/bundler\/gems\/rails-4621f7131d2a\/activerecord\/test\/cases\/associations\/deprecation_test.rb:126:in/ to match "W, [2025-07-07T09:38:38.097702 #30]  WARN -- : The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked ()\n".

  3) Failure:
AssociationDeprecationTest::RaiseModeTest#test_0001_report raises an error in :raise mode [/usr/local/bundle/bundler/gems/rails-4621f7131d2a/activerecord/test/cases/associations/deprecation_test.rb:183]:
Expected /The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked \(\/usr\/local\/bundle\/bundler\/gems\/rails-4621f7131d2a\/activerecord\/test\/cases\/associations\/deprecation_test.rb:182:in/ to match "The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked ()".

  4) Failure:
AssociationDeprecationTest::RaiseBacktraceModeTest#test_0001_report raises an error in :raise mode [/usr/local/bundle/bundler/gems/rails-4621f7131d2a/activerecord/test/cases/associations/deprecation_test.rb:198]:
Expected /The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked \(\/usr\/local\/bundle\/bundler\/gems\/rails-4621f7131d2a\/activerecord\/test\/cases\/associations\/deprecation_test.rb:196:in/ to match "The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked ()".

  5) Failure:
AssociationDeprecationTest::NotifyModeTest#test_0001_report publishes an Active Support notification in :notify mode [/usr/local/bundle/bundler/gems/rails-4621f7131d2a/activerecord/test/cases/associations/deprecation_test.rb:241]:
Expected /The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked \(\/usr\/local\/bundle\/bundler\/gems\/rails-4621f7131d2a\/activerecord\/test\/cases\/associations\/deprecation_test.rb:233:in/ to match "The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked ()".

  6) Failure:
AssociationDeprecationTest::WarnBacktraceModeTest#test_0001_report warns in :warn mode [/usr/local/bundle/bundler/gems/rails-[462](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/actions/runs/16113377465/job/45461734338#step:4:463)1f7131d2a/activerecord/test/cases/associations/deprecation_test.rb:151]:
Expected /The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked \(\/usr\/local\/bundle\/bundler\/gems\/rails-4621f7131d2a\/activerecord\/test\/cases\/associations\/deprecation_test.rb:149:in/ to match "W, [2025-07-07T09:41:27.178952 #30]  WARN -- : The association DATS::Car#deprecated_tyres is deprecated, the method deprecated_tyres was invoked ()\n".

@aidanharan aidanharan marked this pull request as ready for review July 8, 2025 12:10
@aidanharan aidanharan merged commit eca7ac1 into main Jul 8, 2025
3 of 6 checks passed
@aidanharan aidanharan deleted the activerecord-backtrace-cleaner branch July 8, 2025 12:10
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.

1 participant