withStep method
Appends a diagnostic stage to the causal trace of every pulse in this collection.
Use this method to document a shared processing milestone for a group of signals simultaneously. This is particularly useful when a batch of pulses passes through a common gateway, validator, or middleware stage.
When to use
- Bulk Auditing: Marking a set of signals as having cleared a specific
logical hurdle (e.g.,
'security-cleared','schema-validated'). - Pipeline Tracking: Tracking a collection of signals as they move through complex multi-stage transformations.
How it works
This is a fluent wrapper that applies Pulse.withStep to every element in the iterable. It returns a new sequence of evolved pulses, each maintaining its own individual causal link to its parent while sharing the new trace entry.
Example
final signals = [Pulse('data1'), Pulse('data2')];
// Mark the entire batch as sanitized
final sanitized = signals.withStep('sanitized');
for (final p in sanitized) {
print(p.trace); // [..., 'sanitized']
}
Implementation
Iterable<Pulse> withStep(String step) => map((p) => p.withStep(step));