Retain only reportable operation details

This commit is contained in:
2026-11-17 04:31:15 +00:00
parent 7f7aea0921
commit ee1ac8fc89
7 changed files with 44 additions and 36 deletions

View File

@@ -82,9 +82,15 @@ func TestFatalBatchRetainsEarlierDecisionsInLedger(t *testing.T) {
if result.FinalTranscript.Segments[0].Text != "hello" || len(result.ModuleResults[0].AppliedChanges) != 0 {
t.Fatal("fatal partial approvals changed transcript")
}
if len(result.WorkUnits[0].Operations) != 3 || result.WorkUnits[0].State != outcomes.WorkInterrupted {
if len(result.WorkUnits[0].Operations) != 1 || result.WorkUnits[0].Operations[0].FailureReason != outcomes.ReasonValidationDecisionsInvalid ||
result.WorkUnits[0].State != outcomes.WorkInterrupted || result.Totals.ModelOperations != 3 {
t.Fatalf("partial facts: %+v", result.WorkUnits)
}
snapshot := Build(BuildInput{RunOutput: &result, ProcessingError: err})
if len(snapshot.Errors) != 2 || snapshot.Errors[0].Scope != "work_unit" || snapshot.Errors[1].Scope != "run" ||
snapshot.Errors[1].BatchIndex == nil || *snapshot.Errors[1].BatchIndex != 2 {
t.Fatalf("report lost either failure: %+v", snapshot.Errors)
}
ledger := BuildCorrectionLedger(CorrectionLedgerInput{RunOutput: &result})
candidates := make(map[int]CorrectionLedgerEntry)
for _, entry := range ledger {