Cleanup and complete the pipeline refactor
This commit is contained in:
@@ -211,7 +211,7 @@ func (r *Runner) runLane(ctx context.Context, input RunInput, doc *source.Source
|
||||
result, err := extractor.Extract(ctx, contracts.ExtractionRequest{
|
||||
Source: doc,
|
||||
Chunk: &chunk,
|
||||
SourceInput: sourceInput.Clone(),
|
||||
SourceInput: chunkInputMaterial(sourceInput, chunk),
|
||||
SessionID: sessionID,
|
||||
References: CloneReferenceSet(lane.ExtractReferences.ReferenceSet),
|
||||
LLMClient: input.LLMClient,
|
||||
@@ -367,11 +367,6 @@ func (r *Runner) runLane(ctx context.Context, input RunInput, doc *source.Source
|
||||
return nil
|
||||
}
|
||||
|
||||
type validatorExecution struct {
|
||||
validator contracts.Validator
|
||||
binding ModuleBinding
|
||||
}
|
||||
|
||||
type rawValidationTarget struct {
|
||||
stage ModuleStage
|
||||
laneID string
|
||||
@@ -512,21 +507,6 @@ func (r *Runner) validateRaw(ctx context.Context, target rawValidationTarget) ([
|
||||
return warnings, nil, nil
|
||||
}
|
||||
|
||||
func (r *Runner) buildConfiguredValidators(lane ResolvedArtifactLane) ([]validatorExecution, error) {
|
||||
validators := make([]validatorExecution, 0, len(lane.Validators))
|
||||
for _, binding := range lane.Validators {
|
||||
validator, err := r.registries.Validators.Build(binding.Module)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("build validator %q for lane %q: %w", binding.Module, lane.ID, err)
|
||||
}
|
||||
validators = append(validators, validatorExecution{
|
||||
validator: validator,
|
||||
binding: binding,
|
||||
})
|
||||
}
|
||||
return validators, nil
|
||||
}
|
||||
|
||||
func (r *Runner) validateRegistries(pipeline ResolvedPipeline) error {
|
||||
if r.registries.Inputs == nil {
|
||||
return fmt.Errorf("input registry must not be nil")
|
||||
@@ -546,9 +526,6 @@ func (r *Runner) validateRegistries(pipeline ResolvedPipeline) error {
|
||||
if r.registries.Outputs == nil {
|
||||
return fmt.Errorf("output encoder registry must not be nil")
|
||||
}
|
||||
if pipelineUsesConfiguredValidators(pipeline) && r.registries.Validators == nil {
|
||||
return fmt.Errorf("validator registry must not be nil")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -584,10 +561,8 @@ func validateRunInput(input RunInput) error {
|
||||
if lane.Normalize.Module == "" {
|
||||
return fmt.Errorf("resolved pipeline lane %q normalize module must not be empty", lane.ID)
|
||||
}
|
||||
for _, validator := range lane.Validators {
|
||||
if validator.Module == "" {
|
||||
return fmt.Errorf("resolved pipeline lane %q validator module must not be empty", lane.ID)
|
||||
}
|
||||
if len(lane.Validators) > 0 {
|
||||
return fmt.Errorf("resolved pipeline lane %q configured validators are not supported by the current raw validation runner", lane.ID)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -627,9 +602,6 @@ func manifestFromPipeline(input RunInput) artifacts.RunManifest {
|
||||
Merger: lane.Merge.Module,
|
||||
Normalizer: lane.Normalize.Module,
|
||||
}
|
||||
for _, validator := range lane.Validators {
|
||||
laneManifest.Validators = append(laneManifest.Validators, validator.Module)
|
||||
}
|
||||
manifest.ArtifactLanes = append(manifest.ArtifactLanes, laneManifest)
|
||||
}
|
||||
return manifest
|
||||
@@ -867,6 +839,16 @@ func sourceInputMaterial(inputPath string, content []byte) contracts.LLMInputMat
|
||||
)
|
||||
}
|
||||
|
||||
func chunkInputMaterial(sourceInput contracts.LLMInputMaterial, chunk contracts.SourceChunk) contracts.LLMInputMaterial {
|
||||
return contracts.NewLLMInputMaterial(
|
||||
"source",
|
||||
chunk.MediaType,
|
||||
chunk.Content,
|
||||
sourceInputDigest(chunk.Content),
|
||||
sourceInput.OriginURI,
|
||||
)
|
||||
}
|
||||
|
||||
func sourceInputMediaType(inputPath string) string {
|
||||
extension := strings.ToLower(filepath.Ext(strings.TrimSpace(inputPath)))
|
||||
if extension == ".json" {
|
||||
@@ -973,12 +955,3 @@ func cloneRejectedOutputs(rejected []contracts.RejectedOutput) []contracts.Rejec
|
||||
func timePtr(t time.Time) *time.Time {
|
||||
return &t
|
||||
}
|
||||
|
||||
func pipelineUsesConfiguredValidators(pipeline ResolvedPipeline) bool {
|
||||
for _, lane := range pipeline.ArtifactLanes {
|
||||
if len(lane.Validators) > 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user