cgp_teams_connector 0.1.2 → 1.0.0

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: 958165cc4b1251c80dfb6396e54695d9b04164baa84e11b739e9f22f8f45eb9b
4
- data.tar.gz: 78d87668ae6b9420718a34339a1dcbe9a11fd9180dd88b512cb22934ce185655
3
+ metadata.gz: f44f71cdbabfac5750369afea1451a86b985ba41f96898cb2ab6651cd81cb518
4
+ data.tar.gz: 4338cfcf6592621fb266f940c19256e017916fa52ce8567e6a69dc02f6761831
5
5
  SHA512:
6
- metadata.gz: 6e46cb4fe76542f2fe0f2c58f6b796fbfdb80d4b8dabca808a1e953aa86f269811ac062d69be8676a052303d098afbe27414a9a2ab1240e5c8f83141e02426b3
7
- data.tar.gz: a6048fbed068f726da465130c185663f6772925663bf1ee39876c3da4d2515624cbefbc3979f2587ba3ec962530ed12df04e02b5fb70a3cae2d781392457098b
6
+ metadata.gz: e0345c290cf4585da3b10bcc9846d78cd95e21625a1a849e8ae432eeba81785792e1cd32bb201218248ff1662aec2bce9ce00b726cece9c0cf1d404c55bd8636
7
+ data.tar.gz: 8a31895e0d0e07a9ead1996c2c59dc576f72136204376c5985461e384b41b3289cc94bdb435ea17fbd046978a68daeed99a62ed55f253c239685a13c9b2bb394
data/.rspec_status CHANGED
@@ -1,4 +1,7 @@
1
- example_id | status | run_time |
2
- --------------------------------------- | ------ | --------------- |
3
- ./spec/cgp_teams_connector_spec.rb[1:1] | passed | 0.0005 seconds |
4
- ./spec/cgp_teams_connector_spec.rb[1:2] | passed | 0.00042 seconds |
1
+ example_id | status | run_time |
2
+ ----------------------------------------- | ------ | --------------- |
3
+ ./spec/cgp_teams_connector_spec.rb[1:1] | passed | 0.00032 seconds |
4
+ ./spec/cgp_teams_connector_spec.rb[1:2] | passed | 0.00022 seconds |
5
+ ./spec/cgp_teams_connector_spec.rb[1:3:1] | passed | 0.01251 seconds |
6
+ ./spec/cgp_teams_connector_spec.rb[1:3:2] | passed | 0.00032 seconds |
7
+ ./spec/cgp_teams_connector_spec.rb[1:3:3] | passed | 0.00015 seconds |
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.2] - 2025-03-10
3
+ ## [1.0.0] - 2026-11-23
4
+
5
+ - **Breaking:** `notify_error` now accepts the request/job object instead of a pre-extracted ID
6
+ - `:server` — pass the request object; the gem reads `uuid`, `request_method` and `path`
7
+ - `:job` — pass the job hash; the gem reads `job['jid']`
8
+ - Teams message now shows the HTTP verb and request path for server errors
9
+ - A plain ID string is still accepted (shown without verb/path) for backward compatibility
10
+
11
+ ## [0.1.3] - 2025-03-10
4
12
 
5
13
  - compatible with rails 7
6
14
 
data/README.md CHANGED
@@ -12,8 +12,8 @@ Install the gem and add to the application's Gemfile after sidekiq (if in use):
12
12
 
13
13
  Two notifications example:
14
14
 
15
- $ CgpTeamsConnector.notify_error(:server, exception, request.uuid)
16
- $ CgpTeamsConnector.notify_error(:job, exception, job['jid'])
15
+ $ CgpTeamsConnector.notify_error(:server, exception, request)
16
+ $ CgpTeamsConnector.notify_error(:job, exception, job)
17
17
 
18
18
  ## License
19
19
 
