Declares how an intervention type merges external data into a DAG step's output.
Every intervention type (:override, custom modules like MyApp.Operate.Offset)
must implement this behaviour. The callbacks inform the Hook whether the step
can be short-circuited and how caching keys should be derived.
Built-in Implementations
OrchidIntervention.Operate.Override— replaces step output entirely,
supports short-circuit.
Custom Implementations
Pass the module atom directly as the intervention type:
%{"signal" => {MyApp.Operate.Offset, offset_param}}The module must implement all callbacks in this behaviour.
Summary
Callbacks
Declares which data sources are relevant for cache key derivation.
Performs the actual merge of step output with intervention data.
Whether this intervention type allows bypassing step execution entirely.
Functions
Resolves an intervention type atom to its Operate implementation module.
Callbacks
Declares which data sources are relevant for cache key derivation.
Returns {use_inner_result?, use_intervention_data?}.
Examples:
:override→{false, true}— inner data changes don't invalidate cache- A hypothetical
:offset→{true, true}— both matter
@callback merge( inner_data :: Orchid.Param.payload() | nil, intervention_data :: Orchid.Param.payload() ) :: {:ok, Orchid.Param.payload()} | {:error, term()}
Performs the actual merge of step output with intervention data.
inner_datais the step's computed payload (ornilwhen short-circuiting).intervention_datais the resolved intervention payload.
Must return {:ok, merged_payload} or {:error, reason}.
@callback short_circuit?() :: boolean()
Whether this intervention type allows bypassing step execution entirely.
When true and all output keys of a step are covered by short-circuit-capable
interventions, the step body is never called.
Functions
@spec resolve_module(OrchidIntervention.intervention_type()) :: module()
Resolves an intervention type atom to its Operate implementation module.
Built-in atoms are mapped internally; any other atom is assumed to be
a module that implements this behaviour directly.