trailblazer-activity-dsl-linear 1.2.3 → 1.2.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: 9556b0bba65b7d0d785428b33548fc9585a2f9e101c032f47992a1570f2ae53d
4
- data.tar.gz: 0e9243345de16d945fbaf5b85bf74047d1f9f844ace7af62e63fa93393acc717
3
+ metadata.gz: b99e0c72f1c402fc56bf48c302d04d5749e47f159ce9d7b10a2537665a0af62e
4
+ data.tar.gz: f3c35842ae2631b358a1decaad27bb32785e578f0f99cf2597757c2e4485a120
5
5
  SHA512:
6
- metadata.gz: '081bacc336e3e98845d065cbd72d26e56ab4673e620ce5c4d0999ed8879b601fe5e83186e99367af781170b40b3687482d15b7911e7b5f2672db2e61de959112'
7
- data.tar.gz: 7e5f318e4ad5eaef5dc8831ee06737d4f508a934888c2d781325585d82408841f8ebdbbaefa7fa7bd91b98f3b65525a33dd8ff4996bd1371beec062f152fc309
6
+ metadata.gz: 2035d707ca689d84923de40eaccd48b08c355be9351172804dc45d80ded9a141088b26b2d7a464727c5b9c49082018d02085aa3754d0bdca19ad13c6bf70a161
7
+ data.tar.gz: cfdf092b175fdefd34a0321248aa95f4a5a8c768b18e3f23f9285be10c0f1c720dd633e061b9d079a60d610ef743ad6544597af0bf5adb3cf7cb53b6b9b91502
data/CHANGES.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 1.2.5
2
+
3
+ * Fix a bug where, within a helper `Path()`, the last step couldn't
4
+ explicitly define additional `Output()`, e.g. for `:failure`.
5
+
6
+ ```ruby
7
+ ... => Path(connect_to: Track(:success)) do
8
+ step :upload,
9
+ Output(Trailblazer::Activity::Left, :failure) => Track(:failure) # FIXME: this configuration gets lost.
10
+ end
11
+ ```
12
+
13
+ # 1.2.4
14
+
15
+ * Fix a bug where using `fail_fast: true` (same with `:pass_fast`) would result in a
16
+ compile time exception `No fail_fast output found`. See https://github.com/trailblazer/trailblazer/issues/256
17
+
1
18
  # 1.2.3
2
19
 
3
20
  * Add `FastTrack.left` alias.
data/Gemfile CHANGED
@@ -15,4 +15,4 @@ gem "trailblazer-developer", path: "../trailblazer-developer"
15
15
  # gem "benchmark-ips"
16
16
  # gem "stackprof"
17
17
  # gem "standard"
18
- # gem "trailblazer-core-utils", path: "../trailblazer-core-utils"
18
+ gem "trailblazer-core-utils", path: "../trailblazer-core-utils"
@@ -97,14 +97,29 @@ module Trailblazer
97
97
  # Connect last row of the {sequence} to the given step via its {Id}
98
98
  # Useful when steps needs to be inserted in between {Start} and {connect Id()}.
99
99
  private def connect_for_sequence(sequence, connect_to:)
100
- output, _ = sequence[-1][2][0].(sequence, sequence[-1]) # FIXME: the Forward() proc contains the row's Output, and the only current way to retrieve it is calling the search strategy. It should be Forward#to_h
100
+ last_step_on_path = sequence[-1]
101
+ output_searches = last_step_on_path[2]
102
+
103
+ last_step_outputs =
104
+ output_searches.collect do |search_strategy|
105
+ # TODO: introduce {search_strategy.to_h} so we don't need to execute it here.
106
+ output, _ = search_strategy.(sequence, last_step_on_path) # FIXME: the Forward() proc contains the row's Output, and the only current way to retrieve it is calling the search strategy. It should be Forward#to_h
107
+ output
108
+ end
109
+
110
+ # we want to reconnect the last step's {:success} output, everything else we keep.
111
+ success_output = last_step_outputs.find { |output| output.to_h[:semantic] == :success } or raise
112
+
113
+ # FIXME: what about End()?
114
+ success_search = Sequence::Search.ById(success_output, connect_to.value) if connect_to.instance_of?(Linear::Normalizer::OutputTuples::Id)
115
+ success_search = Sequence::Search.Forward(success_output, connect_to.color) if connect_to.instance_of?(Linear::Normalizer::OutputTuples::Track) # FIXME: use existing mapping logic!
116
+
117
+ success_output_index = last_step_outputs.index(success_output)
101
118
 
