error_radar 1.0.3 → 1.0.5
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c45267122a7ded92caa20eb6eb1d34f40ac5691222a8f69f0d32e7418f3f9934
|
|
4
|
+
data.tar.gz: d51638ec8c8e79d536c9b81bee62fb09381d9ce1dc3096bfe3161dc74566e3a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74f8c559c90cb25db39413355a61f987fc2c6cb4ca406327a6bb47a379b68e4ddaed048b4b9da538ce9aabfec3c1556fceecc6b9c9580a6c5acf15c2446b067d
|
|
7
|
+
data.tar.gz: 5feb61f2843942481bb718f69617a3ebf0a1b64d21aea0c5f4c1ea33f60775ace0afb127d6eee708fb4efb3396a3976a814f0d1ccd929045ebac598a98a76831
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.0.4] - 2026-07-03
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Rake integration: `SystemStackError` / infinite recursion on `rake db:migrate`**
|
|
9
|
+
Three compounding issues caused deployment to fail:
|
|
10
|
+
|
|
11
|
+
1. **Double-patching infinite loop** — if the host app's `lib/tasks/error_radar.rake`
|
|
12
|
+
contained an older version of the Rake integration (using `alias_method`), the
|
|
13
|
+
gem's own `alias_method :error_radar_original_execute, :execute` in v1.0.3
|
|
14
|
+
overwrote the alias so both copies called each other indefinitely. Fixed by
|
|
15
|
+
switching to `prepend` with an `ancestors.include?` idempotency guard — `prepend`
|
|
16
|
+
does not touch any existing aliases and composes cleanly with prior patches.
|
|
17
|
+
|
|
18
|
+
2. **Recursive capture** — if `ErrorRadar.capture` itself raised (e.g. because the
|
|
19
|
+
model wasn't loaded yet), the exception propagated back into the rescue block and
|
|
20
|
+
triggered `capture` again. Fixed with a thread-local `error_radar_rake_capturing`
|
|
21
|
+
guard and by never trying to capture `SystemStackError` / `SignalException` /
|
|
22
|
+
`NoMemoryError` (unrecoverable errors).
|
|
23
|
+
|
|
24
|
+
3. **AR 7.1 `respond_to_missing?` recursion** — ActiveRecord 7.1's
|
|
25
|
+
`detect_enum_conflict!` calls `dangerous_class_method?` → `Base.respond_to?`
|
|
26
|
+
→ `respond_to_missing?` which can recurse infinitely when the table does not
|
|
27
|
+
exist yet (first deploy). Added `_scopes: false` to all three enum declarations
|
|
28
|
+
so the class-method conflict-detection path is skipped entirely. Also changed
|
|
29
|
+
`rescue StandardError` → `rescue Exception` in `Tracking.capture` so
|
|
30
|
+
`SystemStackError` is always absorbed and never escapes `capture`.
|
|
31
|
+
|
|
32
|
+
- **`Api::StatsController` used enum-generated scopes** (`ErrorLog.status_open`,
|
|
33
|
+
etc.) which no longer exist with `_scopes: false`. Replaced with explicit
|
|
34
|
+
`where(status: ErrorLog.statuses[:open])` calls.
|
|
35
|
+
|
|
36
|
+
**If you have a `lib/tasks/error_radar.rake` file in your host app** (not inside
|
|
37
|
+
the gem), delete it — the engine loads the rake tasks automatically from the gem,
|
|
38
|
+
and keeping a copy in the host app causes tasks to be defined twice.
|
|
39
|
+
|
|
5
40
|
## [1.0.3] - 2026-07-03
|
|
6
41
|
|
|
7
42
|
### Fixed
|
|
@@ -7,10 +7,10 @@ module ErrorRadar
|
|
|
7
7
|
def show
|
|
8
8
|
render json: {
|
|
9
9
|
total: ErrorLog.count,
|
|
10
|
-
open: ErrorLog.
|
|
11
|
-
in_progress: ErrorLog.
|
|
12
|
-
resolved: ErrorLog.
|
|
13
|
-
ignored: ErrorLog.
|
|
10
|
+
open: ErrorLog.where(status: ErrorLog.statuses[:open]).count,
|
|
11
|
+
in_progress: ErrorLog.where(status: ErrorLog.statuses[:in_progress]).count,
|
|
12
|
+
resolved: ErrorLog.where(status: ErrorLog.statuses[:resolved]).count,
|
|
13
|
+
ignored: ErrorLog.where(status: ErrorLog.statuses[:ignored]).count,
|
|
14
14
|
unresolved: ErrorLog.unresolved.count,
|
|
15
15
|
by_severity: ErrorLog.group(:severity).count,
|
|
16
16
|
by_category: ErrorLog.group(:category).count,
|
|
@@ -10,11 +10,15 @@ module ErrorRadar
|
|
|
10
10
|
# registers via ErrorRadar.config). Read at class-load, which happens after
|
|
11
11
|
# the host's initializer has run `ErrorRadar.configure`, so custom
|
|
12
12
|
# categories are already merged in. See ErrorRadar::Configuration.
|
|
13
|
-
|
|
13
|
+
#
|
|
14
|
+
# _scopes: false avoids the class-method conflict-detection path in AR 7.1
|
|
15
|
+
# (detect_enum_conflict! → dangerous_class_method? → respond_to_missing?)
|
|
16
|
+
# that raises SystemStackError when the table does not yet exist.
|
|
17
|
+
enum category: ErrorRadar.config.categories, _prefix: :category, _scopes: false
|
|
14
18
|
|
|
15
|
-
enum severity: { info: 0, warning: 1, error: 2, critical: 3 }, _prefix: :severity
|
|
19
|
+
enum severity: { info: 0, warning: 1, error: 2, critical: 3 }, _prefix: :severity, _scopes: false
|
|
16
20
|
|
|
17
|
-
enum status: { open: 0, in_progress: 1, resolved: 2, ignored: 3 }, _prefix: :status
|
|
21
|
+
enum status: { open: 0, in_progress: 1, resolved: 2, ignored: 3 }, _prefix: :status, _scopes: false
|
|
18
22
|
|
|
19
23
|
has_many :error_occurrences, class_name: 'ErrorRadar::ErrorOccurrence',
|
|
20
24
|
foreign_key: :error_log_id,
|
|
@@ -2,31 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
module ErrorRadar
|
|
4
4
|
module Integrations
|
|
5
|
-
# Patches Rake::Task#execute so any exception raised inside a rake task is
|
|
6
|
-
# automatically captured as an ErrorLog, then re-raised so rake's normal
|
|
7
|
-
# failure handling (exit code, output) is unaffected.
|
|
8
5
|
module Rake
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
# Prepended into Rake::Task to auto-capture exceptions raised inside any
|
|
7
|
+
# task body. Uses `prepend` (not alias_method) so it composes safely with
|
|
8
|
+
# any other patches already in place — including older versions of this
|
|
9
|
+
# integration that may be in the host app's lib/tasks/error_radar.rake.
|
|
10
|
+
module Capture
|
|
11
|
+
def execute(args = nil)
|
|
12
|
+
super
|
|
13
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
14
|
+
# Never try to capture signals or stack overflows — we can't recover.
|
|
15
|
+
raise if e.is_a?(SignalException) || e.is_a?(SystemStackError) || e.is_a?(NoMemoryError)
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
# Thread-local guard: if capture itself fails and re-raises, we must
|
|
18
|
+
# not enter an infinite rescue loop.
|
|
19
|
+
unless Thread.current[:error_radar_rake_capturing]
|
|
20
|
+
Thread.current[:error_radar_rake_capturing] = true
|
|
21
|
+
begin
|
|
22
|
+
ErrorRadar.capture(
|
|
23
|
+
e,
|
|
24
|
+
source: "rake:#{name}",
|
|
25
|
+
category: :background_job,
|
|
26
|
+
context: { task: name }
|
|
27
|
+
)
|
|
28
|
+
ensure
|
|
29
|
+
Thread.current[:error_radar_rake_capturing] = false
|
|
30
|
+
end
|
|
27
31
|
end
|
|
32
|
+
raise
|
|
28
33
|
end
|
|
29
34
|
end
|
|
35
|
+
|
|
36
|
+
def self.install!
|
|
37
|
+
# `ancestors.include?` is idempotent across multiple calls AND across
|
|
38
|
+
# multiple versions of the gem that may both try to install.
|
|
39
|
+
return if ::Rake::Task.ancestors.include?(Capture)
|
|
40
|
+
|
|
41
|
+
::Rake::Task.prepend(Capture)
|
|
42
|
+
end
|
|
30
43
|
end
|
|
31
44
|
end
|
|
32
45
|
end
|
data/lib/error_radar/tracking.rb
CHANGED
|
@@ -41,7 +41,7 @@ module ErrorRadar
|
|
|
41
41
|
log = ErrorRadar::ErrorLog.record(**attrs)
|
|
42
42
|
ErrorRadar::Notifier.dispatch(log) if log
|
|
43
43
|
log
|
|
44
|
-
rescue
|
|
44
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
45
45
|
warn_internal("capture failed: #{e.class}: #{e.message}")
|
|
46
46
|
nil
|
|
47
47
|
end
|
data/lib/error_radar/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: error_radar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- chienbn9x
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|