Classify source relatedness as data-quality advisories

This commit is contained in:
2026-08-27 15:49:53 +00:00
parent 1f1967c8d2
commit ccba2ce3f9
25 changed files with 232 additions and 189 deletions

View File

@@ -14,10 +14,9 @@ import (
)
const (
Key = "extract/dnd/enemy-events/source_relatedness"
WarningReasonCode = "enemy_event_not_near_source"
OmittedReasonCode = "enemy_event_relatedness_warnings_omitted"
policy = "dnd.enemy_events.validator.source_relatedness.v1"
Key = "extract/dnd/enemy-events/source_relatedness"
ReasonCode = "enemy_event_not_near_source"
policy = "dnd.enemy_events.validator.source_relatedness.v1"
)
type Options struct{}
@@ -51,13 +50,13 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
}
warnings = append(warnings, contracts.Warning{
Scope: fmt.Sprintf("events[%d]", eventIndex),
ReasonCode: WarningReasonCode,
ReasonCode: ReasonCode,
Message: diagnostics.Aggregate("enemy event subject not near source", []string{
fmt.Sprintf("subject %s was not found in cited source text", diagnostics.Quote(event.Name)),
}),
})
}
return contracts.ValidationResult{Approved: true, Warnings: diagnostics.LimitWarnings(warnings, "enemy_events", OmittedReasonCode)}, nil
return diagnostics.DataQualityResult(warnings)
}
func Spec() pipeline.ValidatorSpec {