2.9 KiB
2.9 KiB
Pipeline Internals
Purpose
Describes implemented merge pipeline orchestration in internal/pipeline.
Inputs and outputs
Input:
config.Config- registry-resolved modules from
internal/builtin
Output:
- selected public artifact written by output writer modules
- optional report JSON when
cfg.ReportFileis set
Stage contracts
The runner executes these contracts in order:
InputReader: external inputs ->[]model.RawTranscriptPreprocessor:PreprocessStatetransformations (raw->canonical)Merger: canonical transcripts ->model.MergedTranscriptPostprocessor: merged transcript transformationsOutputWriter: serialized artifact writes
PreprocessState must end in StateCanonical before merge.
Registry resolution
resolvePlan maps configured names to modules:
- input reader:
cfg.InputReader - preprocessors:
cfg.PreprocessingModules - postprocessors:
cfg.PostprocessingModules - output writers:
cfg.OutputModules - merger: single registered merger
Unknown names fail fast with contextual errors.
Execution order and reporting
- Modules run sequentially in configured order.
- Events returned by modules are appended in execution order.
- Report metadata includes input reader, input files, and module lists.
- Output writer events are appended before optional report write.
Config fields used
Runner-level fields:
InputReaderInputFilesPreprocessingModulesPostprocessingModulesOutputModulesOutputSchema(viaartifact.SelectedFromMerged)ReportFile
Module-specific settings are consumed inside builtin modules (for example coalesce gap and overlap thresholds).
Adapters used
- Input adapters: registered
InputReaderimplementations (defaultjson-files). - Output adapters: registered
OutputWriterimplementations (defaultjson). - Report adapter:
report.WriteJSONwhencfg.ReportFileis provided.
Boundaries
- Pipeline does not parse CLI flags.
- Pipeline does not normalize raw CLI strings.
- Pipeline delegates conversion to public output contracts to
internal/artifact. - Artifact-level commands
trimandnormalizeare outside this pipeline.
Failure behavior
Pipeline returns errors from:
- registry resolution (unknown modules, missing merger)
- invalid preprocessing state transitions
- module read/process/merge/write failures
- optional report write failure
No retry/resume state is stored.
Tests to inspect before changes
internal/pipeline/runner_test.gointernal/builtin/preprocess_test.gointernal/builtin/postprocess_test.gointernal/cli/merge_test.go
Invariants
- Sequential deterministic execution order.
- Preprocessing state must type-check from
rawtocanonical. - Module selection is explicit by canonical names.
- Report event order reflects actual execution order.
- Output artifact selection is schema-driven via
internal/artifact.