lex-conditioner 0.3.3 → 0.3.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: bce250dac59290836c688b9835807e9ec63c7afdec5bca0b316cef70c2889d1d
4
- data.tar.gz: 9ff211061515bee37da533730b89eb20554fd81f798a9d7066cc19e4806f448b
3
+ metadata.gz: 1e1a877ff8394192d0e8c23c2fc04c3d2d3f59ca3f5a2897093ced7d81dbbbe1
4
+ data.tar.gz: 728495dace93786ae2fe526e2af36a0cad4c1567bf61751bd549e91fccc6d6d8
5
5
  SHA512:
6
- metadata.gz: ebe046f95e2bda6c9be77d3a55b9865fe2a8d8d5263f0f219f4b6c400137519e0ee3ee4f901aed5da10f2dce6ac5fd4bf3c6317b27174ad75a31d3464421a4bd
7
- data.tar.gz: a3c07a04fa1581f198007c91007f5568e754779ecbc092028e127fabc11031c0dbb7d8d34b3dab6b72ff737f817991314d83b000bc005a30dac5fb3d8b8bec65
6
+ metadata.gz: 2fcfd1ac9c724dbb893aa264a43f6d3dc0ac5158eb4efafdec87887442f8e204669abbb6ea589345c277fda3f589fd03881620528fd892f8b00250fba8d9f347
7
+ data.tar.gz: a5b68093b34e2fdcd95858a0363fb973c3eead249e743f4e1d1dd28c0a42aee833cc93804e15a0b74be7e79bd229c4c8ec2748e7ffec82bd5850f79516823018
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.5] - 2026-04-13
4
+
5
+ ### Added
6
+ - `:engine` to `send_task` whitelist — conditioner now forwards the engine field from the relationship hash to the downstream SubTask message
7
+
8
+ ## [0.3.4] - 2026-03-30
9
+
10
+ ### Added
11
+ - Specs for DomainClassifier (12 examples), ConsentTiers (11 examples), and ConflictResolver (17 examples)
12
+
13
+ ### Fixed
14
+ - DomainClassifier now emits `conditioner.failed` status on invalid classifications
15
+ - ConflictResolver `valid:` field now reflects the actual resolution outcome
16
+ - Collapsed Lint/DuplicateBranch offense in ConflictResolver
17
+
3
18
  ## [0.3.3] - 2026-03-30
4
19
 
5
20
  ### Changed
@@ -41,7 +41,7 @@ module Legion
41
41
 
42
42
  def send_task(**opts)
43
43
  subtask_hash = {}
44
- %i[runner_routing_key relationship_id chain_id trigger_runner_id trigger_function_id function_id function runner_id runner_class transformation debug task_id results].each do |column| # rubocop:disable Layout/LineLength
44
+ %i[runner_routing_key relationship_id chain_id trigger_runner_id trigger_function_id function_id function runner_id runner_class transformation engine debug task_id results].each do |column| # rubocop:disable Layout/LineLength
45
45
  subtask_hash[column] = opts[column] if opts.key? column
46
46
  end
47
47
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/conditioner/helpers/condition'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Conditioner
8
+ module Runners
9
+ module ConflictResolver
10
+ def resolve(conditions:, competing_conditions: nil, **payload)
11
+ primary = Legion::Extensions::Conditioner::Condition.new(conditions: conditions,
12
+ values: payload)
13
+
14
+ resolution = if competing_conditions.nil?
15
+ primary.valid? ? 'primary' : 'none'
16
+ elsif primary.valid?
17
+ 'primary'
18
+ else
19
+ secondary = Legion::Extensions::Conditioner::Condition.new(
20
+ conditions: competing_conditions,
21
+ values: payload
22
+ )
23
+
24
+ if secondary.valid?
25
+ 'secondary'
26
+ else
27
+ 'none'
28
+ end
29
+ end
30
+
31
+ status = resolution == 'none' ? 'conditioner.failed' : 'task.queued'
32
+ task_update(payload[:task_id], status, **payload) unless payload[:task_id].nil?
33
+
34
+ { success: true, valid: resolution != 'none', resolution: resolution }
35
+ rescue StandardError => e
36
+ log.log_exception(e, component_type: :runner)
37
+ task_update(payload[:task_id], 'conditioner.exception', **payload) unless payload[:task_id].nil?
38
+ end
39
+
40
+ include Legion::Extensions::Helpers::Lex
41
+ include Legion::Extensions::Helpers::Task
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/conditioner/helpers/condition'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Conditioner
8
+ module Runners
9
+ module ConsentTiers
10
+ TIERS = %w[tier1 tier2 tier3].freeze
11
+
12
+ def evaluate(conditions:, tier: nil, **payload)
13
+ conditioner = Legion::Extensions::Conditioner::Condition.new(conditions: conditions,
14
+ values: payload.merge(tier: tier))
15
+
16
+ granted_tier = if conditioner.valid? && TIERS.include?(tier.to_s)
17
+ tier.to_s
18
+ elsif conditioner.valid?
19
+ TIERS.first
20
+ end
21
+
22
+ status = conditioner.valid? ? 'task.queued' : 'conditioner.failed'
23
+
24
+ task_update(payload[:task_id], status, **payload) unless payload[:task_id].nil?
25
+
26
+ { success: true, valid: conditioner.valid?, tier: granted_tier }
27
+ rescue StandardError => e
28
+ log.log_exception(e, component_type: :runner)
29
+ task_update(payload[:task_id], 'conditioner.exception', **payload) unless payload[:task_id].nil?
30
+ end
31
+
32
+ include Legion::Extensions::Helpers::Lex
33
+ include Legion::Extensions::Helpers::Task
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/conditioner/helpers/condition'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Conditioner
8
+ module Runners
9
+ module DomainClassifier
10
+ def classify(conditions:, domain: nil, **payload)
11
+ conditioner = Legion::Extensions::Conditioner::Condition.new(conditions: conditions,
12
+ values: payload.merge(domain: domain))
13
+
14
+ classification = if domain
15
+ conditioner.valid? ? domain.to_s : 'unclassified'
16
+ else
17
+ conditioner.valid? ? 'default' : 'unclassified'
18
+ end
19
+
20
+ status = conditioner.valid? ? 'task.queued' : 'conditioner.failed'
21
+ task_update(payload[:task_id], status, **payload) unless payload[:task_id].nil?
22
+
23
+ { success: true, valid: conditioner.valid?, domain: classification }
24
+ rescue StandardError => e
25
+ log.log_exception(e, component_type: :runner)
26
+ task_update(payload[:task_id], 'conditioner.exception', **payload) unless payload[:task_id].nil?
27
+ end
28
+
29
+ include Legion::Extensions::Helpers::Lex
30
+ include Legion::Extensions::Helpers::Task
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Conditioner
6
- VERSION = '0.3.3'
6
+ VERSION = '0.3.5'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-conditioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -137,6 +137,9 @@ files:
137
137
  - lib/legion/extensions/conditioner/helpers/comparator.rb
138
138
  - lib/legion/extensions/conditioner/helpers/condition.rb
139
139
  - lib/legion/extensions/conditioner/runners/conditioner.rb
140
+ - lib/legion/extensions/conditioner/runners/conflict_resolver.rb
141
+ - lib/legion/extensions/conditioner/runners/consent_tiers.rb
142
+ - lib/legion/extensions/conditioner/runners/domain_classifier.rb
140
143
  - lib/legion/extensions/conditioner/transport.rb
141
144
  - lib/legion/extensions/conditioner/transport/exchanges/task.rb
142
145
  - lib/legion/extensions/conditioner/transport/messages/conditioner.rb