bug_reports_client 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbb8da2de255d2a5894ce7079e462b6cc34d53fd3d4077560a4cb7ef3985df64
4
- data.tar.gz: a01439a1eb84e11e51724dbb6b88456871580c654ede63ca57e261b78ab94c0f
3
+ metadata.gz: af1649eb6a9f0c2f134c12ff56daa1b518596abb811df41b3a09646cf11cf723
4
+ data.tar.gz: 350efaea07db0ad969590657a5469cef5d31cb5fabb5f54f0d4b7e5d2301c381
5
5
  SHA512:
6
- metadata.gz: ac6b9dd379ca0530da20787480736f05d415fcac662df5ac58e2d52c61ae6054648bc9e0a15a82523e8c1077a4d4e5c9cd03113ad4acd44be7b0499099c96362
7
- data.tar.gz: 780d9c5e1ce19a35eca0c762dc15a0188f7a3be89958f19f540830e7721641b8ec558e0c9ac8ba5850cb1170c3f229d7a473066a41cb66fa5dcb649a8a2d9930
6
+ metadata.gz: 420ca42a1fac80cbb2f9cc426c5ba5d9759dcdeb41d45c3affad1396cd922fb93c3402ec43edec37f2be1a5e9b324af8ba1d2c8bf8b21976b9360ff706690256
7
+ data.tar.gz: a76dea291d1ae17e671b06d05f1717866a5270347b585b39bd571624bc7fe8e9771fcef26ce946eee93e24ce02ac55238fc395a8a16b63646c7f121ee876a7d2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.4 (16 October 2026)
4
+
5
+ - The engine's helpers and the error-context `before_action` are now added
6
+ to `ActionController::Base` in `config.to_prepare`, not in an
7
+ `on_load(:action_controller_base)` hook. A gem that loads
8
+ `ActionController::Base` while Bundler is still requiring gems ran the
9
+ hook before engine helpers could autoload, and the host failed to boot
10
+ with `NameError: uninitialized constant BugReportsClient::BugReportsHelper`.
11
+ `omniauth-rails_csrf_protection` 2.x does this on Rails 8.1. Hosts need no
12
+ changes.
13
+
14
+ ## 0.1.3 (7 October 2026)
15
+
16
+ - Unhandled errors raised by `bin/rails runner` scripts (Rails.error source
17
+ `"application.runner.railties"`) are no longer reported. They have no
18
+ application frame, so they all shared one fingerprint and merged into one
19
+ misleading issue. Requests and jobs are still captured. The skipped sources
20
+ are configurable via the new `config.ignored_error_sources` setting.
21
+
3
22
  ## 0.1.2 (16 August 2026)
4
23
 
5
24
  - Resolved-report alerts no longer stack. When a user has two or more
data/README.md CHANGED
@@ -224,6 +224,7 @@ Opt in per host and unhandled 500s become GitHub issues, deduplicated:
224
224
  config.error_reporting_enabled = true
225
225
  config.error_ignore = [] # extra exception class names to skip
226
226
  config.error_throttle_period = 300 # seconds between posts per fingerprint
