OC-301e · Module 3

Plugin Composition Patterns

3 min read

Individual plugins provide atomic capabilities. Compositions combine plugins into compound capabilities that are greater than the sum of their parts. A data extraction plugin plus a chart generation plugin plus an email delivery plugin compose into an automated reporting pipeline. The composition layer defines how plugins connect, what data flows between them, and how failures in one plugin affect the others.

Three composition patterns cover most use cases. Sequential: Plugin A's output feeds Plugin B's input, which feeds Plugin C. The pipeline processes data step by step. Parallel: Plugins A, B, and C process the same input simultaneously, and their outputs merge. The fan-out processes data in parallel for speed. Conditional: Plugin A's output determines whether Plugin B or Plugin C executes next. The branch processes data based on runtime conditions. Complex compositions combine all three patterns.

  1. 1. Define the Data Flow Map which plugin produces which data and which plugin consumes it. Every data flow is explicit, typed, and validated. No implicit dependencies — if Plugin B needs Plugin A's output, the composition declares that dependency.
  2. 2. Handle Failure Propagation Define what happens when a plugin in the composition fails. Options: halt the entire composition, skip the failed plugin and continue, retry the failed plugin N times, or substitute a fallback output. The choice depends on whether the failed plugin's output is critical to downstream plugins.
  3. 3. Test the Composition Test the composition end-to-end with realistic data, including failure scenarios. A composition that works when every plugin succeeds but crashes when one fails is not production-ready.