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 +4 -4
- data/CHANGELOG.md +34 -0
- data/lib/legion/extensions/codegen/actors/gap_subscriber.rb +13 -6
- data/lib/legion/extensions/codegen/actors/review_subscriber.rb +11 -4
- data/lib/legion/extensions/codegen/helpers/constants.rb +1 -1
- data/lib/legion/extensions/codegen/helpers/generated_registry.rb +11 -2
- data/lib/legion/extensions/codegen/runners/generate.rb +9 -1
- data/lib/legion/extensions/codegen/runners/review_handler.rb +9 -1
- data/lib/legion/extensions/codegen/version.rb +1 -1
- data/lib/legion/extensions/codegen.rb +4 -0
- 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: 5ae1fad2e903314b7587a1d1173e336b9ab35a1cd6ba69190d2c1a4fb05a4018
|
|
4
|
+
data.tar.gz: acbad453e8e835facdcebe94d16ccfdea26423a1ab0e17266ac4323ba0c08511
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
114
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
110
115
|
|
|
111
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
33
|
+
return Legion::Logging if defined?(Legion::Logging)
|
|
29
34
|
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
46
|
+
log.warn("ReviewHandler: load failed: #{e.message}")
|
|
39
47
|
end
|
|
40
48
|
end
|
|
41
49
|
|