trailblazer-developer 0.0.27 → 0.0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -4
- data/CHANGES.md +9 -0
- data/Gemfile +8 -5
- data/lib/trailblazer/developer/introspect/graph.rb +83 -0
- data/lib/trailblazer/developer/render/circuit.rb +6 -54
- data/lib/trailblazer/developer/render/linear.rb +1 -1
- data/lib/trailblazer/developer/render/task_wrap.rb +1 -1
- data/lib/trailblazer/developer/trace/debugger/normalizer.rb +2 -2
- data/lib/trailblazer/developer/trace/debugger.rb +1 -10
- data/lib/trailblazer/developer/trace/tree.rb +1 -1
- data/lib/trailblazer/developer/version.rb +1 -1
- data/lib/trailblazer/developer.rb +1 -0
- data/trailblazer-developer.gemspec +2 -3
- metadata +9 -11
- data/.github/workflows/ci_jruby.yml +0 -19
- data/.github/workflows/ci_legacy.yml +0 -19
- data/.github/workflows/ci_truffleruby.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bc71f425eee589bda27a8b681b796650443e688c3dc46ddb7d12e6daf092f08
|
4
|
+
data.tar.gz: 2f128bcf1675ba3147db4737f348b52d9a1f96562e317feeddda79846c1ca0e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b10040b636e96bc396ec89b41db298030552b0460ad7fa88b94ebf5a767e881cdf2c219ab573522f4226cb84d6e6d5baac786d384b7ef93d2788576dea4183f
|
7
|
+
data.tar.gz: 2eb0f50c4af74ab44ea0353e61b45a4645adb0f70132be92d329dd8123d0fd20561b58047be1bd9b2a25cb9e6bd5ccd2a6ac67089c7546e0041c78c24c455c62
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
1
|
name: CI
|
5
2
|
on: [push, pull_request]
|
6
3
|
jobs:
|
@@ -8,7 +5,7 @@ jobs:
|
|
8
5
|
strategy:
|
9
6
|
fail-fast: false
|
10
7
|
matrix:
|
11
|
-
ruby: [2.7, '3.0', '3.1']
|
8
|
+
ruby: [2.6, 2.7, '3.0', '3.1', '3.2', 'jruby']
|
12
9
|
runs-on: ubuntu-latest
|
13
10
|
steps:
|
14
11
|
- uses: actions/checkout@v3
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 0.0.28
|
2
|
+
|
3
|
+
* Move `Introspect::Graph` over from `trailblazer-activity`. It's a data structure very specific
|
4
|
+
to rendering, which is not a part of pure runtime behavior.
|
5
|
+
* Use `Introspect.Nodes` API instead of `TaskMap`.
|
6
|
+
* Remove `:task_maps_per_activity` in `Debugger` as we don't need to cache anymore.
|
7
|
+
* Require `trailblazer-activity-dsl-linear-1.2.0`.
|
8
|
+
* Remove `Render::Circuit` as this is part of `trailblazer-activity` now.
|
9
|
+
|
1
10
|
# 0.0.27
|
2
11
|
|
3
12
|
## Trace
|
data/Gemfile
CHANGED
@@ -3,8 +3,11 @@ source "https://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in trailblazer-developer.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
# gem "trailblazer-activity", "
|
7
|
-
# gem "trailblazer-activity",
|
8
|
-
# gem "trailblazer-
|
9
|
-
gem "trailblazer-
|
10
|
-
|
6
|
+
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
7
|
+
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
8
|
+
# gem "trailblazer-operation", path: "../trailblazer-operation"
|
9
|
+
# gem "trailblazer-pro", path: "../trailblazer-pro"
|
10
|
+
|
11
|
+
# gem "trailblazer-activity", github: "trailblazer/trailblazer-activity"
|
12
|
+
# gem "trailblazer-activity-dsl-linear", github: "trailblazer/trailblazer-activity-dsl-linear"
|
13
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# NOTE: The Graph API might get deprecated and replaced.
|
2
|
+
module Trailblazer
|
3
|
+
module Developer
|
4
|
+
module Introspect
|
5
|
+
# TODO: order of step/fail/pass in Node would be cool to have
|
6
|
+
|
7
|
+
# TODO: Remove Graph. This is only useful to render the full circuit
|
8
|
+
# Some thoughts here:
|
9
|
+
# * where do we need Schema.outputs? and where task.outputs?
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# @private This API is still under construction.
|
13
|
+
class Graph
|
14
|
+
def initialize(activity)
|
15
|
+
@schema = activity.to_h or raise
|
16
|
+
@circuit = @schema[:circuit]
|
17
|
+
@map = @circuit.to_h[:map]
|
18
|
+
@configs = @schema[:nodes]
|
19
|
+
end
|
20
|
+
|
21
|
+
def find(id = nil, &block)
|
22
|
+
return find_by_id(id) unless block_given?
|
23
|
+
|
24
|
+
find_with_block(&block)
|
25
|
+
end
|
26
|
+
|
27
|
+
# TODO: convert to {#to_a}.
|
28
|
+
def collect(strategy: :circuit)
|
29
|
+
@map.keys.each_with_index.collect { |task, i| yield find_with_block { |node| node.task == task }, i }
|
30
|
+
end
|
31
|
+
|
32
|
+
def stop_events
|
33
|
+
@circuit.to_h[:end_events]
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def find_by_id(id)
|
39
|
+
node = @configs.find { |_, _node| _node.id == id } or return
|
40
|
+
node_for(node[1])
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_with_block
|
44
|
+
existing = @configs.find { |_, node| yield Node(node.task, node.id, node.outputs, node.data) } or return
|
45
|
+
|
46
|
+
node_for(existing[1])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Build a {Graph::Node} with outputs etc.
|
50
|
+
def node_for(node_attributes)
|
51
|
+
Node(
|
52
|
+
node_attributes.task,
|
53
|
+
node_attributes.id,
|
54
|
+
node_attributes.outputs, # [#<struct Trailblazer::Activity::Output signal=Trailblazer::Activity::Right, semantic=:success>]
|
55
|
+
outgoings_for(node_attributes),
|
56
|
+
node_attributes.data,
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
def Node(*args)
|
61
|
+
Node.new(*args).freeze
|
62
|
+
end
|
63
|
+
|
64
|
+
Node = Struct.new(:task, :id, :outputs, :outgoings, :data)
|
65
|
+
Outgoing = Struct.new(:output, :task)
|
66
|
+
|
67
|
+
def outgoings_for(node)
|
68
|
+
outputs = node.outputs
|
69
|
+
connections = @map[node.task]
|
70
|
+
|
71
|
+
connections.collect do |signal, target|
|
72
|
+
output = outputs.find { |out| out.signal == signal }
|
73
|
+
Outgoing.new(output, target)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.Graph(*args)
|
79
|
+
Graph.new(*args)
|
80
|
+
end
|
81
|
+
end # Graph
|
82
|
+
end
|
83
|
+
end
|
@@ -2,61 +2,13 @@ module Trailblazer
|
|
2
2
|
module Developer
|
3
3
|
module_function
|
4
4
|
|
5
|
-
def render(activity, **options)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
module Render
|
10
|
-
module Circuit
|
11
|
-
module_function
|
12
|
-
|
13
|
-
# Render an {Activity}'s circuit as a simple hash.
|
14
|
-
def call(activity, path: nil, **options)
|
15
|
-
if path # TODO: move to place where all renderers can use this logic!
|
16
|
-
node, _, graph = Developer::Introspect.find_path(activity, path)
|
17
|
-
activity = node.task
|
18
|
-
end
|
19
|
-
|
20
|
-
graph = Activity::Introspect::Graph(activity)
|
21
|
-
|
22
|
-
circuit_hash(graph, **options)
|
23
|
-
end
|
24
|
-
|
25
|
-
def circuit_hash(graph, **options)
|
26
|
-
content = graph.collect do |node|
|
27
|
-
conns = node.outgoings.collect do |outgoing|
|
28
|
-
" {#{outgoing.output.signal}} => #{inspect_with_matcher(outgoing.task, **options)}"
|
29
|
-
end
|
30
|
-
|
31
|
-
[ inspect_with_matcher(node.task, **options), conns.join("\n") ]
|
32
|
-
end
|
33
|
-
|
34
|
-
content = content.join("\n")
|
35
|
-
|
36
|
-
"\n#{content}".gsub(/0x\w+/, "0x")
|
37
|
-
end
|
38
|
-
|
39
|
-
# If Ruby had pattern matching, this function wasn't necessary.
|
40
|
-
def inspect_with_matcher(task, inspect_task: method(:inspect_task), inspect_end: method(:inspect_end))
|
41
|
-
return inspect_task.(task) unless task.kind_of?(Trailblazer::Activity::End)
|
42
|
-
inspect_end.(task)
|
43
|
-
end
|
44
|
-
|
45
|
-
def inspect_task(task)
|
46
|
-
task.inspect
|
47
|
-
end
|
48
|
-
|
49
|
-
def inspect_end(task)
|
50
|
-
class_name = Render::Circuit.strip(task.class)
|
51
|
-
options = task.to_h
|
52
|
-
|
53
|
-
"#<#{class_name}/#{options[:semantic].inspect}>"
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.strip(string)
|
57
|
-
string.to_s.sub("Trailblazer::Activity::", "")
|
58
|
-
end
|
5
|
+
def render(activity, path: nil, **options)
|
6
|
+
if path # TODO: move to place where all renderers can use this logic!
|
7
|
+
node, _, graph = Developer::Introspect.find_path(activity, path)
|
8
|
+
activity = node.task
|
59
9
|
end
|
10
|
+
|
11
|
+
Activity::Introspect::Render.(activity, **options)
|
60
12
|
end
|
61
13
|
end
|
62
14
|
end
|
@@ -15,7 +15,7 @@ module Trailblazer
|
|
15
15
|
module_function
|
16
16
|
|
17
17
|
def call(operation, style: :line)
|
18
|
-
graph =
|
18
|
+
graph = Introspect::Graph(operation)
|
19
19
|
|
20
20
|
rows = graph.collect do |node, i|
|
21
21
|
next if node[:data][:stop_event] # DISCUSS: show this?
|
@@ -23,8 +23,8 @@ module Trailblazer
|
|
23
23
|
|
24
24
|
# Default steps for the Debugger::Node options pipeline, following the step-interface.
|
25
25
|
module Default
|
26
|
-
def self.compile_id(ctx,
|
27
|
-
ctx[:compile_id] =
|
26
|
+
def self.compile_id(ctx, activity:, task:, **)
|
27
|
+
ctx[:compile_id] = Activity::Introspect.Nodes(activity, task: task)[:id]
|
28
28
|
end
|
29
29
|
|
30
30
|
def self.compile_path(ctx, parent_map:, captured_node:, **)
|
@@ -16,13 +16,8 @@ module Trailblazer
|
|
16
16
|
|
17
17
|
container_activity = enumerable_tree[0].captured_input.activity # TODO: any other way to grab the container_activity? Maybe via {activity.container_activity}?
|
18
18
|
|
19
|
-
# TODO: cache activity graph
|
20
19
|
top_activity = enumerable_tree[0].captured_input.task
|
21
20
|
|
22
|
-
task_maps_per_activity = {
|
23
|
-
container_activity => {top_activity => {id: nil}} # exposes {Introspect::TaskMap}-compatible interface.
|
24
|
-
}
|
25
|
-
|
26
21
|
# DISCUSS: this might change if we introduce a new Node type for Trace.
|
27
22
|
debugger_nodes = enumerable_tree[0..-1].collect do |node|
|
28
23
|
activity = node.captured_input.activity
|
@@ -31,22 +26,18 @@ module Trailblazer
|
|
31
26
|
options = node_options[node.captured_input] || {}
|
32
27
|
|
33
28
|
|
34
|
-
|
35
|
-
task_map_for_activity = task_maps_per_activity[activity] || Activity::Introspect.TaskMap(activity)
|
36
|
-
|
37
29
|
options_for_debugger_node, _ = normalizer.(
|
38
30
|
{
|
39
31
|
captured_node: node,
|
40
32
|
task: task,
|
41
33
|
activity: activity,
|
42
34
|
parent_map: parent_map,
|
43
|
-
task_map_for_activity: task_map_for_activity,
|
44
35
|
**options
|
45
36
|
},
|
46
37
|
[]
|
47
38
|
)
|
48
39
|
|
49
|
-
options_for_debugger_node = options_for_debugger_node.slice(*(options_for_debugger_node.keys - [:parent_map
|
40
|
+
options_for_debugger_node = options_for_debugger_node.slice(*(options_for_debugger_node.keys - [:parent_map]))
|
50
41
|
|
51
42
|
# these attributes are not changing with the presentation
|
52
43
|
Debugger::Node.new(
|
@@ -29,7 +29,7 @@ module Trailblazer
|
|
29
29
|
path = []
|
30
30
|
|
31
31
|
while parent = parent_map[node] # DISCUSS: what if the graphs are cached and present, already?
|
32
|
-
node_id = Activity::Introspect
|
32
|
+
node_id = Activity::Introspect.Nodes(node.captured_input.activity, task: node.captured_input.task).id
|
33
33
|
path << node_id
|
34
34
|
|
35
35
|
node = parent
|
@@ -19,3 +19,4 @@ require "trailblazer/developer/render/linear"
|
|
19
19
|
require "trailblazer/developer/render/task_wrap"
|
20
20
|
require "trailblazer/developer/introspect" # TODO: might get removed, again.
|
21
21
|
require "trailblazer/developer/trace/debugger/normalizer"
|
22
|
+
require "trailblazer/developer/introspect/graph"
|
@@ -22,9 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "minitest"
|
23
23
|
spec.add_development_dependency "minitest-line"
|
24
24
|
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "trailblazer-operation"
|
25
|
+
spec.add_development_dependency "trailblazer-operation", ">= 0.10.0"
|
26
26
|
|
27
|
-
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.
|
28
|
-
# FIXME: Activity 0.14.1
|
27
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.3.0"
|
29
28
|
spec.add_dependency "hirb"
|
30
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-developer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,34 +72,34 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.10.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.10.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: trailblazer-activity-dsl-linear
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.2.0
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 1.
|
92
|
+
version: 1.3.0
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.
|
99
|
+
version: 1.2.0
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
102
|
+
version: 1.3.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: hirb
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,9 +122,6 @@ extensions: []
|
|
122
122
|
extra_rdoc_files: []
|
123
123
|
files:
|
124
124
|
- ".github/workflows/ci.yml"
|
125
|
-
- ".github/workflows/ci_jruby.yml"
|
126
|
-
- ".github/workflows/ci_legacy.yml"
|
127
|
-
- ".github/workflows/ci_truffleruby.yml"
|
128
125
|
- ".gitignore"
|
129
126
|
- CHANGES.md
|
130
127
|
- Gemfile
|
@@ -135,6 +132,7 @@ files:
|
|
135
132
|
- bin/setup
|
136
133
|
- lib/trailblazer/developer.rb
|
137
134
|
- lib/trailblazer/developer/introspect.rb
|
135
|
+
- lib/trailblazer/developer/introspect/graph.rb
|
138
136
|
- lib/trailblazer/developer/render/circuit.rb
|
139
137
|
- lib/trailblazer/developer/render/linear.rb
|
140
138
|
- lib/trailblazer/developer/render/task_wrap.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI JRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [jruby, jruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI with EOL ruby versions
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [2.5, 2.6]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI TruffleRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [truffleruby, truffleruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|