227
+ config.ignored_error_sources = [ "application.runner.railties" ] # the default
227
228
  ```
228
229
 
229
230
  The engine subscribes to the Rails error reporter, so anything that would
@@ -236,6 +237,15 @@ slowed down. The API keeps one open issue per fingerprint, counting repeat
236
237
  occurrences; when a closed error recurs, a fresh issue is filed (a
237
238
  regression deserves new attention).
238
239
 
240
+ Errors are also skipped when the `source:` Rails passes to the error
241
+ reporter is in `config.ignored_error_sources`. By default that list holds
242
+ `"application.runner.railties"`, the source Rails uses for unhandled errors
243
+ in `bin/rails runner` scripts: the person running the script already sees the
244
+ error in their terminal, and with no application frame in the backtrace
245
+ every such error would share one fingerprint and merge into one misleading
246
+ issue. Requests and jobs are still captured. Add other sources to skip them
247
+ too, or set the list to `[]` to capture runner errors as well.
248
+
239
249
  Captured errors are also attributed to the signed-in user who hit them
240
250
  (stored locally in `bug_report_error_events`, pruned after 30 days). When
241
251
  that user opens the report form within 24 hours, it asks "did this happen
@@ -44,6 +44,10 @@ module BugReportsClient
44
44
  # limits how often one fingerprint is posted from this app.
45
45
  attr_accessor :error_reporting_enabled, :error_ignore, :error_throttle_period
46
46
 
47
+ # Rails.error `source:` values never reported. Defaults to `bin/rails runner`
48
+ # script errors, which the operator sees in the terminal and which lack an app frame.
49
+ attr_accessor :ignored_error_sources
50
+
47
51
  # Optional overrides for the form definition and GitHub issue template.
48
52
  # When nil, the engine looks for config/bug_report_form.yml and
49
53
  # config/bug_report_issue.md in the host app, then falls back to its own
@@ -82,6 +86,7 @@ module BugReportsClient
82
86
  @error_reporting_enabled = false
83
87
  @error_ignore = []
84
88
  @error_throttle_period = 300
89
+ @ignored_error_sources = [ "application.runner.railties" ]
85
90
  end
86
91
 
87
92
  # The URL the API calls back when a report's GitHub issue is closed.
@@ -29,13 +29,16 @@ module BugReportsClient
29
29
  # Make engine helpers (bug_report_alerts and the badge helpers) available
30
30
  # in host views, so layouts can render the resolved-report alerts with a
31
31
  # single line.
32
- initializer "bug_reports_client.helpers" do
33
- ActiveSupport.on_load(:action_controller_base) do
34
- helper BugReportsClient::Engine.helpers
35
- # Tag requests with the current user so captured 500s can be
36
- # attributed to whoever hit them (see ErrorContext).
37
- include BugReportsClient::ErrorContext
38
- end
32
+ #
33
+ # Keep this in to_prepare, not on_load(:action_controller_base): a gem that
34
+ # loads ActionController::Base during Bundler.require fires on_load hooks
35
+ # before engine helpers can autoload, and the host fails to boot with
36
+ # NameError on BugReportsHelper.
37
+ config.to_prepare do
38
+ ActionController::Base.helper BugReportsClient::Engine.helpers
39
+ # Tag requests with the current user so captured 500s can be
40
+ # attributed to whoever hit them (see ErrorContext).
41
+ ActionController::Base.include BugReportsClient::ErrorContext
39
42
  end
40
43
 
41
44
  # Automatic 500 capture: subscribe to the Rails error reporter. The
@@ -7,6 +7,8 @@ module BugReportsClient
7
7
  #
8
8
  # - Only unhandled errors are captured, and only ones Rails would answer
9
9
  # with a 5xx (RecordNotFound and friends map to 4xx and are skipped).
10
+ # - Errors from sources in config.ignored_error_sources are skipped; by
11
+ # default that is `bin/rails runner` scripts.
10
12
  # - Errors are fingerprinted by exception class + the top application
11
13
  # backtrace frame (line numbers stripped, so deploys that shift code
12
14
  # around keep the same fingerprint).
@@ -23,6 +25,7 @@ module BugReportsClient
23
25
  def report(error, handled:, severity: nil, context: {}, source: nil)
24
26
  return if handled
25
27
  return unless BugReportsClient.config.error_reporting_enabled
28
+ return if BugReportsClient.config.ignored_error_sources.include?(source)
26
29
  return if ignored?(error)
27
30
 
28
31
  fingerprint = self.class.fingerprint_for(error)
@@ -1,3 +1,3 @@
1
1
  module BugReportsClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bug_reports_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - PSA Squash Tour
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-16 00:00:00.000000000 Z
11
+ date: 2026-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails