trailblazer-developer 0.0.27 → 0.1.0

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.
@@ -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.1.0", "< 1.2.0"
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.27
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-14 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: bundler
@@ -72,34 +72,34 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
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: '0'
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.1.0
89
+ version: 1.2.0
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: 1.2.0
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.1.0
99
+ version: 1.2.0
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: 1.2.0
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
@@ -134,16 +131,21 @@ files:
134
131
  - bin/console
135
132
  - bin/setup
136
133
  - lib/trailblazer/developer.rb
134
+ - lib/trailblazer/developer/debugger.rb
135
+ - lib/trailblazer/developer/debugger/normalizer.rb
137
136
  - lib/trailblazer/developer/introspect.rb
137
+ - lib/trailblazer/developer/introspect/graph.rb
138
138
  - lib/trailblazer/developer/render/circuit.rb
139
139
  - lib/trailblazer/developer/render/linear.rb
140
140
  - lib/trailblazer/developer/render/task_wrap.rb
141
141
  - lib/trailblazer/developer/trace.rb
142
- - lib/trailblazer/developer/trace/debugger.rb
143
- - lib/trailblazer/developer/trace/debugger/normalizer.rb
142
+ - lib/trailblazer/developer/trace/node.rb
143
+ - lib/trailblazer/developer/trace/parent_map.rb
144
144
  - lib/trailblazer/developer/trace/present.rb
145
+ - lib/trailblazer/developer/trace/snapshot.rb
146
+ - lib/trailblazer/developer/trace/snapshot/value.rb
147
+ - lib/trailblazer/developer/trace/snapshot/versions.rb
145
148
  - lib/trailblazer/developer/trace/stack.rb
146
- - lib/trailblazer/developer/trace/tree.rb
147
149
  - lib/trailblazer/developer/version.rb
148
150
  - lib/trailblazer/developer/wtf.rb
149
151
  - lib/trailblazer/developer/wtf/renderer.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
@@ -1,68 +0,0 @@
1
- module Trailblazer
2
- module Developer
3
- module Trace
4
- module Debugger
5
- # @private
6
- # Public entry point to add Debugger::Node normalizer steps.
7
- def self.add_normalizer_step!(step, id:, normalizer: Normalizer::PIPELINES.last, **options)
8
- task = Normalizer.Task(step)
9
-
10
- # We have a TaskWrap::Pipeline (a very simple style of "activity" used for normalizers) and
11
- # add another step using the "friendly interface" from {Activity::Adds}.
12
- options = {append: nil} unless options.any?
13
-
14
- pipeline_extension = Activity::TaskWrap::Extension.build([task, id: id, **options])
15
-
16
- Normalizer::PIPELINES << pipeline_extension.(normalizer)
17
- end
18
-
19
- module Normalizer
20
- def self.Task(user_step) # TODO: we could keep this in the {activity} gem.
21
- Activity::TaskWrap::Pipeline::TaskAdapter.for_step(user_step, option: false) # we don't need Option as we don't have ciruit_options here, and no {:exec_context}
22
- end
23
-
24
- # Default steps for the Debugger::Node options pipeline, following the step-interface.
25
- module Default
26
- def self.compile_id(ctx, task_map_for_activity:, task:, **)
27
- ctx[:compile_id] = task_map_for_activity.fetch(task)[:id]
28
- end
29
-
30
- def self.compile_path(ctx, parent_map:, captured_node:, **)
31
- ctx[:compile_path] = Trace::Tree::ParentMap.path_for(parent_map, captured_node)
32
- end
33
-
34
- def self.runtime_id(ctx, compile_id:, **)
35
- ctx[:runtime_id] = compile_id
36
- end
37
-
38
- def self.runtime_path(ctx, runtime_id:, compile_path:, **)
39
- return ctx[:runtime_path] = compile_path if compile_path.empty? # FIXME: this currently only applies to root.
40
-
41
- ctx[:runtime_path] = compile_path[0..-2] + [runtime_id]
42
- end
43
-
44
- def self.label(ctx, label: nil, runtime_id:, **)
45
- ctx[:label] = label || runtime_id
46
- end
47
-
48
- def self.data(ctx, data: {}, **)
49
- ctx[:data] = data
50
- end
51
- end
52
-
53
- default_steps = {
54
- compile_id: Normalizer.Task(Default.method(:compile_id)),
55
- compile_path: Normalizer.Task(Default.method(:compile_path)),
56
- runtime_id: Normalizer.Task(Default.method(:runtime_id)),
57
- runtime_path: Normalizer.Task(Default.method(:runtime_path)),
58
- label: Normalizer.Task(Default.method(:label)),
59
- data: Normalizer.Task(Default.method(:data)),
60
- }.
61
- collect { |id, task| Activity::TaskWrap::Pipeline.Row(id, task) }
62
-
63
- PIPELINES = [Activity::TaskWrap::Pipeline.new(default_steps)] # we do mutate this constant at compile-time. Maybe # DISCUSS and find a better way.
64
- end
65
- end
66
- end
67
- end
68
- end
@@ -1,81 +0,0 @@
1
- module Trailblazer
2
- module Developer
3
- module Trace
4
- module Debugger
5
- class Node < Struct.new(:captured_node, :task, :activity, :compile_id, :compile_path, :runtime_id, :runtime_path, :label, :data, :captured_input, :captured_output, :level, keyword_init: true)
6
- # The idea is to only work with {Activity} instances on this level, as that's the runtime concept.
7
-
8
- # TODO: class, "type",
9
- # which track, return signal, etc
10
-
11
-
12
- # we always key options for specific nodes by Stack::Captured::Input, so we don't confuse activities if they were called multiple times.
13
- def self.build(tree, enumerable_tree, node_options: {}, normalizer: Debugger::Normalizer::PIPELINES.last, **options_for_nodes)
14
- parent_map = Trace::Tree::ParentMap.build(tree).to_h # DISCUSS: can we use {enumerable_tree} for {ParentMap}?
15
-
16
-
17
- container_activity = enumerable_tree[0].captured_input.activity # TODO: any other way to grab the container_activity? Maybe via {activity.container_activity}?
18
-
19
- # TODO: cache activity graph
20
- top_activity = enumerable_tree[0].captured_input.task
21
-
22
- task_maps_per_activity = {
23
- container_activity => {top_activity => {id: nil}} # exposes {Introspect::TaskMap}-compatible interface.
24
- }
25
-
26
- # DISCUSS: this might change if we introduce a new Node type for Trace.
27
- debugger_nodes = enumerable_tree[0..-1].collect do |node|
28
- activity = node.captured_input.activity
29
- task = node.captured_input.task
30
- # it's possible to pass per-node options, like {label: "Yo!"} via {:node_options[<captured_input>]}
31
- options = node_options[node.captured_input] || {}
32
-
33
-
34
-
35
- task_map_for_activity = task_maps_per_activity[activity] || Activity::Introspect.TaskMap(activity)
36
-
37
- options_for_debugger_node, _ = normalizer.(
38
- {
39
- captured_node: node,
40
- task: task,
41
- activity: activity,
42
- parent_map: parent_map,
43
- task_map_for_activity: task_map_for_activity,
44
- **options
45
- },
46
- []
47
- )
48
-
49
- options_for_debugger_node = options_for_debugger_node.slice(*(options_for_debugger_node.keys - [:parent_map, :task_map_for_activity]))
50
-
51
- # these attributes are not changing with the presentation
52
- Debugger::Node.new(
53
- captured_node: node,
54
- activity: activity,
55
- task: task,
56
-
57
- level: node.level,
58
- captured_input: node.captured_input,
59
- captured_output: node.captured_output,
60
-
61
- **options_for_debugger_node,
62
- ).freeze
63
- end
64
- end
65
-
66
- def self.build_for_stack(stack, **options_for_debugger_nodes)
67
- tree, processed = Trace.Tree(stack.to_a)
68
-
69
- enumerable_tree = Trace::Tree.Enumerable(tree)
70
-
71
- Debugger::Node.build(
72
- tree,
73
- enumerable_tree,
74
- **options_for_debugger_nodes,
75
- )
76
- end
77
- end
78
- end # Debugger
79
- end # Trace
80
- end
81
- end
@@ -1,86 +0,0 @@
1
- module Trailblazer
2
- module Developer
3
- module Trace
4
- # Datastructure representing a trace.
5
- class Tree
6
- # This could also be seen as {tree.to_a}.
7
- def self.Enumerable(node)
8
- Enumerable.nodes_for(node)
9
- end
10
-
11
- module Enumerable
12
- # @private
13
- def self.nodes_for(node)
14
- [node, *node.nodes.collect { |n| nodes_for(n) } ].flatten
15
- end
16
- end # Enumerable
17
-
18
- # Map each {Node} instance to its parent {Node}.
19
- module ParentMap
20
- def self.build(node)
21
- children_map = []
22
- node.nodes.each { |n| children_map += ParentMap.build(n) }#.flatten(1)
23
-
24
- node.nodes.collect { |n| [n, node] } + children_map
25
- end
26
-
27
- # @public
28
- def self.path_for(parent_map, node)
29
- path = []
30
-
31
- while parent = parent_map[node] # DISCUSS: what if the graphs are cached and present, already?
32
- node_id = Activity::Introspect::TaskMap(node.captured_input.activity)[node.captured_input.task][:id]
33
- path << node_id
34
-
35
- node = parent
36
- end
37
-
38
- path.reverse
39
- end
40
- end
41
-
42
- class Node < Struct.new(:level, :captured_input, :captured_output, :nodes)
43
- end
44
- end # Tree
45
-
46
-
47
- # Builds a tree graph from a linear stack.
48
- # Consists of {Tree::Node} structures.
49
- def self.Tree(stack_end, level: 0, parent: nil)
50
- processed = []
51
- nodes = []
52
-
53
- # for {captured_input} we're gonna build a {Node}!
54
- captured_input, remaining = stack_end[0], stack_end[1..-1]
55
-
56
- raise unless captured_input.is_a?(Captured::Input)
57
-
58
- while next_captured = remaining[0]
59
- if next_captured.is_a?(Captured::Input)
60
-
61
- bla, _processed = Tree(remaining, level: level+1)
62
- nodes += [bla]
63
- processed += _processed
64
-
65
-
66
- remaining = remaining - processed
67
-
68
- else # Captured::Output
69
-
70
- raise unless next_captured.is_a?(Captured::Output)
71
- raise if next_captured.activity != captured_input.activity
72
-
73
- node = Tree::Node.new(level, captured_input, next_captured, nodes)
74
-
75
- return node,
76
- [captured_input, *processed, next_captured] # what nodes did we process here?
77
-
78
- end
79
-
80
- end
81
-
82
-
83
- end # Tree
84
- end
85
- end # Developer
86
- end