data/UPGRADE.md ADDED
@@ -0,0 +1,52 @@
1
+ # Upgrade to 1.0.0
2
+
3
+ Prompt for the consumer app's agent to migrate `cgp_teams_connector` call sites to the 1.0.0 API.
4
+
5
+ ---
6
+
7
+ The `cgp_teams_connector` gem (Teams error notifications) has a new API for
8
+ `CgpTeamsConnector.notify_error` in 1.0.0: instead of extracting the ID
9
+ yourself, pass the source object — the gem reads the ID, HTTP verb and
10
+ request path from it and shows them in the Teams message.
11
+
12
+ New signature:
13
+
14
+ CgpTeamsConnector.notify_error(:server, exception, request) # request: ActionDispatch/Rack request
15
+ CgpTeamsConnector.notify_error(:job, exception, job) # job: Sidekiq job hash
16
+
17
+ Do the following:
18
+
19
+ 1. In the Gemfile, bump the version constraint:
20
+
21
+ gem "cgp_teams_connector", "~> 1.0.0"
22
+
23
+ (the old `~> 0.1.1` constraint caps below 0.2, so it must be changed
24
+ explicitly — this is intentional: 1.0.0 is a breaking release) and run
25
+ `bundle update cgp_teams_connector`.
26
+ 2. Grep the whole app for `notify_error` — include rescue blocks, exception
27
+ handlers, Sidekiq error hooks, initializers and any wrapper methods.
28
+ 3. For each `:server` call, replace the `request.uuid` argument (and any
29
+ `request.path` argument) with the `request` object itself:
30
+
31
+ notify_error(:server, exception, request.uuid) → notify_error(:server, exception, request)
32
+
33
+ 4. For each `:job` call, replace `job['jid']` with the `job` hash itself:
34
+
35
+ notify_error(:job, exception, job['jid']) → notify_error(:job, exception, job)
36
+
37
+ 5. At each call site, make sure the object is actually in scope (e.g. in a
38
+ Rails rescue block `request` must be reachable; if it isn't, wire it in).
39
+ If a call site genuinely only has the ID string, leave it as is — the old
40
+ string form still works and won't crash, it just won't show verb/path.
41
+ List any such leftovers in your summary.
42
+ 6. Run the test suite; verify no `:server`/`:job` call still passes a bare
43
+ string where the request/job object is available.
44
+
45
+ Notes:
46
+
47
+ - The gem reads `request.uuid`, `request.request_method` and `request.path`
48
+ behind respond_to? checks, so it degrades gracefully on objects missing them.
49
+ - Do not change anything else in the rescue/error handlers.
50
+ - Do the gem bump and the call-site switch in the same deploy: against a gem
51
+ older than 1.0.0, the passed object would be rendered in the message as its
52
+ inspect output.
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
 
26
26
  spec.add_dependency "teams_connector", "~> 0.1"
27
- spec.add_dependency "rails", ">= 6.0", "<= 7.0"
27
+ spec.add_dependency "rails", ">= 6.0", "< 8.0"
28
28
  spec.add_development_dependency "rspec"
29
29
  spec.add_development_dependency "byebug"
30
30
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CgpTeamsConnector
4
- VERSION = "0.1.2"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -15,14 +15,20 @@ module CgpTeamsConnector
15
15
  yield(config) if block_given?
16
16
  end
17
17
 
18
- def notify_error(type, exception, id = nil)
18
+ def notify_error(type, exception, source = nil)
19
19
  return if config.ignored_exceptions.include?(exception.class)
20
20
 
21
- id_type = case type
21
+ id_type, id, request_line = nil, nil, nil
22
+ case type
22
23
  when :server
23
- 'request ID'
24
+ id_type = 'request ID'
25
+ id = source.respond_to?(:uuid) ? source.uuid : source
26
+ verb = source.respond_to?(:request_method) ? source.request_method : nil
27
+ path = source.respond_to?(:path) ? source.path : nil
28
+ request_line = [verb, path].compact.join(" ") || nil
24
29
  when :job
25
- 'job ID'
30
+ id_type = 'job ID'
31
+ id = source.is_a?(Hash) ? source['jid'] : source
26
32
  end
27
33
 
28
34
  content = {
@@ -39,7 +45,7 @@ module CgpTeamsConnector
39
45
  },
40
46
  {
41
47
  type: "TextBlock",
42
- text: "**#{exception.class}**#{id ? " [#{id_type}: #{id}]" : nil}"
48
+ text: "**#{exception.class}**#{id ? " [#{id_type}: #{id}]" : nil}#{request_line ? " #{request_line}" : nil}"
43
49
  },
44
50
  {
45
51
  type: "CodeBlock",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cgp_teams_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - masciugo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-10 00:00:00.000000000 Z
11
+ date: 2026-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: teams_connector
@@ -31,9 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6.0'
34
- - - "<="
34
+ - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '7.0'
36
+ version: '8.0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +41,9 @@ dependencies:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: '6.0'
44
- - - "<="
44
+ - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '7.0'
46
+ version: '8.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +85,7 @@ files:
85
85
  - LICENSE.txt
86
86
  - README.md
87
87
  - Rakefile
88
+ - UPGRADE.md
88
89
  - cgp_teams_connector.gemspec
89
90
  - lib/cgp_teams_connector.rb
90
91
  - lib/cgp_teams_connector/configuration.rb