Classify framework process diagnostics
This commit is contained in:
@@ -88,6 +88,26 @@ func MaterializeReferences(resolved ResolvedPipeline, catalog ModuleCatalog, opt
|
||||
return out, warnings, nil
|
||||
}
|
||||
|
||||
// ReferenceDiagnostics converts framework-owned empty-reference findings into
|
||||
// structured process diagnostics. Legacy callers may continue to use the
|
||||
// materializer's warning return while the framework migration is in progress.
|
||||
func ReferenceDiagnostics(warnings []contracts.Warning) []contracts.ProducerDiagnostic {
|
||||
diagnostics := make([]contracts.ProducerDiagnostic, 0, len(warnings))
|
||||
for _, warning := range warnings {
|
||||
if warning.ReasonCode != "empty_reference" {
|
||||
continue
|
||||
}
|
||||
diagnostics = append(diagnostics, contracts.ProducerDiagnostic{
|
||||
Disposition: contracts.DiagnosticDispositionWarning,
|
||||
Category: contracts.DiagnosticCategoryConfiguration,
|
||||
ReasonCode: "empty_reference",
|
||||
OccurrenceCount: 1,
|
||||
Samples: []contracts.DiagnosticSample{{Scope: warning.Scope, Message: warning.Message}},
|
||||
})
|
||||
}
|
||||
return contracts.CloneProducerDiagnostics(diagnostics)
|
||||
}
|
||||
|
||||
func materializeReferenceTarget(
|
||||
pipelineID string,
|
||||
target ResolvedReferenceTarget,
|
||||
|
||||
Reference in New Issue
Block a user