activerabbit-ai 0.6.1 → 0.6.2

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: 8e1cd1d7c16eb9b4cea15e63674f3c89156c9d8e3b88d51ff2cb17b149e717cf
4
- data.tar.gz: b5e54da451cfa9d98e7ba55a65940af01707bb2f0b17254000ac0aa07e86a8e8
3
+ metadata.gz: c71eb72533f7d6588444722f3ca8502230006f75bd12cee11b7f585e0a00aa1a
4
+ data.tar.gz: e187bb60976eda2eccd743589737240f40930897f6063c9ff6b061e517786135
5
5
  SHA512:
6
- metadata.gz: 2d3aa17b86a6c204454d70374c653e5f50c2648cb236941f13c063e4d9d932d950b4bc8425ea115e7f16d84dee69355fba29466fef28e75daedb3c6a95f3cbf3
7
- data.tar.gz: f7243d857f07247ce600ed7f98156b96e4591e68af2aa954ad6357ba20282d475cd521c55beb4bb74b02133f7ae697d3c973cfaf1b07bcb98132602045c4b220
6
+ metadata.gz: 97ffc354514d50a73b8f32dd086e6d2a095bea00e0ce095464c7ea0a389fc8b1304359125a798abfabf4f456095aec51f3a086a2f6cb1d4c0d3eb5367d1744f0
7
+ data.tar.gz: dafed4a9c5c2de391bdc1527de3092340a093afdde7cc336a04c533c7d4898d5fad4987992fa3861dbbf806dd792eaa8e2a1037cc0a00133e235cd86747a4e3e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.6.2] - 2026-01-26
6
+
7
+ ### Fixed
8
+ - **ActionMailer deliver_later RuntimeError**: Fixed critical bug where `deliver_later` would raise `RuntimeError: You've accessed the message before asking to deliver it later`
9
+ - The patch was incorrectly accessing `message.subject` and `message.to` before calling `super`
10
+ - Rails requires that `message` is NOT accessed before `deliver_later` because only mailer method arguments are passed to the job
11
+ - Now only tracks safe metadata: `@mailer_class`, `@action`, and argument types
12
+ - Added error handling to ensure tracking failures don't break email delivery
13
+
14
+ ### Added
15
+ - **ActionMailer patch tests**: 18 comprehensive tests for the ActionMailer integration
16
+ - Verifies `deliver_later` does NOT access the message object
17
+ - Verifies `deliver_now` correctly tracks message details
18
+ - Tests error handling and edge cases
19
+
5
20
  ## [0.6.1] - 2026-01-09
6
21
 
7
22
  ### Fixed
@@ -14,7 +14,8 @@ module ActiveRabbit
14
14
  ActiveRabbit::Client.track_event(
15
15
  "email_sent",
16
16
  {
17
- mailer: self.class.name,
17
+ mailer_class: @mailer_class.name,
18
+ action: @action,
18
19
  message_id: (message.message_id rescue nil),
19
20
  subject: (message.subject rescue nil),
20
21
  to: (Array(message.to).first rescue nil),
@@ -24,11 +25,26 @@ module ActiveRabbit
24
25
  end
25
26
  end
26
27
 
27
- def deliver_later
28
- ActiveRabbit::Client.track_event(
29
- "email_enqueued",
30
- { mailer: self.class.name, subject: (message.subject rescue nil), to: (Array(message.to).first rescue nil) }
31
- ) if ActiveRabbit::Client.configured?
28
+ def deliver_later(...)
29
+ # IMPORTANT: Do NOT access `message` here!
30
+ # Rails raises RuntimeError if you access the message before deliver_later
31
+ # because only mailer method arguments are passed to the job.
32
+ # We can only safely access metadata that doesn't touch the message object.
33
+ if ActiveRabbit::Client.configured?
34
+ begin
35
+ ActiveRabbit::Client.track_event(
36
+ "email_enqueued",
37
+ {
38
+ mailer_class: @mailer_class.name,
39
+ action: @action,
40
+ args: @args&.map { |a| a.class.name }
41
+ }
42
+ )
43
+ rescue => e
44
+ # Don't let tracking failures break email delivery
45
+ Rails.logger.error "[ActiveRabbit] Failed to track email_enqueued: #{e.message}" if defined?(Rails) && Rails.logger
46
+ end
47
+ end
32
48
  super
33
49
  end
34
50
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRabbit
2
2
  module Client
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerabbit-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Shapalov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-10 00:00:00.000000000 Z
11
+ date: 2026-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -81,7 +81,6 @@ files:
81
81
  - README.md
82
82
  - Rakefile
83
83
  - TESTING_GUIDE.md
84
- - activerabbit-ai-0.4.5.gem
85
84
  - check_api_data.rb
86
85
  - examples/rails_app_testing.rb
87
86
  - examples/rails_integration.rb
Binary file