Skip to content

Commit

Permalink
pass the actcual task into the extension compilation, not the `Implem…
Browse files Browse the repository at this point in the history
…entation::Task`,

as this layer became optional.
  • Loading branch information
apotonick committed Nov 12, 2024
1 parent c8e0421 commit 5b7498b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/trailblazer/activity/schema/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def terminus_to_output(intermediate, implementation)
def invoke_extensions_for(config, impl_task, id)
impl_task
.extensions
.inject(config) { |cfg, ext| ext.(config: cfg, id: id, task: impl_task) } # {ext} must return new config hash.
.inject(config) { |cfg, ext| ext.(config: cfg, id: id, task: impl_task.circuit_task) } # {ext} must return new config hash.
end

# In an array of {Activity::Output}, find the output matching {semantic}.
Expand Down
4 changes: 1 addition & 3 deletions lib/trailblazer/activity/task_wrap/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ def initialize(extension:)
end

def call(config:, task:, **)
# DISCUSS: does it make sense to test the immutable behavior here? What would be the worst outcome?
task = task.circuit_task # Receives {Schema::Implementation::Task}. DISCUSS: why?

# Add the extension's task(s) to the activity's {:wrap_static} taskWrap
# which is stored in the {:config} field.
wrap_static = config[:wrap_static] # the activity's {wrap_static}.
Expand All @@ -97,6 +94,7 @@ def call(config:, task:, **)
# Overwrite the original task_wrap:
wrap_static = wrap_static.merge(task => @extension.(task_wrap))

# DISCUSS: does it make sense to test the immutable behavior here? What would be the worst outcome?
config.merge(wrap_static: wrap_static) # Return new config hash. This needs to be immutable code!
end
end # WrapStatic
Expand Down

0 comments on commit 5b7498b

Please sign in to comment.