trailblazer-macro 2.1.14 → 2.1.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdbc731c17b52586de5a713605423d506a6ea91866db65f4a04be858fa5afb1e
4
- data.tar.gz: 254f4e89aca81b120e6f1392c99ac30dfe9dd70cde79e2f2a9aa669a88448bfb
3
+ metadata.gz: 173e4338e28a9317e1d4982e9cfa9c2662b1639f852c63e17d389d8aac1dbf6f
4
+ data.tar.gz: cfe156150849b2114783ae54799dbc6a9cc1aaf98ee94a076cf2236855c1aebd
5
5
  SHA512:
6
- metadata.gz: d0b26e20fe1f14def81e30ca0a39a37cf58b6257530307bb9db1f80d914c04b8c5dfb4143f98c012a0605074f31c1cf42b91930aeaecd1cf8f820158cfac6ee4
7
- data.tar.gz: cdee315a8ac8900bf438694f7320b88cd3ceb32436baf544826bb550289f56a466ef18da3142ef15e1bde8eb3fc575eadb87e6670106c6be204e921d1285ab00
6
+ metadata.gz: b5d91f20bf7ea34b3328a7cb2419dc3d3df264e998605f887afee09379bc10a41222016f0f63c0512f5caab2236b8528997096baf3b4ec0f17ae2b4b8bb25303
7
+ data.tar.gz: 3a80eb7b70c7c8d9667bad7571c7d8471dc7bfc28ad00fdb40f94ceb5dc4fcae1de7ffae9a4d76848c61526f06cb2d0d85c612e2a5d01f2acb849ed28c1821f0
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 2.1.15
2
+
3
+ * Use `Macro.id_for` for `Rescue`, meaning IDs will now be consistent à la `Rescue/1` instead of `Rescue(1)`.
4
+ * In `Each`'s tracing code, use `developer-0.1.0` API.
5
+ * Use `trailblazer-operation-0.10.1`.
6
+
1
7
  # 2.1.14
2
8
 
3
9
  * Use `trailblazer-activity-dsl-linear-1.2.0` and change internal API as required.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  # gem "trailblazer-developer", github: "trailblazer/trailblazer-developer"
7
+ # gem "trailblazer-developer", path: "../trailblazer-developer"
7
8
  # gem "trailblazer-activity", github: "trailblazer/trailblazer-activity"
8
9
  # gem "trailblazer-activity-dsl-linear", github: "trailblazer/trailblazer-activity-dsl-linear"
9
10
  # gem "trailblazer-macro-contract", git: "https://github.com/trailblazer/trailblazer-macro-contract"
@@ -11,7 +12,7 @@ gemspec
11
12
  # gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
12
13
  # gem "trailblazer-developer", path: "../trailblazer-developer"
13
14
  # gem "trailblazer-activity", path: "../trailblazer-activity"
14
- # gem "trailblazer-operation", path: "../trailblazer-operation"
15
+ gem "trailblazer-operation", path: "../trailblazer-operation"
15
16
 
16
17
  gem "minitest-line"
17
18
  # gem "trailblazer-core-utils", path: "../trailblazer-core-utils"
@@ -66,11 +66,16 @@ module Trailblazer
66
66
  ITERATION_INPUT_PIPE = Activity::DSL::Linear::VariableMapping::DSL.pipe_for_composable_input()
67
67
 
68
68
  # Gets included in Debugger's Normalizer. Results in IDs like {invoke_block_activity.1}.
69
- def self.compute_runtime_id(ctx, captured_node:, activity:, compile_id:, **)
69
+ def self.compute_runtime_id(ctx, trace_node:, activity:, compile_id:, **)
70
70
  # activity is the host activity
71
71
  return compile_id unless activity.to_h[:config][:each] == true
72
72
 
