Preserve version one error record scopes

This commit is contained in:
2026-11-17 03:54:41 +00:00
parent 0c2a2164ec
commit c6be2ec20d
7 changed files with 71 additions and 47 deletions

View File

@@ -233,20 +233,27 @@ func TestReportsDistinguishFatalPeerAndDeliveryFailures(t *testing.T) {
t.Fatal(err)
}
if doc.Status != reporting.StatusFailed || *doc.Summary.WorkUnitsWithErrors != 1 || *doc.Summary.RunErrors != 2 ||
*doc.Summary.WorkUnitsInterrupted != 2 || *doc.Summary.Recoveries != 1 || len(doc.Errors) != 4 {
*doc.Summary.WorkUnitsInterrupted != 2 || *doc.Summary.Recoveries != 1 || len(doc.Errors) != 3 {
t.Fatalf("unexpected report: %s", raw)
}
unit, secondary, initiating, delivery := doc.Errors[0], doc.Errors[1], doc.Errors[2], doc.Errors[3]
unit, initiating, delivery := doc.Errors[0], doc.Errors[1], doc.Errors[2]
if unit.Scope != "work_unit" || len(unit.Failures) != 1 || !reflect.DeepEqual(unit.Failures[0].ProposalIndices, []int{4}) ||
unit.Failures[0].ProviderAttempts == nil || *unit.Failures[0].ProviderAttempts != 1 ||
secondary.Scope != "interrupted" || !reflect.DeepEqual(secondary.ChunkIndex, intPtr(3)) || secondary.Reason != "canceled" ||
initiating.Scope != "run" || initiating.Phase != "validation" || initiating.Validator != "review" ||
!reflect.DeepEqual(initiating.ChunkIndex, intPtr(2)) || !reflect.DeepEqual(initiating.ProposalIndex, intPtr(3)) ||
!reflect.DeepEqual(initiating.RepairAttempt, intPtr(1)) ||
delivery.Scope != "run" || delivery.Phase != "report_write" || delivery.OutputPath != "recoveries.yml" ||
delivery.Scope != "run" || delivery.Phase != "report_write" || delivery.OutputPath != "recoveries.yml" || len(delivery.Interruptions) != 0 ||
strings.Contains(string(raw), defect.Error()) {
t.Fatalf("failure facts were merged or lost: %s", raw)
}
if len(initiating.Interruptions) != 1 {
t.Fatalf("missing peer interruption: %s", raw)
}
secondary := initiating.Interruptions[0]
if secondary.Phase != "validation" || secondary.Reason != "canceled" || secondary.Validator != "review" ||
!reflect.DeepEqual(secondary.ChunkIndex, intPtr(3)) || !reflect.DeepEqual(secondary.StageIndex, intPtr(1)) {
t.Fatalf("peer lost its origin or reason: %+v", secondary)
}
if markdown := string(reporting.Markdown(snapshot)); !strings.Contains(markdown, "Errors: 1 work units; 2 run errors") ||
!strings.Contains(markdown, "Recoveries: 1") {
t.Fatalf("Markdown totals differ from YAML: %s", markdown)