cgp_teams_connector 0.1.3 → 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 +4 -4
- data/.rspec_status +7 -4
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/UPGRADE.md +52 -0
- data/lib/cgp_teams_connector/version.rb +1 -1
- data/lib/cgp_teams_connector.rb +11 -5
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f44f71cdbabfac5750369afea1451a86b985ba41f96898cb2ab6651cd81cb518
|
|
4
|
+
data.tar.gz: 4338cfcf6592621fb266f940c19256e017916fa52ce8567e6a69dc02f6761831
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0345c290cf4585da3b10bcc9846d78cd95e21625a1a849e8ae432eeba81785792e1cd32bb201218248ff1662aec2bce9ce00b726cece9c0cf1d404c55bd8636
|
|
7
|
+
data.tar.gz: 8a31895e0d0e07a9ead1996c2c59dc576f72136204376c5985461e384b41b3289cc94bdb435ea17fbd046978a68daeed99a62ed55f253c239685a13c9b2bb394
|
data/.rspec_status
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
example_id
|
|
2
|
-
|
|
3
|
-
./spec/cgp_teams_connector_spec.rb[1:1]
|
|
4
|
-
./spec/cgp_teams_connector_spec.rb[1:2]
|
|
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,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
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
|
+
|
|
3
11
|
## [0.1.3] - 2025-03-10
|
|
4
12
|
|
|
5
13
|
- compatible with rails 7
|
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
|
|
16
|
-
$ CgpTeamsConnector.notify_error(:job, exception, job
|
|
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.
|
data/lib/cgp_teams_connector.rb
CHANGED
|
@@ -15,14 +15,20 @@ module CgpTeamsConnector
|
|
|
15
15
|
yield(config) if block_given?
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def notify_error(type, exception,
|
|
18
|
+
def notify_error(type, exception, source = nil)
|
|
19
19
|
return if config.ignored_exceptions.include?(exception.class)
|
|
20
20
|
|
|
21
|
-
id_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.
|
|
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:
|
|
11
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: teams_connector
|
|
@@ -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
|