73
- index = captured_node.captured_input.data[:ctx_snapshot].fetch(:index)
73
+ # Developer::Trace::Snapshot::Ctx.ctx_snapshot_for(trace_node.snapshot_before, .data
74
+ # FIXME: BETTER API, we need access to stack now
75
+
76
+
77
+ # index = trace_node.snapshot_before.data[:ctx_snapshot].fetch(:index)
78
+ index = trace_node.snapshot_before.data[:ctx_variable_changeset].find { |name, version, value| name == :index }[2]
74
79
 
75
80
  ctx[:runtime_id] = "#{compile_id}.#{index}"
76
81
  end
@@ -1,10 +1,8 @@
1
- require "securerandom"
2
-
3
1
  module Trailblazer
4
2
  module Macro
5
3
  NoopHandler = lambda { |*| }
6
4
 
7
- def self.Rescue(*exceptions, handler: NoopHandler, &block)
5
+ def self.Rescue(*exceptions, handler: NoopHandler, id: Rescue.random_id, &block)
8
6
  exceptions = [StandardError] unless exceptions.any?
9
7
 
10
8
  handler = Rescue.deprecate_positional_handler_signature(handler)
@@ -22,9 +20,7 @@ module Trailblazer
22
20
  end
23
21
  end
24
22
 
25
- Wrap(rescue_block, id: "Rescue(#{SecureRandom.hex(4)})", &block)
26
- # FIXME: name
27
- # [ step, name: "Rescue:#{block.source_location.last}" ]
23
+ Wrap(rescue_block, id: id, &block)
28
24
  end
29
25
 
30
26
  # TODO: remove me in 2.2.
@@ -38,6 +34,12 @@ module Trailblazer
38
34
  handler.(exception, ctx, &block)
39
35
  end
40
36
  end
37
+
38
+ # TODO: for legacy reasons, we pass `:id` to {#id_for}. In 2.2, remove the id hint and use
39
+ # generic {Macro.id_for} behavior.
40
+ def self.random_id
41
+ Macro.id_for(nil, macro: :Rescue, id: rand(100))
42
+ end
41
43
  end
42
44
  end
43
45
  end
@@ -1,7 +1,7 @@
1
1
  module Trailblazer
2
2
  module Version
3
3
  module Macro
4
- VERSION = "2.1.14"
4
+ VERSION = "2.1.15"
5
5
  end
6
6
  end
7
7
  end
@@ -51,8 +51,14 @@ module Trailblazer
51
51
  return block_activity, block_activity.to_h[:outputs]
52
52
  end
53
53
 
54
- def self.id_for(user_proc, macro:, hint: nil)
55
- id =
54
+ module IdFor
55
+ module_function
56
+
57
+ def call(user_proc, macro:, hint: nil, id: from_callable(user_proc, hint: hint))
58
+ [macro, id].join("/")
59
+ end
60
+
61
+ def from_callable(user_proc, hint: nil)
56
62
  if user_proc.is_a?(Class)
57
63
  user_proc.to_s
58
64
  elsif user_proc.instance_of?(Method)
@@ -60,8 +66,11 @@ module Trailblazer
60
66
  else
61
67
  hint || rand(4)
62
68
  end
69
+ end
70
+ end
63
71
 
64
- "#{macro}/#{id}"
72
+ def self.id_for(user_proc, **options)
73
+ IdFor.(user_proc, **options)
65
74
  end
66
75
  end # Macro
67
76
 
@@ -740,8 +740,11 @@ class DocsEachUnitTest < Minitest::Spec
740
740
 
741
741
  stack, signal, (ctx, _) = Trailblazer::Developer::Trace.invoke(activity, [ctx, {}])
742
742
 
