Harden diagnostic handling and warning presentation

This commit is contained in:
2026-08-27 18:41:59 +00:00
parent 1025001f20
commit 079d5af337
67 changed files with 518 additions and 318 deletions

View File

@@ -40,7 +40,7 @@ func TestNormalizeValidatesPairsAndClones(t *testing.T) {
}
second, err := normalizer.Normalize(context.Background(), contracts.TypedNormalizeRequest[dnd.NPCOccurrenceList]{Source: doc, MergeOutput: contracts.MergeArtifact[dnd.NPCOccurrenceList]{Value: result.Value}})
if err != nil || !reflect.DeepEqual(second.Value, result.Value) || len(second.Diagnostics) != 0 {
t.Fatalf("second normalization = %#v, %v; want idempotent output without warnings", second, err)
t.Fatalf("second normalization = %#v, %v; want idempotent output without findings", second, err)
}
result.Value.Occurrences[0].SourceRefs[0].StartUnitID = 999
if input.Occurrences[0].SourceRefs[0].StartUnitID == 999 {
@@ -120,7 +120,7 @@ func TestNormalizeOrdersAndCollapsesExactDuplicatesOnly(t *testing.T) {
}
}
func TestNormalizerContractAndDeterministicWarnings(t *testing.T) {
func TestNormalizerContractAndDeterministicFindings(t *testing.T) {
normalizer, err := New(Options{}, npcReferences(t))
if err != nil {
t.Fatal(err)
@@ -139,7 +139,7 @@ func TestNormalizerContractAndDeterministicWarnings(t *testing.T) {
}
}
func TestNormalizeBoundsWarnings(t *testing.T) {
func TestNormalizeBoundsFindings(t *testing.T) {
count := contracts.MaxDiagnosticSamples + 5
doc := &source.SourceDocument{ID: "session", Units: make([]source.SourceUnit, count)}
input := dnd.NPCOccurrenceList{Occurrences: make([]dnd.NPCOccurrence, count)}