lex-audit 0.1.6 → 0.1.7
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/CHANGELOG.md +7 -0
- data/lib/legion/extensions/audit/runners/approval_queue.rb +29 -4
- data/lib/legion/extensions/audit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec196d881f4100d6103553ef511db4d81e1cf7a73349e8d4b73cde2a157fcfeb
|
|
4
|
+
data.tar.gz: 55e63f4ae3e27c63fdf17d38eabd1e6e88306179339fb083af886330a7b681b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74f3ff8880bac8ef981243596f0d7634716106c888e73b64e0374f6a9fbebc157462e4062e44056b3a148160860e0e72ff26ce535ffd11495899e78c45093b7d
|
|
7
|
+
data.tar.gz: d65857764c6e20682e374d0771520770c75fad2e06372763dc1c64673ea27ac7074d229b30238b94372ad7864c69ad2ff03b389808b1bbd89bc07c99e330579b
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.7] - 2026-04-13
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `ApprovalQueue#submit` accepts `resume_routing_key:` and `resume_exchange:` kwargs and stores them on the record (backward compatible — both default to nil)
|
|
9
|
+
- `ApprovalQueue#approve` calls `resume_pipeline` after approval: publishes a `Legion::Transport::Messages::Task` to the stored routing key so the fleet pipeline resumes processing
|
|
10
|
+
- `resume_pipeline` private helper: extracts work_item from stored payload, derives function name from routing key, publishes Task message
|
|
11
|
+
|
|
5
12
|
## [0.1.6] - 2026-03-31
|
|
6
13
|
|
|
7
14
|
### Added
|
|
@@ -8,18 +8,23 @@ module Legion
|
|
|
8
8
|
include Legion::Extensions::Helpers::Lex if defined?(Legion::Extensions::Helpers::Lex)
|
|
9
9
|
extend self
|
|
10
10
|
|
|
11
|
-
def submit(approval_type:, payload:, requester_id:, tenant_id: nil,
|
|
11
|
+
def submit(approval_type:, payload:, requester_id:, tenant_id: nil,
|
|
12
|
+
resume_routing_key: nil, resume_exchange: nil, **)
|
|
12
13
|
define_approval_queue_model
|
|
13
14
|
json_payload = json_dump({ data: payload })
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
create_hash = {
|
|
16
17
|
approval_type: approval_type,
|
|
17
18
|
payload: json_payload,
|
|
18
19
|
requester_id: requester_id,
|
|
19
20
|
status: 'pending',
|
|
20
21
|
tenant_id: tenant_id,
|
|
21
22
|
created_at: Time.now.utc
|
|
22
|
-
|
|
23
|
+
}
|
|
24
|
+
create_hash[:resume_routing_key] = resume_routing_key if resume_routing_key
|
|
25
|
+
create_hash[:resume_exchange] = resume_exchange if resume_exchange
|
|
26
|
+
|
|
27
|
+
record = Legion::Extensions::Audit::Runners::ApprovalQueue::ApprovalQueue.create(create_hash)
|
|
23
28
|
publish_event('approval_needed', record)
|
|
24
29
|
{ success: true, approval_id: record.id, status: 'pending' }
|
|
25
30
|
end
|
|
@@ -32,7 +37,9 @@ module Legion
|
|
|
32
37
|
|
|
33
38
|
record.update(status: 'approved', reviewer_id: reviewer_id, reviewed_at: Time.now.utc)
|
|
34
39
|
publish_event('approval_decided', record)
|
|
35
|
-
|
|
40
|
+
|
|
41
|
+
resumed = resume_pipeline(record)
|
|
42
|
+
{ success: true, approval_id: id, status: 'approved', resumed: resumed }
|
|
36
43
|
end
|
|
37
44
|
|
|
38
45
|
def reject(id:, reviewer_id:, **)
|
|
@@ -91,6 +98,24 @@ module Legion
|
|
|
91
98
|
rescue StandardError => e
|
|
92
99
|
log.warn "[audit] failed to publish #{event_type}: #{e.message}"
|
|
93
100
|
end
|
|
101
|
+
|
|
102
|
+
def resume_pipeline(record)
|
|
103
|
+
return false unless record.respond_to?(:resume_routing_key) && record.resume_routing_key # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
104
|
+
|
|
105
|
+
payload = json_load(record.payload)
|
|
106
|
+
routing_key = record.resume_routing_key
|
|
107
|
+
function = routing_key.split('.').last
|
|
108
|
+
|
|
109
|
+
Legion::Transport::Messages::Task.new(
|
|
110
|
+
work_item: payload[:data]&.[](:work_item) || payload[:data],
|
|
111
|
+
function: function,
|
|
112
|
+
routing_key: routing_key
|
|
113
|
+
).publish
|
|
114
|
+
true
|
|
115
|
+
rescue StandardError => e
|
|
116
|
+
log.warn("resume_pipeline failed: #{e.message}")
|
|
117
|
+
false
|
|
118
|
+
end
|
|
94
119
|
end
|
|
95
120
|
end
|
|
96
121
|
end
|