743
- assert_equal Trailblazer::Developer::Trace::Present.(stack,
744
- node_options: {stack.to_a[0] => {label: "<a-Each-b>"}}), %{<a-Each-b>
743
+ output = Trailblazer::Developer::Trace::Present.(stack) do |trace_nodes:, **|
744
+ {node_options: {trace_nodes[0] => {label: "<a-Each-b>"}}}
745
+ end
746
+
747
+ assert_equal output, %{<a-Each-b>
745
748
  |-- Start.default
746
749
  |-- a
747
750
  |-- Each/1
@@ -23,7 +23,7 @@ class NestedRescueTest < Minitest::Spec
23
23
  fail ->(options, **) { options["outer-err"] = true }, id: "nested/failure"
24
24
  end
25
25
 
26
- it { Trailblazer::Developer.railway(NestedInsanity).must_match /\[>Rescue\(.{8}\),>nested/ } # FIXME: better introspect tests for all id-generating macros.
26
+ it { Trailblazer::Developer.railway(NestedInsanity).must_match /\[>Rescue\/.{1,3},>nested/ } # FIXME: better introspect tests for all id-generating macros.
27
27
  it { NestedInsanity.().inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{<Result:true [true, true, true, true, true, true, nil, nil] >} }
28
28
  it { NestedInsanity.( "raise-y" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{<Result:false [true, true, nil, nil, nil, nil, true, true] >} }
29
29
  it { NestedInsanity.( "raise-a" => true).inspect("a", "y", "z", "b", "c", "e", "inner-err", "outer-err").must_equal %{<Result:false [true, true, true, true, nil, nil, nil, true] >} }
@@ -43,31 +43,37 @@ class RescueTest < Minitest::Spec
43
43
  plain Rescue()
44
44
  =end
45
45
  class RescueWithoutHandlerTest < Minitest::Spec
46
- Memo = Class.new
46
+ Song = Class.new
47
+ module Song::Activity; end
47
48
 
48
- class Memo::Create < Trailblazer::Operation
49
- step :find_model
49
+ #:no-args
50
+ class Song::Activity::Create < Trailblazer::Activity::Railway
51
+ step :create_model
50
52
  step Rescue() {
51
- step :update
53
+ step :upload
52
54
  step :rehash
53
55
  }
54
56
  step :notify
55
57
  fail :log_error
56
58
  #~methods
57
- include T.def_steps(:find_model, :update, :notify, :log_error)
59
+ include T.def_steps(:create_model, :upload, :notify, :log_error)
58
60
  include Rehash
59
61
  #~methods end
60
62
  end
63
+ #:no-args end
61
64
 
62
- it { Memo::Create.( { seq: [] } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
63
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error]] >} }
65
+ it { assert_invoke Song::Activity::Create, seq: "[:create_model, :upload, :rehash, :notify]" }
66
+ it { assert_invoke Song::Activity::Create, rehash_raise: RuntimeError, terminus: :failure, seq: "[:create_model, :upload, :rehash, :log_error]", exception_class: RuntimeError }
67
+ it { assert_invoke Song::Activity::Create, rehash_raise: :bla, terminus: :failure, seq: "[:create_model, :upload, :rehash, :log_error]", exception_class: :bla }
68
+ it { assert_invoke Song::Activity::Create, rehash_raise: NoMethodError, terminus: :failure, seq: "[:create_model, :upload, :rehash, :log_error]", exception_class: NoMethodError }
64
69
  end
65
70
 
66
71
  =begin
67
- Rescue( handler: X )
72
+ Rescue( SPECIFIC_EXCEPTION, handler: X )
68
73
  =end
69
74
  class RescueWithClassHandlerTest < Minitest::Spec
70
- Memo = Class.new
75
+ Song = Class.new
76
+ module Song::Activity; end
71
77
 
72
78
  #:rescue-handler
73
79
  class MyHandler
@@ -78,23 +84,29 @@ Rescue( handler: X )
78
84
  #:rescue-handler end
79
85
 
80
86
  #:rescue
81
- class Memo::Create < Trailblazer::Operation
82
- step :find_model
83
- step Rescue( RuntimeError, handler: MyHandler ) {
84
- step :update
87
+ class Song::Activity::Create < Trailblazer::Activity::Railway
88
+ step :create_model
89
+ step Rescue(RuntimeError, handler: MyHandler) {
90
+ step :upload
85
91
  step :rehash
86
92
  }
87
93
  step :notify
88
94
  fail :log_error
89
95
  #~methods
90
- include T.def_steps(:find_model, :update, :notify, :log_error)
96
+ include T.def_steps(:create_model, :upload, :notify, :log_error)
91
97
  include Rehash
92
98
  #~methods end
93
99
  end
94
100
  #:rescue end
95
101
 
96
- it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
97
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
102
+ it { assert_invoke Song::Activity::Create, seq: "[:create_model, :upload, :rehash, :notify]" }
103
+ it { assert_invoke Song::Activity::Create, rehash_raise: RuntimeError, terminus: :failure, seq: "[:create_model, :upload, :rehash, :log_error]", exception_class: RuntimeError }
104
+ it do
105
+ # Since we don't catch NoMethodError, execution stops.
106
+ assert_raises NoMethodError do
107
+ Song::Activity::Create.invoke([{seq: {}, rehash_raise: NoMethodError}])
108
+ end
109
+ end
98
110
  end
99
111
 
100
112
  class RescueWithModuleHandlerTest < Minitest::Spec
@@ -119,7 +131,7 @@ Rescue( handler: X )
119
131
  end
120
132
 
121
133
  it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
122
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
134
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
123
135
  end
124
136
 
125
137
  =begin
@@ -149,7 +161,7 @@ Rescue( handler: :instance_method )
149
161
  #:rescue-method end
150
162
 
151
163
  it { Memo::Create.( { seq: [], } ).inspect(:seq, :exception_class).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify], nil] >} }
152
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
164
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq, :exception_class).must_equal %{<Result:false [[:find_model, :update, :rehash, :log_error], RuntimeError] >} }
153
165
  end
154
166
 
155
167
  =begin
@@ -176,4 +188,63 @@ Rescue(), fast_track: true {}
176
188
  it { Memo::Create.( { seq: [], } ).inspect(:seq).must_equal %{<Result:true [[:find_model, :update, :rehash, :notify]] >} }
177
189
  it { Memo::Create.( { seq: [], update: false } ).inspect(:seq).must_equal %{<Result:false [[:find_model, :update]] >} }
178
190
  end
191
+
192
+ class RescueIDTest < Minitest::Spec
193
+ class Validate
194
+ def self.call(*)
195
+
196
+ end
197
+ end
198
+
199
+ it "assigns ID via {Macro.id_for}" do
200
+ activity = Class.new(Trailblazer::Activity::Railway) do
201
+ step Rescue() {}
202
+ step Rescue(handler: Validate) {}
203
+ step Rescue(handler: :instance_method) {}
204
+ step Rescue() {}, id: "Rescue-1"
205
+ step Rescue(id: "Rescue-2") {}
206
+ # test identical configuration.
207
+ step Rescue() {}
208
+ step Rescue(handler: Validate) {}
209
+ end
210
+
211
+ # assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each/EachIDTest::Validate"])[0].id, "Each/EachIDTest::Validate"
212
+ # assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each-1"])[0].id, "Each-1"
213
+ # assert_equal Trailblazer::Developer::Introspect.find_path(activity, ["Each/composers_for_each"])[0].id, "Each/composers_for_each"
214
+
215
+ assert_match /Rescue\/\d+/, Trailblazer::Activity::Introspect::Nodes(activity).values[1].id
216
+ assert_match /Rescue\/\d+/, Trailblazer::Activity::Introspect::Nodes(activity).values[2].id
217
+ assert_match /Rescue\/\d+/, Trailblazer::Activity::Introspect::Nodes(activity).values[3].id
218
+ assert_match "Rescue-1", Trailblazer::Activity::Introspect::Nodes(activity).values[4].id
219
+ assert_match "Rescue-2", Trailblazer::Activity::Introspect::Nodes(activity).values[5].id
220
+ assert_match /Rescue\/\d+/, Trailblazer::Activity::Introspect::Nodes(activity).values[6].id
221
+ assert_match /Rescue\/\d+/, Trailblazer::Activity::Introspect::Nodes(activity).values[7].id
222
+ end
223
+ end
224
+
225
+ class ComplianceTest < Minitest::Spec
226
+ it "tracing" do
227
+ activity = Class.new(Trailblazer::Activity::Railway) do
228
+ step Rescue(id: "Rescue/1") {
229
+ step :validate
230
+ }
231
+
232
+ def validate(ctx, validate: false, seq:, **)
233
+ seq << :validate
234
+ raise unless validate
235
+ validate
236
+ end
237
+ end
238
+
239
+ ctx = {validate: false}
240
+
241
+ output, _ = trace activity, ctx
242
+ assert_equal output, %(TOP
243
+ |-- Start.default
244
+ |-- Rescue/1
245
+ | |-- Start.default
246
+ | `-- validate
247
+ `-- End.failure)
248
+ end
249
+ end
179
250
  end