102
- # searches = [Search.ById(output, connect_to.value)]
103
- searches = [Sequence::Search.ById(output, connect_to.value)] if connect_to.instance_of?(Linear::Normalizer::OutputTuples::Id)
104
- searches = [Sequence::Search.Forward(output, connect_to.color)] if connect_to.instance_of?(Linear::Normalizer::OutputTuples::Track) # FIXME: use existing mapping logic!
119
+ output_searches[success_output_index] = success_search # replace the success search strategy. # DISCUSS: a bit cryptical with this index.
105
120
 
106
- row = sequence[-1]
107
- row = row[0..1] + [searches] + [row[3]] # FIXME: not mutating an array is so hard: we only want to replace the "searches" element, index 2
121
+ row = last_step_on_path
122
+ row = row[0..1] + [output_searches] + [row[3]] # FIXME: not mutating an array is so hard: we only want to replace the "searches" element, index 2
108
123
  row = Sequence::Row[*row]
109
124
 
110
125
  sequence[0..-2] + [row]
@@ -145,6 +145,7 @@ module Trailblazer
145
145
  )
146
146
  end
147
147
 
148
+ # TODO: remove this! it doesn't receive correct ciruit_options.
148
149
  # DISCUSS: should we remove this special case?
149
150
  # This handles
150
151
  # step task: :instance_method_exposing_circuit_interface
@@ -112,7 +112,6 @@ module Trailblazer
112
112
  TaskWrap.invoke(self, *args, **kws)
113
113
  end
114
114
  end # class << self
115
- # FIXME: do we want class << self?!
116
115
 
117
116
  module DSL
118
117
  module_function
@@ -3,7 +3,7 @@ module Trailblazer
3
3
  module Activity
4
4
  module DSL
5
5
  module Linear
6
- VERSION = "1.2.3"
6
+ VERSION = "1.2.5"
7
7
  end
8
8
  end
9
9
  end
@@ -112,10 +112,11 @@ module Trailblazer
112
112
  ctx = merge_connections_for!(ctx, :fast_track, :fail_fast, :fail_fast, **ctx)
113
113
  end
114
114
 
115
- def pass_fast_option(ctx, **)
115
+ def pass_fast_option(ctx, outputs:, **)
116
116
  ctx = merge_connections_for!(ctx, :pass_fast, :success, **ctx)
117
117
 
118
- ctx = merge_connections_for!(ctx, :pass_fast, :pass_fast, :pass_fast, **ctx)
118
+ ctx = merge_connections_for!(ctx, :pass_fast, :pass_fast, :pass_fast, **ctx) if outputs[:pass_fast]
119
+ ctx
119
120
  end
120
121
 
121
122
  def pass_fast_option_for_pass(ctx, **)
@@ -123,10 +124,12 @@ module Trailblazer
123
124
  ctx = merge_connections_for!(ctx, :pass_fast, :success, **ctx)
124
125
  end
125
126
 
126
- def fail_fast_option(ctx, **)
127
+ def fail_fast_option(ctx, outputs:, **)
127
128
  ctx = merge_connections_for!(ctx, :fail_fast, :failure, **ctx)
128
129
 
129
- ctx = merge_connections_for!(ctx, :fail_fast, :fail_fast, :fail_fast, **ctx)
130
+ # DISCUSS: instead of checking outputs here, we could introduce something like Output(non_strict: true)
131
+ ctx = merge_connections_for!(ctx, :fail_fast, :fail_fast, :fail_fast, **ctx) if outputs[:fail_fast]
132
+ ctx
130
133
  end
131
134
 
132
135
  def fail_fast_option_for_fail(ctx, **)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-activity-dsl-linear
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.5
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-06-15 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trailblazer-activity