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

@@ -1,4 +1,4 @@
// Package sourcerelatedness warns about NPC occurrence evidence unrelated to its NPC.
// Package sourcerelatedness reports advisory findings about NPC occurrence evidence unrelated to its NPC.
package sourcerelatedness
import (
@@ -14,10 +14,9 @@ import (
)
const (
Key = "extract/dnd/npc-occurrences/source_relatedness"
WarningReasonCode = "npc_occurrence_not_near_source"
OmittedReasonCode = "npc_occurrence_relatedness_warnings_omitted"
policy = "dnd.npc_occurrences.validator.source_relatedness.v2"
Key = "extract/dnd/npc-occurrences/source_relatedness"
ReasonCode = "npc_occurrence_not_near_source"
policy = "dnd.npc_occurrences.validator.source_relatedness.v2"
)
type Options struct{}
@@ -58,14 +57,11 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
}
warnings = append(warnings, contracts.Warning{
Scope: fmt.Sprintf("occurrences[%d]", index),
ReasonCode: WarningReasonCode,
ReasonCode: ReasonCode,
Message: fmt.Sprintf("NPC occurrence name %s was not found in cited source text", diagnostics.Quote(occurrence.Name)),
})
}
return contracts.ValidationResult{
Approved: true,
Warnings: diagnostics.LimitWarnings(warnings, "npc_occurrences", OmittedReasonCode),
}, nil
return diagnostics.DataQualityResult(warnings)
}
func Spec() pipeline.ValidatorSpec {