Module: Igniter::Contracts::Execution::StepResultDiagnostics

Defined in:
lib/igniter/contracts/execution/step_result_diagnostics.rb

Class Method Summary collapse

Class Method Details

.augment(report:, result:, profile:) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



9
10
11
# File 'lib/igniter/contracts/execution/step_result_diagnostics.rb', line 9

def augment(report:, result:, profile:) # rubocop:disable Lint/UnusedMethodArgument
  report.add_section(:step_trace, step_trace(result))
end

.step_trace(result) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/igniter/contracts/execution/step_result_diagnostics.rb', line 13

def step_trace(result)
  result.compiled_graph.operations.filter_map do |operation|
    next unless operation.kind == :step

    step_result = result.state[operation.name]
    next unless step_result.is_a?(StepResult)

    trace_entry(operation, step_result)
  end
end

.trace_entry(operation, step_result) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/igniter/contracts/execution/step_result_diagnostics.rb', line 24

def trace_entry(operation, step_result)
  {
    name: operation.name,
    status: step_result.success? ? :success : :failed,
    dependencies: Array(operation.attributes[:depends_on]).map(&:to_sym),
    failure: StructuredDump.dump(step_result.failure)
  }
end