Skip to content

Commit

Permalink
state table keeps :supend_tuples per state.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Mar 27, 2024
1 parent 0df5727 commit 2090bdd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/trailblazer/workflow/introspect/state_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ def aggregate_by_state(ctx, iteration_set:, lanes_cfg:, **)
ctx[:states] = states
end

# DISCUSS: at some point, we need to separate data computing and rendering here.
def render_data(ctx, states:, lanes_cfg:, **)
suggested_state_names = {}

cli_rows = states.flat_map do |positions, catch_events|
# suspend_tuples = positions.to_a.collect do |position|
# Iteration::Set::Serialize.id_tuple_for(*position.to_a, lanes_cfg: lanes_cfg)
# end
suspend_id_hints = positions.to_a.collect do |position| # DISCUSS: are these positions ordered lifecycle,UI,reviewer, always?
cli_rows = states.flat_map do |start_positions, catch_events|
suspend_tuples = start_positions.to_a.collect do |position|
Iteration::Set::Serialize.id_tuple_for(*position.to_a, lanes_cfg: lanes_cfg)
end

suspend_id_hints = start_positions.to_a.collect do |position| # DISCUSS: are these start_positions ordered lifecycle,UI,reviewer, always?
[Introspect::Present.lane_label_for(*position.to_a, lanes_cfg: lanes_cfg), Test::Plan::Introspect.id_hint_for_suspend_position(*position.to_a)].join(" ")
end

Expand Down Expand Up @@ -71,8 +73,11 @@ def render_data(ctx, states:, lanes_cfg:, **)
"Suspend IDs",
readable_suspend_id_hints,

:positions,
positions,
:suspend_tuples,
suspend_tuples,

:start_positions,
start_positions,

:catch_events, # this is triggerable_events as objects, not human-readable.
catch_events
Expand Down
4 changes: 4 additions & 0 deletions test/introspect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class IntrospectStateTableTest < Minitest::Spec
assert_equal ctx[:rows].collect { |row| row["Suspend IDs"] }, [
"⛾ 1hgs ☝ 0fy4 ☑ uspe", "⛾ 0wwf ☝ 14h0 ☑ uspe", "⛾ 0wwf ☝ 0wc2 ☑ uspe", "⛾ 1hp2 ☝ 100g ☑ uspe", "⛾ 01p7 ☝ 1xs9 ☑ uspe", "⛾ 01p7 ☝ 0zso ☑ uspe", "⛾ 1kl7 ☝ 00n4 ☑ uspe", "⛾ 0fnb ☝ 0nxe ☑ uspe", "⛾ 1hp2 ☝ 1sq4 ☑ uspe", "⛾ 0fnb ☝ 0kkn ☑ uspe", "⛾ 1wzo ☝ 1g3f ☑ uspe"
]

assert_equal ctx[:rows].collect { |row| row[:suspend_tuples] }, [
[["lifecycle", "suspend-gw-to-catch-before-Activity_1hgscu3"], ["UI", "suspend-gw-to-catch-before-Activity_0fy41qq"], ["approver", "~suspend~"]], [["lifecycle", "suspend-gw-to-catch-before-Activity_0wwfenp"], ["UI", "suspend-Gateway_14h0q7a"], ["approver", "~suspend~"]], [["lifecycle", "suspend-gw-to-catch-before-Activity_0wwfenp"], ["UI", "suspend-gw-to-catch-before-Activity_0wc2mcq"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_1hp2ssj"], ["UI", "suspend-Gateway_100g9dn"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_01p7uj7"], ["UI", "suspend-Gateway_1xs96ik"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_01p7uj7"], ["UI", "suspend-gw-to-catch-before-Activity_0zsock2"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_1kl7pnm"], ["UI", "suspend-Gateway_00n4dsm"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_0fnbg3r"], ["UI", "suspend-Gateway_0nxerxv"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_1hp2ssj"], ["UI", "suspend-Gateway_1sq41iq"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_0fnbg3r"], ["UI", "suspend-Gateway_0kknfje"], ["approver", "~suspend~"]], [["lifecycle", "suspend-Gateway_1wzosup"], ["UI", "suspend-Gateway_1g3fhu2"], ["approver", "~suspend~"]]
]
end

it "StateTable.render" do
Expand Down

0 comments on commit 2090bdd

Please sign in to comment.