Request for review: PR #58619 — ActiveRecord::Base.skip_callback_monitor

Hi Rails team,

I opened [PR #58619](Add ActiveRecord::Base.skip_callback_monitor by OuYangJinTing · Pull Request #58619 · rails/rails · GitHub) to add `ActiveRecord::Base.skip_callback_monitor`.

Active Record exposes several persistence methods that intentionally bypass callbacks (such as `update_columns`, `update_all`, `delete_all`, `insert_all`, and `upsert_all`). Today, applications have no built-in way to observe these bypasses, which can make it easy for important business logic to be skipped silently.

The PR adds a class-level monitor that is invoked when these low-level persistence paths bypass callbacks. Applications can use it to log, audit, or raise on callback bypasses. Higher-level methods delegate to these paths, so the monitor is invoked once per operation, and it remains a no-op when unset.

The PR has passing checks and has been open for about a week. I would appreciate feedback on:

  • whether this belongs in Active Record’s public API;
  • the naming and placement of `skip_callback_monitor`;
  • whether the callback-bypass coverage and invocation points are the right ones.

Thanks for taking a look!

Sounds like a great feature :slight_smile: I hope you get some traction there :slight_smile: