lex-codegen 0.2.4 → 0.2.10

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: eed547e1328af8116c12a43b51f3dc68ddafdc0d1d17bd7736df863c126c6fba
4
- data.tar.gz: 275a664f737f601f95ad61ae9b73c10a4274ec36f8915dddc555e9ac9e966093
3
+ metadata.gz: 5ae1fad2e903314b7587a1d1173e336b9ab35a1cd6ba69190d2c1a4fb05a4018
4
+ data.tar.gz: acbad453e8e835facdcebe94d16ccfdea26423a1ab0e17266ac4323ba0c08511
5
5
  SHA512:
6
- metadata.gz: f38f7774034f1f24428d4181fa3ef593d648ffdc62932d1eb3cba6c216167678c2441f3e8f6769d8016f4e1aeecaca9dbd27506126b6a62bc339277fced8fd5a
7
- data.tar.gz: 607c285280a1429d2bcdad8ab3be42279a1bb13b3e5816554a178e65c08b5396633b2c0e5510c3b1b0eab766ef331433afe964adf5a76f71e5ac6abeb77d7e4e
6
+ metadata.gz: cd2748dd1d307b4333af2e4770c61f6a178172f66fd581ef4b431a565aaaef44990d29376a78782ec1eeb831500ebcc71c7f8e2ac0d38ecd1773585bc2c4f019
7
+ data.tar.gz: f0f5c698c6333dbd9f576e712f9948446307fa615ad53722c799b9ae0791b33484370ef796def7b9b75a8bf7fb703cb7fba0787d36d5934e5ffaef3a5aa45d98
data/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.10] - 2026-03-27
4
+
5
+ ### Fixed
6
+ - Capture exception in `GeneratedRegistry#db_available?` rescue block (`rescue StandardError => e`) and log debug message to satisfy CI Rescue Logging lint
7
+
8
+ ## [0.2.9] - 2026-03-27
9
+
10
+ ### Fixed
11
+ - Replace all `Legion::Logging.*` direct calls with `log.*` helper calls across actors, runners, and helpers to satisfy CI Helper Migration lint check
12
+ - Fix `log` method in actors to return a null logger fallback instead of `nil` when `Legion::Logging` is undefined, so `log.warn` never raises `NoMethodError`
13
+ - Add private `log` method to `Runners::Generate`, `Runners::ReviewHandler`, and `Helpers::GeneratedRegistry` (all `extend self` / `module_function` modules)
14
+ - Update `RUNNER_TEMPLATE` in `Helpers::Constants` to use `log.debug` instead of `Legion::Logging.debug` in generated runner stubs
15
+
16
+ ## [0.2.8] - 2026-03-27
17
+
18
+ ### Fixed
19
+ - GapSubscriber and ReviewSubscriber: replace `log&.warn`/`log&.debug` in rescue blocks with `Legion::Logging.warn`/`Legion::Logging.debug` so the CI rescue-logging lint script matches the pattern correctly
20
+
21
+ ## [0.2.7] - 2026-03-27
22
+
23
+ ### Fixed
24
+ - GapSubscriber and ReviewSubscriber: added `runner_class` and `runner_function` overrides so `Subscription#prepare` can resolve the runner constant
25
+
26
+ ## [0.2.6] - 2026-03-27
27
+
28
+ ### Fixed
29
+ - Actors: `GapSubscriber` and `ReviewSubscriber` changed from modules to classes inheriting `Actors::Subscription`
30
+ - Actor files guarded with `return unless defined?` for standalone spec compatibility
31
+
32
+ ## [0.2.5] - 2026-03-26
33
+
34
+ ### Changed
35
+ - set remote_invocable? false for local dispatch
36
+
3
37
  ## [0.2.4] - 2026-03-26
4
38
 
5
39
  ### Security
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ return unless defined?(Legion::Extensions::Actors::Subscription)
4
+
3
5
  module Legion
4
6
  module Extensions
5
7
  module Codegen
6
8
  module Actor
7
- module GapSubscriber
9
+ class GapSubscriber < Legion::Extensions::Actors::Subscription
8
10
  QUEUE = Transport::Queues::GapDetected if defined?(Transport::Queues::GapDetected)
9
11
 
12
+ def runner_class = self.class
13
+ def runner_function = 'action'
14
+
10
15
  def action(payload)
11
16
  gap = normalize_gap(payload)
12
17
 
@@ -20,7 +25,7 @@ module Legion
20
25
 
21
26
  result
22
27
  rescue StandardError => e
23
- log&.warn("GapSubscriber failed: #{e.message}")
28
+ log.warn("GapSubscriber failed: #{e.message}")
24
29
  { success: false, error: e.message }
25
30
  end
26
31
 
@@ -47,7 +52,7 @@ module Legion
47
52
  source: { provider: node_name, channel: 'gap_detector' }
48
53
  )
49
54
  rescue StandardError => e
50
- log&.debug("GapSubscriber: Apollo ingest failed: #{e.message}")
55
+ log.debug("GapSubscriber: Apollo ingest failed: #{e.message}")
51
56
  end
52
57
 
53
58
  def query_corroboration(gap)
@@ -62,7 +67,7 @@ module Legion
62
67
  results = result[:results] || []
63
68
  results.map { |r| r.dig(:source, :provider) }.compact.uniq.size
64
69
  rescue StandardError => e
65
- log&.debug("GapSubscriber: Apollo query failed: #{e.message}")
70
+ log.debug("GapSubscriber: Apollo query failed: #{e.message}")
66
71
  0
67
72
  end
68
73
 
@@ -106,9 +111,11 @@ module Legion
106
111
  end
107
112
 
108
113
  def log
109
- return unless defined?(Legion::Logging)
114
+ return Legion::Logging if defined?(Legion::Logging)
110
115
 
111
- Legion::Logging
116
+ @log ||= Object.new.tap do |nl|
117
+ %i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
118
+ end
112
119
  end
113
120
  end
114
121
  end
@@ -1,12 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ return unless defined?(Legion::Extensions::Actors::Subscription)
4
+
3
5
  module Legion
4
6
  module Extensions
5
7
  module Codegen
6
8
  module Actor
7
- module ReviewSubscriber
9
+ class ReviewSubscriber < Legion::Extensions::Actors::Subscription
8
10
  QUEUE = Transport::Queues::ReviewCompleted if defined?(Transport::Queues::ReviewCompleted)
9
11
 
12
+ def runner_class = self.class
13
+ def runner_function = 'action'
14
+
10
15
  def action(payload)
11
16
  review = {
12
17
  generation_id: payload[:generation_id],
@@ -18,16 +23,18 @@ module Legion
18
23
 
19
24
  Runners::ReviewHandler.handle_verdict(review: review)
20
25
  rescue StandardError => e
21
- log&.warn("ReviewSubscriber failed: #{e.message}")
26
+ log.warn("ReviewSubscriber failed: #{e.message}")
22
27
  { success: false, error: e.message }
23
28
  end
24
29
 
25
30
  private
26
31
 
27
32
  def log
28
- return unless defined?(Legion::Logging)
33
+ return Legion::Logging if defined?(Legion::Logging)
29
34
 
30
- Legion::Logging
35
+ @log ||= Object.new.tap do |nl|
36
+ %i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
37
+ end
31
38
  end
32
39
  end
33
40
  end
@@ -252,7 +252,7 @@ module Legion
252
252
  <% methods.each do |m| -%>
253
253
 
254
254
  def <%= m[:name] %>(<%= m[:params].join(', ') %><%= m[:params].empty? ? '**' : ', **' %>)
255
- Legion::Logging.debug "[<%= gem_name_underscored %>] <%= m[:name] %> called"
255
+ log.debug "[<%= gem_name_underscored %>] <%= m[:name] %> called"
256
256
  { success: true }
257
257
  end
258
258
  <% end -%>
@@ -86,7 +86,7 @@ module Legion
86
86
  Kernel.load(record[:file_path])
87
87
  loaded += 1
88
88
  rescue StandardError => e
89
- Legion::Logging.warn("GeneratedRegistry: failed to load #{record[:file_path]}: #{e.message}") if defined?(Legion::Logging)
89
+ log.warn("GeneratedRegistry: failed to load #{record[:file_path]}: #{e.message}")
90
90
  end
91
91
  end
92
92
 
@@ -101,9 +101,18 @@ module Legion
101
101
  @store ||= {}
102
102
  end
103
103
 
104
+ def log
105
+ return Legion::Logging if defined?(Legion::Logging)
106
+
107
+ @log ||= Object.new.tap do |nl|
108
+ %i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
109
+ end
110
+ end
111
+
104
112
  def db_available?
105
113
  defined?(Legion::Data::Local) && Legion::Data::Local.respond_to?(:db) && !Legion::Data::Local.db.nil?
106
- rescue StandardError
114
+ rescue StandardError => e
115
+ log.debug("db_available? check failed: #{e.message}")
107
116
  false
108
117
  end
109
118
 
@@ -32,7 +32,7 @@ module Legion
32
32
  files = build_scaffold_files(engine, variables, helpers, runner_methods, spec_gen, module_name, underscored, runner_names)
33
33
  writer.write_all(files)
34
34
 
35
- Legion::Logging.info "[codegen] scaffolded #{gem_name} with #{files.size} files at #{ext_path}"
35
+ log.info "[codegen] scaffolded #{gem_name} with #{files.size} files at #{ext_path}"
36
36
  { success: true, path: ext_path, files_created: files.size, name: gem_name }
37
37
  rescue ArgumentError => e
38
38
  { success: false, error: e.message }
@@ -50,6 +50,14 @@ module Legion
50
50
 
51
51
  private
52
52
 
53
+ def log
54
+ return Legion::Logging if defined?(Legion::Logging)
55
+
56
+ @log ||= Object.new.tap do |nl|
57
+ %i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
58
+ end
59
+ end
60
+
53
61
  def build_variables(gem_name:, underscored:, module_name:, description:, helpers:, runner_names:, extra_deps:)
54
62
  {
55
63
  gem_name: gem_name,
@@ -28,6 +28,14 @@ module Legion
28
28
 
29
29
  private
30
30
 
31
+ def log
32
+ return Legion::Logging if defined?(Legion::Logging)
33
+
34
+ @log ||= Object.new.tap do |nl|
35
+ %i[debug info warn error fatal].each { |m| nl.define_singleton_method(m) { |*| nil } }
36
+ end
37
+ end
38
+
31
39
  def approve(record, review)
32
40
  Helpers::GeneratedRegistry.update_status(id: record[:id], status: 'approved')
33
41
 
@@ -35,7 +43,7 @@ module Legion
35
43
  begin
36
44
  Kernel.load(record[:file_path])
37
45
  rescue StandardError => e
38
- Legion::Logging.warn("ReviewHandler: load failed: #{e.message}") if defined?(Legion::Logging)
46
+ log.warn("ReviewHandler: load failed: #{e.message}")
39
47
  end
40
48
  end
41
49
 
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module Codegen
6
- VERSION = '0.2.4'
6
+ VERSION = '0.2.10'
7
7
  end
8
8
  end
9
9
  end
@@ -31,6 +31,10 @@ module Legion
31
31
  module Extensions
32
32
  module Codegen
33
33
  extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
34
+
35
+ def self.remote_invocable?
36
+ false
37
+ end
34
38
  end
35
39
  end
36
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-codegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity