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

@@ -13,9 +13,9 @@ import (
)
const (
Key = "extract/dnd/npc-registry/source_relatedness"
WarningReasonCode = "npc_not_near_source"
policy = "dnd.npc_registry.validator.source_relatedness.v2"
Key = "extract/dnd/npc-registry/source_relatedness"
ReasonCode = "npc_not_near_source"
policy = "dnd.npc_registry.validator.source_relatedness.v2"
)
type Options struct{}
@@ -56,11 +56,11 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
}
warnings = append(warnings, contracts.Warning{
Scope: fmt.Sprintf("npcs[%d]", npcIndex),
ReasonCode: WarningReasonCode,
ReasonCode: ReasonCode,
Message: fmt.Sprintf("NPC %s was not found in cited source text", diagnostics.Quote(npc.Name)),
})
}
return contracts.ValidationResult{Approved: true, Warnings: warnings}, nil
return diagnostics.DataQualityResult(warnings)
}
func npcAppearsInCitedText(citedText string, npc dnd.NPC) bool {