@@ -169,9 +169,9 @@ When raise: return {Railway.fail!}
169
169
  #@ happy days
170
170
  assert_invoke Memo::Create, seq: "[:model, :update, :rehash, :notify]"
171
171
  #@ rehash raises
172
- assert_invoke Memo::Create, rehash_raise: true, seq: "[:model, :update, :rehash, :log_error]",
172
+ assert_invoke Memo::Create, rehash_raise: RuntimeError, seq: "[:model, :update, :rehash, :log_error]",
173
173
  terminus: :failure,
174
- expected_ctx_variables: {exception: "nope!"}
174
+ expected_ctx_variables: {exception: "RuntimeError"}
175
175
  end
176
176
 
177
177
  =begin
@@ -205,7 +205,7 @@ When raise: return {Railway.fail!}, but wire Wrap() to {fail_fast: true}
205
205
  end
206
206
 
207
207
  it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
208
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash]] >} }
208
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash]] >} }
209
209
  end
210
210
 
211
211
  =begin
@@ -242,7 +242,7 @@ When raise: return {Railway.fail_fast!} and configure Wrap() to {fast_track: t
242
242
  #:fail-fast end
243
243
 
244
244
  it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
245
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash]] >} }
245
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash]] >} }
246
246
  end
247
247
 
248
248
  =begin
@@ -289,7 +289,7 @@ When raise: return {Railway.fail!} or {Railway.pass!}
289
289
  end
290
290
 
291
291
  it do
292
- result = Memo::Create.( { seq: [], rehash_raise: true } )
292
+ result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } )
293
293
  result.inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash]] >}
294
294
  result.event.inspect.must_equal %{#<Trailblazer::Activity::End semantic=:transaction_failed>}
295
295
  end
@@ -326,7 +326,7 @@ When raise: return {Railway.pass!} and go "successful"
326
326
  end
327
327
 
328
328
  it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
329
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
329
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
330
330
  end
331
331
 
332
332
  =begin
@@ -361,7 +361,7 @@ You can return boolean true in wrap.
361
361
  end
362
362
 
363
363
  it "translates true returned form a wrap to a signal with a `success` semantic" do
364
- result = Memo::Create.( { seq: [], rehash_raise: true } )
364
+ result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } )
365
365
  result.inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >}
366
366
  result.event.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Success semantic=:success>}
367
367
  end
@@ -399,7 +399,7 @@ You can return boolean false in wrap.
399
399
  end
400
400
 
401
401
  it "translates false returned form a wrap to a signal with a `failure` semantic" do
402
- result = Memo::Create.( { seq: [], rehash_raise: true } )
402
+ result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } )
403
403
  result.inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash, :log_error]] >}
404
404
  result.event.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Failure semantic=:failure>}
405
405
  end
@@ -437,7 +437,7 @@ You can return nil in wrap.
437
437
  end
438
438
 
439
439
  it "translates nil returned form a wrap to a signal with a `failure` semantic" do
440
- result = Memo::Create.( { seq: [], rehash_raise: true } )
440
+ result = Memo::Create.( { seq: [], rehash_raise: RuntimeError } )
441
441
  result.inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash, :log_error]] >}
442
442
  result.event.inspect.must_equal %{#<Trailblazer::Activity::Railway::End::Failure semantic=:failure>}
443
443
  end
@@ -484,7 +484,7 @@ This one is mostly to show how one could wrap steps in a transaction
484
484
  #:transaction end
485
485
 
486
486
  it { Memo::Create.( { seq: [] } ).inspect(:seq).must_equal %{<Result:true [[:model, :update, :rehash, :notify]] >} }
487
- it { Memo::Create.( { seq: [], rehash_raise: true } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash, :log_error]] >} }
487
+ it { Memo::Create.( { seq: [], rehash_raise: RuntimeError } ).inspect(:seq).must_equal %{<Result:false [[:model, :update, :rehash, :log_error]] >} }
488
488
  end
489
489
 
490
490
  =begin
data/test/test_helper.rb CHANGED
@@ -17,7 +17,7 @@ end
17
17
  module Rehash
18
18
  def rehash(ctx, seq:, rehash_raise: false, **)
19
19
  seq << :rehash
20
- raise "nope!" if rehash_raise
20
+ raise rehash_raise if rehash_raise
21
21
  true
22
22
  end
23
23
  end
@@ -27,6 +27,13 @@ Minitest::Spec.include Trailblazer::Activity::Testing::Assertions
27
27
  Minitest::Spec.class_eval do
28
28
  def trace(activity, ctx)
29
29
  stack, signal, (ctx, _) = Trailblazer::Developer::Trace.invoke(activity, [ctx, {}])
30
- return Trailblazer::Developer::Trace::Present.(stack, node_options: {stack.to_a[0]=>{label: "TOP"}}).gsub(/:\d+/, ""), signal, ctx
30
+
31
+ output = Trailblazer::Developer::Trace::Present.(stack) do |trace_nodes:, **|
32
+ {node_options: {trace_nodes[0] => {label: "TOP"}}}
33
+ end.gsub(/:\d+/, "")
34
+
35
+ return output, signal, ctx
31
36
  end
32
37
  end
38
+
39
+ # Trailblazer::Core.convert_operation_test("test/docs/composable_variable_mapping_test.rb")
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency "minitest"
21
21
  spec.add_development_dependency "rake"
22
- spec.add_development_dependency "trailblazer-developer"
23
- spec.add_dependency "trailblazer-operation", ">= 0.10.0" # TODO: this dependency will be removed. currently needed for tests and for Guard::Result
22
+ spec.add_development_dependency "trailblazer-developer", ">= 0.1.0", "< 0.2.0"
23
+ spec.add_dependency "trailblazer-operation", ">= 0.10.1" # TODO: this dependency will be removed. currently needed for tests and for Guard::Result
24
24
 
25
25
  spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.3.0"
26
26
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-macro
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.14
4
+ version: 2.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-02 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -44,28 +44,34 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.1.0
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: 0.2.0
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: '0'
57
+ version: 0.1.0
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.2.0
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: trailblazer-operation
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - ">="
60
66
  - !ruby/object:Gem::Version
61
- version: 0.10.0
67
+ version: 0.10.1
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
72
  - - ">="
67
73
  - !ruby/object:Gem::Version
68
- version: 0.10.0
74
+ version: 0.10.1
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: trailblazer-activity-dsl-linear
71
77
  requirement: !ruby/object:Gem::Requirement